riku
2022-10-10 437144f41c74505d362a5214a18cec3d01b3ce4b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// pages/m_user/base_c/c_scene-info/c_scene-info.js
import b_inputCheck from '../../behaviors/b_inputCheck'
import sceneInfo from '../../../../data/sceneInfo'
 
Component({
  behaviors: [b_inputCheck],
  options: {
    addGlobalClass: true,
  },
  /**
   * 组件的属性列表
   */
  properties: {
    submitText: {
      type: String,
      value: '提交'
    },
    sceneType: {
      type: String,
      value: '1'
    }
  },
 
  attached() {
 
  },
 
  pageLifetimes: {
    show: function () {
      // 页面被展示
      const info = sceneInfo()
      this.setData({
        msg: info.get(this.data.sceneType)
      })
    },
    hide: function () {
      // 页面被隐藏
    },
    resize: function (size) {
      // 页面尺寸变化
    }
  },
 
  /**
   * 组件的初始数据
   */
  data: {
 
  },
 
  /**
   * 组件的方法列表
   */
  methods: {
    selectChange(e) {
      const index = e.currentTarget.dataset.index
      const options = e.detail.options
      this.setData({
        [`msg[${index}].options`]: options
      })
    },
 
    pickerChange(e) {
      console.log(e);
      const {
        index,
        mode
      } = e.currentTarget.dataset
      let i = e.detail.value
      if (mode == 'region') {
        this.setData({
          [`msg[${index}].value`]: i
        })
      } else if (mode == 'selector') {
        this.setData({
          [`msg[${index}].selectIndex`]: i,
          [`msg[${index}].value`]: this.data.msg[index].options[i].value
        })
      }
    }
  }
})