|
|
@ -191,6 +191,15 @@ |
|
|
|
this.user = uni.getStorageSync('user'); |
|
|
|
this.user = uni.getStorageSync('user'); |
|
|
|
}, |
|
|
|
}, |
|
|
|
collectionFn(item) { |
|
|
|
collectionFn(item) { |
|
|
|
|
|
|
|
let collectHas3 = this.collection.every(i => i !== '') |
|
|
|
|
|
|
|
if(collectHas3) { |
|
|
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
|
|
title: '只可以收藏3个哦~', |
|
|
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let isHave = this.collection.find(i => i.name === item.name) |
|
|
|
let isHave = this.collection.find(i => i.name === item.name) |
|
|
|
// 是否已收藏 |
|
|
|
// 是否已收藏 |
|
|
|
if(isHave) { |
|
|
|
if(isHave) { |
|
|
@ -203,10 +212,10 @@ |
|
|
|
this.$set(this.collection,isHaveEmptyIndex,item) |
|
|
|
this.$set(this.collection,isHaveEmptyIndex,item) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
//如果收藏满了 栈底推出 |
|
|
|
// //如果收藏满了 栈底推出 |
|
|
|
this.collection.pop() |
|
|
|
// this.collection.pop() |
|
|
|
//栈顶推入 |
|
|
|
// //栈顶推入 |
|
|
|
this.collection.unshift(item) |
|
|
|
// this.collection.unshift(item) |
|
|
|
}, |
|
|
|
}, |
|
|
|
gestureAnalysis(e) {}, |
|
|
|
gestureAnalysis(e) {}, |
|
|
|
indexDis(e) { |
|
|
|
indexDis(e) { |
|
|
|