Browse Source

【优化】 发现好产品页面价格tab未激活但高亮显示的BUG

【优化】 发现好产品页面market加载过久(每次download的问题)的BUG
master
邓平艺 4 years ago
parent
commit
b865f6f560
  1. 89
      pages/shopmap/index.vue

89
pages/shopmap/index.vue

@ -22,8 +22,8 @@
<view class="special_tab" style="position: relative;">
<u-tabs :list="tab_list" active-color="#1998FE" inactive-color='#777777' :is-scroll="true" @click="clicksort" :current="current" @change="tabChange"></u-tabs>
<view style="position: absolute;right: 44rpx;top: 20rpx;display: flex;flex-direction: column;">
<u-icon name="arrow-up" style="font-size: 20rpx;" :class="sort==0?'':'lf-color-blue'"></u-icon>
<u-icon name="arrow-down" style="font-size: 20rpx;" :class="sort==0?'lf-color-blue':''"></u-icon>
<u-icon name="arrow-up" style="font-size: 20rpx;" :class="(current == 2 && sort == 0) ? 'lf-color-blue' : ''"></u-icon>
<u-icon name="arrow-down" style="font-size: 20rpx;" :class="(current == 2 && sort == 1) ? 'lf-color-blue' : ''"></u-icon>
</view>
</view>
<swiper :style="{height: 'calc('+ windowHeight +'px - 110rpx)', width: '100%'}" :current="current" @change="swiperChange">
@ -150,7 +150,8 @@
isPage: true,
pageSize: 20,
sort: 0,
address: ''
address: '',
downloadImages: [] //
}
},
onLoad() {
@ -301,7 +302,6 @@
},
tabChange(index){
this.current = index;
console.log('重复只想')
this.getActivityList()
},
//
@ -310,7 +310,6 @@
if(event.detail.source == '') return; //
},
changeSort(sort) {
console.log('排序')
this.sort != this.sort
this.getActivityList()
},
@ -351,8 +350,7 @@
tab_item.loadingText = '没有更多数据啦~';
}
this.tab_list[this.current].isRefresher = false;
console.log(this.tab_list[this.current].isRefresher )
console.log(this.tab_list[this.current])
if(tab_item.page == 1){
tab_item.list = res.data.data;
}else{
@ -369,45 +367,66 @@
createMarkers(res_list){
let markers_self = [];
let p_list = []; //
let downloadImages = JSON.parse(JSON.stringify(this.downloadImages)); //
uni.showLoading({
title: '加载地图信息中'
})
res_list.map(item => {
let itemP = new Promise((resolve, reject) => {
uni.downloadFile({
url: item.picture,
complete: result => {
let tempFilePath = "";
if (result.statusCode === 200) {
tempFilePath = result.tempFilePath;
}
let obj = {
id: item.id,
name: item.title,
address: item.address,
latitude: Number(item.latitude),
longitude: Number(item.longitude),
iconPath: tempFilePath,
width: 30,
height: 30,
callout: {
content: item.title,
fontSize: 14,
textAlign: 'center',
bgColor: "#fff",
borderRadius: 14,
padding: 4,
display: "ALWAYS"
let tempFilePath = ""; //
let obj = {
id: item.id,
name: item.title,
address: item.address,
latitude: Number(item.latitude),
longitude: Number(item.longitude),
// iconPath: tempFilePath,
width: 30,
height: 30,
callout: {
content: item.title,
fontSize: 14,
textAlign: 'center',
bgColor: "#fff",
borderRadius: 14,
padding: 4,
display: "ALWAYS"
}
};
let image = downloadImages.filter(function(f_item, f_index, f_arr){
return f_item.id == item.id;
});
if(image.length > 0){
//
tempFilePath = image[0].url;
obj.iconPath = image[0].url;
markers_self.push(obj);
resolve();
}else{
// download
uni.downloadFile({
url: item.picture,
complete: result => {
if (result.statusCode === 200) {
tempFilePath = result.tempFilePath;
}
obj.iconPath = tempFilePath;
markers_self.push(obj);
downloadImages.push({
id: item.id,
url: tempFilePath
});
resolve();
}
markers_self.push(obj);
resolve();
}
})
})
}
});
p_list.push(itemP);
});
Promise.all(p_list).then(res => {
this.downloadImages = JSON.parse(JSON.stringify(downloadImages));
this.markers_list = markers_self;
uni.hideLoading();
})

Loading…
Cancel
Save