Browse Source

feat: 添加赶回按钮控制

黎海 2 years ago
parent
commit
e47f1edb38

+ 6 - 1
src/components/common/layout/layout.vue

@@ -2,7 +2,8 @@
2
   <div class="layout">
2
   <div class="layout">
3
     <div class="menu-wrapper">
3
     <div class="menu-wrapper">
4
       <left-menu :isCollapse='isFold'
4
       <left-menu :isCollapse='isFold'
5
-                 @changeMenu="changeMenu"></left-menu>
5
+                 @changeMenu="changeMenu"
6
+                 @changeIsBack="changeIsBack"></left-menu>
6
     </div>
7
     </div>
7
     <div class="content">
8
     <div class="content">
8
       <header :style="menuIndex==0?'justify-content: space-between;':''">
9
       <header :style="menuIndex==0?'justify-content: space-between;':''">
@@ -41,6 +42,7 @@
41
 import leftMenu from './leftMenu'
42
 import leftMenu from './leftMenu'
42
 import api from '@/server/home'
43
 import api from '@/server/home'
43
 
44
 
45
+
44
 export default {
46
 export default {
45
   data () {
47
   data () {
46
     return {
48
     return {
@@ -76,6 +78,9 @@ export default {
76
     changeMenu (index) {
78
     changeMenu (index) {
77
       this.menuIndex = index
79
       this.menuIndex = index
78
     },
80
     },
81
+    changeIsBack (isback) {
82
+      this.isback = isback
83
+    },
79
     goBack () {
84
     goBack () {
80
       this.$router.back()
85
       this.$router.back()
81
     }
86
     }

+ 2 - 1
src/components/common/layout/leftMenu.vue

@@ -89,7 +89,8 @@ export default {
89
   watch: {
89
   watch: {
90
     $route (to, from) {
90
     $route (to, from) {
91
       let patname = `/${window.location.hash.split('/')[1]}`
91
       let patname = `/${window.location.hash.split('/')[1]}`
92
-      console.log(patname, 'patname', window.location);
92
+      console.log(patname, 'patname', to);
93
+      this.$emit('changeIsBack', to.meta.isback)
93
       this.menu.forEach((item, index) => {
94
       this.menu.forEach((item, index) => {
94
         if (patname == item.path) {
95
         if (patname == item.path) {
95
           this.nowIndex = index
96
           this.nowIndex = index

+ 28 - 4
src/router/map/home.js

@@ -22,14 +22,38 @@ export default {
22
   children: [
22
   children: [
23
     { path: '/home', component: Home },
23
     { path: '/home', component: Home },
24
     { path: '/testSkin', component: TestSkin },
24
     { path: '/testSkin', component: TestSkin },
25
-    { path: '/testSkin/details', component: TestSkinDetails },
25
+    {
26
+      path: '/testSkin/details',
27
+      meta: {
28
+        isback: true,
29
+      },
30
+      component: TestSkinDetails
31
+    },
26
     { path: '/customerMan', component: CustomerMan },
32
     { path: '/customerMan', component: CustomerMan },
27
-    { path: '/customerMan/details', component: CustomerManDetails },
33
+    {
34
+      path: '/customerMan/details',
35
+      meta: {
36
+        isback: true,
37
+      },
38
+      component: CustomerManDetails
39
+    },
28
     { path: '/customerMan/projectOrder', component: projectOrder },
40
     { path: '/customerMan/projectOrder', component: projectOrder },
29
     { path: '/historicalOrder', component: HistoricalOrder },
41
     { path: '/historicalOrder', component: HistoricalOrder },
30
-    { path: '/historicalOrder/details', component: HistoricalOrderDetails },
42
+    {
43
+      path: '/historicalOrder/details',
44
+      meta: {
45
+        isback: true,
46
+      },
47
+      component: HistoricalOrderDetails
48
+    },
31
     { path: '/confirmOrder', component: ConfirmOrder },
49
     { path: '/confirmOrder', component: ConfirmOrder },
32
-    { path: '/confirmOrder/details', component: ConfirmOrderDetails },
50
+    {
51
+      path: '/confirmOrder/details',
52
+      meta: {
53
+        isback: true,
54
+      },
55
+      component: ConfirmOrderDetails
56
+    },
33
     { path: '/storeDetection', component: StoreDetection },
57
     { path: '/storeDetection', component: StoreDetection },
34
     { path: '/coupon', component: Coupon },
58
     { path: '/coupon', component: Coupon },
35
 
59