confirm-appointment-info.js 2.3 KB
// pages/index/confirm-appointment-info/confirm-appointment-info.js
Page({

    /**
     * 页面的初始数据
     */
    data: {
        show: false,
        modal_data: {
            is_showModal: false,
            currentBtn: null,
        },
        state_data: {
            is_showSuccessModal: false,
        },
        children: [{name:'张三',is_choose: true},
            {name:'李思思', is_choose: false},
            {name:'迪丽热巴-迪力木拉提',is_choose: false}],
        is_choose: false,
    },
    chooseChildren(e) {
        const current = e.currentTarget.dataset.index;
        this.setData({
            currentChild: current,
            [`children[${current}].is_choose`]: !this.data.children[current].is_choose
        })
    },
    submit() {
        this.setData({'modal_data.is_showModal': true})
    },
    chooseNo(e) {
        this.setData({
            'modal_data.currentBtn': e.currentTarget.dataset.index,
            'modal_data.is_showModal': false
        });
        wx.switchTab({url: '/pages/index/index'})
    },
    chooseYes(e) {
        this.setData({
            'modal_data.currentBtn': e.currentTarget.dataset.index,
            'modal_data.is_showModal': false,
            'state_data.is_showSuccessModal': true
        })
    },
    modalConfirm() {
        this.setData({'state_data.is_showSuccessModal': false})
    },
    disableScroll() {},
    addStudent() {
        wx.navigateTo({url: './add-student/add-student'})
    },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {
    const self = this;
    setTimeout(function() {
      self.setData({
        show: true
      })
    }, 500)
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  }
})