import { getDictData, getMemberInfo } from '../../api/index' Page({ /** * 页面的初始数据 */ data: { topimg: '', clientHeight: 0, clientTop: 0, showCard: false, userInfo: { name: '' } }, onLoad(options) { const res = wx.getMenuButtonBoundingClientRect() this.setData({ clientHeight: res.height }) this.setData({ clientTop: res.top }) }, onShow() { this.initData() }, subscribeMessage: function () { // 显示加载提示 // 调用订阅消息的API wx.requestSubscribeMessage({ tmplIds: ['A_jEWoyl0Uu_l5J-zwlwx_FcbUirlsS6Peu4JW6a7Gc'], success: (res) => { console.log('res', res); }, fail: () => { reject(); } }) }, showQrcode() { this.setData({ showCard: true }) }, onClose() { this.setData({ showCard: false }) }, changePath(e) { const { userInfo } = this.data // 页面跳转 let temp = [ '/pages/userinfo/index', '/pages/store/staff?userType=1', '/pages/userinfo/collect', '/pages/store/index?shopId=' + userInfo.departmentId, '/pages/sets/index' ] const index = e.currentTarget.dataset.index wx.navigateTo({ url: `${temp[index]}`, }) }, initData() { getMemberInfo().then(res => { this.setData({ userInfo: 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 }) }) }, onReady() {}, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })