home.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. const _my = require("../../__antmove/api/index.js")(my);
  2. const wx = _my; // pages/home/home.js
  3. import { meetingGetPageList, myMeeting } from "../../utils/api/meeting";
  4. import { doGetInfo } from "../../utils/api/api";
  5. import { GetQueryJson } from "../../utils/util";
  6. const app = getApp();
  7. Page({
  8. /**
  9. * 页面的初始数据
  10. */
  11. data: {
  12. StatusBar: app.globalData.StatusBar,
  13. //胶囊按钮位置
  14. CustomBar: app.globalData.CustomBar,
  15. userInfo: wx.getStorageSync("userInfo"),
  16. myMeetingList: [],
  17. meetingList: [],
  18. funList: [{
  19. id: "1",
  20. name: "会议室预约",
  21. img: "/static/home/home-1.png",
  22. url: "/pages/meeting/index/index?type=meeting-detail",
  23. jurisdiction: [1, 2]
  24. }, {
  25. id: "2",
  26. name: "我的会议",
  27. img: "/static/home/home-2.png",
  28. url: "/pages/myMeeting/index/index?type=my-meeting",
  29. jurisdiction: [1]
  30. }, {
  31. id: "3",
  32. name: "我的预约",
  33. img: "/static/home/home-3.png",
  34. url: "/pages/mySubscribe/index/index?type=my-subscribe",
  35. jurisdiction: [1]
  36. }, {
  37. id: "10",
  38. name: "我的续约",
  39. img: "/static/home/home-4.png",
  40. url: "/pages/myRenewalContract/index/index?type=my-renewalContract",
  41. jurisdiction: [1]
  42. }, {
  43. id: "5",
  44. name: "我的转让",
  45. img: "/static/home/home-5.png",
  46. url: "/pages/myTransfer/index/index?type=my-transfer",
  47. jurisdiction: [1]
  48. }, {
  49. id: "6",
  50. name: "转让审核",
  51. img: "/static/home/home-6.png",
  52. url: "/pages/myTransfer/index/index?type=transfer-audit",
  53. jurisdiction: [1]
  54. }, {
  55. id: "4",
  56. name: "预约审核",
  57. img: "/static/home/home-7.png",
  58. url: "/pages/mySubscribe/index/index?type=subscribe-audit",
  59. jurisdiction: [2]
  60. }, {
  61. id: "7",
  62. name: "续约审核",
  63. img: "/static/home/home-8.png",
  64. url: "/pages/myRenewalContract/index/index?type=renewalContract-audit",
  65. jurisdiction: [2]
  66. },
  67. {
  68. id: '11',
  69. name: '已约会议',
  70. img: '/static/home/home-10.png',
  71. url: '/pages/meeting/index/index?type=meeting-detail&statusItem=1',
  72. jurisdiction: [3],
  73. },
  74. {
  75. id: '12',
  76. name: '会议记录',
  77. img: '/static/home/home-2.png',
  78. url: '/pages/meetingRecord/index/index?type=meeting-record',
  79. jurisdiction: [3],
  80. },
  81. {
  82. id: "9",
  83. name: "会议服务",
  84. img: "/static/home/home-9.png",
  85. url: "/pages/orderMeal/index/index?type=order-audit",
  86. jurisdiction: [3]
  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. app.data.roomContentInfo = e.currentTarget.dataset.item
  130. // app.data.roomInfo = e.currentTarget.dataset.item
  131. wx.navigateTo({
  132. url: "/pages/meeting/appointmentDetail/index?&type=" + e.currentTarget.dataset.type
  133. });
  134. },
  135. // 会议室-详情
  136. goRoomFun(e) {
  137. let type = "meeting-detail";
  138. if (e.currentTarget.dataset.item) {
  139. app.data.roomInfo = e.currentTarget.dataset.item
  140. wx.navigateTo({
  141. url: "/pages/meeting/detail/index?&type=" + type
  142. });
  143. // console.log("/pages/meeting/detail/index?&type=" + type)
  144. } else {
  145. wx.navigateTo({
  146. url: "/pages/meeting/index/index?" + "&type=" + type
  147. });
  148. }
  149. },
  150. //
  151. goMine() {
  152. wx.switchTab({
  153. url: "/pages/mine/index/index"
  154. });
  155. },
  156. // 功能区
  157. goFun(e) {
  158. // console.log(e, 111);
  159. let item = e.currentTarget.dataset.item;
  160. if (item.id == 6 || item.id == 4 || item.id == 7 || item.id == 9) {
  161. wx.requestSubscribeMessage({
  162. entityIds: ["0de9d8bd15c8447aae3b0bdac0e4da12", "96dbb1e83377423789c846313681ac6e"],
  163. success(res) {
  164. wx.navigateTo({
  165. url: item.url
  166. });
  167. }
  168. });
  169. }
  170. else {
  171. wx.navigateTo({
  172. url: item.url
  173. });
  174. }
  175. },
  176. doGetInfo() {
  177. let userInfo = wx.getStorageSync('userInfo')
  178. if (userInfo) {
  179. doGetInfo().then(res => {
  180. if (res.code == 200) {
  181. userInfo = Object.assign(userInfo, res.data);
  182. this.setData({
  183. userInfo
  184. })
  185. wx.setStorageSync('userInfo', userInfo)
  186. this.meetingGetList()
  187. // 预约权限
  188. if (!userInfo.appointmentAuth && (userInfo.serivceAuth || userInfo.checkAuth)) {
  189. this.setData({
  190. myMeetingList: [],
  191. })
  192. }
  193. if (userInfo.appointmentAuth) {
  194. this.myMeeting()
  195. }
  196. } else {
  197. this.removeData()
  198. }
  199. }).catch((err) => {
  200. this.removeData()
  201. })
  202. } else {
  203. this.removeData()
  204. }
  205. },
  206. removeData() {
  207. wx.removeStorageSync('userInfo')
  208. this.setData({
  209. userInfo: {},
  210. myMeetingList: [],
  211. meetingList: [],
  212. })
  213. },
  214. // 审核人消息订阅
  215. subscriptionFun() {
  216. wx.showModal({
  217. title: "感谢您使用!",
  218. content: "",
  219. success(res) {
  220. wx.requestSubscribeMessage({
  221. entityIds: ["0de9d8bd15c8447aae3b0bdac0e4da12"],
  222. success(res) { }
  223. });
  224. }
  225. });
  226. },
  227. /**
  228. * 生命周期函数--监听页面加载
  229. */
  230. onLoad(options) {
  231. // console.log(options, 123);
  232. // let json = {};
  233. // if (options.q) {
  234. // var url = decodeURIComponent(options.q);
  235. // json = GetQueryJson(url);
  236. // if ('adminId' in json) {
  237. // console.log(111, json.adminId);
  238. // wx.setStorageSync('adminId', json.adminId)
  239. // let adminId = wx.getStorageSync('adminId')
  240. // }
  241. // }
  242. },
  243. /**
  244. * 生命周期函数--监听页面初次渲染完成
  245. */
  246. onReady() {
  247. // console.log(app, 456);
  248. // console.log(app.globalData, 234);
  249. if (app.globalData.adminId) {
  250. // console.log(111, app.globalData.adminId);
  251. let adminId = wx.getStorageSync("adminId") //新增代码
  252. if (adminId != app.globalData.adminId) { //新增代码
  253. this.removeData()
  254. }
  255. wx.setStorageSync("adminId", app.globalData.adminId);
  256. }
  257. },
  258. /**
  259. * 生命周期函数--监听页面显示
  260. */
  261. onShow() {
  262. this.doGetInfo();
  263. },
  264. /**
  265. * 生命周期函数--监听页面隐藏
  266. */
  267. onHide() { },
  268. /**
  269. * 生命周期函数--监听页面卸载
  270. */
  271. onUnload() { },
  272. /**
  273. * 页面相关事件处理函数--监听用户下拉动作
  274. */
  275. onPullDownRefresh() { },
  276. /**
  277. * 页面上拉触底事件的处理函数
  278. */
  279. onReachBottom() { },
  280. /**
  281. * 用户点击右上角分享
  282. */
  283. onShareAppMessage() { },
  284. antmoveAction: function () {
  285. //执行时动态赋值,请勿删除
  286. }
  287. });