// miniprogram/pages/message/message.js var app = getApp() Page({ /** * 页面的初始数据 */ data: { devcode: '' }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.setData({ devcode: options.devcode }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, onAlarm: function () { var that = this wx.showModal({ content: '确定布防?', success: function (res) { if (res.confirm) { wx.cloud.callFunction({ name: 'cancelAlarm', data: { url: app.globalData.httpsUrl + "baseService/device/cancelAlarm.do", devcode: that.data.devcode, flag: '1', attr:app.globalData.nickName }, success: function (res) { if (res.result.success) { wx.showToast({ title: that.data.devcode + "布防成功", icon: 'none', duration: 2000 }) } }, fail: function (err) { wx.showToast({ title: that.data.devcode + "布防失败", icon: 'none', duration: 2000 }) } }) } } }) } })