const APP = getApp() Page({ /** * 页面的初始数据 */ data: { device: {}, }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { this.getBindInfo(); }, getBindInfo() { APP.Get(APP.Url.getBindInfo, {}, false).then(res => { this.setData({ device: res.data }) }) }, submit: function (form) { const that = this; const params = { openNum: that.data.device.openNum, deviceName: form.detail.value.deviceName } APP.Post(APP.Url.updateBindInfo, params).then(res => { APP.Modal.tips("保存成功!") that.getBindInfo() }).catch(res => { APP.Modal.tips("保存失败!") }) } })