residentManage.js 1.6 KB
// tabWorkOrder/pages/residentManage/residentManage.js


const phoneRex = /^[1]([3-9])[0-9]{9}$/;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    navStyle: 'background-color: transparent',
    list: ['新增员工', '调店账号分配'],
    activeIndex:0
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },
  checkRequired(obj) {
    let target = [
      "staffName",
      "staffPhone",
      "staffSceneLabel",
      "merchantId",
      "yqMerchantId"
    ];
  
    obj = {
      ...obj
    };
    if (!phoneRex.test(obj.staffPhone)) {
      this.showToast("请输入正确的手机号");
      return true;
    }
    try {
      target.map((key) => {
        if (!obj[key]) {
          throw key;
        }
      });
    } catch (error) {
      return error;
    }
    return false;
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },
  back() {
    wx.$router.back()
  },
  changeHandle(e) {
    let {
      index
    } = e.currentTarget.dataset;
    this.setData({
      activeIndex: index
    })
    // this.selectComponent(`#page-${index}`)
  },
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

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

  },

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

  },

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

  },

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

  }
})