136 lines
3.5 KiB
JavaScript
Raw Normal View History

2024-02-21 17:43:11 +08:00
let app = getApp()
2024-03-13 15:14:37 +08:00
import {
userProfile
} from "../../api/user/user.js"
2024-02-21 17:43:11 +08:00
Page({
2024-02-22 18:57:41 +08:00
/**
* 页面的初始数据
*/
data: {
2024-03-13 15:14:37 +08:00
DOMAIN_NAME: app.IMG_NAME,
userDetail: {},
2024-02-22 18:57:41 +08:00
// tabBar param
tabBarParam: {
selected: 2,
color: "#515151",
selectedColor: "#217CFF",
backgroundColor: "#ffffff",
2024-02-21 17:43:11 +08:00
},
2024-02-22 18:57:41 +08:00
// tabBar menu
tabBarList: [{
"pagePath": "pages/index/index",
"iconPath": "/images/tabbar/home.png",
"selectedIconPath": "/images/tabbar/home-select.png",
"text": "首页"
},
{
2024-02-23 15:15:37 +08:00
"pagePath": "pages/meeting/accessControl/accessControl",
2024-02-22 18:57:41 +08:00
"iconPath": "/images/tabbar/openDoor.png",
"selectedIconPath": "/images/tabbar/openDoor.png",
"text": "开门",
"bulge": true,
},
{
"pagePath": "pages/my/my",
"iconPath": "/images/tabbar/my.png",
"selectedIconPath": "/images/tabbar/my-select.png",
"text": "我的"
},
],
2024-03-13 15:14:37 +08:00
customerPages: [{
name: "我的活动",
url: "/pages/myActivities/myActivities",
},
{
name: "业务申请",
url: "/pages/my/serviceApply/serviceApply"
},
{
name: "园区建议",
url: "/pages/complaint/complaint",
},
{
name: "账号设置",
url: "/pages/my/accountSetting/accountSetting",
},
{
name: "我的服务",
url: "/pages/enterpriseServices/myServiceList/myServiceList"
},
{
name: "我的报修",
url: "/pages/parkRepair/parkRepair",
}
2024-02-22 18:57:41 +08:00
],
},
2024-02-21 17:43:11 +08:00
2024-03-13 15:14:37 +08:00
// 切换tabbar
switchTab(e) {
2024-02-22 18:57:41 +08:00
const data = e.currentTarget.dataset
console.log('switchTab', data)
const url = data.path
2024-03-13 15:14:37 +08:00
if (url == 'pages/meeting/accessControl/accessControl') {
2024-02-23 15:15:37 +08:00
wx.navigateTo({
url: '/' + url
})
2024-03-13 15:14:37 +08:00
} else {
2024-02-23 15:15:37 +08:00
wx.switchTab({
url: '/' + url
})
}
2024-02-22 18:57:41 +08:00
},
/**
* 生命周期函数--监听页面加载
*/
2024-03-13 15:14:37 +08:00
onLoad(options) {
},
2024-02-22 18:57:41 +08:00
onShow() {
2024-03-13 15:14:37 +08:00
let _this = this
let userId = wx.getStorageSync('userId');
if (userId) {
userProfile(userId).then(res => {
console.log('userProfile', res);
_this.setData({
userDetail: res.data
2024-02-22 18:57:41 +08:00
})
})
} else {
app.getlogin()
}
},
2024-03-13 15:14:37 +08:00
2024-02-22 18:57:41 +08:00
navigateTo(e) {
2024-03-13 15:14:37 +08:00
if (wx.getStorageSync('userId')) {
2024-02-22 18:57:41 +08:00
if (e.currentTarget.dataset.url == '/pages/parkRepair/parkRepair') {
wx.switchTab({
url: e.currentTarget.dataset.url,
})
} else {
wx.navigateTo({
url: e.currentTarget.dataset.url,
})
}
} else {
app.getlogin()
}
},
2024-03-13 15:14:37 +08:00
2024-02-22 18:57:41 +08:00
navpersonalData() {
2024-03-13 15:14:37 +08:00
if (wx.getStorageSync('userId')) {
2024-02-22 18:57:41 +08:00
wx.navigateTo({
2024-03-13 15:14:37 +08:00
url: '/pages/my/personalData/personalData',
2024-02-22 18:57:41 +08:00
})
} else {
wx.navigateTo({
url: '/pages/login/login',
})
}
2024-03-13 15:14:37 +08:00
},
2024-02-21 17:43:11 +08:00
})