const APP = getApp(); Page({ /** * 页面的初始数据 */ data: { set: {},//设置信息 }, /** * 生命周期函数--监听页面加载 */ onLoad: function () { this.getSetInfo(APP.globalData.openNum); }, /** * 设置按键 */ submit: function (form) { const that = this; const params = { openNum: this.data.set.openNum, key0Name: form.detail.value.key0Name, key0Phone: form.detail.value.key0Phone, key1Name: form.detail.value.key1Name, key1Phone: form.detail.value.key1Phone, key2Name: form.detail.value.key2Name, key2Phone: form.detail.value.key2Phone, } APP.Post(APP.Url.setSos, params).then(res => { that.getSetInfo(params.openNum) APP.Modal.tips("保存成功!") }).catch(res => { APP.Modal.tips("保存失败!") }) }, /** * 获取设备设置信息 */ getSetInfo: function (openNum) { const params = { openNum: openNum, } APP.Get(APP.Url.getSos, params, false).then(res => { this.setData({ set: res.data }) }) }, })