Browse Source

Merge branch 'master' of http://git.shengws.com/zhangbj/scrm-vue

XMLWAN 3 years ago
parent
commit
5148314d20

+ 2 - 2
config/index.js View File

@@ -16,9 +16,9 @@ module.exports = {
16 16
     // can be overwritten by process.env.HOST
17 17
     // if you want dev by ip, please set host: '0.0.0.0'
18 18
 
19
-    host: "test1.sgjyun.com",
19
+    // host: "test1.sgjyun.com",
20 20
     //  host: 'microweb.kuyicloud.com',
21
-    //host: "localhost",
21
+    host: "localhost",
22 22
     // host: 'jk.kuyicloud.com',
23 23
     port: 8090, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
24 24
     // host: 'test1.sgjyun.com',

BIN
favicon.ico View File


BIN
src/assets/logo/logo1.png View File


+ 41 - 39
src/styles/sidebar.scss View File

@@ -13,7 +13,7 @@
13 13
     height: 100%;
14 14
     position: fixed;
15 15
     font-size: 0px;
16
-    top: 60px;
16
+    // top: 60px;
17 17
     bottom: 0;
18 18
     left: 0;
19 19
     z-index: 1001;
@@ -47,48 +47,50 @@
47 47
     }
48 48
     .el-menu {
49 49
       border: none;
50
-      min-height: 130%;
50
+      height: 90%;
51
+      // min-height: 130%;
52
+      overflow-y: auto;
51 53
       width: 100% !important;
52 54
     }
53 55
   }
54
-  .hideSidebar {
55
-    .sidebar-container {
56
-      width: 36px !important;
57
-    }
58
-    .main-container {
59
-      margin-left: 36px;
60
-    }
61
-    .submenu-title-noDropdown {
62
-      padding-left: 10px !important;
63
-      position: relative;
64
-      .el-tooltip {
65
-        padding: 0 10px !important;
66
-      }
67
-    }
68
-    .el-submenu {
69
-      overflow: hidden;
70
-      &>.el-submenu__title {
71
-        padding-left: 10px !important;
56
+  // .hideSidebar {
57
+  //   .sidebar-container {
58
+  //     width: 36px !important;
59
+  //   }
60
+  //   .main-container {
61
+  //     margin-left: 36px;
62
+  //   }
63
+  //   .submenu-title-noDropdown {
64
+  //     padding-left: 10px !important;
65
+  //     position: relative;
66
+  //     .el-tooltip {
67
+  //       padding: 0 10px !important;
68
+  //     }
69
+  //   }
70
+  //   .el-submenu {
71
+  //     overflow: hidden;
72
+  //     &>.el-submenu__title {
73
+  //       padding-left: 10px !important;
72 74
         
73
-        .el-submenu__icon-arrow {
74
-          display: none;
75
-        }
76
-      }
77
-    }
78
-    .el-menu--collapse {
79
-      .el-submenu {
80
-        &>.el-submenu__title {
81
-          &>span {
82
-            height: 0;
83
-            width: 0;
84
-            overflow: hidden;
85
-            visibility: hidden;
86
-            display: inline-block;
87
-          }
88
-        }
89
-      }
90
-    }
91
-  }
75
+  //       .el-submenu__icon-arrow {
76
+  //         display: none;
77
+  //       }
78
+  //     }
79
+  //   }
80
+  //   .el-menu--collapse {
81
+  //     .el-submenu {
82
+  //       &>.el-submenu__title {
83
+  //         &>span {
84
+  //           height: 0;
85
+  //           width: 0;
86
+  //           overflow: hidden;
87
+  //           visibility: hidden;
88
+  //           display: inline-block;
89
+  //         }
90
+  //       }
91
+  //     }
92
+  //   }
93
+  // }
92 94
   .sidebar-container .nest-menu .el-submenu>.el-submenu__title,
93 95
   .sidebar-container .el-submenu .el-menu-item {
94 96
     // min-width: 180px !important;

+ 11 - 2
src/views/layout/Layout.vue View File

@@ -4,9 +4,9 @@
4 4
       <navbar></navbar>
5 5
     
6 6
     <div class="Header-container">
7
-    <sidebar class="sidebar-container"></sidebar>
7
+    <sidebar class="sidebar-container" @callBackIndex="handleIndex"></sidebar>
8 8
     <div class="main-container">
9
-      <tags-view></tags-view>
9
+      <tags-view :index="index"></tags-view>
10 10
       <app-main></app-main>
11 11
       <contact-box></contact-box>
12 12
     </div>
@@ -45,9 +45,18 @@ export default {
45 45
       }
46 46
     }
47 47
   },
48
+  data(){
49
+    return{
50
+      index: 0,
51
+    }
52
+  },
48 53
   methods: {
49 54
     handleClickOutside() {
50 55
       this.$store.dispatch('closeSideBar', { withoutAnimation: false })
56
+    },
57
+    handleIndex(data) {
58
+      // console.log({ prop: data });
59
+      this.index = data;
51 60
     }
52 61
   }
53 62
 }

+ 79 - 4
src/views/layout/components/Sidebar/SidebarItem.vue View File

@@ -1,7 +1,7 @@
1 1
 <template>
2 2
   <div v-if="!item.hidden&&item.children" class="menu-wrapper">
3 3
 
4
-      <router-link v-if="hasOneShowingChild(item.children) && !onlyOneChild.children&&!item.alwaysShow" :to="resolvePath(onlyOneChild.path)">
4
+      <!-- <router-link v-if="hasOneShowingChild(item.children) && !onlyOneChild.children&&!item.alwaysShow" :to="resolvePath(onlyOneChild.path)">
5 5
         <el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}">
6 6
           <svg-icon v-if="onlyOneChild.meta&&onlyOneChild.meta.icon" :icon-class="onlyOneChild.meta.icon"></svg-icon>
7 7
           <span v-if="onlyOneChild.meta&&onlyOneChild.meta.title" slot="title">{{generateTitle(onlyOneChild.meta.title)}}</span>
@@ -18,12 +18,10 @@
18 18
           <sidebar-item :is-nest="true" class="nest-menu" v-if="child.children&&child.children.length>0" :item="child" :key="child.path" :base-path="resolvePath(child.path)"></sidebar-item>
19 19
 
20 20
           <template v-else>
21
-            <!-- <router-link :key="child.name" :to="resolvePath(child.path)"> -->
22 21
               <el-menu-item v-if="child.unfinished == true" :key="child.name" @click.native="unfinishAction()"  :index="resolvePath(child.path)">
23 22
                 <svg-icon v-if="child.meta&&child.meta.icon" :icon-class="child.meta.icon"></svg-icon>
24 23
                 <span v-if="child.meta&&child.meta.title" slot="title">{{generateTitle(child.meta.title)}}</span>
25 24
               </el-menu-item>
26
-            <!-- </router-link> -->
27 25
             <router-link v-else :to="resolvePath(child.path)" :key="child.name">
28 26
               <el-menu-item :index="resolvePath(child.path)">
29 27
                 <svg-icon v-if="child.meta&&child.meta.icon" :icon-class="child.meta.icon"></svg-icon>
@@ -33,8 +31,30 @@
33 31
           </template>
34 32
           
35 33
         </template>
36
-      </el-submenu>
34
+      </el-submenu> -->
37 35
 
36
+      <div v-if="hasOneShowingChild(item.children) && !onlyOneChild.children && !item.alwaysShow" @click="onClick(item)">
37
+        <router-link :to="resolvePath(onlyOneChild.path)">
38
+          <el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{ 'submenu-title-noDropdown': !isNest }">
39
+            <svg-icon v-if="onlyOneChild.meta && onlyOneChild.meta.icon" :icon-class="onlyOneChild.meta.icon"></svg-icon>
40
+            <span v-if="onlyOneChild.meta && onlyOneChild.meta.title" slot="title">{{ generateTitle(onlyOneChild.meta.title) }}</span>
41
+          </el-menu-item>
42
+        </router-link>
43
+        
44
+      </div>
45
+
46
+        <div v-else @click="onClick(item)">
47
+          <router-link :to="resolvePath(item.children[0].path)">
48
+            <el-menu-item :index="item.path">
49
+              <template slot="title">
50
+                <svg-icon v-if="item.meta && item.meta.icon" :icon-class="item.meta.icon"></svg-icon>
51
+                <span v-if="item.meta && item.meta.title" slot="title">
52
+                  {{ generateTitle(item.meta.title) }}
53
+                </span>
54
+              </template>
55
+            </el-menu-item>
56
+          </router-link>
57
+        </div>
38 58
   </div>
39 59
 </template>
40 60
 
@@ -42,6 +62,8 @@
42 62
 import path from 'path'
43 63
 import { generateTitle } from '@/utils/i18n'
44 64
 
65
+import { mapGetters } from "vuex";
66
+
45 67
 export default {
46 68
   name: 'SidebarItem',
47 69
   props: {
@@ -59,6 +81,9 @@ export default {
59 81
       default: ''
60 82
     }
61 83
   },
84
+  computed: {
85
+    ...mapGetters(["permission_routers"])
86
+  },
62 87
   data() {
63 88
     return {
64 89
       onlyOneChild: null
@@ -87,7 +112,57 @@ export default {
87 112
     unfinishAction: function() {
88 113
       this.$message.error("功能开发中")
89 114
     },
115
+    onClick(index) {
116
+      this.permission_routers.map((item, i) => {
117
+        if (this.isObjectValueEqual(item, index)) {
118
+          this.$emit("a", i);
119
+        }
120
+      });
121
+    },
122
+    isObjectValueEqual(a, b) {
123
+      var aProps = Object.getOwnPropertyNames(a);
124
+      var bProps = Object.getOwnPropertyNames(b);
125
+
126
+      if (aProps.length != bProps.length) {
127
+        return false;
128
+      }
129
+
130
+      for (var i = 0; i < aProps.length; i++) {
131
+        var propName = aProps[i];
132
+
133
+        if (a[propName] !== b[propName]) {
134
+          return false;
135
+        }
136
+      }
137
+
138
+      return true;
139
+    }
90 140
   }
91 141
 }
92 142
 </script>
93 143
 
144
+<style lang="scss">
145
+.menu-wrapper{
146
+  .el-menu-item{
147
+   background-color:#1F2D3D !important;
148
+   color: #fff !important;
149
+  }
150
+  .el-menu{
151
+    background-color:#1F2D3D !important;
152
+  }
153
+  .el-submenu__title{
154
+    background-color:#1F2D3D !important;
155
+    color: #fff !important;
156
+    height: 32px !important;
157
+    line-height: 32px !important;
158
+  }
159
+  .router-link-exact-active{
160
+    color: rgb(64, 158, 255) !important;
161
+    .el-menu-item{
162
+      color: rgb(64, 158, 255) !important;
163
+    }
164
+  }
165
+}
166
+
167
+</style>
168
+

+ 86 - 3
src/views/layout/components/Sidebar/index.vue View File

@@ -1,19 +1,55 @@
1 1
 <template>
2 2
   <el-scrollbar wrapClass="scrollbar-wrapper">
3
-    <div class="sideColumn">
3
+    <!-- <div class="sideColumn">
4 4
        <hamburger class="hamburger-container" :toggleClick="toggleSideBar" :isActive="sidebar.opened"></hamburger>      
5
+    </div> -->
6
+    <!-- <el-menu
7
+      mode="vertical"
8
+      :unique-opened="uniqueOpened"
9
+      :show-timeout="200"
10
+      :default-active="$route.path"
11
+      :collapse="isCollapse"
12
+      background-color="#304156"
13
+      text-color="#bfcbd9"
14
+      active-text-color="#409EFF"
15
+    > -->
16
+    <div class="logo">
17
+      <img src="../../../../assets/logo/logo1.png" alt />
5 18
     </div>
6 19
     <el-menu
7 20
       mode="vertical"
8 21
       :unique-opened="uniqueOpened"
9 22
       :show-timeout="200"
10 23
       :default-active="$route.path"
11
-      :collapse="isCollapse"
12 24
       background-color="#304156"
13 25
       text-color="#bfcbd9"
14 26
       active-text-color="#409EFF"
15 27
     >
16
-      <sidebar-item v-for="route in permission_routers" :key="route.name" :item="route" :base-path="route.path"></sidebar-item>
28
+      <sidebar-item v-for="route in permission_routers" :key="route.name" :item="route" :base-path="route.path" @a="b"></sidebar-item>
29
+      <el-menu-item v-if="this.$store.getters.xt_user.xt_role_exist" index="100">
30
+        <a :href="XTWebsit()">
31
+          <i class="icon iconfont icon-manbing-xuanzhong" style="margin-right:4px"></i>
32
+          <span
33
+            slot="title"
34
+          >血透管理</span>
35
+        </a>
36
+      </el-menu-item>
37
+      <el-menu-item v-if="this.$store.getters.xt_user.cdm_role_exist" index="100">
38
+        <a :href="CDMWebsit()">
39
+          <i class="icon iconfont icon-manbing-xuanzhong" style="margin-right:4px"></i>
40
+          <span
41
+            slot="title"
42
+          >慢病管理</span>
43
+        </a>
44
+      </el-menu-item>
45
+      <el-menu-item v-if="this.$store.getters.xt_user.mall_role_exist" index="102">
46
+        <a :href="MircoMallWebsit()">
47
+          <i class="icon iconfont icon-service_fill" style="margin-right:4px"></i>
48
+          <span
49
+            slot="title"
50
+          >分销商城</span>
51
+        </a>
52
+      </el-menu-item>
17 53
     </el-menu>
18 54
   </el-scrollbar>
19 55
 </template>
@@ -35,12 +71,32 @@ export default {
35 71
   data(){
36 72
     return{
37 73
       uniqueOpened:true,
74
+      activeClass: 0,
75
+      index: 0
38 76
     }
39 77
   },
40 78
   methods:{
41 79
     toggleSideBar() {
42 80
       this.$store.dispatch("toggleSideBar");
43 81
     },
82
+    b(index) {
83
+      // this.index = index;
84
+      // this.activeClass = index;
85
+      // console.log('b',index)
86
+      this.$emit("callBackIndex", index);
87
+    },
88
+    XTWebsit() {
89
+      return process.env.XT_HOST
90
+    },
91
+    CDMWebsit() {
92
+      return process.env.CDM_HOST;
93
+    },
94
+    SCRMWebsit() {
95
+      return process.env.SRCM_HOST;
96
+    },
97
+    MircoMallWebsit() {
98
+      return process.env.MIRCO_MALL_HOST;
99
+    },
44 100
   }
45 101
 };
46 102
 </script>
@@ -83,6 +139,33 @@ export default {
83 139
   }
84 140
 }
85 141
 }
142
+.logo {
143
+  width: 100px;
144
+  height: 32px;
145
+  margin: 20px auto;
146
+  img {
147
+    width: 100%;
148
+    height: 100%;
149
+    display: block;
150
+  }
151
+}
86 152
 
87 153
 </style>
154
+<style lang="scss">
155
+.scrollbar-wrapper {
156
+  background-color: #1F2D3D;
157
+  .el-menu{
158
+    background-color: #1F2D3D !important;
159
+  }
160
+  .el-menu-item{
161
+    height: 32px !important;
162
+    line-height: 32px !important;
163
+    background-color: #1F2D3D !important;
164
+    color: #fff !important;
165
+    i{
166
+      color: #fff;
167
+    }
168
+  }
169
+}
170
+</style>
88 171
 

+ 86 - 18
src/views/layout/components/TagsView.vue View File

@@ -1,6 +1,6 @@
1 1
 <template>
2 2
   <div class="tags-view-container">
3
-    <scroll-pane class='tags-view-wrapper' ref='scrollPane'>
3
+    <!-- <scroll-pane class='tags-view-wrapper' ref='scrollPane'>
4 4
       <router-link 
5 5
         ref='tag' 
6 6
         class="tags-view-item" 
@@ -17,41 +17,84 @@
17 17
       <li @click="closeSelectedTag(selectedTag)">{{$t('tagsView.close')}}</li>
18 18
       <li @click="closeOthersTags">{{$t('tagsView.closeOthers')}}</li>
19 19
       <li @click="closeAllTags">{{$t('tagsView.closeAll')}}</li>
20
-    </ul>
20
+    </ul> -->
21
+    <div class="tags-view-wrapper">
22
+        <div class="tagsBox">
23
+          <div class="tagsOne"
24
+            v-if="permission_routers[newIndex].meta"
25
+            v-for="(item, i) in permission_routers[newIndex].children"
26
+            :key="i"
27
+          >
28
+            <router-link :to="item.path" v-if="!item.hidden && !item.is_menu">
29
+              <p
30
+                class="newTags"
31
+                :class="activeClass == i ? 'active' : ''"
32
+                @click="onClick(i)"
33
+              >{{ generateTitle(item.meta.title) }}</p>
34
+            </router-link>
35
+          </div>
36
+          <div v-else class="tagsOne">
37
+            <p class="newTags" :class="activeClass == i ? 'active' : ''" @click="onClick(i)">
38
+              {{
39
+              generateTitle(permission_routers[newIndex].children[0].meta.title)
40
+              }}
41
+            </p>
42
+          </div>
43
+        </div>
44
+      </div>
21 45
   </div>
22 46
 </template>
23 47
 
24 48
 <script>
25 49
 import ScrollPane from '@/components/ScrollPane'
26 50
 import { generateTitle } from '@/utils/i18n'
51
+
52
+import { mapGetters } from "vuex";
27 53
   
28 54
 export default {
29 55
   components: { ScrollPane },
56
+  props: {
57
+    index: Number,
58
+  },
30 59
   data() {
31 60
     return {
32 61
       visible: false,
33 62
       top: 0,
34 63
       left: 0,
35
-      selectedTag: {}
64
+      selectedTag: {},
65
+      newIndex: 0,
66
+      activeClass: 0,
36 67
     }
37 68
   },
38 69
   computed: {
39
-    visitedViews() {
40
-      return this.$store.state.tagsView.visitedViews
41
-    }
70
+    // visitedViews() {
71
+    //   return this.$store.state.tagsView.visitedViews
72
+    // },
73
+    ...mapGetters(["permission_routers"])
42 74
   },
43 75
   watch: {
44
-    $route() {
45
-      this.addViewTags()
46
-      this.moveToCurrentTag()
76
+    // $route() {
77
+    //   this.addViewTags()
78
+    //   this.moveToCurrentTag()
79
+    // },
80
+    // visible(value) {
81
+    //   if (value) {
82
+    //     document.body.addEventListener('click', this.closeMenu)
83
+    //   } else {
84
+    //     document.body.removeEventListener('click', this.closeMenu)
85
+    //   }
86
+    // }
87
+    index(newVal) {
88
+      console.log(newVal)
89
+      // if (this.newIndex != newVal) {
90
+      //   this.activeClass = 0;
91
+      // }
92
+      this.newIndex = newVal;
47 93
     },
48
-    visible(value) {
49
-      if (value) {
50
-        document.body.addEventListener('click', this.closeMenu)
51
-      } else {
52
-        document.body.removeEventListener('click', this.closeMenu)
53
-      }
54
-    }
94
+  },
95
+  created(){
96
+    console.log(this.permission_routers)
97
+    this.newIndex = 3
55 98
   },
56 99
   mounted() {
57 100
     this.addViewTags()
@@ -116,7 +159,11 @@ export default {
116 159
     },
117 160
     closeMenu() {
118 161
       this.visible = false
119
-    }
162
+    },
163
+    onClick(index) {
164
+      // console.log(index);
165
+      this.activeClass = index;
166
+    },
120 167
   }
121 168
 }
122 169
 </script>
@@ -125,13 +172,14 @@ export default {
125 172
 .tags-view-container {
126 173
   height: 60px;
127 174
   .tags-view-wrapper {
175
+    width: 100%;
128 176
     background: #fff;
129 177
     height: 50px;
130 178
     border-bottom: 1px solid #d8dce5;
131 179
     box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .12), 0 0 3px 0 rgba(0, 0, 0, .04);
132 180
     position: fixed;
133 181
     z-index: 1000;
134
-    top: 60px;
182
+    top: 50px;
135 183
     overflow-x: scroll;
136 184
     /* 针对缺省样式 (必须的) */
137 185
       &::-webkit-scrollbar {
@@ -222,6 +270,26 @@ export default {
222 270
       }
223 271
     }
224 272
   }
273
+  .tagsBox {
274
+    display: flex;
275
+    align-items: center;
276
+    height: 100%;
277
+    .tagsOne {
278
+      .newTags {
279
+        border: 1px solid rgba(235, 238, 240, 1);
280
+        border-radius: 2px;
281
+        padding: 8px 12px;
282
+        margin-left: 10px;
283
+        font-size: 14px;
284
+      }
285
+    }
286
+    .active {
287
+      border: 1px solid rgba(64, 158, 255, 1);
288
+      background: rgba(64, 158, 255, 1);
289
+      border-radius: 2px;
290
+      color: #fff;
291
+    }
292
+  }
225 293
 }
226 294
 </style>
227 295