You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
140 lines
3.9 KiB
JavaScript
140 lines
3.9 KiB
JavaScript
const app = getApp();
|
|
Component({
|
|
data: {
|
|
isShow: false,
|
|
toTop: false,
|
|
selected: 0,
|
|
color: "#888",
|
|
selectedColor: "#3578f6",
|
|
appId: app.globalData.appId,
|
|
list: [
|
|
{
|
|
"iconPath": "icon-home",
|
|
// "selectedIconPath": "/static/image/tabbar/home.svg",
|
|
"pagePath": "/pages/home/index",
|
|
"text": "首页",
|
|
"index": 0
|
|
},
|
|
{
|
|
iconPath: "icon-gongdanguanli",
|
|
text: '工单',
|
|
"index": 3,
|
|
pagePath: "/pages/home/child/apply",
|
|
},
|
|
// {
|
|
|
|
// "iconPath": "/static/image/tabbar/chat.svg",
|
|
// "selectedIconPath": "/static/image/tabbar/chat.svg",
|
|
// "pagePath": "/pages/ai/index",
|
|
// "text": "AI",
|
|
// "index": 2
|
|
// },
|
|
{
|
|
"iconPath": "icon-message",
|
|
// "iconPath": "/static/image/tabbar/message_active.svg",
|
|
// "selectedIconPath": "/static/image/tabbar/message.svg",
|
|
"pagePath": "/pages/message/index",
|
|
"text": "消息",
|
|
"index": 1
|
|
},
|
|
{
|
|
"iconPath": "icon-appstore",
|
|
// "iconPath": "/static/image/tabbar/message_active.svg",
|
|
// "selectedIconPath": "/static/image/tabbar/message.svg",
|
|
"pagePath": "/pages/workBench/index",
|
|
"text": "工作台",
|
|
"index": 4
|
|
},
|
|
|
|
{
|
|
"iconPath": "icon-user",
|
|
// "iconPath": "/static/image/tabbar/user_active.svg",
|
|
// "selectedIconPath": "/static/image/tabbar/user.svg",
|
|
"pagePath": "/pages/person/index",
|
|
"text": "我的",
|
|
"index": 2
|
|
}
|
|
]
|
|
},
|
|
lifetimes: {
|
|
show: function () {
|
|
// 页面被展示
|
|
console.log("tabbar show");
|
|
console.log('this.data.appid', this.data.appId);
|
|
if (this.data.appId == 'wxb0c590fd696b79be') {
|
|
console.log('');
|
|
// this.data.list = [
|
|
// {
|
|
// "iconPath": "/static/image/nav_home_normal.png",
|
|
// "selectedIconPath": "/static/image/nav_home_selected_lao.png",
|
|
// "pagePath": "/pages/home/index",
|
|
// "text": "首页",
|
|
// "index": 0
|
|
// },
|
|
// // {
|
|
// // "iconPath": "/static/image/chat.png",
|
|
// // "selectedIconPath": "/static/image/chat.png",
|
|
// // "pagePath": "/pages/ai/index",
|
|
// // "text": "AI",
|
|
// // "index": 2
|
|
// // },
|
|
// {
|
|
// "iconPath": "/static/image/xx.png",
|
|
// "selectedIconPath": "/static/image/xx1_lao.png",
|
|
// "pagePath": "/pages/message/index",
|
|
// "text": "消息",
|
|
// "index":1
|
|
// },
|
|
// {
|
|
// "iconPath": "/static/image/nav_my_normal.png",
|
|
// "selectedIconPath": "/static/image/nav_my_selected_lao.png",
|
|
// "pagePath": "/pages/person/index",
|
|
// "text": "我的",
|
|
// "index": 2
|
|
// }
|
|
// ]
|
|
}
|
|
},
|
|
attached: function () {
|
|
// 在组件实例进入页面节点树时执行
|
|
console.log("tabbar attached");
|
|
|
|
},
|
|
detached: function () {
|
|
// 在组件实例被从页面节点树移除时执行
|
|
},
|
|
},
|
|
methods: {
|
|
switchTab (e) {
|
|
const data = e.currentTarget.dataset;
|
|
const url = data.path;
|
|
|
|
// if (!wx.getStorageSync("apply-userinfo")) {
|
|
// if (data.index == 2) {
|
|
// wx.navigateTo({
|
|
// url: "/pages/login/index",
|
|
// });
|
|
// return;
|
|
// }
|
|
// }
|
|
// else {
|
|
// if (data.index == 2) {
|
|
// wx.navigateTo({
|
|
// url: "/pages/message/child/chat",
|
|
// });
|
|
// return;
|
|
// }
|
|
// }
|
|
// this.setData({
|
|
// selected: data.index
|
|
// })
|
|
// this.data.selected = data.index
|
|
console.log('--', url)
|
|
wx.switchTab({ url });
|
|
},
|
|
touchMove () {
|
|
return false
|
|
}
|
|
},
|
|
});
|