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

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=",
cardUrl : "/pages/card/index?cardid="
},
id : 1
storeTabBarConfig: [] //店铺tabBar配置信息
}
})

View File

@@ -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,

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"
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,
})
}
})