const APP = getApp(); Page({ /** * 页面的初始数据 */ data: { typeIdx: 0, typeList: [{ id: 1, name: "实时播报" }, // { // id: 0, // name: "固定播报" // } ], }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { }, /** * 监听-播报类型切换 */ bindTypeChange: function (event) { this.setData({ typeIdx: event.detail.value, }) }, /** * 发送播报消息 */ submit: function (form) { const data = { openNum: APP.globalData.openNum, newsType: 1, news: form.detail.value.news } if (data.news == null || data.news == "") { APP.Modal.tips("播报内容不为空!") return; } APP.Post(APP.Url.setNews, data).then(res => { APP.Modal.tips("发送成功!") }).catch(res => { console.log(res) APP.Modal.tips("发送失败!") }) }, })