Commit 4bef0bcf authored by zhanglw's avatar zhanglw

个人中心-收藏产品

parent 6a2b5b7d
...@@ -172,6 +172,14 @@ export const constantRouterMap = [ ...@@ -172,6 +172,14 @@ export const constantRouterMap = [
}, },
hidden: true hidden: true
}, },
{
path: '/console/collectPro',
meta: { title: '个人中心-收藏的产品', noCache: true },
component: (resolve) => {
return require(['@/views/homepage/console/collectPro'], resolve)
},
hidden: true
},
{ {
path: '/backstage', path: '/backstage',
component: Layout, component: Layout,
......
...@@ -17,7 +17,7 @@ export default { ...@@ -17,7 +17,7 @@ export default {
}, },
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
this.currentMenuObj = this.menus[0] this.currentMenuObj = this.menuIndex > this.menus.length ? { name: '个人中心', url: '/console' } : this.menus[this.menuIndex]
this.$store.dispatch('app/setCurrentMenu', this.currentMenuObj) this.$store.dispatch('app/setCurrentMenu', this.currentMenuObj)
}) })
}, },
......
...@@ -24,7 +24,7 @@ export default { ...@@ -24,7 +24,7 @@ export default {
}, },
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
this.currentMenuObj = this.menus[this.menuIndex] this.currentMenuObj = this.menuIndex > this.menus.length ? { name: '个人中心', url: '/console' } : this.menus[this.menuIndex]
this.$store.dispatch('app/setCurrentMenu', this.currentMenuObj) this.$store.dispatch('app/setCurrentMenu', this.currentMenuObj)
}) })
}, },
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<img src="@/assets/home_images/mark_pro.png"> <img src="@/assets/home_images/mark_pro.png">
<span>供应</span> <span>供应</span>
</div> </div>
<div class="vertical-menu-label touch"><span :class="menuIndex==='3'?'active':''" @click="menuClick('/home')">收藏的产品</span></div> <div class="vertical-menu-label touch"><span :class="menuIndex==='3'?'active':''" @click="menuClick('/console/collectPro')">收藏的产品</span></div>
<div class="vertical-menu-label touch"><span :class="menuIndex==='4'?'active':''" @click="menuClick('/home')">收藏的供应商</span></div> <div class="vertical-menu-label touch"><span :class="menuIndex==='4'?'active':''" @click="menuClick('/home')">收藏的供应商</span></div>
<div class="vertical-menu-label touch"><span :class="menuIndex==='5'?'active':''" @click="menuClick('/home')">询价记录</span></div> <div class="vertical-menu-label touch"><span :class="menuIndex==='5'?'active':''" @click="menuClick('/home')">询价记录</span></div>
</div> </div>
......
<template>
<div class="page-body">
<div class="head-box">
<div class="head-box-top">
<div class="top-call" />
<div class="top-call"><img src="@/assets/home_images/gemho_logo_b.png"></div>
<div class="top-call"><title-menus ref="titleMenus" menu-index="99" style="padding-top: 15px" /></div>
<div class="top-call"><user-login ref="userLogin" /></div>
<div class="top-call"><language-setting ref="languageSetting" /></div>
</div>
</div>
<div class="content-box">
<div style="width: 88%;padding-left: 9%;">
<el-row :gutter="20" style="padding-top: 10px">
<el-col :span="3">
<user-menus menu-index="3" />
</el-col>
<el-col :span="21" style="padding: 0 20px">
<!--查询面板-->
<div class="search-box" style="padding:0;display:flex;font-size: 15px">
<div class="search-item" :class="query.type===undefined?'active':''" style="width: 126px">
<span class="touch label" @click="setQuertType()">收藏时间</span>
<span v-if="query.type===undefined"><i v-if="query.sort" class="el-icon-sort-up touch" /><i v-else class="el-icon-sort-down touch" /></span>
</div>
<div class="search-item" :class="query.type==='hot'?'active':''" style="width: 126px">
<span class="touch label" @click="setQuertType('hot')">销量优先</span>
<span v-if="query.type==='hot'"><i v-if="query.sort" class="el-icon-sort-up touch" /><i v-else class="el-icon-sort-down touch" /></span>
</div>
</div>
<div style="width: 100%;height: 62vh;margin-top: 7px">
<div v-for="(item,index) in tableData" :key="'p_'+index" class="box-card-s">
<el-image
:src="item.imgSrc?imgSrcStart+'/img'+item.imgSrc:defaultImgProduct"
:preview-src-list="item.imgSrcList.length?item.imgSrcList:[defaultImgProduct]"
style="width:200px;height: 160px;margin: 0 5px"
>
<div slot="placeholder" class="image-slot">加载中<span class="dot">...</span></div>
</el-image>
<el-row>
<el-col :span="21">
<div class="title touch" :title="item.title" @click="goToDetails(item, '/product/details')">{{ item.title }}</div>
</el-col>
<el-col :span="3">
<img v-if="item.isStore" class="touch" src="@/assets/home_images/to_like_h.png" title="点击取消收藏" @click="storeShowcase(item, 'product')">
<img v-else class="touch" src="@/assets/home_images/to_like.png" title="点击收藏" @click="storeShowcase(item, 'product')">
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<div class="subTitle" :title="item.subTitle">{{ item.subTitle }}</div>
</el-col>
</el-row>
<div class="line-btn" style="margin-top: 4px;padding-bottom: 4px">
<div class="btn-o" style="width: 120px;border-radius: 10px;box-shadow: 0 1px 2px 0 rgba(0,0,0,0.2);font-size:14px;" @click="inquiry(item, 'product')">询 价</div>
</div>
</div>
</div>
<!--分页组件-->
<el-pagination :total="total" :current-page="page" :page-size="pageSize" style="margin-top: 8px;" layout="total, prev, pager, next, sizes" @size-change="sizeChange" @current-change="pageChange" />
</el-col>
</el-row>
</div>
</div>
<home-footer ref="homeFooter" />
<inquiry-view ref="inquiryView" />
<el-backtop />
</div>
</template>
<script>
import default_product from '@/assets/home_images/default_product.png'
import titleMenus from '../components/titleMenusV2'
import userLogin from '../components/userLoginV2'
import languageSetting from '../components/languageSettingV2'
import homeFooter from '../components/homeFooter'
import inquiryView from '../components/inquiryView'
import userMenus from '../components/userMenus'
export default {
components: { titleMenus, userLogin, languageSetting, homeFooter, inquiryView, userMenus },
data() {
return {
defaultImgProduct: default_product,
imgSrcStart: process.env.VUE_APP_BASE_API,
page: 1,
pageSize: 8,
total: 0,
query: {
keyword: '',
area: undefined,
type: undefined,
sort: false
},
tableData: [
{
isGood: true,
isHot: false,
isStore: false,
title: 'wiwo1002热能工程压力变送器',
subTitle: '乐清市柳市艾普乐传感器厂',
area: '北京',
date: '2023-06-12',
imgSrc: '',
imgSrcList: []
}, {
isGood: true,
isHot: true,
isStore: true,
title: 'wiwo1002热能工程压力变送器',
subTitle: '乐清市柳市艾普乐传感器厂',
area: '北京',
date: '2023-06-12',
imgSrc: '',
imgSrcList: []
}, {
isGood: false,
isHot: true,
isStore: false,
title: 'wiwo1002热能工程压力变送器',
subTitle: '乐清市柳市艾普乐传感器厂',
area: '北京',
date: '2023-06-12',
imgSrc: '',
imgSrcList: []
}, {
isGood: false,
isHot: false,
isStore: true,
title: 'wiwo1002热能工程压力变送器',
subTitle: '乐清市柳市艾普乐传感器厂',
area: '北京',
date: '2023-06-12',
imgSrc: '',
imgSrcList: []
}, {
isGood: false,
isHot: true,
isStore: false,
title: 'wiwo1002热能工程压力变送器',
subTitle: '乐清市柳市艾普乐传感器厂',
area: '北京',
date: '2023-06-12',
imgSrc: '',
imgSrcList: []
}, {
isGood: false,
isHot: false,
isStore: false,
title: 'wiwo1002热能工程压力变送器',
subTitle: '乐清市柳市艾普乐传感器厂',
area: '北京',
date: '2023-06-12',
imgSrc: '',
imgSrcList: []
}, {
isGood: true,
isHot: false,
isStore: false,
title: 'wiwo1002热能工程压力变送器',
subTitle: '乐清市柳市艾普乐传感器厂',
area: '北京',
date: '2023-06-12',
imgSrc: '',
imgSrcList: []
}, {
isGood: false,
isHot: false,
isStore: false,
title: 'wiwo1002热能工程压力变送器',
subTitle: '乐清市柳市艾普乐传感器厂',
area: '北京',
date: '2023-06-12',
imgSrc: '',
imgSrcList: []
}
],
throttle: null, // 节流器
throttleTime: 300
}
},
mounted() {
this.$nextTick(() => {
})
},
methods: {
setQuertType(type) {
if (type === this.query.type) {
this.query.sort = !this.query.sort
} else {
this.query.type = type
this.query.sort = false
}
},
// 点击询价
inquiry(item, type) {
console.log(item, type)
this.$refs.inquiryView.initView(item.id, type)
},
// 点击收藏
storeShowcase(item, type) {
item.isStore = !item.isStore
this.$message.warning({
message: `您${item.isStore ? '' : '已取消'}收藏了该产品!`
})
console.log(item, type)
},
// 跳转到详情
goToDetails(item, path) {
if (item) {
this.$router.push({ path: `${path}/${item.id || 123}` })
} else {
this.$router.push({ path: `${path}` })
}
},
pageChange(e) {
this.page = e
this.loadData()
},
sizeChange(e) {
this.page = 1
this.pageSize = e
this.loadData()
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.touch {
cursor:pointer;
}
.clear {
clear: both
}
.inline-block {
display: inline-block;
}
.ellipsis {
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;
-webkit-line-clamp: 2;
text-overflow: ellipsis;
}
.head-box {
width: 100vw;
top: 0;
position: fixed;
background: none repeat scroll 0 0 white;
z-index: 999;
box-shadow: 0px 3px 7px 0px rgba(0,0,0,0.2);
.head-box-top {
display: flex;
justify-content: space-evenly;
align-items: center;
.top-call {
height: 80px;
padding-top: 15px;
}
}
}
.content-box {
min-height: 70vh;
margin-top: 94px;
font-family: Source Han Sans CN;
user-select: none;
.page-title {
margin-top: 20px;
padding: 0 20px;
font-size: 26px;
font-weight: bold;
color: #333333;
}
.box-card-s {
display: inline-block;
position: relative;
padding: 10px;
margin: 12px;
width: 230px;
background: #FFFFFF;
border: 1px solid rgba(0,0,0,0.12);
box-shadow: 1px 2px 8px 0 rgba(0,0,0,0.12);
border-radius: 10px;
.title {
width: 180px;
padding: 2px 0;
font-size: 15px;
color: #333333;
overflow:hidden;
white-space: nowrap;
text-overflow: ellipsis;
-o-text-overflow:ellipsis;
}
.title:hover {
font-weight: 600;
}
.subTitle {
width: 200px;
padding: 2px 0;
font-size: 13px;
color: #1961C5;
overflow:hidden;
white-space: nowrap;
text-overflow: ellipsis;
-o-text-overflow:ellipsis;
}
.date {
padding: 2px 10px;
font-size: 17px;
color: #999999;
}
.stamp {
border-style: none;
position: absolute;
z-index: 99;
}
}
}
.search-box {
padding-top: 12px;
width: 100%;
font-family: Source Han Sans CN;
font-weight: 400;
color: #666666;
user-select: none;
.search-item {
width: 100%;
display: inline-block;
padding: 8px 20px;
background: #F7F7F7;
border: 1px solid rgba(0,0,0,0.12);
overflow:hidden;
white-space: nowrap;
text-overflow: ellipsis;
-o-text-overflow:ellipsis;
.label:hover {
font-weight: 600;
}
.btn {
width: 74px;
padding: 3px;
margin-left: 12px;
display: inline-block;
background: #1961C5;
border-radius: 6px;
color: white;
text-align: center;
opacity: 0.7;
}
.btn:hover {
opacity: 1;
}
}
.area-title {
height: 62px;
background: #F7F7F7;
border: 1px solid rgba(0,0,0,0.12);
text-align: center;
line-height: 60px;
}
.area_item {
height: 30px;
padding: 6px 12px;
display: inline-block;
}
.area_item:hover {
font-weight: 600;
}
.active {
color: #1961C5;
}
.search-tools {
width: 100%;
.btn{
width: 76%;
height: 38px;
border: 2px solid #1961C5;
border-radius: 8px;
background: #1961C5;
font-family: Source Han Sans CN;
font-weight: 400;
font-size: 21px;
color: #ffffff;
opacity: 0.7;
}
.btn:hover {
opacity: 1;
}
>>>.el-input__inner {
height: 38px;
border: 2px solid #1961C5;
border-radius: 8px;
font-family: Source Han Sans CN;
font-weight: 400;
font-size: 18px;
color: #333333;
opacity: 0.7;
}
>>>.el-input__inner:hover {
opacity: 1;
}
}
.search-keyword {
padding: 5px 0;
font-family: Source Han Sans CN;
font-weight: 400;
font-size: 14px;
text-align: left;
.label {
padding: 1px 15px 1px;
color: #333333;
cursor:pointer;
user-select: none;
}
.label:hover {
color: #1961C5;
}
}
}
.line-btn {
display: flex;
justify-content: center;
font-family: Source Han Sans CN;
font-weight: 400;
.btn-o {
margin: 0 25px;
width: 360px;
padding: 6px 10px;
background: #F7601A;
box-shadow: 0 3px 6px 0 rgba(0,0,0,0.2);
text-align: center;
border: 1px solid transparent;
font-size: 22px;
color: #FFFFFF;
cursor:pointer;
user-select: none;
}
.btn-o:hover {
border: 1px solid rgba(30, 144, 255, 0.8);
color: #1482f0;
}
.btn-l {
margin: 0 25px;
width: 360px;
padding: 10px;
background: #1961C5;
box-shadow: 0 3px 6px 0 rgba(0,0,0,0.2);
text-align: center;
border: 1px solid transparent;
font-size: 22px;
color: #FFFFFF;
cursor:pointer;
user-select: none;
}
.btn-l:hover {
border: 1px solid rgba(0,0,0,0.3);
color: #F7601A;
}
.btn-b {
margin: 0 10px;
width: 168px;
padding: 6px;
background: #EFF6FF;
border: 1px solid transparent;
box-shadow: 0 1px 2px 0 rgba(0,0,0,0.2);
text-align: center;
font-size: 20px;
color: #1961C5;
cursor:pointer;
user-select: none;
}
.btn-b:hover {
border: 1px solid rgba(30, 144, 255, 0.9);
}
.active {
color: #FFFFFF;
font-weight: 400;
background: #1961C5;
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment