Commit 788d50ad by 李嘉林

进入二级页面返回首页总重新渲染问题

parent d385bc3e
...@@ -15,10 +15,12 @@ export default { ...@@ -15,10 +15,12 @@ export default {
console.log(extConfig, "-----------extConfig"); console.log(extConfig, "-----------extConfig");
if (JSON.stringify(extConfig) == "{}") { if (JSON.stringify(extConfig) == "{}") {
let shopItem = { let shopItem = {
// development: { mixid: "IR8rkL", "shopid": 3813}, //道可测试1
// development: { mixid: "iLntd3", "shopid": 3814}, //道可测试2
// development: { mixid: "ssa", "shopid": 2342}, //五粮液uat // development: { mixid: "ssa", "shopid": 2342}, //五粮液uat
development: { mixid: "antgood", "shopid": 67}, development: { mixid: "antgood", "shopid": 67},
// production: { "mixid":"SWQ", "shopid": 1641 }, // 麦贝思
production: { "mixid":"qiyeCT", "shopid": 1045 }, // 道可 production: { "mixid":"qiyeCT", "shopid": 1045 }, // 道可
// production: { "mixid":"SWQ", "shopid": 1641 }, // 麦贝思
// production: { "mixid":"metasense_doctors", "shopid": 1238 }, // 册为医护端 // production: { "mixid":"metasense_doctors", "shopid": 1238 }, // 册为医护端
// production: { "mixid":"3QqsFT", "shopid": 1337 }, // production: { "mixid":"3QqsFT", "shopid": 1337 },
// production: { "mixid":"notSHOWROOM", "shopid": 1274 }, // 诸色 // production: { "mixid":"notSHOWROOM", "shopid": 1274 }, // 诸色
...@@ -74,14 +76,11 @@ export default { ...@@ -74,14 +76,11 @@ export default {
// 商城配置 // 商城配置
await this.shopConfiguration() await this.shopConfiguration()
setTimeout(() => {
let mpApp = getApp(); let mpApp = getApp();
console.log(mpApp, "this.mpApp"); console.log(mpApp, "this.mpApp");
mpApp.getShopInfo = this.getShopInfo mpApp.getShopInfo = this.getShopInfo
mpApp.getThemePage = this.getThemePage mpApp.getThemePage = this.getThemePage
setTimeout(() => {
},300) },300)
}, },
......
...@@ -235,6 +235,7 @@ export default { ...@@ -235,6 +235,7 @@ export default {
h5Params: {}, //params h5Params: {}, //params
fromPage: "", fromPage: "",
customBgOpacity: true, // 沉浸式风格 customBgOpacity: true, // 沉浸式风格
reloadPage: false, // 切换门店进入首页重新获取相关配置
}; };
}, },
components:{ components:{
...@@ -319,7 +320,8 @@ export default { ...@@ -319,7 +320,8 @@ export default {
// } // }
// }; // };
}, },
onReady(){ onReady() {
console.log(new Date().getTime(),'load-----home-onReady')
// 上报首页打开时间 // 上报首页打开时间
if (wx.canIUse('reportPerformance')) { if (wx.canIUse('reportPerformance')) {
const performance = wx.getPerformance() const performance = wx.getPerformance()
...@@ -353,19 +355,30 @@ export default { ...@@ -353,19 +355,30 @@ export default {
this.firstOpenPage = false; this.firstOpenPage = false;
}, },
onLoad(options) { onLoad(options) {
if(this.$options) {
Object.assign(this.$data, this.$options.data());
}
console.log(new Date().getTime(),'load-----home-onLoad') console.log(new Date().getTime(),'load-----home-onLoad')
console.log(options,this.firstOpenPage,'---------home----options') console.log(options,this.firstOpenPage,'---------home----options')
log.info(options, '---------home----options') log.info(options, '---------home----options')
let h5Params = options && options.params ? JSON.parse(decodeURIComponent(options.params)) : {}; let h5Params = options && options.params ? JSON.parse(decodeURIComponent(options.params)) : {};
this.h5Params = h5Params; this.h5Params = h5Params;
console.log(h5Params,'--h5Params') console.log(h5Params,'--h5Params')
if (Object.keys(h5Params).length>0 && h5Params.offlineShopCode) { if (Object.keys(h5Params).length > 0 && h5Params.offlineShopCode) {
console.log("设置切换的门店", h5Params.offlineShopCode, getStoreInfo().offlineShopCode);
// 判断是否等于缓存门店,非缓存门店重新设置并初始化
if (h5Params.offlineShopCode != getStoreInfo().offlineShopCode) {
// 存储h5url门店信息 // 存储h5url门店信息
setStoreInfo({ setStoreInfo({
offlineShopCode:h5Params.offlineShopCode, offlineShopCode:h5Params.offlineShopCode,
offlineShopName:h5Params.offlineShopName, offlineShopName:h5Params.offlineShopName,
}); });
this.reloadPage = true;
} }
} else {
this.reloadPage = false;
}
console.log(this.reloadPage,'-reloadPage1')
//进页面存储需要绑定的信息 //进页面存储需要绑定的信息
if(options.userId||options.spokesmanRelId) { if(options.userId||options.spokesmanRelId) {
wx.setStorage({ wx.setStorage({
...@@ -415,9 +428,6 @@ export default { ...@@ -415,9 +428,6 @@ export default {
}) })
}); });
} }
if(this.$options) {
Object.assign(this.$data, this.$options.data());
}
if (options.from && options.from == "logout") { if (options.from && options.from == "logout") {
//来自用户登出 //来自用户登出
wx.removeStorage({ wx.removeStorage({
...@@ -502,11 +512,14 @@ export default { ...@@ -502,11 +512,14 @@ export default {
}) })
}, },
onShow() { onShow() {
console.log(new Date().getTime(),'load-----home-onShow')
this.pageLoading = false; this.pageLoading = false;
console.log(this.reloadPage,'-reloadPage2')
if (this.reloadPage) {
this.refreshInit(); this.refreshInit();
console.log(new Date().getTime(),'load-----home-onShow') this.reloadPage = false;
}
// 设置显示条件 // 设置显示条件
console.log(new Date().getTime(),'--------on--------------show')
log.info('--------on--------------show') log.info('--------on--------------show')
//分销隔流 //分销隔流
if(this.toHomePage) { if(this.toHomePage) {
...@@ -589,6 +602,7 @@ export default { ...@@ -589,6 +602,7 @@ export default {
// this.pageLoading = false; // this.pageLoading = false;
}, },
toUpdate() { toUpdate() {
console.log("toUpdate");
// 切换门店重新加载 // 切换门店重新加载
this.getThemeList(); this.getThemeList();
}, },
...@@ -1073,6 +1087,7 @@ export default { ...@@ -1073,6 +1087,7 @@ export default {
this.birthGifts = res; this.birthGifts = res;
}, },
async getThemeList() { async getThemeList() {
console.log("getThemeList")
this.pageLoading = true; this.pageLoading = true;
await app.getThemePage(this.$store.state.extConfig); await app.getThemePage(this.$store.state.extConfig);
setTimeout(() => { setTimeout(() => {
...@@ -1163,7 +1178,8 @@ export default { ...@@ -1163,7 +1178,8 @@ export default {
onShareTimeline(res) { onShareTimeline(res) {
log.info(res,'-----onShareTimeline') log.info(res,'-----onShareTimeline')
}, },
onPullDownRefresh(){ onPullDownRefresh() {
console.log("onPullDownRefresh");
this.refreshInit(); this.refreshInit();
} }
}; };
......
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