home.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. // pages/home/home.js
  2. import {
  3. meetingGetPageList,
  4. myMeeting
  5. } from '../../utils/api/meeting'
  6. import {
  7. doGetInfo
  8. } from '../../utils/api/api'
  9. import {
  10. GetQueryJson
  11. } from '../../utils/util'
  12. const app = getApp();
  13. Page({
  14. /**
  15. * 页面的初始数据
  16. */
  17. data: {
  18. StatusBar: app.globalData.StatusBar, //胶囊按钮位置
  19. CustomBar: app.globalData.CustomBar,
  20. userInfo: wx.getStorageSync('userInfo'),
  21. myMeetingList: [],
  22. meetingList: [],
  23. funList: [{
  24. id: '1',
  25. name: '会议室',
  26. img: '/static/home/home-1.png',
  27. url: '/pages/meeting/index/index?type=meeting-detail',
  28. jurisdiction: [1, 2],
  29. },
  30. {
  31. id: '2',
  32. name: '我的会议',
  33. img: '/static/home/home-2.png',
  34. url: '/pages/myMeeting/index/index?type=my-meeting',
  35. jurisdiction: [1],
  36. },
  37. {
  38. id: '3',
  39. name: '我的预约',
  40. img: '/static/home/home-3.png',
  41. url: '/pages/mySubscribe/index/index?type=my-subscribe',
  42. jurisdiction: [1],
  43. },
  44. {
  45. id: '10',
  46. name: '我的续约',
  47. img: '/static/home/home-4.png',
  48. url: '/pages/myRenewalContract/index/index?type=my-renewalContract',
  49. jurisdiction: [1],
  50. },
  51. {
  52. id: '5',
  53. name: '我的转让',
  54. img: '/static/home/home-5.png',
  55. url: '/pages/myTransfer/index/index?type=my-transfer',
  56. jurisdiction: [1],
  57. },
  58. {
  59. id: '6',
  60. name: '转让审核',
  61. img: '/static/home/home-6.png',
  62. url: '/pages/myTransfer/index/index?type=transfer-audit',
  63. jurisdiction: [1],
  64. },
  65. {
  66. id: '4',
  67. name: '预约审核',
  68. img: '/static/home/home-7.png',
  69. url: '/pages/mySubscribe/index/index?type=subscribe-audit',
  70. jurisdiction: [2],
  71. },
  72. {
  73. id: '7',
  74. name: '续约审核',
  75. img: '/static/home/home-8.png',
  76. url: '/pages/myRenewalContract/index/index?type=renewalContract-audit',
  77. jurisdiction: [2],
  78. },
  79. {
  80. id: '9',
  81. name: '会议服务',
  82. img: '/static/home/home-9.png',
  83. url: '/pages/orderMeal/index/index?type=order-audit',
  84. jurisdiction: [2],
  85. },
  86. ],
  87. // accountId: null,
  88. // accountName: null,
  89. },
  90. // getVal(e) {
  91. // console.log(e);
  92. // this.setData({
  93. // accountName: this.data.accountList[e.detail.value].name,
  94. // accountId: this.data.accountList[e.detail.value].id
  95. // })
  96. // },
  97. // 我的会议室-数据
  98. myMeeting() {
  99. let data = {
  100. data: {
  101. appointmentStatus: null
  102. },
  103. pageNum: 1,
  104. pageSize: 3,
  105. }
  106. myMeeting(data).then(res => {
  107. this.setData({
  108. myMeetingList: res.data.records
  109. })
  110. })
  111. },
  112. // 会议室-数据
  113. meetingGetList() {
  114. let data = {
  115. pageNum: 1,
  116. pageSize: 8,
  117. }
  118. meetingGetPageList(data).then(res => {
  119. this.setData({
  120. meetingList: res.data.records
  121. })
  122. })
  123. },
  124. // 我的会议-详情
  125. myMeetingFun(e) {
  126. let item = e.currentTarget.dataset.item
  127. item.status = item.appointmentStatus
  128. item = JSON.stringify(e.currentTarget.dataset.item)
  129. wx.navigateTo({
  130. url: '/pages/meeting/appointmentDetail/index?item=' + item + '&type=' + e.currentTarget.dataset.type
  131. })
  132. },
  133. // 会议室-详情
  134. goRoomFun(e) {
  135. let type = 'meeting-detail'
  136. if (e.currentTarget.dataset.item) {
  137. let item = JSON.stringify(e.currentTarget.dataset.item)
  138. wx.navigateTo({
  139. url: '/pages/meeting/detail/index?item=' + item + '&type=' + type
  140. })
  141. } else {
  142. wx.navigateTo({
  143. url: '/pages/meeting/index/index?' + '&type=' + type
  144. })
  145. }
  146. },
  147. // 功能区
  148. goFun(e) {
  149. let item = e.currentTarget.dataset.item
  150. if (item.id == 6 || item.id == 4 || item.id == 7 || item.id == 9) {
  151. wx.requestSubscribeMessage({
  152. tmplIds: ['w7cy1am3DS8BF31uUDoMKfruKWQXT0ckhALzyUdvweg', 'mJs6TXjIFuwgPu2JOEIpu3lO9ym9rnai-schUPuLuok'],
  153. success(res) {
  154. wx.navigateTo({
  155. url: item.url
  156. })
  157. }
  158. })
  159. } else {
  160. wx.navigateTo({
  161. url: item.url
  162. })
  163. }
  164. },
  165. doGetInfo() {
  166. let userInfo = wx.getStorageSync('userInfo')
  167. if (userInfo) {
  168. doGetInfo().then(res => {
  169. if (res.code == 200) {
  170. userInfo = Object.assign(userInfo, res.data);
  171. this.setData({
  172. userInfo
  173. })
  174. wx.setStorageSync('userInfo', userInfo)
  175. this.meetingGetList()
  176. // 预约权限
  177. if (userInfo.appointmentAuth) {
  178. this.myMeeting()
  179. }
  180. } else {
  181. wx.removeStorageSync('userInfo')
  182. this.setData({
  183. userInfo: {}
  184. })
  185. }
  186. }).catch((err) => {
  187. wx.removeStorageSync('userInfo')
  188. this.setData({
  189. userInfo: {}
  190. })
  191. })
  192. }
  193. },
  194. // 审核人消息订阅
  195. subscriptionFun() {
  196. wx.showModal({
  197. title: '感谢您使用!',
  198. content: '',
  199. success(res) {
  200. wx.requestSubscribeMessage({
  201. tmplIds: ['w7cy1am3DS8BF31uUDoMKfruKWQXT0ckhALzyUdvweg'],
  202. success(res) {}
  203. })
  204. }
  205. })
  206. },
  207. /**
  208. * 生命周期函数--监听页面加载
  209. */
  210. onLoad(options) {
  211. console.log(options);
  212. let json = {};
  213. if (options.q) {
  214. var url = decodeURIComponent(options.q);
  215. json = GetQueryJson(url);
  216. if ('adminId' in json) {
  217. console.log(111, json.adminId);
  218. wx.setStorageSync('adminId', json.adminId)
  219. let adminId = wx.getStorageSync('adminId')
  220. }
  221. }
  222. },
  223. /**
  224. * 生命周期函数--监听页面初次渲染完成
  225. */
  226. onReady() {
  227. },
  228. /**
  229. * 生命周期函数--监听页面显示
  230. */
  231. onShow() {
  232. this.doGetInfo()
  233. },
  234. /**
  235. * 生命周期函数--监听页面隐藏
  236. */
  237. onHide() {
  238. },
  239. /**
  240. * 生命周期函数--监听页面卸载
  241. */
  242. onUnload() {
  243. },
  244. /**
  245. * 页面相关事件处理函数--监听用户下拉动作
  246. */
  247. onPullDownRefresh() {
  248. },
  249. /**
  250. * 页面上拉触底事件的处理函数
  251. */
  252. onReachBottom() {
  253. },
  254. /**
  255. * 用户点击右上角分享
  256. */
  257. onShareAppMessage() {
  258. }
  259. })