Commit 8564c70f by 李嘉林

首页渲染优化

parent 824b5d99
...@@ -53,6 +53,7 @@ export default { ...@@ -53,6 +53,7 @@ export default {
mounted() { }, mounted() { },
methods: { methods: {
init() { init() {
if (!this.microPageId) return;
shop.singlePageInfo({ id: this.microPageId }).then(res => { shop.singlePageInfo({ id: this.microPageId }).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.contentList = res.data.data.pageData ? JSON.parse(res.data.data.pageData) : []; this.contentList = res.data.data.pageData ? JSON.parse(res.data.data.pageData) : [];
......
...@@ -39,20 +39,26 @@ export default { ...@@ -39,20 +39,26 @@ export default {
}; };
}, },
async onLoad() { async onLoad() {
let shopInfo = await shop.getShopInfo(JSON.parse(wx.getStorageSync("extConfig"))); try {
console.log(shopInfo,'-------------shopInfo') let shopInfo = await shop.getShopInfo(JSON.parse(wx.getStorageSync("extConfig")));
if (shopInfo.data.code == 200) { console.log(shopInfo,'-------------shopInfo')
this.openThousandsStoresFlag = shopInfo.data.data.openThousandsStoresFlag == 1; if (shopInfo.data.code == 200) {
this.logoUrl = DFSImg(shopInfo.data.data.logoUrl, 400, 400); this.openThousandsStoresFlag = shopInfo.data.data.openThousandsStoresFlag == 1;
console.log(this.openThousandsStoresFlag,this.logoUrl,'-------------shopInfo') this.logoUrl = DFSImg(shopInfo.data.data.logoUrl, 400, 400);
} console.log(this.openThousandsStoresFlag,this.logoUrl,'-------------shopInfo')
if (this.openThousandsStoresFlag) { }
this.getLocationHandle(() => { if (this.openThousandsStoresFlag) {
this.getLocationHandle(() => {
this.$emit("toUpdate");
// this.getShopList();
});
} else {
this.$emit("toUpdate"); this.$emit("toUpdate");
// this.getShopList(); }
}); this.reloadName();
} catch (error) {
this.$emit("toUpdate");
} }
this.reloadName();
}, },
filters: { filters: {
formatDistance(val) { formatDistance(val) {
......
<template> <template>
<div class="loadings" v-if="shopLogo"> <div class="loadings">
<div class="img flex"> <div class="img flex">
<image :src="shopLogo" alt="" mode="aspectFill"></image> <image :src="shopLogo" alt="" mode="aspectFill"></image>
<van-loading color="black" size="60px" /> <van-loading color="#333" size="60px" />
</div> </div>
</div> </div>
</template> </template>
...@@ -22,12 +22,20 @@ export default { ...@@ -22,12 +22,20 @@ export default {
}, },
computed: { computed: {
shopLogo() { shopLogo() {
let logoUrl = app.globalData && app.globalData.shopInfo && app.globalData.shopInfo.logoUrl; let logoUrl = "";
if (wx.getStorageSync("logoUrl")) {
logoUrl = wx.getStorageSync("logoUrl");
} else {
logoUrl = app.globalData && app.globalData.shopInfo && app.globalData.shopInfo.logoUrl;
}
return logoUrl?DFSImg(logoUrl):""; return logoUrl?DFSImg(logoUrl):"";
}, },
}, },
created() { }, created() { },
mounted() { } mounted() { },
methods: {
}
}; };
</script> </script>
...@@ -39,13 +47,13 @@ export default { ...@@ -39,13 +47,13 @@ export default {
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
z-index: 3000; z-index: 9999;
.img{ .img{
width: 50px; width: 50px;
height: 50px; height: 50px;
position: relative; position: relative;
padding: 2px; padding: 2px;
margin: 60% auto 0; margin: 40vh auto 0;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
image{ image{
......
...@@ -78,7 +78,6 @@ export default { ...@@ -78,7 +78,6 @@ export default {
}, },
onLoad(){ onLoad(){
console.log(this.datas,'iu')
}, },
computed: { computed: {
getPaddingList() { getPaddingList() {
......
...@@ -521,7 +521,6 @@ export default { ...@@ -521,7 +521,6 @@ export default {
}, },
onShow() { onShow() {
console.log(new Date().getTime(),'load-----home-onShow') console.log(new Date().getTime(),'load-----home-onShow')
this.pageLoading = false;
console.log(this.reloadPage,'-reloadPage2') console.log(this.reloadPage,'-reloadPage2')
if (this.reloadPage) { if (this.reloadPage) {
this.refreshInit(); this.refreshInit();
...@@ -555,8 +554,12 @@ export default { ...@@ -555,8 +554,12 @@ export default {
methods: { methods: {
reloadEnterShopRule() { reloadEnterShopRule() {
console.log('eloadEnterShopRule')
// 进店规则--首次进店调用 // 进店规则--首次进店调用
if (this.h5Params && this.h5Params.offlineShopCode) return; if (this.h5Params && this.h5Params.offlineShopCode) {
this.pageLoading = false;
return;
};
console.log('home-methods-reloadEnterShopRule') console.log('home-methods-reloadEnterShopRule')
if (wx.getStorageSync("firstView")) { if (wx.getStorageSync("firstView")) {
console.log('reloadEnterShopRule-------1') console.log('reloadEnterShopRule-------1')
...@@ -568,48 +571,53 @@ export default { ...@@ -568,48 +571,53 @@ export default {
} }
}, },
async enterStoreRule() { async enterStoreRule() {
let shopInfo = await shop.getShopInfo(JSON.parse(wx.getStorageSync("extConfig"))); try {
let openThousandsStoresFlag = shopInfo.data.data.openThousandsStoresFlag == 1; let shopInfo = await shop.getShopInfo(JSON.parse(wx.getStorageSync("extConfig")));
if (!openThousandsStoresFlag) return; let openThousandsStoresFlag = shopInfo.data.data.openThousandsStoresFlag == 1;
console.log(wx.getStorageSync("locationObj"),'--locationObj') if (openThousandsStoresFlag); {
let locationObj = wx.getStorageSync("locationObj") ? JSON.parse(wx.getStorageSync("locationObj")) : {}; console.log(wx.getStorageSync("locationObj"),'--locationObj')
let query = { let locationObj = wx.getStorageSync("locationObj") ? JSON.parse(wx.getStorageSync("locationObj")) : {};
channelType: 2, //设备类型(0:pc,1:app,2:小程序) let query = {
consumerLongitude: locationObj.longitude?locationObj.longitude.toString() : "", //经度,小程序和app可以获取到就要传,没有不传 channelType: 2, //设备类型(0:pc,1:app,2:小程序)
consumerLatitude: locationObj.latitude?locationObj.latitude.toString() : "", //纬度,小程序和app可以获取到就要传,没有不传 consumerLongitude: locationObj.longitude?locationObj.longitude.toString() : "", //经度,小程序和app可以获取到就要传,没有不传
distributionOfficerShopCode: this.h5Params.offlineShopCode || "" //分销员门店id,没有不传 consumerLatitude: locationObj.latitude?locationObj.latitude.toString() : "", //纬度,小程序和app可以获取到就要传,没有不传
} distributionOfficerShopCode: this.h5Params.offlineShopCode || "" //分销员门店id,没有不传
console.log(`%cgetEnterShopId---query${JSON.stringify(query)}`,'color:yellow;font-size:20px;')
let res = await shop.getEnterShopId(query);
console.log(`%cgetEnterShopId${JSON.stringify(res)}`,'color:yellow;font-size:20px;')
if (res.data.code == 200) {
let enterShopId = res.data.data;
console.log(enterShopId,'--enterShopId')
if (enterShopId) {
let storeDetail = await shop.getOfflineStoreDetail({
shopId: enterShopId,
});
if (storeDetail.data.code == 200) {
setStoreInfo({
offlineShopCode: storeDetail.data.data.shopCode,
offlineShopName: storeDetail.data.data.shopName,
});
this.$refs.StoreAddr.reloadName();
this.refreshInit();
}
console.log(storeDetail, '-------storeDetail');
let loginUserInfo = wx.getStorageSync("loginUserInfo") || null;
let query2 = {
telephoneNum: loginUserInfo && loginUserInfo.mobilephone,
enterShopSource: "买家直接进入",
hitRule: "首页进入",
shopName: storeDetail.data.data.shopName,
} }
log.info("进店规则-----",query2) console.log(`%cgetEnterShopId---query${JSON.stringify(query)}`,'color:yellow;font-size:20px;')
shop.saveEnterShopRecord(query2); let res = await shop.getEnterShopId(query);
console.log(`%cgetEnterShopId${JSON.stringify(res)}`,'color:yellow;font-size:20px;')
if (res.data.code == 200) {
let enterShopId = res.data.data;
console.log(enterShopId,'--enterShopId')
if (enterShopId) {
let storeDetail = await shop.getOfflineStoreDetail({
shopId: enterShopId,
});
if (storeDetail.data.code == 200) {
setStoreInfo({
offlineShopCode: storeDetail.data.data.shopCode,
offlineShopName: storeDetail.data.data.shopName,
});
this.$refs.StoreAddr.reloadName();
this.refreshInit();
}
console.log(storeDetail, '-------storeDetail');
let loginUserInfo = wx.getStorageSync("loginUserInfo") || null;
let query2 = {
telephoneNum: loginUserInfo && loginUserInfo.mobilephone,
enterShopSource: "买家直接进入",
hitRule: "首页进入",
shopName: storeDetail.data.data.shopName,
}
log.info("进店规则-----",query2)
shop.saveEnterShopRecord(query2);
}
}
} }
} catch (error) {
} }
// this.pageLoading = false; this.pageLoading = false;
}, },
toPageLoading() { toPageLoading() {
// this.pageLoading = true; // this.pageLoading = true;
...@@ -895,7 +903,6 @@ export default { ...@@ -895,7 +903,6 @@ export default {
} }
if(this.$mp.page && this.$mp.page.selectAllComponents(".transverse-label-goodsListItem")){ if(this.$mp.page && this.$mp.page.selectAllComponents(".transverse-label-goodsListItem")){
this.$mp.page.selectAllComponents(".transverse-label-goodsListItem").forEach(item=>{ this.$mp.page.selectAllComponents(".transverse-label-goodsListItem").forEach(item=>{
console.log(item,'-this.$mp.page.selectComponent(".goodsListItem")')
item.getScroll(el) item.getScroll(el)
}) })
} }
...@@ -1094,20 +1101,29 @@ export default { ...@@ -1094,20 +1101,29 @@ export default {
async getThemeList() { async getThemeList() {
console.log("getThemeList") console.log("getThemeList")
this.pageLoading = true; this.pageLoading = true;
await app.getThemePage(this.$store.state.extConfig); try {
await app.getThemePage(this.$store.state.extConfig);
} catch (error) {
}
setTimeout(() => { setTimeout(() => {
this.pageLoading = false; this.pageLoading = false;
}, 500); console.log("加载完成了");
}, 1500);
}, },
refreshInit() { async refreshInit() {
this.pageLoading = true; // this.pageLoading = true;
setTimeout(() => { // setTimeout(() => {
// this.pageLoading = false;
// }, 1500);
log.info('onPullDownRefresh',this.$store.state.extConfig)
app.getShopInfo(this.$store.state.extConfig);
try {
await this.getThemeList();
} catch (error) {
}
wx.stopPullDownRefresh(); wx.stopPullDownRefresh();
this.pageLoading = false;
}, 1500);
log.info('onPullDownRefresh',this.$store.state.extConfig)
app.getShopInfo(this.$store.state.extConfig);
this.getThemeList();
} }
}, },
async onShareAppMessage(res){ async onShareAppMessage(res){
......
...@@ -284,7 +284,6 @@ export default { ...@@ -284,7 +284,6 @@ export default {
} }
if(this.$mp.page && this.$mp.page.selectAllComponents(".transverse-label-goodsListItem")){ if(this.$mp.page && this.$mp.page.selectAllComponents(".transverse-label-goodsListItem")){
this.$mp.page.selectAllComponents(".transverse-label-goodsListItem").forEach(item=>{ this.$mp.page.selectAllComponents(".transverse-label-goodsListItem").forEach(item=>{
console.log(item,'-this.$mp.page.selectComponent(".goodsListItem")')
item.getScroll(el) item.getScroll(el)
}) })
} }
......
...@@ -8,7 +8,6 @@ module.exports = { ...@@ -8,7 +8,6 @@ module.exports = {
log.debug.apply(log, arguments) log.debug.apply(log, arguments)
}, },
info() { info() {
console.log('日志log级别');
if (!log) return if (!log) return
log.info.apply(log, arguments) log.info.apply(log, arguments)
}, },
......
...@@ -27,14 +27,12 @@ Component({ ...@@ -27,14 +27,12 @@ Component({
newArr: [] newArr: []
}, },
ready() { ready() {
console.log(app.setHomeBgImg, "----------------------30");
this.setData({ newArr: this.newList() }); this.setData({ newArr: this.newList() });
this.bannerChange({ this.bannerChange({
detail: { detail: {
current: 0 current: 0
} }
}); });
console.log(this.data.newArr, this.newList(), "--------32");
}, },
methods: { methods: {
newList() { newList() {
......
...@@ -43,7 +43,6 @@ Component({ ...@@ -43,7 +43,6 @@ Component({
let columnWidthArr = ['100%', '50%', '33.3%', '25%', '20%', '16.6%'] let columnWidthArr = ['100%', '50%', '33.3%', '25%', '20%', '16.6%']
this.data.datas.componentData.imgList.forEach(item => { this.data.datas.componentData.imgList.forEach(item => {
console.log(item,'---------------44')
item.imageUrl = item.imageUrl ? app.DFSImg(item.imageUrl,400,400) : '' item.imageUrl = item.imageUrl ? app.DFSImg(item.imageUrl,400,400) : ''
}) })
this.setData({ this.setData({
......
...@@ -179,7 +179,7 @@ ...@@ -179,7 +179,7 @@
<view <view
class="moreBottom" class="moreBottom"
bindtap="viewMore" bindtap="viewMore"
wx:if="{{datas.componentData['moreShow'] && datas.componentData.moreButtonSite=='bottom' && datas.componentData['goodsSource']!='assign' && datas.componentData['goodsSource']!='intelligenceRec'}}" wx:if="{{datas.componentData['moreShow'] && datas.componentData.moreButtonSite=='bottom' && datas.componentData['goodsSource']!='assign' && datas.componentData['goodsSource']!='intelligenceRec' && !loading}}"
> >
查看更多 查看更多
<text class="jt"></text> <text class="jt"></text>
......
...@@ -44,8 +44,8 @@ image{ ...@@ -44,8 +44,8 @@ image{
display: inline-block; display: inline-block;
border-top: 1px solid; border-top: 1px solid;
border-right: 1px solid; border-right: 1px solid;
width: 10px; width: 8px;
height: 10px; height: 8px;
-webkit-transform: rotate(-135deg); -webkit-transform: rotate(-135deg);
transform: rotate(405deg); transform: rotate(405deg);
margin-left: 0px; margin-left: 0px;
......
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