hookehuyr

解决方案新增二级切换功能

1 <!-- 1 <!--
2 * @Date: 2024-09-29 15:49:27 2 * @Date: 2024-09-29 15:49:27
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-12-03 16:18:50 4 + * @LastEditTime: 2024-12-03 17:46:50
5 * @FilePath: /hager/src/views/solution/detail.vue 5 * @FilePath: /hager/src/views/solution/detail.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -15,6 +15,13 @@ ...@@ -15,6 +15,13 @@
15 </div> 15 </div>
16 </div> 16 </div>
17 </hager-box> 17 </hager-box>
18 + <hager-box v-if="case_list.length > 1">
19 + <div class="hager-solution-detail-nav">
20 + <div class="nav" v-for="(item, index) in case_list" :key="index">
21 + <div @click="changeCase(item, index)" :class="[current_id === item.id ? 'current-nav' : '', 'detail-nav']">{{ item.category_name }}</div>
22 + </div>
23 + </div>
24 + </hager-box>
18 <hager-box v-if="!is_xs" class="box-n"> 25 <hager-box v-if="!is_xs" class="box-n">
19 <el-row :gutter="0"> 26 <el-row :gutter="0">
20 <el-col :span="12" style="height: 25rem;"> 27 <el-col :span="12" style="height: 25rem;">
...@@ -181,6 +188,8 @@ export default { ...@@ -181,6 +188,8 @@ export default {
181 reach_product_end: false, 188 reach_product_end: false,
182 SuccessSlidesPerView: 4, 189 SuccessSlidesPerView: 4,
183 productSlidesPerView: 4, 190 productSlidesPerView: 4,
191 + case_list: [],
192 + current_id: '',
184 } 193 }
185 }, 194 },
186 async mounted () { 195 async mounted () {
...@@ -189,8 +198,10 @@ export default { ...@@ -189,8 +198,10 @@ export default {
189 this.case_info = data; 198 this.case_info = data;
190 this.case_banner = data.file?.banner ? data.file?.banner[0] : 'https://cdn.ipadbiz.cn/hager/banner/banner08.png'; 199 this.case_banner = data.file?.banner ? data.file?.banner[0] : 'https://cdn.ipadbiz.cn/hager/banner/banner08.png';
191 this.case_img = data.file?.img ? data.file?.img : ['https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg']; 200 this.case_img = data.file?.img ? data.file?.img : ['https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'];
192 - this.success_data_list = data.list; 201 + this.case_list = data.list;
193 - this.product_list = data.product; 202 + this.current_id = this.case_list[0]['id'];
203 + this.success_data_list = this.case_list[0].list ?? [];
204 + this.product_list = this.case_list[0].product ?? [];
194 } 205 }
195 this.$nextTick(() => { 206 this.$nextTick(() => {
196 this.$refs.myProductSwiper.$swiper?.on('breakpoint', (swiper) => { 207 this.$refs.myProductSwiper.$swiper?.on('breakpoint', (swiper) => {
...@@ -271,6 +282,15 @@ export default { ...@@ -271,6 +282,15 @@ export default {
271 this.reach_success_end = false; 282 this.reach_success_end = false;
272 } 283 }
273 }, 284 },
285 + changeCase (v, idx) {
286 + this.current_id = this.case_list[idx]['id'];
287 + this.success_data_list = this.case_list[idx].list ?? [];
288 + this.product_list = this.case_list[idx].product ?? [];
289 + this.activeSuccessIndex = 0
290 + this.activeProductIndex = 0
291 + this.reach_product_end = false
292 + this.reach_success_end = false
293 + }
274 } 294 }
275 } 295 }
276 </script> 296 </script>
...@@ -393,11 +413,11 @@ export default { ...@@ -393,11 +413,11 @@ export default {
393 413
394 .card-box { 414 .card-box {
395 .card-image-wrapper { 415 .card-image-wrapper {
396 - background-color: #F3F3F3; 416 + background-color: #FFF;
397 border-radius: 5px; 417 border-radius: 5px;
398 transition: transform 0.3s ease-in-out; 418 transition: transform 0.3s ease-in-out;
419 + border: 1px solid rgba(0, 0, 0, 0.1);
399 &:hover { 420 &:hover {
400 - transform: scale(1.05);
401 // box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); 421 // box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
402 cursor: pointer; 422 cursor: pointer;
403 } 423 }
...@@ -417,5 +437,42 @@ export default { ...@@ -417,5 +437,42 @@ export default {
417 } 437 }
418 } 438 }
419 } 439 }
440 +
441 + .hager-solution-detail-nav {
442 + background-color: #F3F3F3;
443 + display: flex;
444 + align-items: center;
445 + justify-content:space-around;
446 + margin-top: 2rem;
447 + .nav {
448 + flex: 1; text-align: center; padding: 0.75rem 0;
449 + position: relative;
450 + &:not(:last-child) {
451 + &::after {
452 + content: '|';
453 + position: absolute;
454 + right: 0rem;
455 + top: 50%;
456 + transform: translateY(-50%);
457 + color: #adadad;
458 + font-size: 1rem;
459 + }
460 + }
461 + }
462 + .detail-nav {
463 + display: inline;
464 + color: @text-color;
465 + font-size: 1.05rem;
466 + padding: 0.7rem 0;
467 + &:hover {
468 + cursor: pointer;
469 + }
470 + }
471 + .current-nav {
472 + color: @secondary-color;
473 + border-bottom: 2px solid #ED6C00;
474 + font-weight: bold;
475 + }
476 + }
420 } 477 }
421 </style> 478 </style>
......