2024-07-26 16:36:45 +08:00
|
|
|
|
const app = getApp()
|
|
|
|
|
|
2024-08-16 14:51:54 +08:00
|
|
|
|
import Notify from '@vant/weapp/notify/notify';
|
|
|
|
|
|
2024-07-26 16:36:45 +08:00
|
|
|
|
Page({
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 页面的初始数据
|
|
|
|
|
*/
|
|
|
|
|
data: {
|
|
|
|
|
IMG_NAME: app.IMG_NAME,
|
2024-08-15 16:25:45 +08:00
|
|
|
|
userDetail: {},
|
2024-07-26 16:36:45 +08:00
|
|
|
|
menuList: [{
|
2024-08-15 16:25:45 +08:00
|
|
|
|
type: "report",
|
2024-07-26 16:36:45 +08:00
|
|
|
|
name: "我要报修",
|
2024-08-05 16:28:32 +08:00
|
|
|
|
img: "/profile/static/repair/index/my.png",
|
2024-08-15 16:25:45 +08:00
|
|
|
|
path: "/pages/reportRepair/report/report",
|
|
|
|
|
visible: true
|
2024-07-26 16:36:45 +08:00
|
|
|
|
}, {
|
2024-08-15 16:25:45 +08:00
|
|
|
|
type: "query",
|
2024-07-26 16:36:45 +08:00
|
|
|
|
name: "报修查询",
|
2024-08-05 16:28:32 +08:00
|
|
|
|
img: "/profile/static/repair/index/query.png",
|
2024-08-15 16:25:45 +08:00
|
|
|
|
path: "/pages/reportRepair/query/record/record",
|
|
|
|
|
visible: true
|
2024-07-26 16:36:45 +08:00
|
|
|
|
}, {
|
2024-08-15 16:25:45 +08:00
|
|
|
|
type: "repair",
|
2024-07-26 16:36:45 +08:00
|
|
|
|
name: "维修入口",
|
2024-08-05 16:28:32 +08:00
|
|
|
|
img: "/profile/static/repair/index/repair.png",
|
2024-08-15 16:25:45 +08:00
|
|
|
|
path: "/pages/reportRepair/repair/index/index",
|
|
|
|
|
visible: false
|
2024-07-26 16:36:45 +08:00
|
|
|
|
}, {
|
2024-08-15 16:25:45 +08:00
|
|
|
|
type: "assign",
|
2024-07-26 16:36:45 +08:00
|
|
|
|
name: "派单入口",
|
2024-08-05 16:28:32 +08:00
|
|
|
|
img: "/profile/static/repair/index/case.png",
|
2024-08-15 16:25:45 +08:00
|
|
|
|
path: "/pages/reportRepair/assign/record/record",
|
|
|
|
|
visible: false
|
2024-07-26 16:36:45 +08:00
|
|
|
|
}]
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
|
*/
|
|
|
|
|
onLoad(options) {
|
2024-08-15 16:25:45 +08:00
|
|
|
|
let _this = this
|
|
|
|
|
let userDetail = wx.getStorageSync('user')
|
|
|
|
|
_this.setData({
|
|
|
|
|
userDetail
|
|
|
|
|
})
|
|
|
|
|
// 展示模块
|
|
|
|
|
_this.visibleBlock()
|
2024-07-26 16:36:45 +08:00
|
|
|
|
},
|
|
|
|
|
|
2024-07-26 17:28:44 +08:00
|
|
|
|
// 跳转菜单
|
2024-07-29 10:32:57 +08:00
|
|
|
|
jumpMenu(e) {
|
|
|
|
|
console.log('jumpMenu', e);
|
2024-07-26 17:28:44 +08:00
|
|
|
|
let obj = e.currentTarget.dataset.obj
|
2024-08-16 14:51:54 +08:00
|
|
|
|
if (obj.visible) {
|
|
|
|
|
wx.navigateTo({
|
|
|
|
|
url: obj.path,
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
app.vantNotifyErrTop(Notify, `"${obj.name}"无权限访问!`)
|
|
|
|
|
return
|
|
|
|
|
}
|
2024-07-26 17:28:44 +08:00
|
|
|
|
},
|
|
|
|
|
|
2024-08-15 16:25:45 +08:00
|
|
|
|
// 展示模块
|
|
|
|
|
visibleBlock() {
|
|
|
|
|
let _this = this
|
|
|
|
|
let userDetail = _this.data.userDetail
|
|
|
|
|
let dataType = userDetail.dataType
|
|
|
|
|
let menuList = _this.data.menuList
|
2024-08-20 11:41:50 +08:00
|
|
|
|
// 角色类型 1.普通用户,3派单员,5维修工,7管理员 , 9楼层
|
|
|
|
|
if (dataType == 3 || dataType == 7 || dataType == 9) { // 展示-派单入口
|
2024-08-15 16:25:45 +08:00
|
|
|
|
menuList = menuList.map(item => {
|
|
|
|
|
if (item.type == 'assign') {
|
|
|
|
|
item.visible = true
|
|
|
|
|
}
|
|
|
|
|
return item
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
if (dataType == 5) { // 展示-维修入口
|
|
|
|
|
menuList = menuList.map(item => {
|
|
|
|
|
if (item.type == 'repair') {
|
|
|
|
|
item.visible = true
|
|
|
|
|
}
|
|
|
|
|
return item
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
_this.setData({
|
|
|
|
|
menuList
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
back() {
|
2024-07-30 11:17:41 +08:00
|
|
|
|
wx.navigateBack()
|
|
|
|
|
},
|
|
|
|
|
|
2024-07-26 16:36:45 +08:00
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
|
|
*/
|
|
|
|
|
onReady() {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面显示
|
|
|
|
|
*/
|
|
|
|
|
onShow() {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
|
|
*/
|
|
|
|
|
onHide() {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
|
|
*/
|
|
|
|
|
onUnload() {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
|
*/
|
|
|
|
|
onPullDownRefresh() {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
|
|
*/
|
|
|
|
|
onReachBottom() {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 用户点击右上角分享
|
|
|
|
|
*/
|
|
|
|
|
onShareAppMessage() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
})
|