1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- const APP = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- time: "点击选择时间",
- typeIdx: 0,
- typeList: [{
- id: 1,
- name: "实时播报"
- },
- // {
- // id: 0,
- // name: "固定播报"
- // }
- ],
- weekList: [{
- id: 7,
- name: "日"
- }, {
- id: 1,
- name: "一"
- }, {
- id: 2,
- name: "二"
- }, {
- id: 3,
- name: "三"
- }, {
- id: 4,
- name: "四"
- }, {
- id: 5,
- name: "五"
- }, {
- id: 6,
- name: "六"
- }]
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) { },
- /**
- * 监听-时间选择切换
- */
- bindTimeChange: function (event) {
- this.setData({
- time: event.detail.value,
- })
- },
- /**
- * 监听-播报类型切换
- */
- bindTypeChange: function (event) {
- this.setData({
- typeIdx: event.detail.value,
- })
- },
- /**
- * 发送播报消息
- */
- setNews: function (form) {
- const data = {
- openNum: APP.globalData.openNum,
- newsType: 1,
- news: form.detail.value.news
- // newsType: this.data.typeList[this.data.typeIdx].id,
- // newTime: "",
- }
- // if (data.newsType == 0) {
- // if (this.data.time === "点击选择时间") {
- // APP.Modal.tips("时间不为空!")
- // return;
- // }
- // data.newsTime = this.data.time + ":00";
- // }
- 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("发送失败!")
- })
- },
- })
|