You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
2.1 KiB

Component({
data: {
selected: 0,
"selectedColor": "#0a6597",
"color": "#999999",
"borderStyle": "black",
"backgroundColor": "#ffffff",
navList: []
},
ready() {
if(wx.getStorageSync('userType') == 'PLATFORM_EMP'){//平台员工
this.setData({
navList: [{
"pagePath": "/pages/home/home",
"text": "首页",
"iconPath": "/img/home.png",
"selectedIconPath": "/img/home-se.png"
},
{
"pagePath": "/pages/pend/pend",
"text": "待办",
"iconPath": "/img/pend.png",
"selectedIconPath": "/img/pend-se.png"
},
{
"pagePath": "/pages/mine/mine",
"text": "我的",
"iconPath": "/img/mine.png",
"selectedIconPath": "/img/mine-se.png"
}]
});
}else if(wx.getStorageSync('userType') == 'SERVICE_PROV'){//服务商
this.setData({
navList: [{
"pagePath": "/monitor/pages/home/home",
"text": "首页",
"iconPath": "/img/home.png",
"selectedIconPath": "/img/home-se.png"
},
{
"pagePath": "/monitor/pages/workOrder/workOrder",
"text": "工单",
"iconPath": "/img/mine.png",
"selectedIconPath": "/img/mine-se.png"
}]
});
}else{//代理商
this.setData({
navList: [{
"pagePath": "/pages/home/home",
"text": "首页",
"iconPath": "/img/home.png",
"selectedIconPath": "/img/home-se.png"
},
{
"pagePath": "/pages/mine/mine",
"text": "我的",
"iconPath": "/img/mine.png",
"selectedIconPath": "/img/mine-se.png"
}]
});
}
},
methods: {
switchTab(e) {
const data = e.currentTarget.dataset
const url = data.path
if(url =='/monitor/pages/home/home' || url =='/monitor/pages/workOrder/workOrder'){
wx.navigateTo({
url: url, //因为添加页面在分包中 因此只能使用wx.navigateTo跳转
})
}else{
wx.switchTab({url})
}
}
}
})