jiangping
2024-09-27 04b4bddaac0a222760113899568d20b45af701f4
wechat_staff/pages/work/index.js
@@ -1,38 +1,76 @@
import { getDictData, getMemberInfo } from '../../api/index'
import {
  getDictData,
  getMemberInfo
} from '../../api/index'
Page({
  /**
   * 页面的初始数据
   */
  data: {
    topimg:'',
    topimg: '',
    clientHeight: 0,
    clientTop: 0,
    clientTop: 0,
    showCard: false,
    userInfo: {name:''}
    userInfo: {
      name: ''
    }
  },
  onLoad(options) {
    const res = wx.getMenuButtonBoundingClientRect()
    this.setData({clientHeight: res.height})
    this.setData({clientTop: res.top})
    this.setData({
      clientHeight: res.height
    })
    this.setData({
      clientTop: res.top
    })
  },
  onShow() {
    this.initData()
  },
  subscribe: function () {
    // 显示加载提示
    let that = this
    wx.requestSubscribeMessage({
      tmplIds: ['A_jEWoyl0Uu_l5J-zwlwx_FcbUirlsS6Peu4JW6a7Gc'],
      success: (res) => {
        if (res['A_jEWoyl0Uu_l5J-zwlwx_FcbUirlsS6Peu4JW6a7Gc'] === 'accept') {
          that.submitClock();
        } else if (res['A_jEWoyl0Uu_l5J-zwlwx_FcbUirlsS6Peu4JW6a7Gc'] === 'reject') {
          // 用户历史操作有设置了拒绝 or 关闭了订阅消息的主(总)开关,导致无法推送
          // console.log(res, '0 拒绝 or 关闭了订阅消息的主(总)开关---');
        } else {
          wx.showToast({
            title: '授权订阅消息有误',
            icon: 'none'
          });
        }
      },
      fail: () => {
        reject();
      }
    })
  },
  showQrcode() {
    this.setData({ showCard: true })
    this.setData({
      showCard: true
    })
  },
  onClose() {
    this.setData({ showCard: false })
    this.setData({
      showCard: false
    })
  },
  changePath(e) {
    const {userInfo} = this.data
    const {
      userInfo
    } = this.data
    // 页面跳转
    let temp = [
      '/pages/userinfo/index',
      '/pages/store/staff?userType=1',
      '/pages/userinfo/collect',
      '/pages/store/index?shopId='+userInfo.departmentId,
      '/pages/store/index?shopId=' + userInfo.departmentId,
      '/pages/sets/index'
    ]
    const index = e.currentTarget.dataset.index
@@ -44,18 +82,19 @@
    getMemberInfo().then(res => {
      this.setData({
        userInfo: res.data
      })
      wx.setStorageSync('member',res.data)
    })
      })
      wx.setStorageSync('member', res.data)
    })
    getDictData({
      code: 'WEIXIN_DEFAULT_IMGS',
      label: 'STAFF_WORK_TOP_IMG'
    }).then(res => {
      this.setData({ topimg: res.data.code })
      this.setData({
        topimg: res.data.code
      })
    })
  },
  onReady() {
  },
  onReady() {},
  /**
   * 生命周期函数--监听页面隐藏