Authored by zhangwenxue

商品详情: 修正收藏接口

@@ -182,7 +182,7 @@ export default { @@ -182,7 +182,7 @@ export default {
182 }, 182 },
183 mounted() { 183 mounted() {
184 this.loadData(this.productId); 184 this.loadData(this.productId);
185 - this.imageHideThreadhold = -window.innerWidth * 0.8; 185 + this.imageHideThreadhold = -window.innerWidth * 0.693;
186 }, 186 },
187 activated() { 187 activated() {
188 this.refresh(); 188 this.refresh();
@@ -26,11 +26,13 @@ export default { @@ -26,11 +26,13 @@ export default {
26 const result = await this.$api.get('/api/ufo/product/top', {product_id: productId}); 26 const result = await this.$api.get('/api/ufo/product/top', {product_id: productId});
27 27
28 if (result.code === 200) { 28 if (result.code === 200) {
29 - commit(Types.UPDATE_PRODUCT_TOP3, {productId, topList: result.data.product_list.slice(0, 3)}); 29 + const productList = result.data.product_list || [];
  30 +
  31 + commit(Types.UPDATE_PRODUCT_TOP3, {productId, topList: productList.slice(0, 3)});
30 } 32 }
31 }, 33 },
32 async toggleFav({commit}, {productId, isFav}) { 34 async toggleFav({commit}, {productId, isFav}) {
33 - const result = await this.$api.get(`/api/ufo/product/${isFav ? 'add' : 'cancel'}`, {productId}); 35 + const result = await this.$api.get(`/api/ufo/product/favorite/${isFav ? 'add' : 'cancel'}`, {productId});
34 36
35 if (result && result.code === 200) { 37 if (result && result.code === 200) {
36 commit(Types.UPDATE_PRODUCT_FAV, {productId, isFav}); 38 commit(Types.UPDATE_PRODUCT_FAV, {productId, isFav});