// pages/setting/notification.js import { readMessage } from "../../../api/saas" const app = getApp() Component({ options: { addGlobalClass: true, multipleSlots: true }, data: { StatusBar: app.globalData.StatusBar, CustomBar: app.globalData.CustomBar, isAdmin: false, notice: false, message: null, numb: 0 }, lifetimes: { attached: function () { this.setData({ StatusBar: app.globalData.StatusBar, CustomBar: app.globalData.CustomBar, isAdmin: app.userInfo.type && app.userInfo.type.indexOf('ADMIN') >= 0 }) } }, methods: { notify: function(message){ if(!app.userInfo.factoryId || this.data.notice){ return } this.setData({ notice: true, message }) }, submit: function(e){ if(!this.data.message.redirectInfo || !this.data.message.redirectInfo.targetView){ return } readMessage({ idList: [this.data.message.id] }).then(result => { if(this.data.message.redirectInfo.targetView == 'factoryCustomerDetail'){// 新建客户 this.setData({ notice: false }) if(e.currentTarget.id == 'client'){ wx.navigateTo({ url: `/pages/home/customer-info/index?cardNo=${this.data.message.redirectInfo.params.cardNo}` }) } else if(e.currentTarget.id == 'employ'){ wx.navigateTo({ url: `/pages/home/employee-info/index?cardNo=${this.data.message.redirectInfo.params.cardNo}` }) } } }) }, onClose: function(){ this.setData({ notice: false }) } } })