Compare commits

...

2 Commits

Author SHA1 Message Date
a621c6402a bugfix 2025-08-26 16:43:41 +08:00
086ccbff0d bugfix 2025-08-26 16:31:48 +08:00
4 changed files with 41 additions and 18 deletions

View File

@ -14,13 +14,13 @@
<span class="radio-text">企业需求</span>
</label>
</div>
<div class="history-list" v-if="productList.length > 0">
<div v-loading="loadingBox" class="history-list" v-if="productList.length > 0">
<div class="history-item" v-for="item in productList" :key="item.id">
<div class="history-date">
<span class="date-text">{{ formatBrowseDate(item.create_at) }}</span>
<span class="relative-time">{{ getRelativeTime(item.create_at) }}</span>
<span class="date-text">{{ formatBrowseDate(item.browse_date) }}</span>
<span class="relative-time">{{ getRelativeTime(item.browse_date) }}</span>
</div>
<div class="follow-content">
<div class="history-content">
<productCard
contentType="favorite"
:productList="item.products"
@ -44,6 +44,7 @@ export default {
name: 'followBox',
data() {
return {
loadingBox:false,
productList: [],
value1: null,
publish_type: '1', //
@ -67,10 +68,12 @@ export default {
this.reqFavoriteSearch();
},
reqFavoriteSearch() {
this.loadingBox = true;
reqFavoriteSearch({
url_list: window.location.href,
publish_type: this.publish_type //
}).then(res => {
this.loadingBox = false;
if (res.status) {
// product_info
this.productList = this.flattenProductInfo(res.data.favorites);
@ -100,6 +103,9 @@ export default {
// product_info
Object.keys(product.product_info).forEach(key => {
if(key == 'id'){
flattenedProduct.productid = product.product_info.id;
}
//
if (!(key in flattenedProduct)) {
flattenedProduct[key] = product.product_info[key];
@ -232,11 +238,11 @@ export default {
}
/* 关注记录列表样式 */
.follow-list {
.history-list {
margin-top: 20px;
}
.follow-item {
.history-item {
background: #fff;
border-radius: 12px;
padding: 20px;
@ -246,12 +252,12 @@ export default {
transition: all 0.3s ease;
}
.follow-item:hover {
.history-item:hover {
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
/* transform: translateY(-2px); */
}
.follow-date {
.history-date {
display: flex;
align-items: center;
margin-bottom: 16px;
@ -274,7 +280,7 @@ export default {
border-radius: 12px;
}
.follow-content {
.history-content {
margin-top: 8px;
}

View File

@ -14,7 +14,7 @@
<span class="radio-text">企业需求</span>
</label>
</div>
<div class="history-list" v-if="productList.length > 0">
<div v-loading="loadingBox" class="history-list" v-if="productList.length > 0">
<div class="history-item" v-for="item in productList" :key="item.id">
<div class="history-date">
<span class="date-text">{{ formatBrowseDate(item.browse_date) }}</span>
@ -44,6 +44,7 @@ export default {
name: 'historyBox',
data() {
return {
loadingBox:false,
productList: [],
value1: null,
publish_type: '1', //
@ -67,10 +68,12 @@ export default {
this.reqUserBrowseHistorySearch();
},
reqUserBrowseHistorySearch() {
this.loadingBox = true;
reqUserBrowseHistorySearch({
url_list: window.location.href,
publish_type: this.publish_type //
}).then(res => {
this.loadingBox = false;
if (res.status) {
// product_info
this.productList = this.flattenProductInfo(res.data.history_list);
@ -100,6 +103,9 @@ export default {
// product_info
Object.keys(product.product_info).forEach(key => {
if(key == 'id'){
flattenedProduct.productid = product.product_info.id;
}
//
if (!(key in flattenedProduct)) {
flattenedProduct[key] = product.product_info[key];

View File

@ -258,6 +258,20 @@ export default Vue.extend({
handleSearch() {
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>
<ul class="userBtn">
<li @click="$router.push('/ncmatchHome/historyBox')"><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="goHistory"><img style="width: 26px;height: 26px;" src="./img/eye.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> -->
</ul>
</aside>

View File

@ -1,7 +1,6 @@
<template>
<!-- 产品列表 -->
<div>
{{ contentType }}
<ul v-if="type === 'homePage'" class="productListContent" style="padding-top: 16px;">
<li class="product-item" v-for="item in productList" :key="item.id">
<div v-if="item.img!=null" class="product-image">
@ -232,12 +231,10 @@ export default {
collect(item){
this.$set(this.collectLoadingStates, item.id, true);
// /
console.log("收藏",item);
if(item.favorite=='1'){
reqFavoriteDelete({
id:item.id,
id:item.productid?item.productid:item.id,
}).then(res=>{
item.favorite='0'
if(res.status){
@ -251,7 +248,7 @@ export default {
}else if(item.favorite=='0'){
reqPublishProductCollect({
productid:item.id,
productid:item.productid,
favorite_type:item.publish_type
}).then(res=>{
item.favorite='1'
@ -272,7 +269,7 @@ export default {
async openDetail(item) {
this.$set(this.loadingStates, item.id, true);
reqGetProductDetail({
id: item.id,
id:item.productid?item.productid:item.id,
from:'f'
}).then(res => {