[更新]变更了获取企业信息配置,简化配置文件

This commit is contained in:
唐明明
2020-12-30 10:31:55 +08:00
parent 3e59b16c27
commit 49a7bade36
4 changed files with 13 additions and 26 deletions

2
app.js
View File

@@ -25,6 +25,6 @@ App({
goodUrl : "/pages/goods/show?goodsId=", goodUrl : "/pages/goods/show?goodsId=",
cardUrl : "/pages/card/index?cardid=" cardUrl : "/pages/card/index?cardid="
}, },
id : 1 storeTabBarConfig: [] //店铺tabBar配置信息
} }
}) })

View File

@@ -4,8 +4,6 @@
* 碌碌无为枉半生,一朝惊醒万事空。 * 碌碌无为枉半生,一朝惊醒万事空。
*/ */
import { tabBar } from "../../lib/storeConfig"
Component({ Component({
/** /**
* 组件接收参数 * 组件接收参数
@@ -33,6 +31,7 @@ Component({
*/ */
pageLifetimes: { pageLifetimes: {
show(){ show(){
let tabBar = getApp().globalData.storeTabBarConfig
let selectedIndex = tabBar.findIndex(val=> val.pagePath == '/' + this.data.pagesUrl) let selectedIndex = tabBar.findIndex(val=> val.pagePath == '/' + this.data.pagesUrl)
this.setData({ this.setData({
list : tabBar, list : tabBar,

View File

@@ -1,13 +0,0 @@
/**
* Web唐明明
* 匆匆数载恍如梦,岁月迢迢华发增。
* 碌碌无为枉半生,一朝惊醒万事空。
*/
// 企业tabBar配置
const tabBar = []
export {
tabBar
}

View File

@@ -4,7 +4,6 @@
* 碌碌无为枉半生,一朝惊醒万事空。 * 碌碌无为枉半生,一朝惊醒万事空。
*/ */
import { tabBar } from "../../lib/storeConfig"
import { mall, video, ticket, user } from "../../lib/tabBarData" import { mall, video, ticket, user } from "../../lib/tabBarData"
Page({ Page({
@@ -21,31 +20,33 @@ Page({
wx.getStorage({ wx.getStorage({
key : 'compayId', key : 'compayId',
success : res=>{ success : res=>{
wx.$api.publics.storeConfig({ wx.$api.publics.storeConfig({
company_id: res.data company_id: res.data
}).then(res => { }).then(res => {
let tabBarVal = res.concat({}) let tabBarVal = res.concat({}),
newTabBar = []
tabBarVal.forEach(res => { tabBarVal.forEach(res => {
switch (res.slug) { switch (res.slug) {
case "video": case "video":
tabBar.push(video) newTabBar.push(video)
break; break;
case "mall": case "mall":
tabBar.push(mall) newTabBar.push(mall)
break; break;
case "ticket": case "ticket":
tabBar.push(ticket) newTabBar.push(ticket)
break; break;
default : default :
tabBar.push(user) newTabBar.push(user)
break; break;
} }
}) })
if(tabBarVal.length == tabBar.length){ if(tabBarVal.length == newTabBar.length){
wx.reLaunch({ getApp().globalData.storeTabBarConfig = newTabBar
url: tabBar[0].pagePath, wx.redirectTo({
url: newTabBar[0].pagePath,
}) })
} }
}) })