// pages/setting/notification.js import { readMessage } from "../../../api/saas" const util = require('../../../utils/util') const app = getApp() Component({ options: { addGlobalClass: true, multipleSlots: true }, data: { StatusBar: app.globalData.StatusBar, CustomBar: app.globalData.CustomBar, notice: false, message: null }, lifetimes: { // 生命周期函数,可以为函数,或一个在methods段中定义的方法名 attached: function () { this.setData({ StatusBar: app.globalData.StatusBar || 40, CustomBar: app.globalData.CustomBar || (app.globalData.isIos ? 64 : 60), }) } }, methods: { notify: function(message){ if(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 }) wx.navigateTo({ url: `/pages/home/customer-info/index?cardNo=${this.data.message.redirectInfo.params.cardNo}` }) } }) }, onClose: function(){ this.setData({ notice: false }) } } })