Browse Source

【新增】 频道跳转至推荐列表页面的方法

【修改】 发现好产品页面market
master
邓平艺 4 years ago
parent
commit
f242d63354
  1. 6
      pages/index/index.vue
  2. 25
      pages/recommList/index.vue
  3. 13
      pages/shopmap/index.vue
  4. BIN
      static/market_icon.png

6
pages/index/index.vue

@ -28,6 +28,7 @@
</view>
<view class="lf-flex-wrap" v-if="channel_list.length">
<view class="channel-item" v-for="(item, index) in channel_list" :key="index" @click="$url('/pages/goodsList/index?channel_id='+item.id)">
<!-- <view class="channel-item" v-for="(item, index) in channel_list" :key="index" @click="toRecommlist(item)"> -->
<image :src="item.icon" class="channel-mask" mode="aspectFill"></image>
<view class="lf-row-center channe-text lf-font-bold">{{item.name}}</view>
<!-- <view>
@ -162,6 +163,11 @@
}
},
methods: {
//
toRecommlist(item){
uni.setStorageSync('channel_id', item.channel_id || item.id);
this.$url('/pages/recommList/index', {type: 'switch'});
},
//
getFavourite() {
this.$http(this.API.API_FAVOURITE).then(res => {

25
pages/recommList/index.vue

@ -38,6 +38,18 @@
},
onShow(){
this.windowHeight = getApp().globalData.windowHeight;
// tab
if(this.tab_list.length){ //
let channel_id = uni.getStorageSync('channel_id');
if(channel_id){
this.tab_list.map((item, index) => {
if(item.id == channel_id){
this.current = index;
}
})
uni.removeStorage('channel_id');
}
}
if(this.show_count >= 1){
this.clearTabItem();
this.getData();
@ -50,7 +62,10 @@
getCategory(options = {}) {
this.$http(this.API.API_CATEGORYLIST).then(res => {
let res_list = res.data || [];
let tab_list = res_list.map(item => {
let current = 0;
let channel_id = uni.getStorageSync('channel_id');
let tab_list = res_list.map((item, index) => {
return {
id: item.id,
name: item.name,
@ -66,11 +81,15 @@
let list = []
tab_list.forEach((item,index) => {
if(item.pid == 0) {
list.push(item)
list.push(item);
if(channel_id && item.id == channel_id){ // id
current = index;
uni.removeStorage('channel_id');
}
}
})
this.current = current;
this.tab_list = list;
console.log(this.tab_list)
this.getData()
}).catch(err => {

13
pages/shopmap/index.vue

@ -367,20 +367,20 @@
createMarkers(res_list){
let markers_self = [];
let p_list = []; //
let downloadImages = JSON.parse(JSON.stringify(this.downloadImages)); //
// let downloadImages = JSON.parse(JSON.stringify(this.downloadImages)); // PS: market
uni.showLoading({
title: '加载地图信息中'
})
res_list.map(item => {
let itemP = new Promise((resolve, reject) => {
let tempFilePath = ""; //
let tempFilePath = '../../static/market_icon.png';
let obj = {
id: item.id,
name: item.title,
address: item.address,
latitude: Number(item.latitude),
longitude: Number(item.longitude),
// iconPath: tempFilePath,
iconPath: tempFilePath,
width: 30,
height: 30,
callout: {
@ -394,6 +394,8 @@
}
};
/* PSmarket
let image = downloadImages.filter(function(f_item, f_index, f_arr){
return f_item.id == item.id;
});
@ -422,11 +424,14 @@
}
})
}
*/
markers_self.push(obj);
resolve(); // PS:
});
p_list.push(itemP);
});
Promise.all(p_list).then(res => {
this.downloadImages = JSON.parse(JSON.stringify(downloadImages));
// this.downloadImages = JSON.parse(JSON.stringify(downloadImages)); // PS: market
this.markers_list = markers_self;
uni.hideLoading();
})

BIN
static/market_icon.png

After

Width: 209  |  Height: 200  |  Size: 6.7 KiB

Loading…
Cancel
Save