hookehuyr

🐞 fix: 底部解决方案跳转在解决方案页面不处理问题

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-09 13:46:50 4 + * @LastEditTime: 2024-12-09 16:36:59
5 * @FilePath: /hager/src/views/solution/detail.vue 5 * @FilePath: /hager/src/views/solution/detail.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -212,29 +212,39 @@ export default { ...@@ -212,29 +212,39 @@ export default {
212 category_description: '', 212 category_description: '',
213 } 213 }
214 }, 214 },
215 - async mounted () { 215 + mounted () {
216 - const { code, data } = await getSolutionCaseAPI({ cid: this.$route.query.id }); 216 + this.initialize();
217 - if (code) { 217 + },
218 - this.case_info = data; 218 + watch: {
219 - this.case_banner = data.file?.banner ? data.file?.banner[0] : 'https://cdn.ipadbiz.cn/hager/banner/banner08.png'; 219 + '$route.query.id' (old, val) {
220 - this.case_list = data.list; 220 + if (old !== val) {
221 - this.current_index = this.$route.query.current_index ? +this.$route.query.current_index : 0; 221 + this.initialize();
222 - this.current_id = this.case_list[this.current_index]['id']; 222 + }
223 - this.success_data_list = this.case_list[this.current_index].list ?? [];
224 - this.category_description = this.case_list[this.current_index].category_description ?? '';
225 - this.case_img = this.case_list[this.current_index].file?.img ? this.case_list[this.current_index].file?.img : ['https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'];
226 - this.product_list = this.case_list[this.current_index].product ?? [];
227 } 223 }
228 - this.$nextTick(() => {
229 - this.$refs.myProductSwiper.$swiper?.on('breakpoint', (swiper) => {
230 - // breakpoint时 显示的条数
231 - this.productSlidesPerView = swiper.slidesPerView
232 - });
233 -
234 - clampText('.clamp-text', 3); // 限制显示三行文本
235 - });
236 }, 224 },
237 methods: { 225 methods: {
226 + async initialize () {
227 + const { code, data } = await getSolutionCaseAPI({ cid: this.$route.query.id });
228 + if (code) {
229 + this.case_info = data;
230 + this.case_banner = data.file?.banner ? data.file?.banner[0] : 'https://cdn.ipadbiz.cn/hager/banner/banner08.png';
231 + this.case_list = data.list;
232 + this.current_index = this.$route.query.current_index ? +this.$route.query.current_index : 0;
233 + this.current_id = this.case_list[this.current_index]['id'];
234 + this.success_data_list = this.case_list[this.current_index].list ?? [];
235 + this.category_description = this.case_list[this.current_index].category_description ?? '';
236 + this.case_img = this.case_list[this.current_index].file?.img ? this.case_list[this.current_index].file?.img : ['https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'];
237 + this.product_list = this.case_list[this.current_index].product ?? [];
238 + }
239 + this.$nextTick(() => {
240 + this.$refs.myProductSwiper.$swiper?.on('breakpoint', (swiper) => {
241 + // breakpoint时 显示的条数
242 + this.productSlidesPerView = swiper.slidesPerView
243 + });
244 +
245 + clampText('.clamp-text', 3); // 限制显示三行文本
246 + });
247 + },
238 onClickImg (item) { 248 onClickImg (item) {
239 window.open(item, '_blank'); 249 window.open(item, '_blank');
240 }, 250 },
......