const app = getApp(); Component({ data: { isShow: false, toTop: false, selected: 0, color: "#888", selectedColor: app.globalData.appId == 'wxb0c590fd696b79be' ? "#ff4400" : "#3578f6", appId: app.globalData.appId, list: app.globalData.appId == 'wxb0c590fd696b79be' ? [ { "iconPath": "icon-home", // "selectedIconPath": "/static/image/tabbar/home.svg", "pagePath": "/pages/home/index", "text": "首页", "index": 0 }, { iconPath: "icon-home", 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-user", // "iconPath": "/static/image/tabbar/user_active.svg", // "selectedIconPath": "/static/image/tabbar/user.svg", "pagePath": "/pages/person/index", "text": "我的", "index": 2 } ] : [ { "iconPath": "icon-home", // "iconPath": "/static/image/tabbar/home_active.svg", // "selectedIconPath": "/static/image/tabbar/home.svg", "pagePath": "/pages/home/index", "text": "首页", "index": 0 }, { "iconPath": "icon-shop", // "iconPath": "/static/image/tabbar/shop_active.svg", // "selectedIconPath": "/static/image/tabbar/shop.svg", "pagePath": "/pages/company/index", "text": "门店", "index": 1 }, // { // "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": 2 }, { "iconPath": "icon-user", // "iconPath": "/static/image/tabbar/user_active.svg", // "selectedIconPath": "/static/image/tabbar/user.svg", "pagePath": "/pages/person/index", "text": "我的", "index": 3 } ], }, 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 } }, });