hookehuyr

解决方案详情路由调整

<!--
* @Date: 2024-09-26 13:42:22
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-12-04 11:40:52
* @LastEditTime: 2024-12-12 14:13:11
* @FilePath: /hager/src/components/common/hagerFooter.vue
* @Description: 文件描述
-->
......@@ -198,11 +198,7 @@ export default {
},
goToSolution (item) {
this.$router.push({
path: '/solution/detail',
query: {
id: item.id,
timestamp: Date.now()
}
path: `/solution/detail/${item.id}/${Date.now()}`,
});
},
goToCorp (item) {
......
/*
* @Date: 2024-08-26 10:42:15
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-12-12 13:51:12
* @LastEditTime: 2024-12-12 14:03:26
* @FilePath: /hager/src/route.js
* @Description: 文件描述
*/
......@@ -25,7 +25,7 @@ export default [{
children: []
}, {
path: '/product/detail/:id',
name: '详情页',
name: '详情页1',
component: () => import('@/views/product/detail'),
meta: {
title: '海格电气',
......@@ -34,7 +34,7 @@ export default [{
children: []
}, {
path: '/product/detail/:id/:timestamp',
name: '详情页',
name: '详情页2',
component: () => import('@/views/product/detail'),
meta: {
title: '海格电气',
......@@ -43,7 +43,7 @@ export default [{
children: []
}, {
path: '/product/detail/:id/:category_id/:timestamp',
name: '详情页',
name: '详情页3',
component: () => import('@/views/product/detail'),
meta: {
title: '海格电气',
......@@ -60,8 +60,17 @@ export default [{
},
children: []
}, {
path: '/solution/detail',
name: '解决方案详情',
path: '/solution/detail/:id/:timestamp',
name: '解决方案详情1',
component: () => import('@/views/solution/detail'),
meta: {
title: '解决方案 | Hager China',
tag: 'solution'
},
children: []
}, {
path: '/solution/detail/:id/:current_index/:timestamp',
name: '解决方案详情2',
component: () => import('@/views/solution/detail'),
meta: {
title: '解决方案 | Hager China',
......
<!--
* @Date: 2024-08-27 10:06:30
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-12-12 12:48:04
* @LastEditTime: 2024-12-12 14:14:08
* @FilePath: /hager/src/views/index.vue
* @Description: 首页
-->
......@@ -323,11 +323,7 @@ export default {
},
goToSolution (v) {
this.$router.push({
path: '/solution/detail',
query: {
id: v.id,
timestamp: Date.now()
}
path: `/solution/detail/${v.id}/${Date.now()}`,
});
},
goToProduct (v) {
......
<!--
* @Date: 2024-10-20 16:57:48
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-12-12 13:52:16
* @LastEditTime: 2024-12-12 14:14:55
* @FilePath: /hager/src/views/search.vue
* @Description: 文件描述
-->
......@@ -248,10 +248,7 @@ export default {
},
goToCase (id) {
this.$router.push({
path: '/solution/detail',
query: {
id: id
}
path: `/solution/detail/${id}/${Date.now()}`,
});
},
goToSolution (v) { // 跳转产品详情
......
......@@ -157,7 +157,7 @@ export default {
},
computed: {
casePath () {
return `/solution/detail?id=${this.success_info.category_id}&current_index=${this.$route.query.current_index}`;
return `/solution/detail/${this.success_info.category_id}/${this.$route.query.current_index}/${Date.now()}`;
}
},
watch: {
......
<!--
* @Date: 2024-09-29 15:49:27
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-12-12 13:53:39
* @LastEditTime: 2024-12-12 14:21:31
* @FilePath: /hager/src/views/solution/detail.vue
* @Description: 文件描述
-->
......@@ -216,7 +216,7 @@ export default {
this.initialize();
},
watch: {
'$route.query.id' (old, val) {
'$route.params.id' (old, val) {
if (old !== val) {
this.initialize();
}
......@@ -224,12 +224,12 @@ export default {
},
methods: {
async initialize () {
const { code, data } = await getSolutionCaseAPI({ cid: this.$route.query.id });
const { code, data } = await getSolutionCaseAPI({ cid: this.$route.params.id });
if (code) {
this.case_info = data;
this.case_banner = data.file?.banner ? data.file?.banner[0] : 'https://cdn.ipadbiz.cn/hager/banner/banner08.png';
this.case_list = data.list;
this.current_index = this.$route.query.current_index ? +this.$route.query.current_index : 0;
this.current_index = this.$route.params.current_index ? +this.$route.params.current_index : 0;
this.current_id = this.case_list[this.current_index]['id'];
this.success_data_list = this.case_list[this.current_index].list ?? [];
this.category_description = this.case_list[this.current_index].category_description ?? '';
......@@ -250,7 +250,7 @@ export default {
},
goToProduct (v) {
this.$router.push({
path: `/product/detail/${v.id}}`,
path: `/product/detail/${v.id}`,
});
},
goToCase (v) {
......@@ -313,11 +313,7 @@ export default {
})
// 记录点击的分类ID,用于返回定位到该分类
this.$router.push({
path: '/solution/detail',
query: {
...this.$route.query, // 先展开原来的参数
current_index: this.current_index
}
path: `/solution/detail/${this.$route.params.id}/${this.current_index}/${Date.now()}`,
});
}
}
......
......@@ -161,10 +161,7 @@ export default {
},
goToSolution (v) {
this.$router.push({
path: '/solution/detail',
query: {
id: v.id
}
path: `/solution/detail/${v.id}/${Date.now()}`,
});
},
prevSolutionBtn () {
......