Authored by zhangwenxue

商品详情: 修正收藏接口

... ... @@ -182,7 +182,7 @@ export default {
},
mounted() {
this.loadData(this.productId);
this.imageHideThreadhold = -window.innerWidth * 0.8;
this.imageHideThreadhold = -window.innerWidth * 0.693;
},
activated() {
this.refresh();
... ...
... ... @@ -26,11 +26,13 @@ export default {
const result = await this.$api.get('/api/ufo/product/top', {product_id: productId});
if (result.code === 200) {
commit(Types.UPDATE_PRODUCT_TOP3, {productId, topList: result.data.product_list.slice(0, 3)});
const productList = result.data.product_list || [];
commit(Types.UPDATE_PRODUCT_TOP3, {productId, topList: productList.slice(0, 3)});
}
},
async toggleFav({commit}, {productId, isFav}) {
const result = await this.$api.get(`/api/ufo/product/${isFav ? 'add' : 'cancel'}`, {productId});
const result = await this.$api.get(`/api/ufo/product/favorite/${isFav ? 'add' : 'cancel'}`, {productId});
if (result && result.code === 200) {
commit(Types.UPDATE_PRODUCT_FAV, {productId, isFav});
... ...