monitor.ts 1.9 KB

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