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 },
......
This diff is collapsed. Click to expand it.