bugfix
This commit is contained in:
parent
737878beb9
commit
086ccbff0d
@ -100,6 +100,9 @@ export default {
|
|||||||
|
|
||||||
// 遍历product_info的所有属性
|
// 遍历product_info的所有属性
|
||||||
Object.keys(product.product_info).forEach(key => {
|
Object.keys(product.product_info).forEach(key => {
|
||||||
|
if(key == 'id'){
|
||||||
|
flattenedProduct.productid = product.product_info.id;
|
||||||
|
}
|
||||||
// 如果上一级已经有同名属性,则跳过(避免覆盖)
|
// 如果上一级已经有同名属性,则跳过(避免覆盖)
|
||||||
if (!(key in flattenedProduct)) {
|
if (!(key in flattenedProduct)) {
|
||||||
flattenedProduct[key] = product.product_info[key];
|
flattenedProduct[key] = product.product_info[key];
|
||||||
|
|||||||
@ -100,6 +100,9 @@ export default {
|
|||||||
|
|
||||||
// 遍历product_info的所有属性
|
// 遍历product_info的所有属性
|
||||||
Object.keys(product.product_info).forEach(key => {
|
Object.keys(product.product_info).forEach(key => {
|
||||||
|
if(key == 'id'){
|
||||||
|
flattenedProduct.productid = product.product_info.id;
|
||||||
|
}
|
||||||
// 如果上一级已经有同名属性,则跳过(避免覆盖)
|
// 如果上一级已经有同名属性,则跳过(避免覆盖)
|
||||||
if (!(key in flattenedProduct)) {
|
if (!(key in flattenedProduct)) {
|
||||||
flattenedProduct[key] = product.product_info[key];
|
flattenedProduct[key] = product.product_info[key];
|
||||||
|
|||||||
@ -258,6 +258,20 @@ export default Vue.extend({
|
|||||||
handleSearch() {
|
handleSearch() {
|
||||||
console.log('搜索:1', this.searchKeyword)
|
console.log('搜索:1', this.searchKeyword)
|
||||||
|
|
||||||
|
},
|
||||||
|
goFavorite() {
|
||||||
|
if (this.loginState) {
|
||||||
|
this.$router.push('/ncmatchHome/favoriteBox')
|
||||||
|
} else {
|
||||||
|
this.$router.push('/login')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
goHistory() {
|
||||||
|
if (this.loginState) {
|
||||||
|
this.$router.push('/ncmatchHome/historyBox')
|
||||||
|
} else {
|
||||||
|
this.$router.push('/login')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -303,8 +317,8 @@ export default Vue.extend({
|
|||||||
<span class="publish-goods" @click="sendInfo('1')">发布商品</span>
|
<span class="publish-goods" @click="sendInfo('1')">发布商品</span>
|
||||||
|
|
||||||
<ul class="userBtn">
|
<ul class="userBtn">
|
||||||
<li @click="$router.push('/ncmatchHome/historyBox')"><img style="width: 26px;height: 26px;" src="./img/eye.png" alt="">浏览记录</li>
|
<li @click="goHistory"><img style="width: 26px;height: 26px;" src="./img/eye.png" alt="">浏览记录</li>
|
||||||
<li @click="$router.push('/ncmatchHome/favoriteBox')"><img style="width: 26px;height: 26px;" src="./img/collect.png" alt="">我的收藏</li>
|
<li @click="goFavorite"><img style="width: 26px;height: 26px;" src="./img/collect.png" alt="">我的收藏</li>
|
||||||
<!-- <li><img src="./img/like.png" alt="">关注需求</li> -->
|
<!-- <li><img src="./img/like.png" alt="">关注需求</li> -->
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 产品列表 -->
|
<!-- 产品列表 -->
|
||||||
<div>
|
<div>
|
||||||
{{ contentType }}
|
|
||||||
<ul v-if="type === 'homePage'" class="productListContent" style="padding-top: 16px;">
|
<ul v-if="type === 'homePage'" class="productListContent" style="padding-top: 16px;">
|
||||||
<li class="product-item" v-for="item in productList" :key="item.id">
|
<li class="product-item" v-for="item in productList" :key="item.id">
|
||||||
<div v-if="item.img!=null" class="product-image">
|
<div v-if="item.img!=null" class="product-image">
|
||||||
@ -232,12 +231,10 @@ export default {
|
|||||||
collect(item){
|
collect(item){
|
||||||
this.$set(this.collectLoadingStates, item.id, true);
|
this.$set(this.collectLoadingStates, item.id, true);
|
||||||
// 这里添加收藏/取消收藏的逻辑
|
// 这里添加收藏/取消收藏的逻辑
|
||||||
console.log("收藏",item);
|
|
||||||
|
|
||||||
if(item.favorite=='1'){
|
if(item.favorite=='1'){
|
||||||
|
|
||||||
reqFavoriteDelete({
|
reqFavoriteDelete({
|
||||||
id:item.id,
|
id:item.productid?item.productid:item.id,
|
||||||
}).then(res=>{
|
}).then(res=>{
|
||||||
item.favorite='0'
|
item.favorite='0'
|
||||||
if(res.status){
|
if(res.status){
|
||||||
@ -251,7 +248,7 @@ export default {
|
|||||||
}else if(item.favorite=='0'){
|
}else if(item.favorite=='0'){
|
||||||
|
|
||||||
reqPublishProductCollect({
|
reqPublishProductCollect({
|
||||||
productid:item.id,
|
productid:item.productid,
|
||||||
favorite_type:item.publish_type
|
favorite_type:item.publish_type
|
||||||
}).then(res=>{
|
}).then(res=>{
|
||||||
item.favorite='1'
|
item.favorite='1'
|
||||||
@ -272,7 +269,7 @@ export default {
|
|||||||
async openDetail(item) {
|
async openDetail(item) {
|
||||||
this.$set(this.loadingStates, item.id, true);
|
this.$set(this.loadingStates, item.id, true);
|
||||||
reqGetProductDetail({
|
reqGetProductDetail({
|
||||||
id: item.id,
|
id:item.productid?item.productid:item.id,
|
||||||
from:'f'
|
from:'f'
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user