Fix:2826 【商城小程序】农民店铺无法取消收藏,收藏时点取消图标未变更
This commit is contained in:
@@ -21,4 +21,7 @@ export function setFarmerShopCollection(data) {
|
|||||||
return request.post("/collection/farmerShop/add", data)
|
return request.post("/collection/farmerShop/add", data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function removeFarmerShopCollection(data) {
|
||||||
|
return request.post("/collection/farmerShop/remove", data)
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,14 +81,14 @@
|
|||||||
:src="webUrl + '/icon/icon-star-on.png'"
|
:src="webUrl + '/icon/icon-star-on.png'"
|
||||||
mode="scaleToFill"
|
mode="scaleToFill"
|
||||||
class="icon"
|
class="icon"
|
||||||
@click="doneFavorite"
|
@click="doneFavorite(store.hasFavorite)"
|
||||||
/>
|
/>
|
||||||
<image
|
<image
|
||||||
v-else
|
v-else
|
||||||
:src="webUrl + '/icon/icon-star-off.png'"
|
:src="webUrl + '/icon/icon-star-off.png'"
|
||||||
mode="scaleToFill"
|
mode="scaleToFill"
|
||||||
class="icon"
|
class="icon"
|
||||||
@click="doneFavorite"
|
@click="doneFavorite(store.hasFavorite)"
|
||||||
/>
|
/>
|
||||||
<text>{{ store.favoriteCount }}</text>
|
<text>{{ store.favoriteCount }}</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -340,7 +340,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getFarmerShop, setFarmerShopZan, getFarmerShopNews, setFarmerShopCollection } from '@/api/farmer'
|
import { getFarmerShop, setFarmerShopZan, getFarmerShopNews, removeFarmerShopCollection, setFarmerShopCollection } from '@/api/farmer'
|
||||||
import { postCountyFamousNewsZan, postCountyFamousNewsView } from '@/api/qianxian'
|
import { postCountyFamousNewsZan, postCountyFamousNewsView } from '@/api/qianxian'
|
||||||
import imgBox from '@/components/imageTypeSet/imagebox.vue'
|
import imgBox from '@/components/imageTypeSet/imagebox.vue'
|
||||||
export default {
|
export default {
|
||||||
@@ -514,11 +514,12 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
doneFavorite() {
|
doneFavorite(has) {
|
||||||
|
const api = !has ? setFarmerShopCollection : removeFarmerShopCollection
|
||||||
const params = {
|
const params = {
|
||||||
farmerShopId: this.id
|
farmerShopId: this.id
|
||||||
}
|
}
|
||||||
setFarmerShopCollection(params).then(res => {
|
api(params).then(res => {
|
||||||
this.getFarmerData()
|
this.getFarmerData()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user