mirror of
https://gitee.com/elegant_wings/dbd-meeting-wx-small.git
synced 2025-06-21 18:59:36 +08:00

1、小程序端、PC端,修改文字“淮安市行政中心智慧后勤服务平台” 2、小程序端,进入会议系统后加入弹窗(5秒自动关闭),底部加入会议服务热线 3、小程序端、PC端,加入占用取消功能,管理员专用,取消后即删除
354 lines
8.2 KiB
JavaScript
354 lines
8.2 KiB
JavaScript
const app = getApp()
|
||
|
||
import Notify from '@vant/weapp/notify/notify';
|
||
import Dialog from '@vant/weapp/dialog/dialog';
|
||
import {
|
||
depLogin
|
||
} from "../../../api/login/login.js"
|
||
Page({
|
||
/**
|
||
* 页面的初始数据
|
||
*/
|
||
data: {
|
||
IMG_NAME: app.IMG_NAME,
|
||
userDetail: {},
|
||
menuList: [{
|
||
type: "reservation",
|
||
name: "会议预约",
|
||
img: "/profile/static/meeting/index/reservation.png",
|
||
path: "/pages/meeting/meetingReservation/meetingReservation",
|
||
visible: false
|
||
}, {
|
||
type: "record",
|
||
name: "预约记录",
|
||
img: "/profile/static/meeting/index/record.png",
|
||
path: "/pages/meeting/reservationRecord/meetingRecord/meetingRecord",
|
||
visible: true
|
||
}, {
|
||
type: "approve",
|
||
name: "会议审核",
|
||
img: "/profile/static/meeting/index/examine.png",
|
||
path: "/pages/meeting/reservationRecord/approve/approve",
|
||
visible: false
|
||
}, {
|
||
type: "service",
|
||
name: "会务服务",
|
||
img: "/profile/static/meeting/index/serve.png",
|
||
path: "/pages/meeting/reservationRecord/service/service",
|
||
visible: false
|
||
}],
|
||
timeShow: false,
|
||
currentDate: new Date().getTime(),
|
||
minDate: new Date().getTime(),
|
||
maxDate: '',
|
||
formatter(type, value) {
|
||
if (type === 'year') {
|
||
return `${value}年`;
|
||
}
|
||
if (type === 'month') {
|
||
return `${value}月`;
|
||
}
|
||
if (type === 'day') {
|
||
return `${value}日`;
|
||
}
|
||
return value;
|
||
},
|
||
// 用户登录相关参数
|
||
showLogin: false, // 是否展示弹出层
|
||
username: '', // 用户名
|
||
pwd: '', // 登录密码
|
||
depName: '', // 登录单位
|
||
depId: '', // 登录单位id
|
||
beforeClose(action) {
|
||
return new Promise(resolve => {
|
||
if (action === 'confirm') {
|
||
resolve(false)
|
||
} else {
|
||
resolve(true)
|
||
}
|
||
})
|
||
}, // 弹出层点击确认不关闭,手动关
|
||
adminTel: '83605343',
|
||
},
|
||
showTimePicker() {
|
||
this.setData({
|
||
timeShow: true
|
||
});
|
||
},
|
||
hideTimePicker() {
|
||
this.setData({
|
||
timeShow: false
|
||
});
|
||
},
|
||
/**
|
||
* 生命周期函数--监听页面加载
|
||
*/
|
||
onLoad(options) {
|
||
Dialog.alert({
|
||
message: '1、此系统分配的账号仅用于会议室申请预约,请各单位专人扎口负责会议预定管理工作。\n2、系统提示“预约提交成功”后请及时关注预约进度,若有疑问请随时拨打会议服务热线:83605343。\n3、会议开始前如需调整会议,请及时通过系统操作或电话告知,已预约成功的会议室可能因临时重大会议取消或调剂,请理解配合。',
|
||
messageAlign: 'left',
|
||
}).then(() => {
|
||
// on close
|
||
})
|
||
let count = 5
|
||
const countdown = setInterval(() => {
|
||
if (count > 0) {
|
||
count--;
|
||
} else {
|
||
Dialog.close()
|
||
clearInterval(countdown);
|
||
}
|
||
}, 1000)
|
||
|
||
let _this = this
|
||
let userDetail = wx.getStorageSync('user')
|
||
// 获取两周后时间,默认只能选两周之后,管理员可以选一年后的
|
||
const today = new Date()
|
||
const newDate = new Date(today)
|
||
if (userDetail.roomRole == 5) {
|
||
newDate.setFullYear(newDate.getFullYear() + 1)
|
||
} else {
|
||
newDate.setDate(newDate.getDate() + 14)
|
||
}
|
||
|
||
wx.getStorage({
|
||
key: 'DEP_USERNAME',
|
||
success(res) {
|
||
_this.setData({
|
||
username: res.data
|
||
})
|
||
},
|
||
})
|
||
wx.getStorage({
|
||
key: 'DEP_PWD',
|
||
success(res) {
|
||
_this.setData({
|
||
pwd: res.data
|
||
})
|
||
},
|
||
})
|
||
_this.setData({
|
||
userDetail,
|
||
maxDate: newDate.getTime(),
|
||
})
|
||
// 展示模块
|
||
_this.visibleBlock()
|
||
|
||
},
|
||
// 跳转会议预约页面
|
||
goRes(e) {
|
||
let date = new Date(e.detail);
|
||
let year = date.getFullYear()
|
||
let month = date.getMonth() + 1
|
||
let day = date.getDate()
|
||
// IOS不支持-,必须用/
|
||
let chooseTime = year + '/' + month + '/' + day + ' 00:00:00'
|
||
let chooseTimeStr = new Date(chooseTime).getTime()
|
||
wx.navigateTo({
|
||
url: '/pages/meeting/meetingReservation/meetingReservation?time=' + chooseTimeStr + '&dep=' + this.data.depName + '&depId=' + this.data.depId,
|
||
})
|
||
},
|
||
// 跳转菜单
|
||
jumpMenu(e) {
|
||
console.log('jumpMenu', e);
|
||
let obj = e.currentTarget.dataset.obj
|
||
if (obj.visible) {
|
||
// 未授权
|
||
if (obj.name == '会议预约') {
|
||
// 会议预约需要先选择时间
|
||
this.showTimePicker()
|
||
} else {
|
||
wx.navigateTo({
|
||
url: obj.path,
|
||
})
|
||
}
|
||
} else {
|
||
if (obj.name === '会议预约') {
|
||
if (this.data.userDetail.roomRole == 5) {
|
||
// 管理员,不需要认证
|
||
this.showTimePicker()
|
||
} else {
|
||
// 未授权
|
||
this.setData({
|
||
showLogin: true
|
||
})
|
||
}
|
||
return
|
||
// app.selfShowMsg('您暂无权限使用该功能,请联系机关事务局XXX(电话15888888888)进行赋权后使用')
|
||
} else {
|
||
app.vantNotifyErrTop(Notify, `"${obj.name}"无权限访问!`)
|
||
return
|
||
}
|
||
}
|
||
},
|
||
|
||
// 展示模块
|
||
visibleBlock() {
|
||
let _this = this
|
||
let userDetail = _this.data.userDetail
|
||
let userRole = userDetail.roomRole
|
||
let menuList = _this.data.menuList
|
||
// 角色类型 1.普通用户,3.会务人员,5.管理员
|
||
if (userRole == 3) {
|
||
// 会务人员,会务服务允许访问
|
||
menuList = menuList.map(item => {
|
||
if (item.type == 'service') {
|
||
item.visible = true
|
||
}
|
||
return item
|
||
})
|
||
}
|
||
if (userRole == 5) {
|
||
// 管理员,会务审核允许访问,且预约记录自动跳转到会议审核
|
||
menuList = menuList.map(item => {
|
||
if (item.type == 'approve') {
|
||
item.visible = true
|
||
}
|
||
if (item.type == 'record') {
|
||
item.path = '/pages/meeting/reservationRecord/approve/approve?act=show'
|
||
item.visible = true
|
||
}
|
||
return item
|
||
})
|
||
}
|
||
_this.setData({
|
||
menuList
|
||
})
|
||
},
|
||
|
||
back() {
|
||
wx.navigateBack()
|
||
},
|
||
|
||
onCloseLogin(e) {
|
||
let _this = this;
|
||
_this.setData({
|
||
cancelId: '',
|
||
showCancelReason: false,
|
||
cancelReason: ''
|
||
})
|
||
},
|
||
onChangeUsername(e) {
|
||
let _this = this;
|
||
_this.setData({
|
||
username: e.detail
|
||
})
|
||
},
|
||
onChangePwd(e) {
|
||
let _this = this;
|
||
_this.setData({
|
||
pwd: e.detail
|
||
})
|
||
},
|
||
// 认证方法
|
||
orderLogin() {
|
||
let _this = this;
|
||
let uName = _this.data.username
|
||
let pwd = _this.data.pwd
|
||
if (uName === '' || pwd === '') {
|
||
Notify({
|
||
message: '请填写用户名、密码!',
|
||
top: 50
|
||
})
|
||
return
|
||
}
|
||
depLogin({
|
||
loginName: uName,
|
||
password: pwd
|
||
}).then(res => {
|
||
if (res.code !== 0) {
|
||
Notify({
|
||
message: '认证失败!',
|
||
top: 50
|
||
})
|
||
wx.removeStorage({
|
||
key: 'DEP_USERNAME',
|
||
})
|
||
wx.removeStorage({
|
||
key: 'DEP_PWD',
|
||
})
|
||
} else {
|
||
// 认证通过
|
||
Notify({
|
||
type: 'success',
|
||
message: '认证通过!',
|
||
top: 50
|
||
})
|
||
wx.setStorage({
|
||
key: "DEP_USERNAME",
|
||
data: uName
|
||
})
|
||
wx.setStorage({
|
||
key: "DEP_PWD",
|
||
data: pwd
|
||
})
|
||
_this.setData({
|
||
['menuList[0].visible']: true,
|
||
username: uName,
|
||
pwd: pwd,
|
||
showLogin: false,
|
||
depName: res.data.orgName,
|
||
depId: res.data.orgId,
|
||
})
|
||
this.showTimePicker()
|
||
}
|
||
console.log('depLogin', res)
|
||
|
||
})
|
||
|
||
},
|
||
callAdmin() {
|
||
let num = this.data.adminTel
|
||
wx.makePhoneCall({
|
||
phoneNumber: num
|
||
})
|
||
},
|
||
/**
|
||
* 生命周期函数--监听页面初次渲染完成
|
||
*/
|
||
onReady() {
|
||
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面显示
|
||
*/
|
||
onShow() {
|
||
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面隐藏
|
||
*/
|
||
onHide() {
|
||
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面卸载
|
||
*/
|
||
onUnload() {
|
||
|
||
},
|
||
|
||
/**
|
||
* 页面相关事件处理函数--监听用户下拉动作
|
||
*/
|
||
onPullDownRefresh() {
|
||
|
||
},
|
||
|
||
/**
|
||
* 页面上拉触底事件的处理函数
|
||
*/
|
||
onReachBottom() {
|
||
|
||
},
|
||
|
||
/**
|
||
* 用户点击右上角分享
|
||
*/
|
||
onShareAppMessage() {
|
||
|
||
}
|
||
}) |