|
|
|
//app.js
|
|
|
|
App({
|
|
|
|
onLaunch: function () {
|
|
|
|
this.hidetabbar();
|
|
|
|
this.getSystemInfo();
|
|
|
|
},
|
|
|
|
//自己对wx.hideTabBar的一个封装
|
|
|
|
hidetabbar() {
|
|
|
|
wx.hideTabBar({
|
|
|
|
fail: function() {
|
|
|
|
setTimeout(function() { // 做了个延时重试一次,作为保底。
|
|
|
|
wx.hideTabBar()
|
|
|
|
}, 500)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
getSystemInfo: function() {
|
|
|
|
let t = this;
|
|
|
|
wx.getSystemInfo({
|
|
|
|
success: function(res) {
|
|
|
|
t.globalData.systemInfo = res;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
editTabbar: function() {
|
|
|
|
let tabbar = this.globalData.tabBar;
|
|
|
|
let currentPages = getCurrentPages();
|
|
|
|
let _this = currentPages[currentPages.length - 1];
|
|
|
|
let pagePath = _this.route;
|
|
|
|
(pagePath.indexOf('/') != 0) && (pagePath = '/' + pagePath);
|
|
|
|
for (let i in tabbar.list) {
|
|
|
|
tabbar.list[i].selected = false;
|
|
|
|
(tabbar.list[i].pagePath == pagePath) && (tabbar.list[i].selected = true);
|
|
|
|
}
|
|
|
|
_this.setData({
|
|
|
|
tabbar: tabbar
|
|
|
|
});
|
|
|
|
},
|
|
|
|
globalData: {
|
|
|
|
systemInfo: null,//客户端设备信息
|
|
|
|
tabBar: {
|
|
|
|
"color": "#727272",
|
|
|
|
"selectedColor": "#F46368",
|
|
|
|
"backgroundColor": "#ffffff",
|
|
|
|
"list": [
|
|
|
|
{
|
|
|
|
"pagePath": "pages/index/index",
|
|
|
|
"iconPath": "/components/tabbarComponent/icons/home.png",
|
|
|
|
"selectedIconPath": "/components/tabbarComponent/icons/homeActive.png",
|
|
|
|
"text": "首页"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"pagePath": "pages/insight/index",
|
|
|
|
"iconPath": "/components/tabbarComponent/icons/insight.png",
|
|
|
|
"selectedIconPath": "/components/tabbarComponent/icons/insightActive.png",
|
|
|
|
"text": "洞察"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"pagePath": "pages/brandSearch/index",
|
|
|
|
"iconPath": "/components/tabbarComponent/icons/appSearch.png",
|
|
|
|
"selectedIconPath": "/components/tabbarComponent/icons/appSearchActive.png",
|
|
|
|
"text": "品牌搜索"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"pagePath": "pages/varComm/index",
|
|
|
|
"iconPath": "/components/tabbarComponent/icons/varComm.png",
|
|
|
|
"selectedIconPath": "/components/tabbarComponent/icons/varCommActive.png",
|
|
|
|
"text": "对比"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"pagePath": "pages/mine/index",
|
|
|
|
"iconPath": "/components/tabbarComponent/icons/mine.png",
|
|
|
|
"selectedIconPath": "/components/tabbarComponent/icons/mineActive.png",
|
|
|
|
"text": "我的"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|