Showing
4 changed files
with
94 additions
and
57 deletions
| ... | @@ -16,7 +16,7 @@ | ... | @@ -16,7 +16,7 @@ |
| 16 | "jquery": "^3.7.1", | 16 | "jquery": "^3.7.1", |
| 17 | "mui-player": "^1.8.1", | 17 | "mui-player": "^1.8.1", |
| 18 | "sass": "1.55.0", | 18 | "sass": "1.55.0", |
| 19 | - "swiper": "5", | 19 | + "swiper": "6", |
| 20 | "vue": "2.7.13", | 20 | "vue": "2.7.13", |
| 21 | "vue-awesome-swiper": "4.1.1", | 21 | "vue-awesome-swiper": "4.1.1", |
| 22 | "vue-router": "3.6.5" | 22 | "vue-router": "3.6.5" | ... | ... |
| 1 | /* | 1 | /* |
| 2 | * @Date: 2024-08-26 10:12:56 | 2 | * @Date: 2024-08-26 10:12:56 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-10-11 10:10:31 | 4 | + * @LastEditTime: 2024-10-11 13:20:49 |
| 5 | * @FilePath: /hager/src/main.js | 5 | * @FilePath: /hager/src/main.js |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | */ | 7 | */ |
| ... | @@ -19,7 +19,7 @@ import 'element-ui/lib/theme-chalk/display.css'; // 基于断点的隐藏类, | ... | @@ -19,7 +19,7 @@ import 'element-ui/lib/theme-chalk/display.css'; // 基于断点的隐藏类, |
| 19 | import CollapseTransition from 'element-ui/lib/transitions/collapse-transition'; | 19 | import CollapseTransition from 'element-ui/lib/transitions/collapse-transition'; |
| 20 | 20 | ||
| 21 | import VueAwesomeSwiper from 'vue-awesome-swiper'; | 21 | import VueAwesomeSwiper from 'vue-awesome-swiper'; |
| 22 | -import 'swiper/css/swiper.css'; // 确保引入正确的CSS文件路径 | 22 | +import 'swiper/swiper-bundle.css'; // 确保引入正确的CSS文件路径 |
| 23 | 23 | ||
| 24 | Vue.use(VueRouter); | 24 | Vue.use(VueRouter); |
| 25 | // Vue.use(ElementUI); | 25 | // Vue.use(ElementUI); | ... | ... |
| 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-11 11:21:43 | 4 | + * @LastEditTime: 2024-10-11 13:30:57 |
| 5 | * @FilePath: /hager/src/views/index.vue | 5 | * @FilePath: /hager/src/views/index.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -59,12 +59,10 @@ | ... | @@ -59,12 +59,10 @@ |
| 59 | </div> | 59 | </div> |
| 60 | <div v-else> | 60 | <div v-else> |
| 61 | <swiper ref="mySolutionSwiper" class="swiper" :options="swiperOption"> | 61 | <swiper ref="mySolutionSwiper" class="swiper" :options="swiperOption"> |
| 62 | - <swiper-slide | 62 | + <swiper-slide v-for="(item, index) in solution_list" :key="index"> |
| 63 | - @click.native="goToSolution(item)" | 63 | + <div @click="goToSolution(item)" class="solution-item xs" :style="{ backgroundImage: 'url('+item.src+')' }"> |
| 64 | - class="solution-item xs" | 64 | + <p @click="goToSolution(item)">{{ item.title }}</p> |
| 65 | - :style="{ backgroundImage: 'url('+item.src+')' }" | 65 | + </div> |
| 66 | - v-for="(item, index) in solution_list" :key="index"> | ||
| 67 | - <p>{{ item.title }}</p> | ||
| 68 | </swiper-slide> | 66 | </swiper-slide> |
| 69 | </swiper> | 67 | </swiper> |
| 70 | <div class="xs-control"> | 68 | <div class="xs-control"> |
| ... | @@ -77,16 +75,29 @@ | ... | @@ -77,16 +75,29 @@ |
| 77 | </hager-box> | 75 | </hager-box> |
| 78 | <hager-box class="box-n"> | 76 | <hager-box class="box-n"> |
| 79 | <hager-h1 title="产品中心" sub="Product Center"></hager-h1> | 77 | <hager-h1 title="产品中心" sub="Product Center"></hager-h1> |
| 80 | - <div :class="['hager-product-center', is_xs ? 'xs' : '']"> | 78 | + <div v-if="!is_xs" class="hager-product-center"> |
| 81 | - <div v-for="(item, index) in product_list" :key="index" :class="['product-item', is_xs ? 'xs' : '']"> | 79 | + <div @click ="goToProduct(item)" v-for="(item, index) in product_list" :key="index" class="product-item"> |
| 82 | <el-image style="height: 14rem;" :src="item.src" fit="cover"></el-image> | 80 | <el-image style="height: 14rem;" :src="item.src" fit="cover"></el-image> |
| 83 | <p style="margin-top: 1rem;">{{ item.title }}</p> | 81 | <p style="margin-top: 1rem;">{{ item.title }}</p> |
| 84 | </div> | 82 | </div> |
| 85 | </div> | 83 | </div> |
| 86 | - <div :class="['hager-product-center-more', is_xs ? 'xs' : '']"> | 84 | + <div v-else> |
| 87 | - <hager-more></hager-more> | 85 | + <swiper ref="myProductSwiper" class="swiper" :options="swiperOption"> |
| 88 | - <div class="xs-control" v-if="is_xs"> | 86 | + <swiper-slide v-for="(item, index) in product_list" :key="index"> |
| 89 | - <div><i class="el-icon-arrow-left" @click="prevBtn(product_list)"></i> <i class="el-icon-arrow-right" @click="nextBtn(product_list)"></i></div> | 87 | + <div @click="goToProduct(item)" class="product-item xs"> |
| 88 | + <el-image style="height: 8rem; margin: 1rem; margin-bottom: 0;" :src="item.src" fit="cover"></el-image> | ||
| 89 | + <p style="margin: 0.5rem;">{{ item.title }}</p> | ||
| 90 | + </div> | ||
| 91 | + </swiper-slide> | ||
| 92 | + </swiper> | ||
| 93 | + <div class="hager-product-center-more xs"> | ||
| 94 | + <hager-more></hager-more> | ||
| 95 | + <div class="xs-control"> | ||
| 96 | + <div> | ||
| 97 | + <i class="el-icon-arrow-left" @click="prevProductBtn()"></i> | ||
| 98 | + <i class="el-icon-arrow-right" @click="nextProductBtn()"></i> | ||
| 99 | + </div> | ||
| 100 | + </div> | ||
| 90 | </div> | 101 | </div> |
| 91 | </div> | 102 | </div> |
| 92 | </hager-box> | 103 | </hager-box> |
| ... | @@ -203,10 +214,11 @@ export default { | ... | @@ -203,10 +214,11 @@ export default { |
| 203 | title: '三型特决井天' | 214 | title: '三型特决井天' |
| 204 | }], | 215 | }], |
| 205 | swiperOption: { | 216 | swiperOption: { |
| 206 | - // slidesPerView: 3, | 217 | + slidesPerView: 2, |
| 207 | spaceBetween: 50, | 218 | spaceBetween: 50, |
| 208 | - preventClicks : false, | 219 | + preventClicks : true, |
| 209 | slideToClickedSlide: false, | 220 | slideToClickedSlide: false, |
| 221 | + touchRatio: 0, | ||
| 210 | breakpoints: { | 222 | breakpoints: { |
| 211 | 1024: { | 223 | 1024: { |
| 212 | slidesPerView: 4, | 224 | slidesPerView: 4, |
| ... | @@ -240,6 +252,14 @@ export default { | ... | @@ -240,6 +252,14 @@ export default { |
| 240 | // if (boxes.length > 11) { | 252 | // if (boxes.length > 11) { |
| 241 | // boxes[boxes.length - 1].classList.add('other'); | 253 | // boxes[boxes.length - 1].classList.add('other'); |
| 242 | // } | 254 | // } |
| 255 | + // this.$nextTick(() => { | ||
| 256 | + // console.warn(this.$refs.mySolutionSwiper); | ||
| 257 | + // this.$refs.mySolutionSwiper.$swiper?.on('click', (evt) => { | ||
| 258 | + // // evt.preventDefault(); | ||
| 259 | + // let index = this.$refs.mySolutionSwiper.$swiper.clickedIndex; | ||
| 260 | + // this.goToSolution(this.solution_list[index]); | ||
| 261 | + // }); | ||
| 262 | + // }); | ||
| 243 | }, | 263 | }, |
| 244 | watch: { | 264 | watch: { |
| 245 | // 监听$route对象的变化 | 265 | // 监听$route对象的变化 |
| ... | @@ -256,7 +276,15 @@ export default { | ... | @@ -256,7 +276,15 @@ export default { |
| 256 | }, | 276 | }, |
| 257 | goToSolution (v) { | 277 | goToSolution (v) { |
| 258 | this.$router.push({ | 278 | this.$router.push({ |
| 259 | - path: '/solution/detail' | 279 | + path: '/solution/detail', |
| 280 | + query: { | ||
| 281 | + id: v.id | ||
| 282 | + } | ||
| 283 | + }); | ||
| 284 | + }, | ||
| 285 | + goToProduct (v) { | ||
| 286 | + this.$router.push({ | ||
| 287 | + path: '/product/detail' | ||
| 260 | }); | 288 | }); |
| 261 | }, | 289 | }, |
| 262 | handleScreenWidth(width) { | 290 | handleScreenWidth(width) { |
| ... | @@ -268,6 +296,12 @@ export default { | ... | @@ -268,6 +296,12 @@ export default { |
| 268 | nextSolutionBtn () { | 296 | nextSolutionBtn () { |
| 269 | this.$refs.mySolutionSwiper.$swiper.slideNext(); | 297 | this.$refs.mySolutionSwiper.$swiper.slideNext(); |
| 270 | }, | 298 | }, |
| 299 | + prevProductBtn () { | ||
| 300 | + this.$refs.myProductSwiper.$swiper.slidePrev(); | ||
| 301 | + }, | ||
| 302 | + nextProductBtn () { | ||
| 303 | + this.$refs.myProductSwiper.$swiper.slideNext(); | ||
| 304 | + }, | ||
| 271 | }, | 305 | }, |
| 272 | } | 306 | } |
| 273 | </script> | 307 | </script> |
| ... | @@ -442,30 +476,33 @@ export default { | ... | @@ -442,30 +476,33 @@ export default { |
| 442 | display: grid; | 476 | display: grid; |
| 443 | grid-template-columns: repeat(4, 1fr); /* 一行显示4个 */ | 477 | grid-template-columns: repeat(4, 1fr); /* 一行显示4个 */ |
| 444 | gap: 1.5rem; /* 每个项目之间的间距 */ | 478 | gap: 1.5rem; /* 每个项目之间的间距 */ |
| 445 | - &.xs { | 479 | + // &.xs { |
| 446 | - display: flex; | 480 | + // display: flex; |
| 447 | - overflow: hidden; /* 超出部分隐藏 */ | 481 | + // overflow: hidden; /* 超出部分隐藏 */ |
| 448 | - width: calc(100vw - 1rem); /* 容器宽度适应屏幕 */ | 482 | + // width: calc(100vw - 1rem); /* 容器宽度适应屏幕 */ |
| 449 | - gap: 1rem; | 483 | + // gap: 1rem; |
| 484 | + // } | ||
| 485 | + } | ||
| 486 | + .product-item { | ||
| 487 | + height: auto; | ||
| 488 | + padding: 1.5rem; | ||
| 489 | + text-align: center; | ||
| 490 | + color: #333; | ||
| 491 | + border-radius: 8px; | ||
| 492 | + background-color: #f3f3f3; | ||
| 493 | + // transition: transform 0.3s ease-in-out; | ||
| 494 | + &:hover { | ||
| 495 | + cursor: pointer; | ||
| 496 | + // transform: scale(1.05); | ||
| 497 | + // box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); | ||
| 450 | } | 498 | } |
| 451 | - .product-item { | 499 | + &.xs { |
| 452 | - height: auto; | 500 | + // flex: 0 0 50vw; /* 每个子元素宽度为屏幕宽度的一半 (显示2个元素) */ |
| 453 | - padding: 1.5rem; | 501 | + // padding: 0 20px; |
| 454 | - text-align: center; | 502 | + // box-sizing: border-box; |
| 455 | - color: #333; | 503 | + padding: 0; |
| 456 | - border-radius: 8px; | 504 | + margin-top: 1rem; |
| 457 | - background-color: #f3f3f3; | 505 | + padding-bottom: 0.25rem; |
| 458 | - // transition: transform 0.3s ease-in-out; | ||
| 459 | - &:hover { | ||
| 460 | - cursor: pointer; | ||
| 461 | - // transform: scale(1.05); | ||
| 462 | - // box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); | ||
| 463 | - } | ||
| 464 | - &.xs { | ||
| 465 | - flex: 0 0 50vw; /* 每个子元素宽度为屏幕宽度的一半 (显示2个元素) */ | ||
| 466 | - // padding: 0 20px; | ||
| 467 | - // box-sizing: border-box; | ||
| 468 | - } | ||
| 469 | } | 506 | } |
| 470 | } | 507 | } |
| 471 | 508 | ... | ... |
| ... | @@ -1552,12 +1552,12 @@ delayed-stream@~1.0.0: | ... | @@ -1552,12 +1552,12 @@ delayed-stream@~1.0.0: |
| 1552 | resolved "https://mirrors.cloud.tencent.com/npm/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" | 1552 | resolved "https://mirrors.cloud.tencent.com/npm/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" |
| 1553 | integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== | 1553 | integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== |
| 1554 | 1554 | ||
| 1555 | -dom7@^2.1.5: | 1555 | +dom7@^3.0.0: |
| 1556 | - version "2.1.5" | 1556 | + version "3.0.0" |
| 1557 | - resolved "https://mirrors.cloud.tencent.com/npm/dom7/-/dom7-2.1.5.tgz#a79411017800b31d8400070cdaebbfc92c1f6377" | 1557 | + resolved "https://mirrors.cloud.tencent.com/npm/dom7/-/dom7-3.0.0.tgz#b861ce5d67a6becd7aaa3ad02942ff14b1240331" |
| 1558 | - integrity sha512-xnhwVgyOh3eD++/XGtH+5qBwYTgCm0aW91GFgPJ3XG+jlsRLyJivnbP0QmUBFhI+Oaz9FV0s7cxgXHezwOEBYA== | 1558 | + integrity sha512-oNlcUdHsC4zb7Msx7JN3K0Nro1dzJ48knvBOnDPKJ2GV9wl1i5vydJZUSyOfrkKFDZEud/jBsTk92S/VGSAe/g== |
| 1559 | dependencies: | 1559 | dependencies: |
| 1560 | - ssr-window "^2.0.0" | 1560 | + ssr-window "^3.0.0-alpha.1" |
| 1561 | 1561 | ||
| 1562 | electron-to-chromium@^1.5.4: | 1562 | electron-to-chromium@^1.5.4: |
| 1563 | version "1.5.13" | 1563 | version "1.5.13" |
| ... | @@ -2345,10 +2345,10 @@ source-map@^0.6.1, source-map@~0.6.0: | ... | @@ -2345,10 +2345,10 @@ source-map@^0.6.1, source-map@~0.6.0: |
| 2345 | resolved "https://mirrors.cloud.tencent.com/npm/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" | 2345 | resolved "https://mirrors.cloud.tencent.com/npm/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" |
| 2346 | integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== | 2346 | integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== |
| 2347 | 2347 | ||
| 2348 | -ssr-window@^2.0.0: | 2348 | +ssr-window@^3.0.0, ssr-window@^3.0.0-alpha.1: |
| 2349 | - version "2.0.0" | 2349 | + version "3.0.0" |
| 2350 | - resolved "https://mirrors.cloud.tencent.com/npm/ssr-window/-/ssr-window-2.0.0.tgz#98c301aef99523317f8d69618f0010791096efc4" | 2350 | + resolved "https://mirrors.cloud.tencent.com/npm/ssr-window/-/ssr-window-3.0.0.tgz#fd5b82801638943e0cc704c4691801435af7ac37" |
| 2351 | - integrity sha512-NXzN+/HPObKAx191H3zKlYomE5WrVIkoCB5IaSdvKokxTpjBdWfr0RaP+1Z5KOfDT0ZVz+2tdtiBkhsEQ9p+0A== | 2351 | + integrity sha512-q+8UfWDg9Itrg0yWK7oe5p/XRCJpJF9OBtXfOPgSJl+u3Xd5KI328RUEvUqSMVM9CiQUEf1QdBzJMkYGErj9QA== |
| 2352 | 2352 | ||
| 2353 | supports-color@^5.3.0: | 2353 | supports-color@^5.3.0: |
| 2354 | version "5.5.0" | 2354 | version "5.5.0" |
| ... | @@ -2369,13 +2369,13 @@ supports-preserve-symlinks-flag@^1.0.0: | ... | @@ -2369,13 +2369,13 @@ supports-preserve-symlinks-flag@^1.0.0: |
| 2369 | resolved "https://mirrors.cloud.tencent.com/npm/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" | 2369 | resolved "https://mirrors.cloud.tencent.com/npm/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" |
| 2370 | integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== | 2370 | integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== |
| 2371 | 2371 | ||
| 2372 | -swiper@5: | 2372 | +swiper@6: |
| 2373 | - version "5.4.5" | 2373 | + version "6.8.4" |
| 2374 | - resolved "https://mirrors.cloud.tencent.com/npm/swiper/-/swiper-5.4.5.tgz#a350f654bf68426dbb651793824925512d223c0f" | 2374 | + resolved "https://mirrors.cloud.tencent.com/npm/swiper/-/swiper-6.8.4.tgz#938fed4144f4d7952fbf9c44e5832d133a4de794" |
| 2375 | - integrity sha512-7QjA0XpdOmiMoClfaZ2lYN6ICHcMm72LXiY+NF4fQLFidigameaofvpjEEiTQuw3xm5eksG5hzkaRsjQX57vtA== | 2375 | + integrity sha512-O+buF9Q+sMA0H7luMS8R59hCaJKlpo8PXhQ6ZYu6Rn2v9OsFd4d1jmrv14QvxtQpKAvL/ZiovEeANI/uDGet7g== |
| 2376 | dependencies: | 2376 | dependencies: |
| 2377 | - dom7 "^2.1.5" | 2377 | + dom7 "^3.0.0" |
| 2378 | - ssr-window "^2.0.0" | 2378 | + ssr-window "^3.0.0" |
| 2379 | 2379 | ||
| 2380 | systemjs@^6.15.1: | 2380 | systemjs@^6.15.1: |
| 2381 | version "6.15.1" | 2381 | version "6.15.1" | ... | ... |
-
Please register or login to post a comment