hookehuyr

产品面包屑导航功能新增

1 <!-- 1 <!--
2 * @Date: 2024-09-26 13:42:11 2 * @Date: 2024-09-26 13:42:11
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-10-31 13:50:28 4 + * @LastEditTime: 2024-11-01 17:26:50
5 * @FilePath: /hager/src/components/common/hagerHeader.vue 5 * @FilePath: /hager/src/components/common/hagerHeader.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
72 <div class="product-left-wrapper"> 72 <div class="product-left-wrapper">
73 <div :class="['product-left-item', p_index === index ? 'active' : '']" v-for="(item, index) in product_menu" :key="index" @click="onClick(item, index)"> 73 <div :class="['product-left-item', p_index === index ? 'active' : '']" v-for="(item, index) in product_menu" :key="index" @click="onClick(item, index)">
74 <div class="icon-text"> 74 <div class="icon-text">
75 - <el-image style="width: auto; height: 1.65rem" :src="item.icon" fit="fit"></el-image> 75 + <el-image style="width: auto; height: 1.45rem" :src="item.icon" fit="fit"></el-image>
76 &nbsp; 76 &nbsp;
77 {{ item.category_name }} 77 {{ item.category_name }}
78 </div> 78 </div>
...@@ -334,6 +334,7 @@ export default { ...@@ -334,6 +334,7 @@ export default {
334 path: '/product/detail', 334 path: '/product/detail',
335 query: { 335 query: {
336 id: item.id, 336 id: item.id,
337 + category_id: item.category_id,
337 timestamp: Date.now() 338 timestamp: Date.now()
338 } 339 }
339 }); 340 });
...@@ -441,6 +442,7 @@ export default { ...@@ -441,6 +442,7 @@ export default {
441 color: #F56400; 442 color: #F56400;
442 } 443 }
443 .icon-text { 444 .icon-text {
445 + font-size: 0.95rem;
444 display: flex; 446 display: flex;
445 align-items: center; 447 align-items: center;
446 } 448 }
...@@ -486,6 +488,7 @@ export default { ...@@ -486,6 +488,7 @@ export default {
486 flex-basis: calc(33.33%); 488 flex-basis: calc(33.33%);
487 margin-bottom: 10px; 489 margin-bottom: 10px;
488 .header-text { 490 .header-text {
491 + font-size: 0.95rem;
489 margin-bottom: 0.25rem; 492 margin-bottom: 0.25rem;
490 color: @text-color; 493 color: @text-color;
491 &:hover { 494 &:hover {
...@@ -494,6 +497,7 @@ export default { ...@@ -494,6 +497,7 @@ export default {
494 } 497 }
495 } 498 }
496 .item-text { 499 .item-text {
500 + font-size: 0.95rem;
497 line-height: 1.75; 501 line-height: 1.75;
498 color: @secondary-text-color; 502 color: @secondary-text-color;
499 &:hover { 503 &:hover {
......
1 <!-- 1 <!--
2 * @Date: 2024-08-27 10:06:30 2 * @Date: 2024-08-27 10:06:30
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-10-30 11:28:24 4 + * @LastEditTime: 2024-11-01 17:31:10
5 * @FilePath: /hager/src/views/index.vue 5 * @FilePath: /hager/src/views/index.vue
6 * @Description: 首页 6 * @Description: 首页
7 --> 7 -->
...@@ -329,7 +329,8 @@ export default { ...@@ -329,7 +329,8 @@ export default {
329 this.$router.push({ 329 this.$router.push({
330 path: '/product/index', 330 path: '/product/index',
331 query: { 331 query: {
332 - id: v.first_child_id, 332 + // id: v.first_child_id,
333 + id: v.id,
333 timestamp: Date.now() 334 timestamp: Date.now()
334 } 335 }
335 }); 336 });
......
1 <!-- 1 <!--
2 * @Date: 2024-09-29 14:26:41 2 * @Date: 2024-09-29 14:26:41
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-11-01 08:36:00 4 + * @LastEditTime: 2024-11-01 17:50:42
5 * @FilePath: /hager/src/views/product/detail.vue 5 * @FilePath: /hager/src/views/product/detail.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -11,8 +11,9 @@ ...@@ -11,8 +11,9 @@
11 <div style="margin-top: 1.5rem;"> 11 <div style="margin-top: 1.5rem;">
12 <el-breadcrumb separator="/"> 12 <el-breadcrumb separator="/">
13 <el-breadcrumb-item v-if="!is_xs">所有产品</el-breadcrumb-item> 13 <el-breadcrumb-item v-if="!is_xs">所有产品</el-breadcrumb-item>
14 - <el-breadcrumb-item>{{ info.parent_name }}</el-breadcrumb-item> 14 + <el-breadcrumb-item :to="{ path: productPath }">{{ info.parent_name }}</el-breadcrumb-item>
15 - <el-breadcrumb-item>{{ info.category_name }}</el-breadcrumb-item> 15 + <!-- <el-breadcrumb-item>{{ info.parent_name }}</el-breadcrumb-item> -->
16 + <el-breadcrumb-item :to="{ path: categoryPath }">{{ info.category_name }}</el-breadcrumb-item>
16 <el-breadcrumb-item>{{ info.product_name }}</el-breadcrumb-item> 17 <el-breadcrumb-item>{{ info.product_name }}</el-breadcrumb-item>
17 </el-breadcrumb> 18 </el-breadcrumb>
18 </div> 19 </div>
...@@ -44,7 +45,12 @@ ...@@ -44,7 +45,12 @@
44 <div :class="['product-advantage', is_xs ? 'xs' : '']"> 45 <div :class="['product-advantage', is_xs ? 'xs' : '']">
45 <div :class="['item', is_xs ? 'xs' : '']" v-for="(item, index) in product_advantages" :key="index"> 46 <div :class="['item', is_xs ? 'xs' : '']" v-for="(item, index) in product_advantages" :key="index">
46 <el-row :gutter="0" v-for="(x, idx) in item" :key="idx"> 47 <el-row :gutter="0" v-for="(x, idx) in item" :key="idx">
47 - <el-col :span="24">{{ x }}</el-col> 48 + <el-col :span="24" v-if="x">
49 + <!-- <div class="item-content">
50 + <span class="item-icon">·</span>{{ x }}
51 + </div> -->
52 + <div class="item-content" v-html="x"></div>
53 + </el-col>
48 </el-row> 54 </el-row>
49 </div> 55 </div>
50 </div> 56 </div>
...@@ -167,6 +173,12 @@ export default { ...@@ -167,6 +173,12 @@ export default {
167 }); 173 });
168 return sum; 174 return sum;
169 }, 175 },
176 + productPath () {
177 + return `/product/index?id=${this.info.parent_id}&timestamp=${Date.now()}`;
178 + },
179 + categoryPath () {
180 + return `/product/index?id=${this.$route.query.category_id}&timestamp=${Date.now()}`;
181 + },
170 }, 182 },
171 async mounted () { 183 async mounted () {
172 this.getInfo(); 184 this.getInfo();
...@@ -199,7 +211,7 @@ export default { ...@@ -199,7 +211,7 @@ export default {
199 }, { 211 }, {
200 id: 3, 212 id: 3,
201 type: 'shuomingshu', 213 type: 'shuomingshu',
202 - name: '产品说明书', 214 + name: '产品手册',
203 show: false, 215 show: false,
204 list: [], 216 list: [],
205 checked_sum: 0, 217 checked_sum: 0,
...@@ -375,8 +387,7 @@ export default { ...@@ -375,8 +387,7 @@ export default {
375 } 387 }
376 .product-detail-info { 388 .product-detail-info {
377 .product-title { 389 .product-title {
378 - font-size: 2rem; 390 + font-size: 1.5rem;
379 - font-weight: bold;
380 color: @secondary-color; 391 color: @secondary-color;
381 } 392 }
382 .product-sub { 393 .product-sub {
...@@ -404,11 +415,20 @@ export default { ...@@ -404,11 +415,20 @@ export default {
404 padding-top: 1rem; 415 padding-top: 1rem;
405 background-color: #f0f0f0; 416 background-color: #f0f0f0;
406 border-top: 4px solid @primary-color; 417 border-top: 4px solid @primary-color;
407 - line-height: 2; 418 + line-height: 1.25;
408 &.xs { 419 &.xs {
409 padding-bottom: 1rem; 420 padding-bottom: 1rem;
410 width: 100%; 421 width: 100%;
411 } 422 }
423 + .item-content {
424 + display: flex;
425 + align-items: center;
426 + line-height: 2;
427 + .item-icon {
428 + color: @primary-color;
429 + font-size: 2rem;
430 + }
431 + }
412 } 432 }
413 &.xs { 433 &.xs {
414 display: block; 434 display: block;
...@@ -572,5 +592,10 @@ export default { ...@@ -572,5 +592,10 @@ export default {
572 } 592 }
573 } 593 }
574 } 594 }
595 +
596 + :deep(.el-breadcrumb__inner a:hover, .el-breadcrumb__inner.is-link:hover) {
597 + color: @primary-color;
598 + cursor: pointer;
599 + }
575 } 600 }
576 </style> 601 </style>
......
1 <!-- 1 <!--
2 * @Date: 2024-09-27 16:53:09 2 * @Date: 2024-09-27 16:53:09
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-10-29 14:58:08 4 + * @LastEditTime: 2024-11-01 17:43:50
5 * @FilePath: /hager/src/views/product/index.vue 5 * @FilePath: /hager/src/views/product/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
11 <div v-if="!is_search" style="margin-top: 1.5rem;"> 11 <div v-if="!is_search" style="margin-top: 1.5rem;">
12 <el-breadcrumb separator="/"> 12 <el-breadcrumb separator="/">
13 <el-breadcrumb-item>所有产品</el-breadcrumb-item> 13 <el-breadcrumb-item>所有产品</el-breadcrumb-item>
14 - <el-breadcrumb-item>{{ parent_name }}</el-breadcrumb-item> 14 + <el-breadcrumb-item v-if="parent_name" :to="{ path: productPath }">{{ parent_name }}</el-breadcrumb-item>
15 <el-breadcrumb-item>{{ category_name }}</el-breadcrumb-item> 15 <el-breadcrumb-item>{{ category_name }}</el-breadcrumb-item>
16 </el-breadcrumb> 16 </el-breadcrumb>
17 </div> 17 </div>
...@@ -68,6 +68,7 @@ export default { ...@@ -68,6 +68,7 @@ export default {
68 search_keyword: '', 68 search_keyword: '',
69 keyword: '', 69 keyword: '',
70 activeNames: [], 70 activeNames: [],
71 + cate_id: '',
71 parent_name: '', 72 parent_name: '',
72 category_name: '', 73 category_name: '',
73 category_name_en: '', 74 category_name_en: '',
...@@ -80,6 +81,11 @@ export default { ...@@ -80,6 +81,11 @@ export default {
80 async mounted () { 81 async mounted () {
81 this.getMain(); 82 this.getMain();
82 }, 83 },
84 + computed: {
85 + productPath () {
86 + return `/product/index?id=${this.cate_id}&timestamp=${Date.now()}`;
87 + },
88 + },
83 watch: { 89 watch: {
84 // 监听路由参数变化时,更新输入框的值 90 // 监听路由参数变化时,更新输入框的值
85 '$route.query.id' (val, old) { 91 '$route.query.id' (val, old) {
...@@ -100,7 +106,8 @@ export default { ...@@ -100,7 +106,8 @@ export default {
100 this.$router.push({ 106 this.$router.push({
101 path: '/product/detail', 107 path: '/product/detail',
102 query: { 108 query: {
103 - id: v.id 109 + id: v.id,
110 + category_id: this.$route.query.id
104 } 111 }
105 }); 112 });
106 }, 113 },
...@@ -114,14 +121,15 @@ export default { ...@@ -114,14 +121,15 @@ export default {
114 this.product_list = info.list; 121 this.product_list = info.list;
115 this.search_keyword = ''; 122 this.search_keyword = '';
116 // 获取当前类别的内容 123 // 获取当前类别的内容
117 - this.getCurrentCate(info.category_parent); 124 + this.cate_id = info.category_parent ? info.category_parent : info.id; // 同一个值,在不同层级下名字不一样
125 + this.getCurrentCate(this.cate_id);
118 } 126 }
119 }, 127 },
120 - async getCurrentCate (category_parent) { 128 + async getCurrentCate (cate_id) {
121 const { code, data } = await getProductCateAPI(); 129 const { code, data } = await getProductCateAPI();
122 if (code) { 130 if (code) {
123 data.forEach((item) => { 131 data.forEach((item) => {
124 - if (item.id === category_parent) { 132 + if (item.id === cate_id) {
125 this.cate_list = item.children; 133 this.cate_list = item.children;
126 } 134 }
127 }) 135 })
......
1 <!-- 1 <!--
2 * @Date: 2024-10-20 16:57:48 2 * @Date: 2024-10-20 16:57:48
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-10-28 16:10:58 4 + * @LastEditTime: 2024-11-01 13:51:06
5 * @FilePath: /hager/src/views/search.vue 5 * @FilePath: /hager/src/views/search.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -248,7 +248,9 @@ export default { ...@@ -248,7 +248,9 @@ export default {
248 this.$router.push({ 248 this.$router.push({
249 path: '/product/detail', 249 path: '/product/detail',
250 query: { 250 query: {
251 - id: v.id 251 + id: v.id,
252 + category_id: v.category_id,
253 + timestamp: Date.now()
252 } 254 }
253 }); 255 });
254 }, 256 },
......