hookehuyr

Merge branch 'feature/地址参数显示修改' into develop

...@@ -41,11 +41,7 @@ export default { ...@@ -41,11 +41,7 @@ export default {
41 toggle(v) { 41 toggle(v) {
42 if (v?.list) { 42 if (v?.list) {
43 this.$router.push({ 43 this.$router.push({
44 - path: '/product/index', 44 + path: `/product/index/${v.id}/${Date.now()}`,
45 - query: {
46 - id: v.id,
47 - timestamp: Date.now()
48 - }
49 }); 45 });
50 } else { 46 } else {
51 if (this.hasChildren) { 47 if (this.hasChildren) {
...@@ -55,11 +51,7 @@ export default { ...@@ -55,11 +51,7 @@ export default {
55 }, 51 },
56 goToDetail (v) { // 跳转产品详情 52 goToDetail (v) { // 跳转产品详情
57 this.$router.push({ 53 this.$router.push({
58 - path: '/product/detail', 54 + path: `/product/detail${v.id}/${Date.now()}`,
59 - query: {
60 - id: v.id,
61 - timestamp: Date.now()
62 - }
63 }); 55 });
64 } 56 }
65 } 57 }
......
1 <!-- 1 <!--
2 * @Date: 2024-09-26 13:42:22 2 * @Date: 2024-09-26 13:42:22
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-12-04 11:40:52 4 + * @LastEditTime: 2024-12-12 14:13:11
5 * @FilePath: /hager/src/components/common/hagerFooter.vue 5 * @FilePath: /hager/src/components/common/hagerFooter.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -193,20 +193,12 @@ export default { ...@@ -193,20 +193,12 @@ export default {
193 }, 193 },
194 goToProduct (item) { 194 goToProduct (item) {
195 this.$router.push({ 195 this.$router.push({
196 - path: '/product/index', 196 + path: `/product/index/${item.id}/${Date.now()}`,
197 - query: {
198 - id: item.id,
199 - timestamp: Date.now()
200 - }
201 }); 197 });
202 }, 198 },
203 goToSolution (item) { 199 goToSolution (item) {
204 this.$router.push({ 200 this.$router.push({
205 - path: '/solution/detail', 201 + path: `/solution/detail/${item.id}/${Date.now()}`,
206 - query: {
207 - id: item.id,
208 - timestamp: Date.now()
209 - }
210 }); 202 });
211 }, 203 },
212 goToCorp (item) { 204 goToCorp (item) {
......
1 <!-- 1 <!--
2 * @Date: 2024-09-26 13:42:11 2 * @Date: 2024-09-26 13:42:11
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-12-12 15:02:26 4 + * @LastEditTime: 2024-12-12 17:05:36
5 * @FilePath: /hager/src/components/common/hagerHeader.vue 5 * @FilePath: /hager/src/components/common/hagerHeader.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -64,12 +64,12 @@ ...@@ -64,12 +64,12 @@
64 <div :class="[is_active === 'about' ? 'active' : '', 'item']" @click="goTo('/about')">关于海格</div> 64 <div :class="[is_active === 'about' ? 'active' : '', 'item']" @click="goTo('/about')">关于海格</div>
65 <div :class="[is_active === 'contact' ? 'active' : '', 'item']" @click="goTo('/contact')">联系我们</div> 65 <div :class="[is_active === 'contact' ? 'active' : '', 'item']" @click="goTo('/contact')">联系我们</div>
66 <div :class="[is_active === 'index' ? 'active' : '', 'item']" @click="goTo('/')">首页</div> --> 66 <div :class="[is_active === 'index' ? 'active' : '', 'item']" @click="goTo('/')">首页</div> -->
67 - <a :class="[is_active === 'solution' ? 'active' : '', 'item']" :href="`${baseUrl}#/solution/index`" @click="goTo('/solution/index')">解决方案</a> 67 + <a :class="[is_active === 'solution' ? 'active' : '', 'item']" :href="`${baseUrl}/solution/index`" @click.prevent="goTo('/solution/index')">解决方案</a>
68 - <a :class="[is_active === 'news' ? 'active' : '', 'item']" :href="`${baseUrl}#/news`" @click="goTo('/news')">新闻中心</a> 68 + <a :class="[is_active === 'news' ? 'active' : '', 'item']" :href="`${baseUrl}/news`" @click.prevent="goTo('/news')">新闻中心</a>
69 - <a :class="[is_active === 'recruit' ? 'active' : '', 'item']" :href="`${baseUrl}#/recruit`" @click="goTo('/recruit')">招聘信息</a> 69 + <a :class="[is_active === 'recruit' ? 'active' : '', 'item']" :href="`${baseUrl}/recruit`" @click.prevent="goTo('/recruit')">招聘信息</a>
70 - <a :class="[is_active === 'about' ? 'active' : '', 'item']" :href="`${baseUrl}#/about`" @click="goTo('/about')">关于海格</a> 70 + <a :class="[is_active === 'about' ? 'active' : '', 'item']" :href="`${baseUrl}/about`" @click.prevent="goTo('/about')">关于海格</a>
71 - <a :class="[is_active === 'contact' ? 'active' : '', 'item']" :href="`${baseUrl}#/contact`" @click="goTo('/contact')">联系我们</a> 71 + <a :class="[is_active === 'contact' ? 'active' : '', 'item']" :href="`${baseUrl}/contact`" @click.prevent="goTo('/contact')">联系我们</a>
72 - <a :class="[is_active === 'index' ? 'active' : '', 'item']" :href="`${baseUrl}#/`" @click="goTo('/')">首页</a> 72 + <a :class="[is_active === 'index' ? 'active' : '', 'item']" :href="`${baseUrl}/`" @click.prevent="goTo('/')">首页</a>
73 </div> 73 </div>
74 </el-col> 74 </el-col>
75 </el-row> 75 </el-row>
...@@ -185,7 +185,7 @@ export default { ...@@ -185,7 +185,7 @@ export default {
185 }, 185 },
186 watch: { 186 watch: {
187 // 监听路由参数变化时,更新输入框的值 187 // 监听路由参数变化时,更新输入框的值
188 - '$route.query.keyword': function(newKeyword) { 188 + '$route.params.keyword': function(newKeyword) {
189 this.keyword = newKeyword || ''; 189 this.keyword = newKeyword || '';
190 }, 190 },
191 '$route' (to, from) { 191 '$route' (to, from) {
...@@ -210,7 +210,7 @@ export default { ...@@ -210,7 +210,7 @@ export default {
210 }, 210 },
211 computed: { 211 computed: {
212 baseUrl () { 212 baseUrl () {
213 - return location.origin + location.pathname; 213 + return location.origin;
214 } 214 }
215 }, 215 },
216 async mounted () { 216 async mounted () {
...@@ -377,23 +377,14 @@ export default { ...@@ -377,23 +377,14 @@ export default {
377 }, 377 },
378 goToC (item) { // 跳转产品二级 378 goToC (item) { // 跳转产品二级
379 this.$router.push({ 379 this.$router.push({
380 - path: '/product/index', 380 + path: `/product/index/${item.id}/${Date.now()}`,
381 - query: {
382 - id: item.id,
383 - timestamp: Date.now()
384 - }
385 }); 381 });
386 382
387 this.closeMenu(); 383 this.closeMenu();
388 }, 384 },
389 goToP (item) { // 跳转产品详情 385 goToP (item) { // 跳转产品详情
390 this.$router.push({ 386 this.$router.push({
391 - path: '/product/detail', 387 + path: `/product/detail/${item.id}/${item.category_id}/${Date.now()}`,
392 - query: {
393 - id: item.id,
394 - category_id: item.category_id,
395 - timestamp: Date.now()
396 - }
397 }); 388 });
398 this.closeMenu(); 389 this.closeMenu();
399 }, 390 },
...@@ -432,18 +423,14 @@ export default { ...@@ -432,18 +423,14 @@ export default {
432 } 423 }
433 }, 424 },
434 updateURL() { 425 updateURL() {
435 - const currentKeyword = this.$route.query.keyword; 426 + const currentKeyword = this.$route.params.keyword;
436 427
437 // 如果输入的 keyword 和当前路由的 keyword 相同,不做更新 428 // 如果输入的 keyword 和当前路由的 keyword 相同,不做更新
438 if (this.keyword === currentKeyword) return; 429 if (this.keyword === currentKeyword) return;
439 430
440 // 使用 Vue Router 动态更新 URL 中的 keyword 参数 431 // 使用 Vue Router 动态更新 URL 中的 keyword 参数
441 this.$router.replace({ 432 this.$router.replace({
442 - path: '/search', // 确保路径不变 433 + path: `/search/${this.keyword}`
443 - query: {
444 - ...this.$route.query, // 保留其他可能存在的 query 参数
445 - keyword: this.keyword // 更新 keyword 参数
446 - }
447 }); 434 });
448 } 435 }
449 } 436 }
......
1 <!-- 1 <!--
2 * @Date: 2024-10-10 10:37:16 2 * @Date: 2024-10-10 10:37:16
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-12-10 16:12:02 4 + * @LastEditTime: 2024-12-12 13:50:39
5 * @FilePath: /hager/src/components/hagerMenu.vue 5 * @FilePath: /hager/src/components/hagerMenu.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -143,19 +143,13 @@ export default { ...@@ -143,19 +143,13 @@ export default {
143 goToSub(id) { 143 goToSub(id) {
144 this.$emit("close"); 144 this.$emit("close");
145 this.$router.push({ 145 this.$router.push({
146 - path: "/product/index", 146 + path: `/product/index/${id}`,
147 - query: {
148 - id: id,
149 - },
150 }); 147 });
151 }, 148 },
152 goToThird(id) { 149 goToThird(id) {
153 this.$emit("close"); 150 this.$emit("close");
154 this.$router.push({ 151 this.$router.push({
155 - path: "/product/detail", 152 + path: `/product/detail/${id}`,
156 - query: {
157 - id: id,
158 - },
159 }); 153 });
160 }, 154 },
161 // 155 //
......
1 /* 1 /*
2 * @Date: 2024-08-26 10:42:15 2 * @Date: 2024-08-26 10:42:15
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-12-10 16:01:00 4 + * @LastEditTime: 2024-12-12 14:54:14
5 * @FilePath: /hager/src/route.js 5 * @FilePath: /hager/src/route.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
...@@ -15,7 +15,7 @@ export default [{ ...@@ -15,7 +15,7 @@ export default [{
15 }, 15 },
16 children: [] 16 children: []
17 }, { 17 }, {
18 - path: '/product/index', 18 + path: '/product/index/:id?/:timestamp?',
19 name: '二级目录', 19 name: '二级目录',
20 component: () => import('@/views/product/index'), 20 component: () => import('@/views/product/index'),
21 meta: { 21 meta: {
...@@ -24,8 +24,26 @@ export default [{ ...@@ -24,8 +24,26 @@ export default [{
24 }, 24 },
25 children: [] 25 children: []
26 }, { 26 }, {
27 - path: '/product/detail', 27 + path: '/product/detail/:id',
28 - name: '详情页', 28 + name: '详情页1',
29 + component: () => import('@/views/product/detail'),
30 + meta: {
31 + title: '海格电气',
32 + tag: 'product'
33 + },
34 + children: []
35 +}, {
36 + path: '/product/detail/:id/:timestamp',
37 + name: '详情页2',
38 + component: () => import('@/views/product/detail'),
39 + meta: {
40 + title: '海格电气',
41 + tag: 'product'
42 + },
43 + children: []
44 +}, {
45 + path: '/product/detail/:id/:category_id/:timestamp',
46 + name: '详情页3',
29 component: () => import('@/views/product/detail'), 47 component: () => import('@/views/product/detail'),
30 meta: { 48 meta: {
31 title: '海格电气', 49 title: '海格电气',
...@@ -42,8 +60,17 @@ export default [{ ...@@ -42,8 +60,17 @@ export default [{
42 }, 60 },
43 children: [] 61 children: []
44 }, { 62 }, {
45 - path: '/solution/detail', 63 + path: '/solution/detail/:id/:timestamp',
46 - name: '解决方案详情', 64 + name: '解决方案详情1',
65 + component: () => import('@/views/solution/detail'),
66 + meta: {
67 + title: '解决方案 | Hager China',
68 + tag: 'solution'
69 + },
70 + children: []
71 +}, {
72 + path: '/solution/detail/:id/:current_index/:timestamp',
73 + name: '解决方案详情2',
47 component: () => import('@/views/solution/detail'), 74 component: () => import('@/views/solution/detail'),
48 meta: { 75 meta: {
49 title: '解决方案 | Hager China', 76 title: '解决方案 | Hager China',
...@@ -51,7 +78,7 @@ export default [{ ...@@ -51,7 +78,7 @@ export default [{
51 }, 78 },
52 children: [] 79 children: []
53 }, { 80 }, {
54 - path: '/solution/case', 81 + path: '/solution/case/:id/:current_index?',
55 name: '成功案例', 82 name: '成功案例',
56 component: () => import('@/views/solution/case'), 83 component: () => import('@/views/solution/case'),
57 meta: { 84 meta: {
...@@ -141,7 +168,7 @@ export default [{ ...@@ -141,7 +168,7 @@ export default [{
141 }, 168 },
142 children: [] 169 children: []
143 }, { 170 }, {
144 - path: '/news/detail', 171 + path: '/news/detail/:id',
145 name: '新闻详情', 172 name: '新闻详情',
146 component: () => import('@/views/news/detail'), 173 component: () => import('@/views/news/detail'),
147 meta: { 174 meta: {
...@@ -205,7 +232,7 @@ export default [{ ...@@ -205,7 +232,7 @@ export default [{
205 }, 232 },
206 ] 233 ]
207 }, { 234 }, {
208 - path: '/search', 235 + path: '/search/:keyword?',
209 name: '搜索结果', 236 name: '搜索结果',
210 component: () => import('@/views/search'), 237 component: () => import('@/views/search'),
211 meta: { 238 meta: {
......
...@@ -12,8 +12,9 @@ import ConfigRouter from './route.js' ...@@ -12,8 +12,9 @@ import ConfigRouter from './route.js'
12 Vue.use(VueRouter) 12 Vue.use(VueRouter)
13 13
14 const router = new VueRouter({ 14 const router = new VueRouter({
15 - history: false, 15 + // history: false,
16 - hashbang: true, 16 + // hashbang: true,
17 + mode: 'history',
17 base: '/', 18 base: '/',
18 routes: ConfigRouter, 19 routes: ConfigRouter,
19 scrollBehavior(to, from, savedPosition) { 20 scrollBehavior(to, from, savedPosition) {
......
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-12-11 15:16:27 4 + * @LastEditTime: 2024-12-12 14:14:08
5 * @FilePath: /hager/src/views/index.vue 5 * @FilePath: /hager/src/views/index.vue
6 * @Description: 首页 6 * @Description: 首页
7 --> 7 -->
...@@ -308,10 +308,7 @@ export default { ...@@ -308,10 +308,7 @@ export default {
308 }, 308 },
309 goToNew (v) { 309 goToNew (v) {
310 this.$router.push({ 310 this.$router.push({
311 - path: '/news/detail', 311 + path: `/news/detail/${v.id}`,
312 - query: {
313 - id: v.id
314 - }
315 }); 312 });
316 }, 313 },
317 goToNews () { 314 goToNews () {
...@@ -326,21 +323,12 @@ export default { ...@@ -326,21 +323,12 @@ export default {
326 }, 323 },
327 goToSolution (v) { 324 goToSolution (v) {
328 this.$router.push({ 325 this.$router.push({
329 - path: '/solution/detail', 326 + path: `/solution/detail/${v.id}/${Date.now()}`,
330 - query: {
331 - id: v.id,
332 - timestamp: Date.now()
333 - }
334 }); 327 });
335 }, 328 },
336 goToProduct (v) { 329 goToProduct (v) {
337 this.$router.push({ 330 this.$router.push({
338 - path: '/product/index', 331 + path: `/product/index/${v.id}/${Date.now()}`,
339 - query: {
340 - // id: v.first_child_id,
341 - id: v.id,
342 - timestamp: Date.now()
343 - }
344 }); 332 });
345 }, 333 },
346 handleScreenWidth(width) { 334 handleScreenWidth(width) {
......
1 <!-- 1 <!--
2 * @Date: 2024-10-18 12:06:09 2 * @Date: 2024-10-18 12:06:09
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-12-04 18:16:02 4 + * @LastEditTime: 2024-12-12 12:49:20
5 * @FilePath: /hager/src/views/news/detail.vue 5 * @FilePath: /hager/src/views/news/detail.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -52,7 +52,7 @@ export default { ...@@ -52,7 +52,7 @@ export default {
52 } 52 }
53 }, 53 },
54 async mounted () { 54 async mounted () {
55 - const { code, data } = await getNewsDetailAPI({ id: this.$route.query.id }); 55 + const { code, data } = await getNewsDetailAPI({ id: this.$route.params.id });
56 if (code) { 56 if (code) {
57 this.title = data.post_title; 57 this.title = data.post_title;
58 this.content = data.product_advantages; 58 this.content = data.product_advantages;
......
1 <!-- 1 <!--
2 * @Date: 2024-10-18 12:05:44 2 * @Date: 2024-10-18 12:05:44
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-12-03 16:26:23 4 + * @LastEditTime: 2024-12-12 12:48:45
5 * @FilePath: /hager/src/views/news/index.vue 5 * @FilePath: /hager/src/views/news/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -87,10 +87,7 @@ export default { ...@@ -87,10 +87,7 @@ export default {
87 methods: { 87 methods: {
88 goToNew (v) { 88 goToNew (v) {
89 this.$router.push({ 89 this.$router.push({
90 - path: '/news/detail', 90 + path: `/news/detail/${v.id}`,
91 - query: {
92 - id: v.id
93 - }
94 }); 91 });
95 }, 92 },
96 async getMore () { 93 async getMore () {
......
1 <!-- 1 <!--
2 * @Date: 2024-09-29 14:26:41 2 * @Date: 2024-09-29 14:26:41
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-11-06 15:34:53 4 + * @LastEditTime: 2024-12-12 13:54:06
5 * @FilePath: /hager/src/views/product/detail.vue 5 * @FilePath: /hager/src/views/product/detail.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -186,10 +186,10 @@ export default { ...@@ -186,10 +186,10 @@ export default {
186 return sum; 186 return sum;
187 }, 187 },
188 productPath () { 188 productPath () {
189 - return `/product/index?id=${this.info.parent_id}&timestamp=${Date.now()}`; 189 + return `/product/index/${this.info.parent_id}/${Date.now()}`;
190 }, 190 },
191 categoryPath () { 191 categoryPath () {
192 - return `/product/index?id=${this.info.category_id}&timestamp=${Date.now()}`; 192 + return `/product/index/${this.info.category_id}/${Date.now()}`;
193 }, 193 },
194 }, 194 },
195 async mounted () { 195 async mounted () {
...@@ -204,7 +204,7 @@ export default { ...@@ -204,7 +204,7 @@ export default {
204 }, 204 },
205 watch: { 205 watch: {
206 // 监听路由参数变化时,更新输入框的值 206 // 监听路由参数变化时,更新输入框的值
207 - async '$route.query.id' (val, old) { 207 + async '$route.params.id' (val, old) {
208 if (old !== val) { 208 if (old !== val) {
209 this.getInfo(); 209 this.getInfo();
210 } 210 }
...@@ -253,7 +253,7 @@ export default { ...@@ -253,7 +253,7 @@ export default {
253 checked_sum: 0, 253 checked_sum: 0,
254 }]; 254 }];
255 this.info_images = []; 255 this.info_images = [];
256 - const { code, data } = await getProductInfoAPI( { id: this.$route.query.id }); 256 + const { code, data } = await getProductInfoAPI( { id: this.$route.params.id });
257 if (code) { 257 if (code) {
258 this.info = data; 258 this.info = data;
259 this.keyword = data.post_keyword; 259 this.keyword = data.post_keyword;
......
1 <!-- 1 <!--
2 * @Date: 2024-09-27 16:53:09 2 * @Date: 2024-09-27 16:53:09
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-11-19 16:06:14 4 + * @LastEditTime: 2024-12-12 13:55:31
5 * @FilePath: /hager/src/views/product/index.vue 5 * @FilePath: /hager/src/views/product/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -122,18 +122,18 @@ export default { ...@@ -122,18 +122,18 @@ export default {
122 }, 122 },
123 computed: { 123 computed: {
124 allPath () { 124 allPath () {
125 - return `/product/index?timestamp=${Date.now()}`; 125 + return `/product/index/all/${Date.now()}`;
126 }, 126 },
127 productPath () { 127 productPath () {
128 - return `/product/index?id=${this.cate_id}&timestamp=${Date.now()}`; 128 + return `/product/index/${this.cate_id}/${Date.now()}`;
129 }, 129 },
130 is_all_cate () { 130 is_all_cate () {
131 - return this.$route.query.id === undefined; 131 + return this.$route.params.id === 'all';
132 } 132 }
133 }, 133 },
134 watch: { 134 watch: {
135 // 监听路由参数变化时,更新输入框的值 135 // 监听路由参数变化时,更新输入框的值
136 - '$route.query.id' (val, old) { 136 + '$route.params.id' (val, old) {
137 if (val) { 137 if (val) {
138 if (old !== val) { 138 if (old !== val) {
139 this.is_search = false; 139 this.is_search = false;
...@@ -144,7 +144,7 @@ export default { ...@@ -144,7 +144,7 @@ export default {
144 this.getAllMain(); 144 this.getAllMain();
145 } 145 }
146 }, 146 },
147 - '$route.query.timestamp' (val, old) { 147 + '$route.params.timestamp' (val, old) {
148 this.is_search = false; 148 this.is_search = false;
149 if (!this.is_all_cate) { 149 if (!this.is_all_cate) {
150 this.getMain(); 150 this.getMain();
...@@ -168,11 +168,7 @@ export default { ...@@ -168,11 +168,7 @@ export default {
168 }, 168 },
169 goToDetail (v) { // 跳转产品详情 169 goToDetail (v) { // 跳转产品详情
170 this.$router.push({ 170 this.$router.push({
171 - path: '/product/detail', 171 + path: `/product/detail/${v.id}/${this.$route.params.id}/${Date.now()}`
172 - query: {
173 - id: v.id,
174 - category_id: this.$route.query.id
175 - }
176 }); 172 });
177 }, 173 },
178 async getAllMain () { // 查询所有产品列表数据 174 async getAllMain () { // 查询所有产品列表数据
...@@ -194,7 +190,7 @@ export default { ...@@ -194,7 +190,7 @@ export default {
194 } 190 }
195 }, 191 },
196 async getMain () { 192 async getMain () {
197 - const { code, data } = await getProductCateAPI({cid: this.$route.query.id }); 193 + const { code, data } = await getProductCateAPI({cid: this.$route.params.id });
198 if (code) { 194 if (code) {
199 let info = data[0]; 195 let info = data[0];
200 this.parent_name = info.parent_name; 196 this.parent_name = info.parent_name;
......
1 <!-- 1 <!--
2 * @Date: 2024-10-20 16:57:48 2 * @Date: 2024-10-20 16:57:48
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-12-04 16:00:08 4 + * @LastEditTime: 2024-12-12 14:54:04
5 * @FilePath: /hager/src/views/search.vue 5 * @FilePath: /hager/src/views/search.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -92,7 +92,7 @@ export default { ...@@ -92,7 +92,7 @@ export default {
92 data () { 92 data () {
93 return { 93 return {
94 activeName: 'product', 94 activeName: 'product',
95 - keyword: this.$route.query.keyword, 95 + keyword: this.$route.params.keyword,
96 news_list: [], 96 news_list: [],
97 case_list: [], 97 case_list: [],
98 count_news: 0, 98 count_news: 0,
...@@ -110,7 +110,7 @@ export default { ...@@ -110,7 +110,7 @@ export default {
110 } 110 }
111 }, 111 },
112 watch: { 112 watch: {
113 - '$route.query.keyword': function(newKeyword, oldKeyword) { 113 + '$route.params.keyword': function(newKeyword, oldKeyword) {
114 this.keyword = newKeyword || ''; 114 this.keyword = newKeyword || '';
115 if (newKeyword !== oldKeyword) { // 关键词变化时,重新搜索 115 if (newKeyword !== oldKeyword) { // 关键词变化时,重新搜索
116 this.activeName = 'product'; 116 this.activeName = 'product';
...@@ -238,44 +238,27 @@ export default { ...@@ -238,44 +238,27 @@ export default {
238 }, 238 },
239 goToNews (id) { 239 goToNews (id) {
240 this.$router.push({ 240 this.$router.push({
241 - path: '/news/detail', 241 + path: `/news/detail/${id}`,
242 - query: {
243 - id: id
244 - }
245 }); 242 });
246 }, 243 },
247 goToDetail (v) { // 跳转产品详情 244 goToDetail (v) { // 跳转产品详情
248 this.$router.push({ 245 this.$router.push({
249 - path: '/product/detail', 246 + path: `/product/detail/${v.id}/${v.category_id}/${Date.now()}`,
250 - query: {
251 - id: v.id,
252 - category_id: v.category_id,
253 - timestamp: Date.now()
254 - }
255 }); 247 });
256 }, 248 },
257 goToCase (id) { 249 goToCase (id) {
258 this.$router.push({ 250 this.$router.push({
259 - path: '/solution/detail', 251 + path: `/solution/detail/${id}/${Date.now()}`,
260 - query: {
261 - id: id
262 - }
263 }); 252 });
264 }, 253 },
265 goToSolution (v) { // 跳转产品详情 254 goToSolution (v) { // 跳转产品详情
266 this.$router.push({ 255 this.$router.push({
267 - path: '/product/detail', 256 + path: `/product/detail/${v.id}`,
268 - query: {
269 - id: v.id
270 - }
271 }); 257 });
272 }, 258 },
273 goToSuccess (v) { // 跳转成功案例 259 goToSuccess (v) { // 跳转成功案例
274 this.$router.push({ 260 this.$router.push({
275 - path: '/solution/case', 261 + path: `/solution/case/${v}}`,
276 - query: {
277 - id: v
278 - }
279 }); 262 });
280 } 263 }
281 } 264 }
......
1 <!-- 1 <!--
2 * @Date: 2024-10-18 12:06:09 2 * @Date: 2024-10-18 12:06:09
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-12-09 13:41:51 4 + * @LastEditTime: 2024-12-12 16:05:29
5 * @FilePath: /hager/src/views/solution/case.vue 5 * @FilePath: /hager/src/views/solution/case.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -157,7 +157,7 @@ export default { ...@@ -157,7 +157,7 @@ export default {
157 }, 157 },
158 computed: { 158 computed: {
159 casePath () { 159 casePath () {
160 - return `/solution/detail?id=${this.success_info.category_id}&current_index=${this.$route.query.current_index}`; 160 + return `/solution/detail/${this.success_info.category_id}/${this.$route.params.current_index}/${Date.now()}`;
161 } 161 }
162 }, 162 },
163 watch: { 163 watch: {
...@@ -166,7 +166,7 @@ export default { ...@@ -166,7 +166,7 @@ export default {
166 } 166 }
167 }, 167 },
168 async mounted () { 168 async mounted () {
169 - const { code, data } = await getSolutionDetailAPI({ id: this.$route.query.id }); 169 + const { code, data } = await getSolutionDetailAPI({ id: this.$route.params.id });
170 if (code) { 170 if (code) {
171 this.success_info = data; 171 this.success_info = data;
172 this.top_banner = this.success_info.file?.top_img ? this.success_info.file?.top_img[0]['value'] : ''; 172 this.top_banner = this.success_info.file?.top_img ? this.success_info.file?.top_img[0]['value'] : '';
...@@ -284,6 +284,7 @@ export default { ...@@ -284,6 +284,7 @@ export default {
284 // // box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); 284 // // box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
285 // cursor: pointer; 285 // cursor: pointer;
286 // } 286 // }
287 + overflow: hidden;
287 img { 288 img {
288 width: 100%; 289 width: 100%;
289 // margin-left: calc((100%) / 2); 290 // margin-left: calc((100%) / 2);
......
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-11 17:21:35 4 + * @LastEditTime: 2024-12-12 16:07:57
5 * @FilePath: /hager/src/views/solution/detail.vue 5 * @FilePath: /hager/src/views/solution/detail.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -216,7 +216,7 @@ export default { ...@@ -216,7 +216,7 @@ export default {
216 this.initialize(); 216 this.initialize();
217 }, 217 },
218 watch: { 218 watch: {
219 - '$route.query.id' (old, val) { 219 + '$route.params.id' (old, val) {
220 if (old !== val) { 220 if (old !== val) {
221 this.initialize(); 221 this.initialize();
222 } 222 }
...@@ -224,12 +224,12 @@ export default { ...@@ -224,12 +224,12 @@ export default {
224 }, 224 },
225 methods: { 225 methods: {
226 async initialize () { 226 async initialize () {
227 - const { code, data } = await getSolutionCaseAPI({ cid: this.$route.query.id }); 227 + const { code, data } = await getSolutionCaseAPI({ cid: this.$route.params.id });
228 if (code) { 228 if (code) {
229 this.case_info = data; 229 this.case_info = data;
230 this.case_banner = data.file?.banner ? data.file?.banner[0] : 'https://cdn.ipadbiz.cn/hager/banner/banner08.png'; 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; 231 this.case_list = data.list;
232 - this.current_index = this.$route.query.current_index ? +this.$route.query.current_index : 0; 232 + this.current_index = this.$route.params.current_index ? +this.$route.params.current_index : 0;
233 this.current_id = this.case_list[this.current_index]['id']; 233 this.current_id = this.case_list[this.current_index]['id'];
234 this.success_data_list = this.case_list[this.current_index].list ?? []; 234 this.success_data_list = this.case_list[this.current_index].list ?? [];
235 this.category_description = this.case_list[this.current_index].category_description ?? ''; 235 this.category_description = this.case_list[this.current_index].category_description ?? '';
...@@ -250,19 +250,12 @@ export default { ...@@ -250,19 +250,12 @@ export default {
250 }, 250 },
251 goToProduct (v) { 251 goToProduct (v) {
252 this.$router.push({ 252 this.$router.push({
253 - path: '/product/detail', 253 + path: `/product/detail/${v.id}`,
254 - query: {
255 - id: v.id
256 - }
257 }); 254 });
258 }, 255 },
259 goToCase (v) { 256 goToCase (v) {
260 this.$router.push({ 257 this.$router.push({
261 - path: '/solution/case', 258 + path: `/solution/case/${v.id}/${this.current_index}`,
262 - query: {
263 - id: v.id,
264 - current_index: this.current_index
265 - }
266 }); 259 });
267 }, 260 },
268 prevProductBtn () { 261 prevProductBtn () {
...@@ -316,11 +309,7 @@ export default { ...@@ -316,11 +309,7 @@ export default {
316 }) 309 })
317 // 记录点击的分类ID,用于返回定位到该分类 310 // 记录点击的分类ID,用于返回定位到该分类
318 this.$router.push({ 311 this.$router.push({
319 - path: '/solution/detail', 312 + path: `/solution/detail/${this.$route.params.id}/${this.current_index}/${Date.now()}`,
320 - query: {
321 - ...this.$route.query, // 先展开原来的参数
322 - current_index: this.current_index
323 - }
324 }); 313 });
325 } 314 }
326 } 315 }
...@@ -492,6 +481,7 @@ export default { ...@@ -492,6 +481,7 @@ export default {
492 border-radius: 5px; 481 border-radius: 5px;
493 transition: transform 0.3s ease-in-out; 482 transition: transform 0.3s ease-in-out;
494 border: 1px solid rgba(0, 0, 0, 0.1); 483 border: 1px solid rgba(0, 0, 0, 0.1);
484 + overflow: hidden;
495 &:hover { 485 &:hover {
496 // box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); 486 // box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
497 cursor: pointer; 487 cursor: pointer;
......
...@@ -161,10 +161,7 @@ export default { ...@@ -161,10 +161,7 @@ export default {
161 }, 161 },
162 goToSolution (v) { 162 goToSolution (v) {
163 this.$router.push({ 163 this.$router.push({
164 - path: '/solution/detail', 164 + path: `/solution/detail/${v.id}/${Date.now()}`,
165 - query: {
166 - id: v.id
167 - }
168 }); 165 });
169 }, 166 },
170 prevSolutionBtn () { 167 prevSolutionBtn () {
......