|
|
|
@ -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(); |
|
|
|
}) |
|
|
|
|