// pages/circularize/circularize.js let miucms = require('../../utils/miucms.js') let app = getApp() Page({ /** * 页面的初始数据 */ data: { speedinessState: false, uniqid: "", content: "" }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.setData({ uniqid: options.uniqid }) this.getinit() }, getinit() { miucms.request(`${app.globalData.baseURL}/tenement/message/housingMessage`, { uniqid: this.data.uniqid }).then(res => { if (res.code == 200) { let data = res.data this.setData({ quickcontent: data.quickcontent, token: data.token, info: data.info }) } else { wx.showModal({ title: '提示', content: res.message, showCancel: false, success(res) { if (res.confirm) { wx.navigateBack({ delta: 1, }) } } }) } }) }, triggerRulesClose() { let that = this setTimeout(() => { that.setData({ speedinessState: !this.data.speedinessState }) }, 50) }, // 点击快速选择选项 speediness(e) { let content = e.currentTarget.dataset.content this.setData({ content }) this.triggerRulesClose() }, issubmit: false, send() { if (this.issubmit) { wx.showToast({ title: '请勿重复提交~', icon: 'none' }) return false } this.issubmit = true miucms.request(`${app.globalData.baseURL}/tenement/message/sendMessage`, { token: this.data.token, content: this.data.content }).then(res => { this.issubmit = false if (res.code == 200) { wx.showToast({ title: res.message, }) setTimeout(() => { wx.navigateBack({ delta: 1 }) }, 1500) } else { wx.showModal({ title: '提示', content: res.message }) } }).catch(() => { this.issubmit = false }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ // onShareAppMessage: function () { // } })