Commit 286740db by 程默

显示条件

parent 370a1389
<!--miniprogram/custom-tab-bar/index.wxml-->
<cover-view class="tab-bar" wx:if="{{show}}">
<cover-view class="antt ant-daipinglun"></cover-view>
<cover-view class="iconfont icon-fenzhi">3</cover-view>
<cover-view class="tab-bar {{show?'':'hide'}}">
<!-- <cover-view class="antt ant-daipinglun"></cover-view> -->
<!-- <cover-view class="iconfont icon-fenzhi">3</cover-view> -->
<cover-view class="tab-bar-border"></cover-view>
<cover-view
......
......@@ -1417,3 +1417,7 @@
width: 100%;
height: 100%;
}
.hide{
display: none;
}
......@@ -3,6 +3,7 @@
"extEnable":true,
"extAppid":"wxae95a07ffdf11548",
"ext":{
"mixid":"antgood"
"mixid":"antgood",
"shopid":67
}
}
\ No newline at end of file
<script>
import shop from "@/api/shop";
import {themeColor} from "@/utils/mayi"
import {themeColor , checkShowConditionIds} from "@/utils/mayi"
export default {
created() {
// NODE_ENV
......@@ -43,6 +44,31 @@ export default {
this.getThemePage(extConfig);
},
methods: {
async setVisible(pageList){
// 首页显示条件
this.pageInfo = pageList.filter((item) => item.pageCode == 1)[0];
this.pageData = JSON.parse(this.pageInfo.pageData);
// 显示条件列表
let showConditionIds=checkShowConditionIds(this.pageData)
let ll=await this.checkCondition(showConditionIds)
console.log(showConditionIds,'--------------5454',ll)
},
checkCondition({allCondition}) {
return new Promise((resolve,reject)=>{
// 获取
let params = { allCondition, region: '' }
shop.checkShowCondition(params).then(res => {
if (res.code == 200) {
console.log(params, 'check显示条件', res.data)
// commit('setShowConditionIds', res.data)
// commit('updateCondition')
resolve(res.data)
}
}).catch(err => {
console.log('check显示条件失败', err)
})
})
},
//商城配置
getShopInfo({mixid}) {
shop.getShopInfo({ shopMixId: mixid }).then((res) => {
......@@ -91,21 +117,26 @@ export default {
console.log("90", data);
this.mpApp.globalData.pageList = data;
this.setVisible(data)
// app中异步数据回调 底部栏数据
if (this.mpApp.pageCallBack) {
this.mpApp.pageCallBack(data);
}
}
}
})
.catch((err) => {});
},
// ---
},
onError(data) {
console.log(data, "js异常捕获");
this.$mpAnalytics.recordError({
data,
keyword: data,
'keyword': data,
extendsInfo: {
mixid: this.$store.state.mixid || null,
},
......
......@@ -13,5 +13,8 @@ export default {
// 页面数据
themePagesInfo(params) {
return requestPOST(`${process.env.OLSHOP_URL}/cms/get_shop_install_pages`, { params })
}
},
checkShowCondition(params) {
return requestPOST(`${process.env.OLSHOP_URL}/cms/check_show_condition`, {params})
},
};
......@@ -6,52 +6,52 @@
<div style="position:relative;">
<ThemeDataPlant></ThemeDataPlant>
<div v-for="(item,index) in pageData" :key="index">
<div v-if="item.componentCode=='banner'">
<div v-if="item.componentCode=='banner' && item.componentInfo.visible == 1">
<banner :datas="item"></banner>
</div>
<div v-else-if="item.componentCode=='goods-list'" style="height:100%;">
<div v-else-if="item.componentCode=='goods-list' && item.componentInfo.visible == 1" style="height:100%;">
<goods-list class="goodsListItem" :datas="item"></goods-list>
</div>
<div v-else-if="item.componentCode == 'area-navigation'">
<div v-else-if="item.componentCode == 'area-navigation' && item.componentInfo.visible == 1">
<area-navigation :datas="item"></area-navigation>
</div>
<div v-else-if="item.componentCode == 'cube-nav'">
<div v-else-if="item.componentCode == 'cube-nav' && item.componentInfo.visible == 1">
<cube-nav :datas="item"></cube-nav>
</div>
<div v-else-if="item.componentCode == 'time-limited-discount'">
<div v-else-if="item.componentCode == 'time-limited-discount' && item.componentInfo.visible == 1">
<time-limited-discount :datas="item"></time-limited-discount>
</div>
<div v-if="item.componentCode == 'links'">
<div v-if="item.componentCode == 'links' && item.componentInfo.visible == 1">
<links :datas="item"></links>
</div>
<div v-if="item.componentCode == 'interval'">
<div v-if="item.componentCode == 'interval' && item.componentInfo.visible == 1">
<interval :datas="item"></interval>
</div>
<div v-if="item.componentCode == 'partition'">
<div v-if="item.componentCode == 'partition' && item.componentInfo.visible == 1">
<partition :datas="item"></partition>
</div>
<div v-if="item.componentCode == 'shop-popup'">
<div v-if="item.componentCode == 'shop-popup' && item.componentInfo.visible == 1">
<shop-popup :datas="item"></shop-popup>
</div>
<div v-if="item.componentCode == 'float-button'">
<div v-if="item.componentCode == 'float-button' && item.componentInfo.visible == 1">
<float-button :datas="item"></float-button>
</div>
<div v-if="item.componentCode == 'text-text'">
<div v-if="item.componentCode == 'text-text' && item.componentInfo.visible == 1">
<text-text :datas="item"></text-text>
</div>
<div v-if="item.componentCode == 'img-text'">
<div v-if="item.componentCode == 'img-text' && item.componentInfo.visible == 1">
<img-text :datas="item"></img-text>
</div>
<div v-if="item.componentCode == 'video-player'">
<div v-if="item.componentCode == 'video-player' && item.componentInfo.visible == 1">
<videoPlayer :datas="item"></videoPlayer>
</div>
<div v-if="item.componentCode == 'goods-search'">
<div v-if="item.componentCode == 'goods-search' && item.componentInfo.visible == 1">
<goods-search :datas="item"></goods-search>
</div>
<div v-if="item.componentCode == 'notice'">
<div v-if="item.componentCode == 'notice' && item.componentInfo.visible == 1">
<notice :datas="item"></notice>
</div>
<div v-if="item.componentCode == 'pop-up'">
<div v-if="item.componentCode == 'pop-up' && item.componentInfo.visible == 1">
<pop-up :datas="item"></pop-up>
</div>
......
<template>
<div>
{{withoutScene}}
<div>{{withoutScene?"初始化完成":"初始化中"}}</div>
<web-view v-if="withoutScene" :src="pageUrl" @message="getMessage" @error="handleError" @load="handleLoad"></web-view>
</div>
</template>
......@@ -76,6 +76,7 @@ export default {
}
},
onLoad(options) {
this.withoutScene = true;
this.options = options;
Object.assign(this.$data, this.$options.data());
......@@ -84,7 +85,6 @@ export default {
success: res => {
this.code = res.code;
login.miniLogin({ code: this.code}).then(res1 => {
this.withoutScene = true;
console.log(res1,555555)
if (res1.data.code == 200) {
wx.setStorage({
......
import Vue from 'vue'
import App from './index'
// add this to handle exception
Vue.config.errorHandler = function (err) {
if (console && console.error) {
console.error(err)
}
}
const app = new Vue(App)
app.$mount()
{
}
\ No newline at end of file
// 主题色
export let themeColor={
export let themeColor = {
"--main-color": "#ffffff",
"--minor-color": "#ffffff"
}
......@@ -125,3 +125,43 @@ export function setTabBarActive(data) {
})
}
}
// 遍历所有组件有显示条件的id 是否包含地区导航组件
export function checkShowConditionIds(list) {
let allCondition = [];
let isAreaNavigation=false;
list.forEach(element => {
pollCondition(element)
});
function pollCondition(object) {
if (Object.prototype.toString.call(object) === '[object Object]') {
if (object.condition != '' && object.condition != undefined) {
allCondition.push(object.condition);
}
for (const key in object) {
if (object.hasOwnProperty(key)) {
const element = object[key];
if (Object.prototype.toString.call(element) === '[object Object]') {
if (element.condition != '' && element.condition != undefined) {
allCondition.push(element.condition);
}
pollCondition(element)
} else if (Object.prototype.toString.call(element) === '[object Array]' && element.length > 0) {
element.forEach((item) => {
pollCondition(item)
})
}
}
}
// 有地区导航组件
if (object.componentCode == 'area-navigation') {
isAreaNavigation=true
}
}
}
return {
allCondition:[...new Set(allCondition)],
isAreaNavigation
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment