const _my = require("../../__antmove/api/index.js")(my); const wx = _my; // pages/home/home.js import { meetingGetPageList, myMeeting } from "../../utils/api/meeting"; import { doGetInfo } from "../../utils/api/api"; import { GetQueryJson } from "../../utils/util"; const app = getApp(); Page({ /** * 页面的初始数据 */ data: { StatusBar: app.globalData.StatusBar, //胶囊按钮位置 CustomBar: app.globalData.CustomBar, userInfo: wx.getStorageSync("userInfo"), myMeetingList: [], meetingList: [], funList: [{ id: "1", name: "会议室预约", img: "/static/home/home-1.png", url: "/pages/meeting/index/index?type=meeting-detail", jurisdiction: [1, 2] }, { id: "2", name: "我的会议", img: "/static/home/home-2.png", url: "/pages/myMeeting/index/index?type=my-meeting", jurisdiction: [1] }, { id: "3", name: "我的预约", img: "/static/home/home-3.png", url: "/pages/mySubscribe/index/index?type=my-subscribe", jurisdiction: [1] }, { id: "10", name: "我的续约", img: "/static/home/home-4.png", url: "/pages/myRenewalContract/index/index?type=my-renewalContract", jurisdiction: [1] }, { id: "5", name: "我的转让", img: "/static/home/home-5.png", url: "/pages/myTransfer/index/index?type=my-transfer", jurisdiction: [1] }, { id: "6", name: "转让审核", img: "/static/home/home-6.png", url: "/pages/myTransfer/index/index?type=transfer-audit", jurisdiction: [1] }, { id: "4", name: "预约审核", img: "/static/home/home-7.png", url: "/pages/mySubscribe/index/index?type=subscribe-audit", jurisdiction: [2] }, { id: "7", name: "续约审核", img: "/static/home/home-8.png", url: "/pages/myRenewalContract/index/index?type=renewalContract-audit", jurisdiction: [2] }, { id: '11', name: '已约会议', img: '/static/home/home-10.png', url: '/pages/meeting/index/index?type=meeting-detail&statusItem=1', jurisdiction: [3], }, { id: '12', name: '会议记录', img: '/static/home/home-2.png', url: '/pages/meetingRecord/index/index?type=meeting-record', jurisdiction: [3], }, { id: "9", name: "会议服务", img: "/static/home/home-9.png", url: "/pages/orderMeal/index/index?type=order-audit", jurisdiction: [3] }] // accountId: null, // accountName: null, }, // getVal(e) { // console.log(e); // this.setData({ // accountName: this.data.accountList[e.detail.value].name, // accountId: this.data.accountList[e.detail.value].id // }) // }, // 我的会议室-数据 myMeeting() { let data = { data: { appointmentStatus: null }, pageNum: 1, pageSize: 3 }; myMeeting(data).then(res => { this.setData({ myMeetingList: res.data.records }); }); }, // 会议室-数据 meetingGetList() { let data = { pageNum: 1, pageSize: 8 }; meetingGetPageList(data).then(res => { this.setData({ meetingList: res.data.records }); }); }, // 我的会议-详情 myMeetingFun(e) { let item = e.currentTarget.dataset.item; item.status = item.appointmentStatus; item = JSON.stringify(e.currentTarget.dataset.item); app.data.roomContentInfo = e.currentTarget.dataset.item // app.data.roomInfo = e.currentTarget.dataset.item wx.navigateTo({ url: "/pages/meeting/appointmentDetail/index?&type=" + e.currentTarget.dataset.type }); }, // 会议室-详情 goRoomFun(e) { let type = "meeting-detail"; if (e.currentTarget.dataset.item) { app.data.roomInfo = e.currentTarget.dataset.item wx.navigateTo({ url: "/pages/meeting/detail/index?&type=" + type }); // console.log("/pages/meeting/detail/index?&type=" + type) } else { wx.navigateTo({ url: "/pages/meeting/index/index?" + "&type=" + type }); } }, // goMine() { wx.switchTab({ url: "/pages/mine/index/index" }); }, // 功能区 goFun(e) { // console.log(e, 111); let item = e.currentTarget.dataset.item; if (item.id == 6 || item.id == 4 || item.id == 7 || item.id == 9) { wx.requestSubscribeMessage({ entityIds: ["0de9d8bd15c8447aae3b0bdac0e4da12", "96dbb1e83377423789c846313681ac6e"], success(res) { wx.navigateTo({ url: item.url }); } }); } else { wx.navigateTo({ url: item.url }); } }, doGetInfo() { let userInfo = wx.getStorageSync('userInfo') if (userInfo) { doGetInfo().then(res => { if (res.code == 200) { userInfo = Object.assign(userInfo, res.data); this.setData({ userInfo }) wx.setStorageSync('userInfo', userInfo) this.meetingGetList() // 预约权限 if (!userInfo.appointmentAuth && (userInfo.serivceAuth || userInfo.checkAuth)) { this.setData({ myMeetingList: [], }) } if (userInfo.appointmentAuth) { this.myMeeting() } } else { this.removeData() } }).catch((err) => { this.removeData() }) } else { this.removeData() } }, removeData() { wx.removeStorageSync('userInfo') this.setData({ userInfo: {}, myMeetingList: [], meetingList: [], }) }, // 审核人消息订阅 subscriptionFun() { wx.showModal({ title: "感谢您使用!", content: "", success(res) { wx.requestSubscribeMessage({ entityIds: ["0de9d8bd15c8447aae3b0bdac0e4da12"], success(res) { } }); } }); }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { // console.log(options, 123); // let json = {}; // if (options.q) { // var url = decodeURIComponent(options.q); // json = GetQueryJson(url); // if ('adminId' in json) { // console.log(111, json.adminId); // wx.setStorageSync('adminId', json.adminId) // let adminId = wx.getStorageSync('adminId') // } // } }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { // console.log(app, 456); // console.log(app.globalData, 234); if (app.globalData.adminId) { // console.log(111, app.globalData.adminId); let adminId = wx.getStorageSync("adminId") //新增代码 if (adminId != app.globalData.adminId) { //新增代码 this.removeData() } wx.setStorageSync("adminId", app.globalData.adminId); } }, /** * 生命周期函数--监听页面显示 */ onShow() { this.doGetInfo(); }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { }, antmoveAction: function () { //执行时动态赋值,请勿删除 } });