register.ts 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // pages/register/register.ts
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. region: ['北京市', '北京市', '海淀区'],
  8. schoolArray: ['中国', '美国', '巴西', '日本'],
  9. schoolIndex: 0,
  10. classArray: ['一年级一班', '一年级2班', '一年级3班', '一年级4班'],
  11. classIndex: 0,
  12. isShowPassWord: true
  13. },
  14. /**
  15. * 生命周期函数--监听页面加载
  16. */
  17. onLoad() {
  18. },
  19. bindRegionChange: function (event: any) {
  20. console.log('picker发送选择改变,携带值为', event.detail.value)
  21. this.setData({
  22. region: event.detail.value
  23. })
  24. },
  25. bindSchoolPicker: function (event: any) {
  26. let newArray;
  27. switch (Number(event.detail.value)) {
  28. case 0:
  29. newArray = ["一", "二", "三"];
  30. this.setData({
  31. classArray: newArray,
  32. classIndex: 0
  33. })
  34. break;
  35. case 1:
  36. newArray = ["4", "5", "6"];
  37. this.setData({
  38. classArray: newArray,
  39. classIndex: 0
  40. })
  41. break;
  42. case 2:
  43. newArray = ["as", "ad", "af"];
  44. this.setData({
  45. classArray: newArray,
  46. classIndex: 0
  47. })
  48. break;
  49. case 3:
  50. newArray = ["b1", "b2", "b3"];
  51. this.setData({
  52. classArray: newArray,
  53. classIndex: 0
  54. })
  55. break;
  56. }
  57. this.setData({
  58. schoolIndex: event.detail.value
  59. })
  60. },
  61. bindClssPicker: function (event: any) {
  62. this.setData({
  63. classIndex: event.detail.value
  64. })
  65. },
  66. showPwdTab: function () {
  67. if (this.data.isShowPassWord) {
  68. this.setData({
  69. isShowPassWord: false
  70. })
  71. } else {
  72. this.setData({
  73. isShowPassWord: true
  74. })
  75. }
  76. },
  77. exitPage: function () {
  78. wx.navigateBack()
  79. }
  80. })