broadcast.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. const APP = getApp();
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. time: "点击选择时间",
  8. typeIdx: 0,
  9. typeList: [{
  10. id: 1,
  11. name: "实时播报"
  12. },
  13. // {
  14. // id: 0,
  15. // name: "固定播报"
  16. // }
  17. ],
  18. weekList: [{
  19. id: 7,
  20. name: "日"
  21. }, {
  22. id: 1,
  23. name: "一"
  24. }, {
  25. id: 2,
  26. name: "二"
  27. }, {
  28. id: 3,
  29. name: "三"
  30. }, {
  31. id: 4,
  32. name: "四"
  33. }, {
  34. id: 5,
  35. name: "五"
  36. }, {
  37. id: 6,
  38. name: "六"
  39. }]
  40. },
  41. /**
  42. * 生命周期函数--监听页面加载
  43. */
  44. onLoad: function (options) { },
  45. /**
  46. * 监听-时间选择切换
  47. */
  48. bindTimeChange: function (event) {
  49. this.setData({
  50. time: event.detail.value,
  51. })
  52. },
  53. /**
  54. * 监听-播报类型切换
  55. */
  56. bindTypeChange: function (event) {
  57. this.setData({
  58. typeIdx: event.detail.value,
  59. })
  60. },
  61. /**
  62. * 发送播报消息
  63. */
  64. setNews: function (form) {
  65. const data = {
  66. openNum: APP.globalData.openNum,
  67. newsType: 1,
  68. news: form.detail.value.news
  69. // newsType: this.data.typeList[this.data.typeIdx].id,
  70. // newTime: "",
  71. }
  72. // if (data.newsType == 0) {
  73. // if (this.data.time === "点击选择时间") {
  74. // APP.Modal.tips("时间不为空!")
  75. // return;
  76. // }
  77. // data.newsTime = this.data.time + ":00";
  78. // }
  79. if (data.news == null || data.news == "") {
  80. APP.Modal.tips("播报内容不为空!")
  81. return;
  82. }
  83. APP.Post(APP.Url.setNews, data).then(res => {
  84. APP.Modal.tips("发送成功!")
  85. }).catch(res => {
  86. console.log(res)
  87. APP.Modal.tips("发送失败!")
  88. })
  89. },
  90. })