hookehuyr

产品二级页面路由相关页面调整

......@@ -41,11 +41,7 @@ export default {
toggle(v) {
if (v?.list) {
this.$router.push({
path: '/product/index',
query: {
id: v.id,
timestamp: Date.now()
}
path: `/product/index/${v.id}/${Date.now()}`,
});
} else {
if (this.hasChildren) {
......
......@@ -193,11 +193,7 @@ export default {
},
goToProduct (item) {
this.$router.push({
path: '/product/index',
query: {
id: item.id,
timestamp: Date.now()
}
path: `/product/index/${item.id}/${Date.now()}`,
});
},
goToSolution (item) {
......
<!--
* @Date: 2024-09-26 13:42:11
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-12-11 17:11:01
* @LastEditTime: 2024-12-12 13:39:46
* @FilePath: /hager/src/components/common/hagerHeader.vue
* @Description: 文件描述
-->
......@@ -375,11 +375,7 @@ export default {
},
goToC (item) { // 跳转产品二级
this.$router.push({
path: '/product/index',
query: {
id: item.id,
timestamp: Date.now()
}
path: `/product/index/${item.id}/${Date.now()}`,
});
this.closeMenu();
......
<!--
* @Date: 2024-10-10 10:37:16
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-12-10 16:12:02
* @LastEditTime: 2024-12-12 13:39:03
* @FilePath: /hager/src/components/hagerMenu.vue
* @Description: 文件描述
-->
......@@ -143,10 +143,7 @@ export default {
goToSub(id) {
this.$emit("close");
this.$router.push({
path: "/product/index",
query: {
id: id,
},
path: `/product/index/${id}`,
});
},
goToThird(id) {
......
/*
* @Date: 2024-08-26 10:42:15
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-12-12 12:47:30
* @LastEditTime: 2024-12-12 13:38:22
* @FilePath: /hager/src/route.js
* @Description: 文件描述
*/
......@@ -15,7 +15,7 @@ export default [{
},
children: []
}, {
path: '/product/index',
path: '/product/index/:id?/:timestamp?',
name: '二级目录',
component: () => import('@/views/product/index'),
meta: {
......
......@@ -332,12 +332,7 @@ export default {
},
goToProduct (v) {
this.$router.push({
path: '/product/index',
query: {
// id: v.first_child_id,
id: v.id,
timestamp: Date.now()
}
path: `/product/index/${v.id}/${Date.now()}`,
});
},
handleScreenWidth(width) {
......
......@@ -186,10 +186,10 @@ export default {
return sum;
},
productPath () {
return `/product/index?id=${this.info.parent_id}&timestamp=${Date.now()}`;
return `/product/index/${this.info.parent_id}/${Date.now()}`;
},
categoryPath () {
return `/product/index?id=${this.info.category_id}&timestamp=${Date.now()}`;
return `/product/index/${this.info.category_id}/${Date.now()}`;
},
},
async mounted () {
......
<!--
* @Date: 2024-09-27 16:53:09
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-11-19 16:06:14
* @LastEditTime: 2024-12-12 13:44:08
* @FilePath: /hager/src/views/product/index.vue
* @Description: 文件描述
-->
......@@ -122,18 +122,18 @@ export default {
},
computed: {
allPath () {
return `/product/index?timestamp=${Date.now()}`;
return `/product/index/all/${Date.now()}`;
},
productPath () {
return `/product/index?id=${this.cate_id}&timestamp=${Date.now()}`;
return `/product/index/${this.cate_id}/${Date.now()}`;
},
is_all_cate () {
return this.$route.query.id === undefined;
return this.$route.params.id === 'all';
}
},
watch: {
// 监听路由参数变化时,更新输入框的值
'$route.query.id' (val, old) {
'$route.params.id' (val, old) {
if (val) {
if (old !== val) {
this.is_search = false;
......@@ -144,7 +144,7 @@ export default {
this.getAllMain();
}
},
'$route.query.timestamp' (val, old) {
'$route.params.timestamp' (val, old) {
this.is_search = false;
if (!this.is_all_cate) {
this.getMain();
......@@ -194,7 +194,7 @@ export default {
}
},
async getMain () {
const { code, data } = await getProductCateAPI({cid: this.$route.query.id });
const { code, data } = await getProductCateAPI({cid: this.$route.params.id });
if (code) {
let info = data[0];
this.parent_name = info.parent_name;
......