53 lines
2.2 KiB
JavaScript
53 lines
2.2 KiB
JavaScript
"use strict";
|
|
let menu = [
|
|
{
|
|
pagePath: "/pages/index/index",
|
|
iconPath: "/static/tabbar/home_icon.png",
|
|
selectedIconPath: "/static/tabbar/home_active.png",
|
|
text: "首页"
|
|
},
|
|
{
|
|
pagePath: "/pages/ai/chat",
|
|
iconPath: "/static/tabbar/news_icon.png",
|
|
selectedIconPath: "/static/tabbar/news_active.png",
|
|
text: "管家在线"
|
|
},
|
|
{
|
|
pagePath: "/pages/me/index",
|
|
iconPath: "/static/tabbar/news_icon.png",
|
|
selectedIconPath: "/static/tabbar/news_active.png",
|
|
text: "我的"
|
|
}
|
|
];
|
|
function setTabBar(res) {
|
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
const pages = getCurrentPages();
|
|
const currentPage = pages[pages.length - 1];
|
|
if (currentPage) {
|
|
const tabBar = (currentPage == null ? void 0 : currentPage.getTabBar) ? currentPage == null ? void 0 : currentPage.getTabBar() : null;
|
|
let list = (_c = (_b = (_a = res == null ? void 0 : res.companyConfig) == null ? void 0 : _a.config_value) == null ? void 0 : _b.menu) == null ? void 0 : _c.map((i) => {
|
|
var _a2, _b2, _c2, _d2;
|
|
return {
|
|
...i,
|
|
iconPath: (_b2 = (_a2 = i.iconPath) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.url,
|
|
selectedIconPath: (_d2 = (_c2 = i.selectedIconPath) == null ? void 0 : _c2[0]) == null ? void 0 : _d2.url
|
|
};
|
|
});
|
|
list.splice(((_f = (_e = (_d = res == null ? void 0 : res.companyConfig) == null ? void 0 : _d.config_value) == null ? void 0 : _e.menu) == null ? void 0 : _f.length) / 2, 0, {
|
|
pagePath: "/pages/ai/index",
|
|
iconPath: "https://pay-prod-1369486729.cos.ap-guangzhou.myqcloud.com/uploads/cs-test/01KN63WTGSX2T5X8N233CJ5K0Q.png",
|
|
selectedIconPath: "https://pay-prod-1369486729.cos.ap-guangzhou.myqcloud.com/uploads/cs-test/01KN63WTGSX2T5X8N233CJ5K0Q.png",
|
|
text: "管家在线"
|
|
});
|
|
getApp().globalData.menuList = list || menu;
|
|
console.log("getApp().globalData", getApp().globalData, list);
|
|
if (tabBar) {
|
|
tabBar.setData({
|
|
list: list || menu
|
|
});
|
|
}
|
|
}
|
|
console.log("App.globalData.selectedOrg", (_h = (_g = res == null ? void 0 : res.companyConfig) == null ? void 0 : _g.config_value) == null ? void 0 : _h.menu);
|
|
}
|
|
exports.setTabBar = setTabBar;
|