diff --git a/app.json b/app.json index 73734cf..a4fb14b 100644 --- a/app.json +++ b/app.json @@ -1,15 +1,18 @@ { "pages": [ - "pages/user/index", - "pages/user/companyMine/myActives/myActives", + "pages/config/config", + "pages/welcome/index", "pages/company/index", "pages/company/search/search", + "pages/user/index", + "pages/user/companyMine/myActives/myActives", "pages/shortVideo/index", "pages/richText/richText", "pages/login/login", "pages/card/index", "pages/mall/index", + "pages/mall/mall_details/mall_details", "pages/live/index", "pages/ticket/index", "pages/home/index", diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js index fb5dfeb..49bf6f2 100644 --- a/custom-tab-bar/index.js +++ b/custom-tab-bar/index.js @@ -5,7 +5,7 @@ * 碌碌无为枉半生,一朝惊醒万事空。 */ -import { mall, video, ticket, user} from "../lib/tabBarData" +import { tabBar } from "../lib/storeConfig" Component({ /** @@ -15,21 +15,23 @@ Component({ selected : 0, color : "#4e4f51", selectedColor: "#0b0041", - list : [video, mall, ticket, user] + list : [] }, /** * 生命周期函数 */ - lifetimes:{ - // attached: ()=>{ - // //获取模版信息 - // wx.$api.publics.storeConfig({ - // company_id: "17" - // }).then(res=>{ - // console.log(res) - // }) - // } + attached(){ + if(this.data.list.length <= 0 && tabBar.length > 0){ + this.setData({ + list: tabBar + }) + }else{ + wx.showToast({ + title: "获取店铺模块信息失败", + icon : "none" + }) + } }, /** diff --git a/lib/storeConfig.js b/lib/storeConfig.js new file mode 100644 index 0000000..1a7db34 --- /dev/null +++ b/lib/storeConfig.js @@ -0,0 +1,13 @@ + +/** + * Web唐明明 + * 匆匆数载恍如梦,岁月迢迢华发增。 + * 碌碌无为枉半生,一朝惊醒万事空。 + */ + +// 企业tabBar配置 +const tabBar = [] + +export { + tabBar +} \ No newline at end of file diff --git a/lib/tabBarData.js b/lib/tabBarData.js index 750f2ce..59d23fb 100644 --- a/lib/tabBarData.js +++ b/lib/tabBarData.js @@ -7,7 +7,7 @@ // 商城 const mall = { - "pagePath": "pages/mall/index", + "pagePath": "/pages/mall/index", "text": "商城", "iconPath": "/static/tabbar/tabbar_icon_01.png", "selectedIconPath": "/static/tabbar/tabbar_icon_show_01.png" @@ -15,7 +15,7 @@ const mall = { // 短视频 const video = { - "pagePath": "pages/shortVideo/index", + "pagePath": "/pages/shortVideo/index", "text": "首页", "iconPath": "/static/tabbar/tabbar_icon_00.png", "selectedIconPath": "/static/tabbar/tabbar_icon_show_00.png" @@ -23,7 +23,7 @@ const video = { // 优惠券 const ticket = { - "pagePath": "pages/ticket/index", + "pagePath": "/pages/ticket/index", "text": "优惠", "iconPath": "/static/tabbar/tabbar_icon_02.png", "selectedIconPath": "/static/tabbar/tabbar_icon_show_02.png" @@ -31,7 +31,7 @@ const ticket = { // 我的 const user = { - "pagePath": "pages/user/index", + "pagePath": "/pages/user/index", "text": "我的", "iconPath": "/static/tabbar/tabbar_icon_03.png", "selectedIconPath": "/static/tabbar/tabbar_icon_show_03.png" @@ -43,4 +43,3 @@ export { ticket, user } - diff --git a/pages/config/config.js b/pages/config/config.js new file mode 100644 index 0000000..a589427 --- /dev/null +++ b/pages/config/config.js @@ -0,0 +1,47 @@ +/** + * Web唐明明 + * 匆匆数载恍如梦,岁月迢迢华发增。 + * 碌碌无为枉半生,一朝惊醒万事空。 + */ + +import { tabBar } from "../../lib/storeConfig" +import { mall, video, ticket, user } from "../../lib/tabBarData" + +Page({ + /** + * 生命周期函数--监听页面加载 + */ + onLoad(e) { + if (e.companyoid && e.companyoid == "") { + wx.showToast({ + title: "参数错误,缺少companyoId" + }) + return + } + + wx.$api.publics.storeConfig({ + company_id: e.companyoid + }).then(res => { + let tabBarVal = res.concat({}) + tabBarVal.forEach(res => { + switch (res.slug) { + case "video": + tabBar.push(video) + break; + case "mall": + tabBar.push(mall) + break; + case "ticket": + tabBar.push(ticket) + break; + default : + tabBar.push(user) + break; + } + }) + wx.switchTab({ + url: tabBar[0].pagePath + }) + }) + } +}) \ No newline at end of file diff --git a/pages/config/config.json b/pages/config/config.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/config/config.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/config/config.wxml b/pages/config/config.wxml new file mode 100644 index 0000000..ceaa87e --- /dev/null +++ b/pages/config/config.wxml @@ -0,0 +1,5 @@ + + + + 加载企业信息 + diff --git a/pages/config/config.wxss b/pages/config/config.wxss new file mode 100644 index 0000000..93bf0aa --- /dev/null +++ b/pages/config/config.wxss @@ -0,0 +1 @@ +/* pages/config/config.wxss */ \ No newline at end of file diff --git a/pages/shortVideo/index.wxml b/pages/shortVideo/index.wxml index 300e482..276f0b2 100644 --- a/pages/shortVideo/index.wxml +++ b/pages/shortVideo/index.wxml @@ -1,3 +1,6 @@ + +短视频 +