341 lines
9.5 KiB
JavaScript
Raw Permalink Normal View History

2024-02-21 17:43:11 +08:00
const app = getApp()
2024-03-13 18:27:17 +08:00
import Notify from '@vant/weapp/notify/notify';
import Dialog from '@vant/weapp/dialog/dialog'
2024-03-13 18:27:17 +08:00
import {
callScanUrl
2024-03-13 18:27:17 +08:00
} from "../../api/common/scan.js"
2024-03-14 08:54:04 +08:00
import {
userProfile,
getUserInfoRq
2024-03-14 08:54:04 +08:00
} from "../../api/user/user.js"
2024-03-14 15:31:25 +08:00
import {
getParkRq
2024-03-14 15:31:25 +08:00
} from "../../api/index/index.js"
2024-08-19 15:32:53 +08:00
import {
repairRemindLatestListRq,
repairRemindReadRq
2024-08-19 15:32:53 +08:00
} from "../../api/repair/repair.js"
2024-05-06 15:24:42 +08:00
import {
getUrlParamsObj
2024-05-06 15:24:42 +08:00
} from "../../utils/util.js"
2024-03-13 18:27:17 +08:00
2024-02-21 17:43:11 +08:00
Page({
data: {
// tabBar param
tabBarParam: {
selected: 0,
color: "#515151",
selectedColor: "#217CFF",
backgroundColor: "#ffffff",
},
// tabBar menu
tabBarList: [{
"pagePath": "/pages/index/index",
"iconPath": "/images/tabbar/home.png",
"selectedIconPath": "/images/tabbar/home-select.png",
"text": "首页"
},
{
"pagePath": "/pages/reportRepair/report/report",
"iconPath": "/images/tabbar/center.png",
"selectedIconPath": "/images/tabbar/center.png",
"text": "报修",
"bulge": true,
},
{
"pagePath": "/pages/my/my",
"iconPath": "/images/tabbar/my.png",
"selectedIconPath": "/images/tabbar/my-select.png",
"text": "我的"
},
],
IMG_NAME: app.IMG_NAME,
menuList: [
// {
// name: "创业活动",
// img: "/images/hicon/chuangyehuodong.png",
// path: "/pages/community/community"
// },
// {
// name: "政策信息",
// img: "/images/hicon/zhengcexinxi.png",
// path: "/pages/notice/notice"
// },
// {
// name: "党建园地",
// img: "/images/hicon/zhaozhengce.png",
// path: "/pages/party/party"
// },
// {
// name: "租办公室",
// img: "/images/hicon/zubangongshi.png",
// path: "/pages/office/office"
// },
// {
// name: "项目入孵",
// img: "/images/hicon/xiangmurufu.png",
// path: "/pages/applyType/applyType"
// },
// {
// name: "企业入驻",
// img: "/images/hicon/qiyeruzhu.png",
// path: "/pages/applyType/applyType"
// },
// {
// name: "厂房申请",
// img: "/images/hicon/qianrushenqing.png",
// path: "/pages/applyType/applyType"
// },
// {
// name: "园区建议",
// img: "/images/hicon/yuanqujianyi.png",
// path: "/pages/complaint/complaint"
// },
// {
// name: "商业计划书",
// img: "/images/hicon/wenjuandiaocha.png",
// path: "/pages/outer/outer"
// },
/*
{
name: "园区报修",
img: "/images/hicon/zhaozhuanli.png",
path: "/pages/parkRepair/parkRepair"
},
*/
{
name: "随手拍",
img: "/profile/static/index/menu-bxfw.png",
path: "/pages/reportRepair/index/index"
},
{
name: "会议预约",
img: "/profile/static/index/menu-hyyy.png",
path: "/pages/meeting/index/index"
},
// {
// name: "展厅预约",
// img: "/profile/static/index/menu-ztyy.png",
// path: "/pages/meeting/exhibition/list/list"
// },
// {
// name: "访客预约",
// img: "/profile/static/index/menu-fkyy.png",
// path: "/pages/meeting/visitorIinvitation/list/list"
// },
// {
// name: "预约记录",
// img: "/profile/static/index/menu-yyjl.png",
// path: "/pages/meeting/reservationRecord/meetingRecord/meetingRecord"
// },
2024-03-08 13:57:54 +08:00
// {
// name: "远程门禁",
// img: "/profile/static/index/menu-ycmj.png",
// path: "/pages/meeting/accessControl/accessControl"
// },
// {
// name: "报修服务",
// img: "/profile/static/index/menu-bxfw.png",
// path: "/pages/parkRepair/parkRepair"
// },
// {
// name: "投诉建议",
// img: "/profile/static/index/menu-tsjy.png",
// path: "/pages/complaint/complaint"
// },
// {
// name: "社群活动",
// img: "/profile/static/index/menu-sqhd.png",
// path: "/pages/community/community"
// },
// {
// name: "政策中心",
// img: "/profile/static/index/menu-zczx.png",
// path: "/pages/notice/notice"
// },
// {
// name: "入住申请",
// img: "/profile/static/index/menu-rzsq.png",
// path: "/pages/applyType/applyType"
// },
2024-03-08 13:57:54 +08:00
],
bannerList: [],
userDetail: {},
parkName: app.parkName,
qrcodeParam: null,
infoList: [],
},
2024-02-22 18:57:41 +08:00
onLoad(options) {
console.log('onLoad options', options);
let _this = this;
},
2024-03-14 15:31:25 +08:00
// 切换tabbar
switchTab(e) {
const data = e.currentTarget.dataset
console.log('switchTab', data)
const url = data.path
if (url == '/pages/reportRepair/report/report') {
wx.navigateTo({
url
})
} else {
wx.switchTab({
url
})
}
},
2024-02-22 18:57:41 +08:00
onShow() {
let _this = this
let userId = wx.getStorageSync('userId');
if (userId) {
getUserInfoRq(userId).then(res => {
console.log('getUserInfoRq', res);
if (res.code == 0) {
let userDetail = res.data;
// 存储用户信息
wx.setStorageSync('openid', userDetail.openid)
wx.setStorageSync('user', userDetail)
wx.setStorageSync('userId', userDetail.id)
_this.setData({
userDetail
})
if (!userDetail.gzhOpenid) {
// 未绑定公众号
Dialog.confirm({
title: '提醒',
message: '您当前未绑定手机号,为更好提供服务,请绑定号码接收提醒!',
})
.then(() => {
wx.navigateTo({
url: '/pages/my/bindWei/bindWei',
})
})
.catch(() => {
// on cancel
})
}
// 查询轮播图
// getParkRq(userDetail.parkId).then(res => {
// console.log('getParkRq', res);
// let bannerList = res.bannerImages.map(item => item.url)
// _this.setData({
// bannerList
// })
// })
// 查询消息列表
repairRemindLatestListRq().then(res => {
console.log('repairRemindLatestListRq', res);
_this.setData({
infoList: res.data
2024-03-14 08:54:04 +08:00
})
})
2024-03-14 08:54:04 +08:00
} else {
app.selfShowMsg(res.msg, '/pages/login/login')
2024-04-02 17:51:41 +08:00
}
})
} else {
app.selfShowMsg('本平台为淮安市政府内部使用,为更好为您提供服务,请登录帐号', '/pages/login/login')
}
},
2024-04-03 09:13:18 +08:00
2024-02-21 17:43:11 +08:00
navapply(e) {
if (wx.getStorageSync('token')) {
if (e.currentTarget.dataset.path) {
2024-08-19 15:32:53 +08:00
wx.navigateTo({
url: e.currentTarget.dataset.path + '?name=' + e.currentTarget.dataset.name,
2024-08-19 15:32:53 +08:00
})
} else {
wx.showModal({
content: `"${e.currentTarget.dataset.name}"暂未开放`,
showCancel: false,
})
}
} else {
app.getlogin()
}
},
2024-08-19 15:32:53 +08:00
jumpInfo() {
wx.navigateTo({
url: '/pages/my/info/info',
})
},
removeNotice(id) {
let _this = this
repairRemindReadRq({
id
}).then(res => {
// 查询消息列表
repairRemindLatestListRq().then(res => {
console.log('repairRemindLatestListRq', res);
_this.setData({
infoList: res.data
2024-08-19 15:32:53 +08:00
})
})
})
},
2024-08-19 15:32:53 +08:00
jumpInfoDetail(e) {
console.log('detail', e);
let id = e.currentTarget.dataset.obj.id
let repairId = e.currentTarget.dataset.obj.repairId
2024-09-05 15:58:22 +08:00
let title = e.currentTarget.dataset.obj.content
let url = `/pages/reportRepair/assign/detail/detail?id=${repairId}`
if ((title.includes('你收到工单') && title.includes('请尽快处理')) || title.includes('已经超时,黄灯告警') || title.includes('已经严重超时,红灯告警')) {
// 此处为维修单要跳转到case
url = `/pages/reportRepair/repair/case/case?id=${repairId}`
}
if ((title.includes('您收到会议预约') && title.includes('待审核')) || (title.includes('会议预约') && title.includes('已取消'))) {
// 此处为管理员收到的会议审核
url = "/pages/meeting/reservationRecord/meetingRecord/meetingDetail/meetingDetail?act=approve&id=" + repairId
}
if (title.includes('您的会议预约') && (title.includes('被驳回') || title.includes('已被管理员修改') || title.includes('已审核通过') || title.includes('即将开始'))) {
// 此处为预约人收到的会议预约
url = "/pages/meeting/reservationRecord/meetingRecord/meetingDetail/meetingDetail?id=" + repairId
}
if (title.includes('会议预约') && title.includes('指定您为会务负责人')) {
// 此处为管理员收到的会议审核
url = "/pages/meeting/reservationRecord/meetingRecord/meetingDetail/meetingDetail?act=serve&id=" + repairId
}
repairRemindReadRq({
id
}).then(res => {
wx.navigateTo({
2024-09-05 15:58:22 +08:00
url: url,
})
})
},
2024-03-13 18:27:17 +08:00
// 成功通知
showSuccessMsg(msg) {
Notify({
type: 'success',
top: '160rpx',
message: msg
});
},
// 危险通知
showErrMsg(msg) {
Notify({
type: 'danger',
top: '160rpx',
message: msg
});
},
2024-03-13 18:27:17 +08:00
2024-02-21 17:43:11 +08:00
})