Commit 89a1ff17 by 李嘉林

优化加载

parent 8051a704
<template>
<div class="domain" :style="{'--main-color':themeColor['--main-color'],'--minor-color':themeColor['--minor-color']}">
<pageLoading v-if="pageLoading"></pageLoading>
<!-- 自定义导航头 -->
<div style="position:relative;">
<div v-if="showSpokesManHome">
<!-- <div v-if="showSpokesManHome">
<get-index-homepage class="getIndexHomePage"></get-index-homepage>
</div>
</div> -->
<CustomNav :customBgOpacity="customBgOpacity"></CustomNav>
<StoreAddr @toUpdate="reloadEnterShopRule" @toPageLoading="toPageLoading" ref="StoreAddr"></StoreAddr>
<StoreAddr v-if="showStoreAddr" @toUpdate="reloadEnterShopRule" @toPageLoading="toPageLoading" ref="StoreAddr"></StoreAddr>
<ThemeDataPlant></ThemeDataPlant>
<div v-for="(item,index) in pageData" :key="index">
<div v-if="item.componentCode=='banner' && item.componentInfo.visible == 1">
......@@ -126,6 +125,7 @@
<template>
</template>
</div>
<pageLoading v-if="pageLoading"></pageLoading>
<share-popup></share-popup>
<div v-if="showMyCard">
<my-card></my-card>
......@@ -235,9 +235,11 @@ export default {
pageLoading: true,
firstOpenPage: true, //首次打开页面
h5Params: {}, //params
pageOptions: {},
fromPage: "",
customBgOpacity: true, // 沉浸式风格
reloadPage: false, // 切换门店进入首页重新获取相关配置
showStoreAddr: false,
};
},
components:{
......@@ -359,8 +361,47 @@ export default {
if(this.$options) {
Object.assign(this.$data, this.$options.data());
}
this.pageOptions = options;
console.log(new Date().getTime(),'load-----home-onLoad')
console.log(options,this.firstOpenPage,'---------home----options')
this.pageInit(options);
},
onShow() {
console.log(new Date().getTime(),'load-----home-onShow')
console.log(this.reloadPage,'-reloadPage2')
// if (this.reloadPage) {
// console.log("refreshInit--------1")
// this.refreshInit();
// this.reloadPage = false;
// }
// 设置显示条件
log.info('--------on--------------show')
//分销隔流
if(this.toHomePage) {
let linkVal = '/personalCenter/spokesmanCenter/mine/spokesmanHomePage?from=_goodsInfo'
app.$themeToLink({
type: 1,
link:linkVal,
});
}
this.getCartNum();
if(checkTabbarPage('/')!=-1){
this.active=checkTabbarPage('/')
}
// this.$mp.page.onPageScroll= (el)=>{
// throttle(this.scrolls(el),100)
// };
},
// 滚动节流方法
onPageScroll: tool.throttle(function (el) {
// console.log(el);
this.scrolls(el[0])
},200),
methods: {
async pageInit(options) {
log.info(options, '---------home----options')
let h5Params = options && options.params ? JSON.parse(decodeURIComponent(options.params)) : {};
this.h5Params = h5Params;
......@@ -413,6 +454,7 @@ export default {
offlineShopName:paramsObj.offlineShopName,
});
}
this.showStoreAddr = true;
wx.setStorageSync('attractingCustomerChannelId',sceneObj.attractingCustomerChannelId);
wx.setStorageSync(this.$store.state.mixid+'storeId',sceneObj.storeId);
wx.setStorageSync(this.$store.state.mixid+'sellerId',sceneObj.sellerId);
......@@ -435,8 +477,8 @@ export default {
})
}
}
wx.nextTick(() => {
});
} else {
this.showStoreAddr = true;
}
if (options.from && options.from == "logout") {
//来自用户登出
......@@ -522,41 +564,6 @@ export default {
}
})
},
onShow() {
console.log(new Date().getTime(),'load-----home-onShow')
console.log(this.reloadPage,'-reloadPage2')
// if (this.reloadPage) {
// console.log("refreshInit--------1")
// this.refreshInit();
// this.reloadPage = false;
// }
// 设置显示条件
log.info('--------on--------------show')
//分销隔流
if(this.toHomePage) {
let linkVal = '/personalCenter/spokesmanCenter/mine/spokesmanHomePage?from=_goodsInfo'
app.$themeToLink({
type: 1,
link:linkVal,
});
}
this.getCartNum();
if(checkTabbarPage('/')!=-1){
this.active=checkTabbarPage('/')
}
// this.$mp.page.onPageScroll= (el)=>{
// throttle(this.scrolls(el),100)
// };
},
// 滚动节流方法
onPageScroll: tool.throttle(function (el) {
// console.log(el);
this.scrolls(el[0])
},200),
methods: {
setPageLoading() {
setTimeout(() => {
this.pageLoading = false;
......@@ -564,7 +571,6 @@ export default {
},
reloadEnterShopRule() {
console.log('eloadEnterShopRule', this.h5Params)
// 进店规则--首次进店调用
if (this.h5Params && this.h5Params.offlineShopCode) {
console.log("refreshInit--------2")
this.refreshInit();
......@@ -572,6 +578,7 @@ export default {
return;
};
console.log('home-methods-reloadEnterShopRule')
// 进店规则--首次进店调用
if (wx.getStorageSync("firstView") == 1) {
console.log('reloadEnterShopRule-------1')
wx.removeStorageSync("firstView");
......
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