hookehuyr

产品详情页接口相关页面联调

1 /* 1 /*
2 * @Date: 2024-09-26 13:36:06 2 * @Date: 2024-09-26 13:36:06
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-10-23 13:47:59 4 + * @LastEditTime: 2024-10-23 16:23:08
5 * @FilePath: /hager/src/api/hager.js 5 * @FilePath: /hager/src/api/hager.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
...@@ -13,6 +13,7 @@ const Api = { ...@@ -13,6 +13,7 @@ const Api = {
13 NEWS_DETAIL: '/srv/?a=detail&type=news', 13 NEWS_DETAIL: '/srv/?a=detail&type=news',
14 HOME: '/srv/?a=home', 14 HOME: '/srv/?a=home',
15 PRODUCT_CATE: '/srv/?a=cate&type=product', 15 PRODUCT_CATE: '/srv/?a=cate&type=product',
16 + PRODUCT_INFO: '/srv/?a=detail&type=product',
16 }; 17 };
17 18
18 export const honorAPI = (params) => fn(fetch.get(Api.HONOR, params)); 19 export const honorAPI = (params) => fn(fetch.get(Api.HONOR, params));
...@@ -20,3 +21,4 @@ export const newsAPI = (params) => fn(fetch.get(Api.NEWS, params)); ...@@ -20,3 +21,4 @@ export const newsAPI = (params) => fn(fetch.get(Api.NEWS, params));
20 export const getNewsDetailAPI = (params) => fn(fetch.get(Api.NEWS_DETAIL, params)); 21 export const getNewsDetailAPI = (params) => fn(fetch.get(Api.NEWS_DETAIL, params));
21 export const getHomeAPI = (params) => fn(fetch.get(Api.HOME, params)); 22 export const getHomeAPI = (params) => fn(fetch.get(Api.HOME, params));
22 export const getProductCateAPI = (params) => fn(fetch.get(Api.PRODUCT_CATE, params)); 23 export const getProductCateAPI = (params) => fn(fetch.get(Api.PRODUCT_CATE, params));
24 +export const getProductInfoAPI = (params) => fn(fetch.get(Api.PRODUCT_INFO, params));
......
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-23 17:05:50 4 + * @LastEditTime: 2024-10-23 17:08:32
5 * @FilePath: /hager/src/components/common/hagerHeader.vue 5 * @FilePath: /hager/src/components/common/hagerHeader.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -222,7 +222,6 @@ export default { ...@@ -222,7 +222,6 @@ export default {
222 for (let i = 0; i < product.list?.length; i += maxLength) { 222 for (let i = 0; i < product.list?.length; i += maxLength) {
223 listChunks.push(product.list.slice(i, i + maxLength)); 223 listChunks.push(product.list.slice(i, i + maxLength));
224 } 224 }
225 - console.warn(listChunks);
226 225
227 // 第一个块保留原有的 name,后续块 name 设为空 226 // 第一个块保留原有的 name,后续块 name 设为空
228 listChunks.forEach((chunk, index) => { 227 listChunks.forEach((chunk, index) => {
...@@ -242,7 +241,6 @@ export default { ...@@ -242,7 +241,6 @@ export default {
242 }); 241 });
243 } 242 }
244 }); 243 });
245 - console.warn('res', result);
246 244
247 return result; 245 return result;
248 }, 246 },
......
1 <!-- 1 <!--
2 * @Date: 2024-09-27 19:49:03 2 * @Date: 2024-09-27 19:49:03
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-09-30 10:04:50 4 + * @LastEditTime: 2024-10-23 17:25:41
5 * @FilePath: /hager/src/components/hagerCarousel.vue 5 * @FilePath: /hager/src/components/hagerCarousel.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
30 </div> 30 </div>
31 31
32 <!-- 右边大图区域 --> 32 <!-- 右边大图区域 -->
33 - <div class="main-image" :class="{ 'fade-out': isTransitioning, 'fade-in': !isTransitioning }"> 33 + <div class="main-image" :class="{ 'fade-out': isTransitioning, 'fade-in': !isTransitioning }" :style="{ backgroundImage: `url(${images[selectedImage]})`}">
34 - <img :src="images[selectedImage]" alt="main image"> 34 + <!-- <img :src="images[selectedImage]" alt="main image"> -->
35 </div> 35 </div>
36 </div> 36 </div>
37 </div> 37 </div>
...@@ -163,18 +163,22 @@ export default { ...@@ -163,18 +163,22 @@ export default {
163 } 163 }
164 164
165 .main-image { 165 .main-image {
166 - width: 300px; 166 + width: 18rem;
167 - height: 300px; 167 + height: 18rem;
168 position: relative; 168 position: relative;
169 transition: opacity 0.5s ease-in-out; /* 大图切换时的淡入淡出效果 */ 169 transition: opacity 0.5s ease-in-out; /* 大图切换时的淡入淡出效果 */
170 opacity: 1; 170 opacity: 1;
171 + background-position: center;
172 + background-size: 80%;
173 + background-repeat: no-repeat;
171 } 174 }
172 175
173 .main-image img { 176 .main-image img {
174 - width: 100%; 177 + width: 80%;
175 - height: 100%; 178 + height: 80%;
176 object-fit: cover; 179 object-fit: cover;
177 position: absolute; 180 position: absolute;
181 + top: 20%;
178 } 182 }
179 183
180 .main-image.fade-out { 184 .main-image.fade-out {
......
1 <!-- 1 <!--
2 * @Date: 2024-10-10 10:37:16 2 * @Date: 2024-10-10 10:37:16
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-10-23 14:28:22 4 + * @LastEditTime: 2024-10-23 16:39:02
5 * @FilePath: /hager/src/components/hagerMenu.vue 5 * @FilePath: /hager/src/components/hagerMenu.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
27 :class="['menu-label', activeMenu === item.id ? 'active' : '']" 27 :class="['menu-label', activeMenu === item.id ? 'active' : '']"
28 > 28 >
29 <div> 29 <div>
30 - <el-image style="width: auto; height: 1rem" :src="item.cover" fit="fit"></el-image> 30 + <el-image style="width: auto; height: 1rem" :src="item.icon" fit="fit"></el-image>
31 {{ item.category_name }} 31 {{ item.category_name }}
32 </div> 32 </div>
33 <div> 33 <div>
......
1 /* 1 /*
2 * @Date: 2024-08-26 10:42:15 2 * @Date: 2024-08-26 10:42:15
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-10-21 09:59:04 4 + * @LastEditTime: 2024-10-23 16:46:46
5 * @FilePath: /hager/src/route.js 5 * @FilePath: /hager/src/route.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
...@@ -15,15 +15,6 @@ export default [{ ...@@ -15,15 +15,6 @@ export default [{
15 }, 15 },
16 children: [] 16 children: []
17 }, { 17 }, {
18 - path: '/product/category',
19 - name: '产品类别',
20 - component: () => import('@/views/product/category'),
21 - meta: {
22 - title: '海格电器',
23 - tag: 'product'
24 - },
25 - children: []
26 -}, {
27 path: '/product/index', 18 path: '/product/index',
28 name: '二级目录', 19 name: '二级目录',
29 component: () => import('@/views/product/index'), 20 component: () => import('@/views/product/index'),
......
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-23 15:58:51 4 + * @LastEditTime: 2024-10-23 16:32:21
5 * @FilePath: /hager/src/views/index.vue 5 * @FilePath: /hager/src/views/index.vue
6 * @Description: 首页 6 * @Description: 首页
7 --> 7 -->
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
110 <!-- <div v-if="product_list.length <= productSlidesPerView" class="more-box" style="margin-top: 2rem;"> 110 <!-- <div v-if="product_list.length <= productSlidesPerView" class="more-box" style="margin-top: 2rem;">
111 <hager-more></hager-more> 111 <hager-more></hager-more>
112 </div> --> 112 </div> -->
113 - <div v-if="product_list.length > productSlidesPerView || is_xs" class="hager-product-center-more xs"> 113 + <div v-if="product_list.length > productSlidesPerView || is_xs || !isEnd" class="hager-product-center-more xs">
114 <!-- <hager-more></hager-more> --> 114 <!-- <hager-more></hager-more> -->
115 <div class="xs-control"> 115 <div class="xs-control">
116 <div> 116 <div>
...@@ -306,6 +306,7 @@ export default { ...@@ -306,6 +306,7 @@ export default {
306 reach_solution_end: false, 306 reach_solution_end: false,
307 reach_product_end: false, 307 reach_product_end: false,
308 productSlidesPerView: 5, 308 productSlidesPerView: 5,
309 + isEnd: true,
309 } 310 }
310 }, 311 },
311 async mounted () { 312 async mounted () {
...@@ -314,10 +315,11 @@ export default { ...@@ -314,10 +315,11 @@ export default {
314 console.warn(data); 315 console.warn(data);
315 this.product_list = data.product; 316 this.product_list = data.product;
316 } 317 }
318 + this.isEnd = this.$refs.myProductSwiper.$swiper.isEnd; // 是否全部显示出来
317 this.$nextTick(() => { 319 this.$nextTick(() => {
318 this.$refs.myProductSwiper.$swiper?.on('breakpoint', (swiper) => { 320 this.$refs.myProductSwiper.$swiper?.on('breakpoint', (swiper) => {
319 // breakpoint时 显示的条数 321 // breakpoint时 显示的条数
320 - this.productSlidesPerView = swiper.slidesPerView 322 + this.productSlidesPerView = swiper.slidesPerView;
321 }); 323 });
322 }); 324 });
323 }, 325 },
......
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-10-23 10:04:04 4 + * @LastEditTime: 2024-10-23 18:29:36
5 * @FilePath: /hager/src/views/product/detail.vue 5 * @FilePath: /hager/src/views/product/detail.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -11,40 +11,30 @@ ...@@ -11,40 +11,30 @@
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>配电产品</el-breadcrumb-item> 14 + <el-breadcrumb-item>{{ info.parent_name }}</el-breadcrumb-item>
15 - <el-breadcrumb-item>低压主配电</el-breadcrumb-item> 15 + <el-breadcrumb-item>{{ info.category_name }}</el-breadcrumb-item>
16 - <el-breadcrumb-item>HW+系列空气断路器</el-breadcrumb-item> 16 + <el-breadcrumb-item>{{ info.product_name }}</el-breadcrumb-item>
17 </el-breadcrumb> 17 </el-breadcrumb>
18 </div> 18 </div>
19 </hager-box> 19 </hager-box>
20 <hager-box class="box-n"> 20 <hager-box class="box-n">
21 <el-row v-if="!is_xs" :gutter="10" style="margin-bottom: 3rem;"> 21 <el-row v-if="!is_xs" :gutter="10" style="margin-bottom: 3rem;">
22 - <el-col :span="10"> 22 + <el-col :span="8">
23 - <hager-carousel :images="images"></hager-carousel> 23 + <hager-carousel :images="info_images"></hager-carousel>
24 </el-col> 24 </el-col>
25 - <el-col :span="14"> 25 + <el-col :span="16">
26 <div class="product-detail-info"> 26 <div class="product-detail-info">
27 - <div class="product-title" style="">HW+系列空气断路器</div> 27 + <div class="product-title" style="">{{ info.product_name }}</div>
28 - <div class="product-sub" style="margin: 1rem 0 2rem;">全新智能型hw+系列空气断路器,可搭载集通讯、自诊断、功能编程、维护预警、远程监控、测量、报警、保护功能于一体的Sentinel Energy控制器。</div> 28 + <div class="product-sub" style="margin: 1rem 0 2rem;" v-html="info.post_excerpt"></div>
29 - <ul class="product-info-list">
30 - <li>实现谐波测量,实时监测电能质量;</li>
31 - <li>图文显示多电量参数,系统状态一目了然;</li>
32 - <li>支持Modbus远程通讯协议,无线蓝牙连接等多种通讯方式,全方位提升客户的数字化体验。</li>
33 - </ul>
34 </div> 29 </div>
35 </el-col> 30 </el-col>
36 </el-row> 31 </el-row>
37 <div v-else> 32 <div v-else>
38 <div class="product-detail-info"> 33 <div class="product-detail-info">
39 - <div class="product-title" style="">HW+系列空气断路器</div> 34 + <div class="product-title" style="">{{ info.product_name }}</div>
40 - <div class="product-sub" style="margin: 1rem 0 2rem;">全新智能型hw+系列空气断路器,可搭载集通讯、自诊断、功能编程、维护预警、远程监控、测量、报警、保护功能于一体的Sentinel Energy控制器。</div> 35 + <div class="product-sub" style="margin: 1rem 0 2rem;" v-html="info.post_excerpt"></div>
41 - <ul class="product-info-list">
42 - <li>实现谐波测量,实时监测电能质量;</li>
43 - <li>图文显示多电量参数,系统状态一目了然;</li>
44 - <li>支持Modbus远程通讯协议,无线蓝牙连接等多种通讯方式,全方位提升客户的数字化体验。</li>
45 - </ul>
46 </div> 36 </div>
47 - <div v-for="(item, index) in images" :key="index" class="product-item-img"> 37 + <div v-for="(item, index) in info_images" :key="index" class="product-item-img">
48 <el-image style="height: 14rem;" :src="item" fit="cover"></el-image> 38 <el-image style="height: 14rem;" :src="item" fit="cover"></el-image>
49 </div> 39 </div>
50 </div> 40 </div>
...@@ -52,10 +42,9 @@ ...@@ -52,10 +42,9 @@
52 <hager-box class="box-2n"> 42 <hager-box class="box-2n">
53 <hager-h1 title="产品优势" sub="Product advantages"></hager-h1> 43 <hager-h1 title="产品优势" sub="Product advantages"></hager-h1>
54 <div :class="['product-advantage', is_xs ? 'xs' : '']"> 44 <div :class="['product-advantage', is_xs ? 'xs' : '']">
55 - <div :class="['item', is_xs ? 'xs' : '']" v-for="(item, index) in 3" :key="index"> 45 + <div :class="['item', is_xs ? 'xs' : '']" v-for="(item, index) in product_advantages" :key="index">
56 - <el-row :gutter="0" v-for="(item, index) in 5" :key="index"> 46 + <el-row :gutter="0" v-for="(x, idx) in item" :key="idx">
57 - <el-col :span="6">极致的分断能力:</el-col> 47 + <el-col :span="24">{{ x }}</el-col>
58 - <el-col :span="18">标配独立的故障指示触点、远程复位、ZSI保护功能</el-col>
59 </el-row> 48 </el-row>
60 </div> 49 </div>
61 </div> 50 </div>
...@@ -64,15 +53,21 @@ ...@@ -64,15 +53,21 @@
64 <hager-h1 title="产品资料" sub="Product Information"></hager-h1> 53 <hager-h1 title="产品资料" sub="Product Information"></hager-h1>
65 <div class="product-info"> 54 <div class="product-info">
66 <div class="info-control"> 55 <div class="info-control">
56 + <el-row :gutter="0">
57 + <el-col :span="is_xs ? 24 : 19">
67 <div :class="['control-left', is_xs ? 'xs' : '']"> 58 <div :class="['control-left', is_xs ? 'xs' : '']">
68 - <div :class="['button', is_xs ? 'xs' : '', is_active === 0 ? 'active' : '']" @click="onClick(0)">产品样本</div> 59 + <div v-if="product_sample" :class="['button', is_xs ? 'xs' : '', is_active === 0 ? 'active' : '']" @click="onClick(0, product_sample)">产品样本</div>
69 - <div :class="['button', is_xs ? 'xs' : '', is_active === 1 ? 'active' : '']" @click="onClick(1)">技术参数</div> 60 + <div v-if="technical_parameter" :class="['button', is_xs ? 'xs' : '', is_active === 1 ? 'active' : '']" @click="onClick(1, technical_parameter)">技术参数</div>
70 - <div :class="['button', is_xs ? 'xs' : '', is_active === 2 ? 'active' : '']" @click="onClick(2)">产品说明书</div> 61 + <div v-if="product_manual" :class="['button', is_xs ? 'xs' : '', is_active === 2 ? 'active' : '']" @click="onClick(2, product_manual)">产品说明书</div>
71 - <div :class="['button', is_xs ? 'xs' : '', is_active === 3 ? 'active' : '']" @click="onClick(3)">安装教程</div> 62 + <div v-if="installation_tutorial" :class="['button', is_xs ? 'xs' : '', is_active === 3 ? 'active' : '']" @click="onClick(3, installation_tutorial)">安装教程</div>
72 </div> 63 </div>
73 - <div v-if="!is_xs"> 64 + </el-col>
65 + <el-col v-if="!is_xs" :span="5">
66 + <div>
74 <div @click="goToDownload" :class="['button', is_download_checked ? 'active' : '']">发送到邮箱</div> 67 <div @click="goToDownload" :class="['button', is_download_checked ? 'active' : '']">发送到邮箱</div>
75 </div> 68 </div>
69 + </el-col>
70 + </el-row>
76 </div> 71 </div>
77 <div> 72 <div>
78 <div class="mini-download-wrapper" v-if="is_xs"> 73 <div class="mini-download-wrapper" v-if="is_xs">
...@@ -83,17 +78,34 @@ ...@@ -83,17 +78,34 @@
83 <div @click="goToDownload" :class="['button', is_download_checked ? 'active' : '']">发送到邮箱</div> 78 <div @click="goToDownload" :class="['button', is_download_checked ? 'active' : '']">发送到邮箱</div>
84 </div> 79 </div>
85 <div class="info-list" v-for="(item, index) in download_list" :key="index"> 80 <div class="info-list" v-for="(item, index) in download_list" :key="index">
81 + <el-row :gutter="0">
82 + <el-col :span="18">
86 <div class="info-list-title"> 83 <div class="info-list-title">
87 - <i v-if="item.checked" @click="item.checked = !item.checked" class="el-icon-folder-checked download-checked"></i> 84 + <el-row :gutter="0">
88 - <i v-else @click="item.checked = !item.checked" class="el-icon-folder download-unchecked"></i> 85 + <el-col :span="is_xs ? 4 : 2">
89 - <i class="el-icon-document" style="font-size: 1.25rem; margin-left: 1rem;"></i>&nbsp;&nbsp;{{ item.name }}&nbsp;&nbsp;{{ item.size }} 86 + <i v-if="item.checked" @click="checkItem(item)" class="el-icon-folder-checked download-checked"></i>
87 + <i v-else @click="checkItem(item)" class="el-icon-folder download-unchecked"></i>&nbsp;
88 + </el-col>
89 + <el-col :span="is_xs ? 20 : 22">
90 + <i class="el-icon-document" style="font-size: 1.5rem;"></i>
91 + {{ item.name }}{{ item.size }}
92 + </el-col>
93 + </el-row>
94 + <!-- <i v-if="item.checked" @click="checkItem(item)" class="el-icon-folder-checked download-checked"></i>
95 + <i v-else @click="checkItem(item)" class="el-icon-folder download-unchecked"></i>
96 + <i class="el-icon-document" style="font-size: 1.25rem; margin-left: 1rem;"></i>
97 + <p><span>{{ item.name }}</span><span>{{ item.size }}</span></p> -->
90 </div> 98 </div>
99 + </el-col>
100 + <el-col :span="6">
91 <div class="info-list-control"> 101 <div class="info-list-control">
92 <div @click="preview(item)">预览</div> 102 <div @click="preview(item)">预览</div>
93 <div @click="sendEmail" class="icon-wrapper"> 103 <div @click="sendEmail" class="icon-wrapper">
94 - <img style="height: 1rem;" src="https://cdn.ipadbiz.cn/hager/icon/%E9%82%AE%E4%BB%B6@2x.png"> 104 + <img style="height: 1rem; width: auto;" src="https://cdn.ipadbiz.cn/hager/icon/%E9%82%AE%E4%BB%B6@2x.png">
95 </div> 105 </div>
96 </div> 106 </div>
107 + </el-col>
108 + </el-row>
97 </div> 109 </div>
98 </div> 110 </div>
99 </div> 111 </div>
...@@ -107,6 +119,7 @@ import hagerBox from '@/components/common/hagerBox'; ...@@ -107,6 +119,7 @@ import hagerBox from '@/components/common/hagerBox';
107 import hagerCarousel from '@/components/hagerCarousel'; 119 import hagerCarousel from '@/components/hagerCarousel';
108 import hagerH1 from '@/components/common/hagerH1.vue'; 120 import hagerH1 from '@/components/common/hagerH1.vue';
109 import { MessageBox, Message } from 'element-ui'; 121 import { MessageBox, Message } from 'element-ui';
122 +import { getProductInfoAPI } from "@/api/hager.js";
110 123
111 export default { 124 export default {
112 components: { hagerBox, hagerCarousel, hagerH1 }, 125 components: { hagerBox, hagerCarousel, hagerH1 },
...@@ -114,23 +127,15 @@ export default { ...@@ -114,23 +127,15 @@ export default {
114 data () { 127 data () {
115 return { 128 return {
116 is_active: 0, 129 is_active: 0,
117 - download_list: [{ 130 + download_list: [],
118 - id: '123', 131 + images: [],
119 - name: '产品样本', 132 + info: {},
120 - size: '123MB', 133 + info_images: [],
121 - checked: false 134 + product_advantages: [],
122 - }, { 135 + product_sample: '',
123 - id: '123', 136 + technical_parameter: '',
124 - name: '产品样本', 137 + product_manual: '',
125 - size: '123MB', 138 + installation_tutorial: '',
126 - checked: false
127 - }],
128 - images: [
129 - "https://cdn.ipadbiz.cn/hager/img/product/P11.jpg",
130 - "https://cdn.ipadbiz.cn/hager/img/product/t01.jpg",
131 - "https://cdn.ipadbiz.cn/hager/img/product/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20240920151453.png",
132 - "https://cdn.ipadbiz.cn/hager/img/product/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20240920151457.png",
133 - ]
134 } 139 }
135 }, 140 },
136 computed: { 141 computed: {
...@@ -141,12 +146,46 @@ export default { ...@@ -141,12 +146,46 @@ export default {
141 return this.download_list.filter(item => item.checked).length; 146 return this.download_list.filter(item => item.checked).length;
142 }, 147 },
143 }, 148 },
144 - mounted () { 149 + async mounted () {
145 - 150 + this.getInfo();
151 + },
152 + watch: {
153 + // 监听路由参数变化时,更新输入框的值
154 + async '$route.query.id' (val, old) {
155 + if (old !== val) {
156 + this.getInfo();
157 + }
158 + }
146 }, 159 },
147 methods: { 160 methods: {
148 - onClick (n) { 161 + async getInfo () {
162 + const { code, data } = await getProductInfoAPI( { id: this.$route.query.id });
163 + if (code) {
164 + this.info = data;
165 + if (this.info.file?.img) {
166 + this.info_images = this.info.file.img.map(item => item.value);
167 + }
168 + //
169 + this.product_advantages = this.splitArrayIntoChunks(this.info.product_advantages);
170 + //
171 + this.product_sample = this.info.file?.yangben?.map(item => ({ ...item, checked: false }));// 产品样本
172 + this.technical_parameter = this.info.file?.canshu?.map(item => ({ ...item, checked: false })); // 技术参数
173 + this.product_manual = this.info.file?.shuomingshu?.map(item => ({ ...item, checked: false })); // 产品说明书
174 + this.installation_tutorial = this.info.file?.jiaocheng?.map(item => ({ ...item, checked: false })); // 安装教程
175 + let arr = [this.product_sample, this.technical_parameter, this.product_manual, this.installation_tutorial]
176 + for (let index = 0; index < arr.length; index++) {
177 + const element = arr[index];
178 + if (element) {
179 + this.download_list = element;
180 + return;
181 + }
182 + }
183 + }
184 + },
185 + onClick (n , item) {
149 this.is_active = n; 186 this.is_active = n;
187 + this.download_list = item;
188 + this.download_list.forEach(item => item.checked = false);
150 }, 189 },
151 goToDownload () { 190 goToDownload () {
152 if (this.is_download_checked) { 191 if (this.is_download_checked) {
...@@ -168,8 +207,25 @@ export default { ...@@ -168,8 +207,25 @@ export default {
168 }); 207 });
169 }, 208 },
170 preview (item) { 209 preview (item) {
171 - window.open(item, '_blank'); 210 + window.open(item.value, '_blank');
211 + },
212 + splitArrayIntoChunks(list) {
213 + const productAdvantages = list;
214 + const chunkSize = 5;
215 + const result = [];
216 +
217 + for (let i = 0; i < productAdvantages.length; i += chunkSize) {
218 + // 使用 slice 方法按每组 5 个元素分割
219 + const chunk = productAdvantages.slice(i, i + chunkSize);
220 + result.push(chunk);
172 } 221 }
222 +
223 + return result;
224 + },
225 + checkItem (item) {
226 + item.checked = !item.checked;
227 + // this.$forceUpdate();
228 + },
173 } 229 }
174 } 230 }
175 </script> 231 </script>
...@@ -191,8 +247,8 @@ export default { ...@@ -191,8 +247,8 @@ export default {
191 color: @secondary-color; 247 color: @secondary-color;
192 } 248 }
193 .product-sub { 249 .product-sub {
194 - margin: 1rem 0 2rem; 250 + // margin: 1rem 0 2rem;
195 - color: @text-color; 251 + // color: @text-color;
196 } 252 }
197 .product-info-list { 253 .product-info-list {
198 padding: 0 1rem; 254 padding: 0 1rem;
...@@ -206,16 +262,19 @@ export default { ...@@ -206,16 +262,19 @@ export default {
206 margin-top: 1rem; 262 margin-top: 1rem;
207 display: flex; 263 display: flex;
208 flex-wrap: wrap; 264 flex-wrap: wrap;
209 - gap: 3rem; 265 + // gap: 3rem;
210 .item { 266 .item {
211 - flex: 0 1 calc(50% - 3rem); /* 每行2个元素,减去gap的宽度 */ 267 + width: calc(50% - 3rem);
212 - box-sizing: border-box; /* 确保padding和border不会影响宽度计算 */ 268 + box-sizing: border-box;
269 + margin-right: 3rem;
270 + margin-bottom: 1rem;
213 padding-top: 1rem; 271 padding-top: 1rem;
214 background-color: #f0f0f0; 272 background-color: #f0f0f0;
215 border-top: 4px solid @primary-color; 273 border-top: 4px solid @primary-color;
216 line-height: 2; 274 line-height: 2;
217 &.xs { 275 &.xs {
218 padding-bottom: 1rem; 276 padding-bottom: 1rem;
277 + width: 100%;
219 } 278 }
220 } 279 }
221 &.xs { 280 &.xs {
...@@ -224,13 +283,13 @@ export default { ...@@ -224,13 +283,13 @@ export default {
224 } 283 }
225 .product-info { 284 .product-info {
226 .info-control { 285 .info-control {
227 - display: flex; 286 + // display: flex;
228 border-bottom: 4px solid @primary-color; 287 border-bottom: 4px solid @primary-color;
229 padding-bottom: 1rem; 288 padding-bottom: 1rem;
230 margin-top: 2rem; 289 margin-top: 2rem;
231 .control-left { 290 .control-left {
232 display: flex; 291 display: flex;
233 - flex: 1 0 0; 292 + // flex: 1 0 0;
234 &.xs { 293 &.xs {
235 display: flex; 294 display: flex;
236 flex-wrap: nowrap; /* 禁止换行 */ 295 flex-wrap: nowrap; /* 禁止换行 */
...@@ -259,17 +318,18 @@ export default { ...@@ -259,17 +318,18 @@ export default {
259 } 318 }
260 } 319 }
261 .info-list { 320 .info-list {
262 - display: flex; 321 + // display: flex;
263 - justify-content: space-between; 322 + // justify-content: space-between;
264 - align-items: center; 323 + // align-items: center;
265 padding-top: 2rem; 324 padding-top: 2rem;
266 color: #6b6b6b; 325 color: #6b6b6b;
267 .info-list-title { 326 .info-list-title {
268 - display: flex; align-items: center; 327 + // display: flex;
328 + // align-items: center;
269 } 329 }
270 .info-list-control { 330 .info-list-control {
271 display: flex; 331 display: flex;
272 - justify-content: center; 332 + justify-content: flex-end;
273 align-items: center; 333 align-items: center;
274 color: @primary-color; 334 color: @primary-color;
275 div { 335 div {
......