diff --git a/app.js b/app.js index 820a03e..0b5cd90 100644 --- a/app.js +++ b/app.js @@ -25,6 +25,6 @@ App({ goodUrl : "/pages/goods/show?goodsId=", cardUrl : "/pages/card/index?cardid=" }, - id : 1 + storeTabBarConfig: [] //店铺tabBar配置信息 } }) diff --git a/components/storeTabBar/storeTabBar.js b/components/storeTabBar/storeTabBar.js index e4bb99a..c1e5982 100644 --- a/components/storeTabBar/storeTabBar.js +++ b/components/storeTabBar/storeTabBar.js @@ -4,8 +4,6 @@ * 碌碌无为枉半生,一朝惊醒万事空。 */ -import { tabBar } from "../../lib/storeConfig" - Component({ /** * 组件接收参数 @@ -33,6 +31,7 @@ Component({ */ pageLifetimes: { show(){ + let tabBar = getApp().globalData.storeTabBarConfig let selectedIndex = tabBar.findIndex(val=> val.pagePath == '/' + this.data.pagesUrl) this.setData({ list : tabBar, diff --git a/lib/storeConfig.js b/lib/storeConfig.js deleted file mode 100644 index 1a7db34..0000000 --- a/lib/storeConfig.js +++ /dev/null @@ -1,13 +0,0 @@ - -/** - * Web唐明明 - * 匆匆数载恍如梦,岁月迢迢华发增。 - * 碌碌无为枉半生,一朝惊醒万事空。 - */ - -// 企业tabBar配置 -const tabBar = [] - -export { - tabBar -} \ No newline at end of file diff --git a/pages/config/config.js b/pages/config/config.js index 2128690..a699175 100644 --- a/pages/config/config.js +++ b/pages/config/config.js @@ -4,7 +4,6 @@ * 碌碌无为枉半生,一朝惊醒万事空。 */ -import { tabBar } from "../../lib/storeConfig" import { mall, video, ticket, user } from "../../lib/tabBarData" Page({ @@ -21,31 +20,33 @@ Page({ wx.getStorage({ key : 'compayId', success : res=>{ - wx.$api.publics.storeConfig({ company_id: res.data }).then(res => { - let tabBarVal = res.concat({}) + let tabBarVal = res.concat({}), + newTabBar = [] + tabBarVal.forEach(res => { switch (res.slug) { case "video": - tabBar.push(video) + newTabBar.push(video) break; case "mall": - tabBar.push(mall) + newTabBar.push(mall) break; case "ticket": - tabBar.push(ticket) + newTabBar.push(ticket) break; default : - tabBar.push(user) + newTabBar.push(user) break; } }) - if(tabBarVal.length == tabBar.length){ - wx.reLaunch({ - url: tabBar[0].pagePath, + if(tabBarVal.length == newTabBar.length){ + getApp().globalData.storeTabBarConfig = newTabBar + wx.redirectTo({ + url: newTabBar[0].pagePath, }) } })