Showing
4 changed files
with
72 additions
and
46 deletions
| ... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
| 2 | VITE_PORT = 8106 | 2 | VITE_PORT = 8106 |
| 3 | 3 | ||
| 4 | # 反向代理服务器地址 | 4 | # 反向代理服务器地址 |
| 5 | -VITE_PROXY_TARGET = https://oa-dev.onwall.cn | 5 | +VITE_PROXY_TARGET = http://www.hager-electric.com/ |
| 6 | # VITE_PROXY_TARGET = https://oa.onwall.cn | 6 | # VITE_PROXY_TARGET = https://oa.onwall.cn |
| 7 | 7 | ||
| 8 | # API请求前缀 | 8 | # API请求前缀 | ... | ... |
| 1 | +/* | ||
| 2 | + * @Date: 2024-09-26 13:36:06 | ||
| 3 | + * @LastEditors: hookehuyr hookehuyr@gmail.com | ||
| 4 | + * @LastEditTime: 2024-10-23 10:13:25 | ||
| 5 | + * @FilePath: /hager/src/api/hager.js | ||
| 6 | + * @Description: 文件描述 | ||
| 7 | + */ | ||
| 1 | import { fn, fetch } from '@/api/fn'; | 8 | import { fn, fetch } from '@/api/fn'; |
| 2 | 9 | ||
| 3 | const Api = { | 10 | const Api = { |
| 4 | - MAP: '/srv/?a=map', | 11 | + HONOR: '/srv/?a=cate&type=honor', |
| 5 | }; | 12 | }; |
| 6 | 13 | ||
| 7 | -export const mapAPI = (params) => fn(fetch.get(Api.MAP, params)); | 14 | +export const honorAPI = (params) => fn(fetch.get(Api.HONOR, params)); | ... | ... |
| ... | @@ -2,8 +2,8 @@ | ... | @@ -2,8 +2,8 @@ |
| 2 | * @Author: hookehuyr hookehuyr@gmail.com | 2 | * @Author: hookehuyr hookehuyr@gmail.com |
| 3 | * @Date: 2022-05-28 10:17:40 | 3 | * @Date: 2022-05-28 10:17:40 |
| 4 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 4 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 5 | - * @LastEditTime: 2024-09-03 16:01:59 | 5 | + * @LastEditTime: 2024-10-23 10:11:14 |
| 6 | - * @FilePath: /vue2_vite_web/src/utils/axios.js | 6 | + * @FilePath: /hager/src/utils/axios.js |
| 7 | * @Description: | 7 | * @Description: |
| 8 | */ | 8 | */ |
| 9 | import axios from 'axios'; | 9 | import axios from 'axios'; |
| ... | @@ -13,7 +13,7 @@ import { strExist } from '@/utils/tools' | ... | @@ -13,7 +13,7 @@ import { strExist } from '@/utils/tools' |
| 13 | // import { parseQueryString } from '@/utils/tools' | 13 | // import { parseQueryString } from '@/utils/tools' |
| 14 | 14 | ||
| 15 | axios.defaults.params = { | 15 | axios.defaults.params = { |
| 16 | - f: 'tools', | 16 | + m: 'srv', |
| 17 | }; | 17 | }; |
| 18 | 18 | ||
| 19 | /** | 19 | /** | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2024-10-17 11:13:44 | 2 | * @Date: 2024-10-17 11:13:44 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-10-22 13:45:54 | 4 | + * @LastEditTime: 2024-10-23 10:43:05 |
| 5 | * @FilePath: /hager/src/views/about/honors.vue | 5 | * @FilePath: /hager/src/views/about/honors.vue |
| 6 | - * @Description: 文件描述 | 6 | + * @Description: 关于海格-荣誉展示 |
| 7 | --> | 7 | --> |
| 8 | <template> | 8 | <template> |
| 9 | <div class="hager-about-honors-page"> | 9 | <div class="hager-about-honors-page"> |
| ... | @@ -18,40 +18,37 @@ | ... | @@ -18,40 +18,37 @@ |
| 18 | <div :class="['top-img', is_xs ? 'xs' : '']"></div> | 18 | <div :class="['top-img', is_xs ? 'xs' : '']"></div> |
| 19 | <hager-box v-if="!is_xs"> | 19 | <hager-box v-if="!is_xs"> |
| 20 | <div class="select-btn-box"> | 20 | <div class="select-btn-box"> |
| 21 | - <div @click="onClickBtn(0)" :class="['btn', active_idx === 0 ? 'active' : 'normal']">行业荣誉</div> | 21 | + <div |
| 22 | - <div @click="onClickBtn(1)":class="['btn', active_idx === 1 ? 'active' : 'normal']">美学设计</div> | 22 | + v-for="(item, index) in button_list" :key="index" |
| 23 | - <div @click="onClickBtn(2)":class="['btn', active_idx === 2 ? 'active' : 'normal']">卓越发展</div> | 23 | + :class="['btn', active_idx === index ? 'active' : 'normal']" |
| 24 | + @click="onClickBtn(index)"> | ||
| 25 | + {{ item.category_name }} | ||
| 26 | + </div> | ||
| 24 | </div> | 27 | </div> |
| 25 | </hager-box> | 28 | </hager-box> |
| 26 | <div v-else class="select-btn-box" style="padding: 1rem;"> | 29 | <div v-else class="select-btn-box" style="padding: 1rem;"> |
| 27 | <el-row :gutter="10"> | 30 | <el-row :gutter="10"> |
| 28 | - <el-col :span="8"> | 31 | + <el-col :span="8" v-for="(item, index) in button_list" :key="index"> |
| 29 | - <div @click="onClickBtn(0)" :class="['btn xs', active_idx === 0 ? 'active' : 'normal']">行业荣誉</div> | 32 | + <div @click="onClickBtn(index)" :class="['btn xs', active_idx === index ? 'active' : 'normal']">{{ item.category_name }}</div> |
| 30 | - </el-col> | ||
| 31 | - <el-col :span="8"> | ||
| 32 | - <div @click="onClickBtn(1)" :class="['btn xs', active_idx === 1 ? 'active' : 'normal']">美学设计</div> | ||
| 33 | - </el-col> | ||
| 34 | - <el-col :span="8"> | ||
| 35 | - <div @click="onClickBtn(2)" :class="['btn xs', active_idx === 2 ? 'active' : 'normal']">卓越发展</div> | ||
| 36 | </el-col> | 33 | </el-col> |
| 37 | </el-row> | 34 | </el-row> |
| 38 | </div> | 35 | </div> |
| 39 | - <hager-box v-if="!is_xs" v-for="(item, index) in years_list" :key="index"> | 36 | + <hager-box v-if="!is_xs" v-for="(item, index) in honors_cate_list" :key="index"> |
| 40 | - <p class="list-title">{{ item.year }}年</p> | 37 | + <p class="list-title">{{ item.category_name }}</p> |
| 41 | <div class="list-wrapper"> | 38 | <div class="list-wrapper"> |
| 42 | <div class="card" v-for="(x, idx) in item.list" :key="idx"> | 39 | <div class="card" v-for="(x, idx) in item.list" :key="idx"> |
| 43 | <div class="card-image-box"> | 40 | <div class="card-image-box"> |
| 44 | - <div class="card-image" :style="{ backgroundImage: `url(${x.img})` }"></div> | 41 | + <div class="card-image" :style="{ backgroundImage: `url(${x.cover})` }"></div> |
| 45 | </div> | 42 | </div> |
| 46 | <div class="card-content"> | 43 | <div class="card-content"> |
| 47 | - <h3>{{ x.title }}</h3> | 44 | + <h3>{{ x.post_title }}</h3> |
| 48 | - <p>{{ x.content }}</p> | 45 | + <p v-html="x.post_content"></p> |
| 49 | </div> | 46 | </div> |
| 50 | </div> | 47 | </div> |
| 51 | </div> | 48 | </div> |
| 52 | </hager-box> | 49 | </hager-box> |
| 53 | - <div v-if="is_xs" v-for="(item, index) in years_list" :key="index" style="padding: 1rem;"> | 50 | + <div v-if="is_xs" v-for="(item, index) in honors_cate_list" :key="index" style="padding: 1rem;"> |
| 54 | - <p class="list-title">{{ item.year }}年</p> | 51 | + <p class="list-title">{{ item.category_name }}</p> |
| 55 | <swiper class="swiper" | 52 | <swiper class="swiper" |
| 56 | :ref="'mySwiper' + item.id" | 53 | :ref="'mySwiper' + item.id" |
| 57 | :options="swiperOption" | 54 | :options="swiperOption" |
| ... | @@ -61,11 +58,11 @@ | ... | @@ -61,11 +58,11 @@ |
| 61 | <div class="list-wrapper-mini"> | 58 | <div class="list-wrapper-mini"> |
| 62 | <div class="card"> | 59 | <div class="card"> |
| 63 | <div class="card-image-box"> | 60 | <div class="card-image-box"> |
| 64 | - <div class="card-image" :style="{ backgroundImage: `url(${x.img})` }"></div> | 61 | + <div class="card-image xs" :style="{ backgroundImage: `url(${x.cover})` }"></div> |
| 65 | </div> | 62 | </div> |
| 66 | - <div class="card-content"> | 63 | + <div class="card-content xs"> |
| 67 | - <h3>{{ x.title }}</h3> | 64 | + <h3>{{ x.post_title }}</h3> |
| 68 | - <p>{{ x.content }}</p> | 65 | + <p v-html="x.post_content"></p> |
| 69 | </div> | 66 | </div> |
| 70 | </div> | 67 | </div> |
| 71 | </div> | 68 | </div> |
| ... | @@ -73,14 +70,14 @@ | ... | @@ -73,14 +70,14 @@ |
| 73 | </swiper> | 70 | </swiper> |
| 74 | <div v-if="item.list.length > item.slidesPerView || is_xs" class="xs-control"> | 71 | <div v-if="item.list.length > item.slidesPerView || is_xs" class="xs-control"> |
| 75 | <div> | 72 | <div> |
| 76 | - <i :class="['el-icon-arrow-left', item.activeIndex === 0 ? 'disabled' : '']" @click="prevBtn(item)"></i> | 73 | + <i :class="['el-icon-arrow-left', item.activeIndex === 0 ? 'disabled' : '']" @click="prevBtn(item)"></i> |
| 77 | <i :class="['el-icon-arrow-right', item.reach_end ? 'disabled' : '']" @click="nextBtn(item)"></i> | 74 | <i :class="['el-icon-arrow-right', item.reach_end ? 'disabled' : '']" @click="nextBtn(item)"></i> |
| 78 | </div> | 75 | </div> |
| 79 | </div> | 76 | </div> |
| 80 | </div> | 77 | </div> |
| 81 | - <hager-box> | 78 | + <!-- <hager-box> |
| 82 | <hager-load-more></hager-load-more> | 79 | <hager-load-more></hager-load-more> |
| 83 | - </hager-box> | 80 | + </hager-box> --> |
| 84 | </div> | 81 | </div> |
| 85 | </template> | 82 | </template> |
| 86 | 83 | ||
| ... | @@ -88,6 +85,7 @@ | ... | @@ -88,6 +85,7 @@ |
| 88 | import mixin from 'common/mixin'; | 85 | import mixin from 'common/mixin'; |
| 89 | import hagerBox from '@/components/common/hagerBox'; | 86 | import hagerBox from '@/components/common/hagerBox'; |
| 90 | import hagerLoadMore from '@/components/hagerLoadMore.vue'; | 87 | import hagerLoadMore from '@/components/hagerLoadMore.vue'; |
| 88 | +import { honorAPI } from "@/api/hager.js"; | ||
| 91 | 89 | ||
| 92 | export default { | 90 | export default { |
| 93 | components: { hagerBox, hagerLoadMore }, | 91 | components: { hagerBox, hagerLoadMore }, |
| ... | @@ -95,7 +93,9 @@ export default { | ... | @@ -95,7 +93,9 @@ export default { |
| 95 | data () { | 93 | data () { |
| 96 | return { | 94 | return { |
| 97 | active_idx: 0, | 95 | active_idx: 0, |
| 98 | - years_list: [{ | 96 | + button_list: [], |
| 97 | + all_honors_list: [], | ||
| 98 | + honors_cate_list: [{ | ||
| 99 | id: '1', | 99 | id: '1', |
| 100 | year: '2022', | 100 | year: '2022', |
| 101 | list: [{ | 101 | list: [{ |
| ... | @@ -169,22 +169,35 @@ export default { | ... | @@ -169,22 +169,35 @@ export default { |
| 169 | }, | 169 | }, |
| 170 | } | 170 | } |
| 171 | }, | 171 | }, |
| 172 | - mounted () { | 172 | + async mounted () { |
| 173 | - this.years_list.forEach((item) => { | 173 | + const { code, data } = await honorAPI(); |
| 174 | - this.$nextTick(() => { | 174 | + if (code) { |
| 175 | - const swiperRef = this.$refs[`mySwiper${item.id}`]; | 175 | + this.all_honors_list = data; // 所有荣誉集合 |
| 176 | - if (swiperRef && swiperRef[0].$swiper) { | 176 | + // 荣誉分类列表 |
| 177 | - swiperRef[0].$swiper.on('breakpoint', (swiper) => { | 177 | + this.button_list = data.map(item => { |
| 178 | - // breakpoint时 显示的条数 | 178 | + return { |
| 179 | - item.slidesPerView = swiper.slidesPerView; | 179 | + id: item.id, |
| 180 | - }); | 180 | + category_name: item.category_name |
| 181 | } | 181 | } |
| 182 | }); | 182 | }); |
| 183 | - }); | 183 | + this.honors_cate_list = this.all_honors_list[0]['children']; // 默认第一个 |
| 184 | + this.honors_cate_list.forEach((item) => { | ||
| 185 | + this.$nextTick(() => { | ||
| 186 | + const swiperRef = this.$refs[`mySwiper${item.id}`]; | ||
| 187 | + if (swiperRef && swiperRef[0].$swiper) { | ||
| 188 | + swiperRef[0].$swiper.on('breakpoint', (swiper) => { | ||
| 189 | + // breakpoint时 显示的条数 | ||
| 190 | + item.slidesPerView = swiper.slidesPerView; | ||
| 191 | + }); | ||
| 192 | + } | ||
| 193 | + }); | ||
| 194 | + }); | ||
| 195 | + } | ||
| 184 | }, | 196 | }, |
| 185 | methods: { | 197 | methods: { |
| 186 | onClickBtn (idx) { | 198 | onClickBtn (idx) { |
| 187 | this.active_idx = idx; | 199 | this.active_idx = idx; |
| 200 | + this.honors_cate_list = this.all_honors_list[idx]['children']; | ||
| 188 | }, | 201 | }, |
| 189 | prevBtn (item) { | 202 | prevBtn (item) { |
| 190 | this.$nextTick(() => { | 203 | this.$nextTick(() => { |
| ... | @@ -272,13 +285,13 @@ export default { | ... | @@ -272,13 +285,13 @@ export default { |
| 272 | .list-wrapper { | 285 | .list-wrapper { |
| 273 | margin-bottom: 1rem; | 286 | margin-bottom: 1rem; |
| 274 | .card-image-box { | 287 | .card-image-box { |
| 275 | - padding: 1rem; | 288 | + padding: 0.5rem; |
| 276 | background-color: #E3F1F7; | 289 | background-color: #E3F1F7; |
| 277 | } | 290 | } |
| 278 | .card-image { | 291 | .card-image { |
| 279 | width: 100%; | 292 | width: 100%; |
| 280 | height: 17rem; | 293 | height: 17rem; |
| 281 | - background-size: cover; | 294 | + background-size: contain; |
| 282 | background-position: center; | 295 | background-position: center; |
| 283 | background-repeat: no-repeat; | 296 | background-repeat: no-repeat; |
| 284 | } | 297 | } |
| ... | @@ -348,12 +361,18 @@ export default { | ... | @@ -348,12 +361,18 @@ export default { |
| 348 | background-size: cover; | 361 | background-size: cover; |
| 349 | background-position: center; | 362 | background-position: center; |
| 350 | background-repeat: no-repeat; | 363 | background-repeat: no-repeat; |
| 364 | + &.xs { | ||
| 365 | + height: 15rem; | ||
| 366 | + } | ||
| 351 | } | 367 | } |
| 352 | .card-content { | 368 | .card-content { |
| 353 | background-color: #F7F7F7; | 369 | background-color: #F7F7F7; |
| 354 | padding: 2rem 1.5rem; | 370 | padding: 2rem 1.5rem; |
| 355 | height: 12rem; | 371 | height: 12rem; |
| 356 | overflow: scroll; | 372 | overflow: scroll; |
| 373 | + &.xs { | ||
| 374 | + height: 7rem; | ||
| 375 | + } | ||
| 357 | h3 { | 376 | h3 { |
| 358 | color: @secondary-color; | 377 | color: @secondary-color; |
| 359 | font-size: 1rem; | 378 | font-size: 1rem; | ... | ... |
-
Please register or login to post a comment