Просмотр исходного кода

Merge branch 'v5.0.0dev' of https://gitee.com/ZhongBangKeJi/CRMEB into v5.0.0dev

sugar1569 2 лет назад
Родитель
Сommit
8320efedfc

+ 3 - 1
template/admin/src/layout/component/aside.vue

@@ -66,9 +66,11 @@ export default {
     this.bus.$on('setSendColumnsChildren', (res) => {
       console.log('收到了', res);
       this.menuList = res || [];
+      this.menuList.length > 0
+        ? (this.$store.state.themeConfig.themeConfig.isCollapse = false)
+        : (this.$store.state.themeConfig.themeConfig.isCollapse = true);
     });
     this.bus.$on('layoutMobileResize', (res) => {
-
       this.initMenuFixed(res.clientWidth);
     });
     // 菜单滚动条监听

+ 12 - 6
template/admin/src/layout/component/columnsAside.vue

@@ -74,6 +74,7 @@ export default {
   methods: {
     // 设置菜单高亮位置移动
     setColumnsAsideMove(k) {
+      console.log(k);
       if (k === undefined) return false;
       const els = this.$refs.columnsAsideOffsetTopRefs;
       this.liIndex = k;
@@ -140,12 +141,16 @@ export default {
     },
     // tagsView 点击时,根据路由查找下标 columnsAsideList,实现左侧菜单高亮
     setColumnsMenuHighlight(path) {
-      this.routeSplit = path.split('/');
-      this.routeSplit.shift();
-      const routeFirst = `/${this.routeSplit[0]}`;
-      const currentSplitRoute = this.columnsAsideList.find((v) => v.path === routeFirst);
+      // this.routeSplit = path.split('/');
+      // this.routeSplit.shift();
+      // const routeFirst = `/${this.routeSplit[0]}`;
+      console.log(path, this.columnsAsideList);
+      const currentSplitRoute = this.columnsAsideList.find((v) => v.path === path);
       console.log(currentSplitRoute, 'currentSplitRoute');
-      if (!currentSplitRoute) return false;
+      if (!currentSplitRoute) {
+        // this.onColumnsAsideDown(0);
+        return false;
+      }
       // 延迟拿值,防止取不到
       setTimeout(() => {
         this.onColumnsAsideDown(currentSplitRoute.k);
@@ -161,7 +166,6 @@ export default {
           ? (this.difference = 3)
           : (this.difference = 0);
         if (val.routesList.routesList.length === this.columnsAsideList.length) return false;
-        // this.setFilterRoutes();
       },
       deep: true,
     },
@@ -171,6 +175,8 @@ export default {
         this.setColumnsMenuHighlight(to.path);
         // this.setColumnsAsideMove();
         let HeadName = getHeaderName(to, this.columnsAsideList);
+        console.log(to, '1231');
+
         let asideList = getMenuSider(this.columnsAsideList, HeadName)[0]?.children;
         const resData = this.setSendChildren(HeadName);
         if (resData.length <= 0) return false;

+ 1 - 1
template/admin/src/layout/navBars/breadcrumb/userNews.vue

@@ -21,7 +21,7 @@
         </div>
       </div>
     </div>
-    <div class="foot-box" @click="onGoToGiteeClick" v-if="newsList.length > 0">{{ $t('message.user.newGo') }}</div>
+    <!-- <div class="foot-box" @click="onGoToGiteeClick" v-if="newsList.length > 0">{{ $t('message.user.newGo') }}</div> -->
   </div>
 </template>
 

+ 23 - 18
template/admin/src/layout/navBars/tagsView/tagsView.vue

@@ -3,7 +3,7 @@
     <el-scrollbar ref="scrollbarRef" @wheel.native.prevent="onHandleScroll">
       <ul class="layout-navbars-tagsview-ul" :class="setTagsStyle" ref="tagsUlRef">
         <li
-          v-for="(v, k) in tagNavList"
+          v-for="(v, k) in tagsViewList"
           :key="k"
           class="layout-navbars-tagsview-ul-li"
           :data-name="v.name"
@@ -46,7 +46,7 @@ export default {
   data() {
     return {
       userInfo: {},
-      tagsViewList: [],
+      // tagsViewList: [],
       tagsDropdown: {
         x: '',
         y: '',
@@ -65,7 +65,7 @@ export default {
     setTagsStyle() {
       return this.$store.state.themeConfig.themeConfig.tagsStyle;
     },
-    tagNavList() {
+    tagsViewList() {
       return this.$store.state.app.tagNavList;
     },
   },
@@ -74,9 +74,11 @@ export default {
     this.bus.$on('onCurrentContextmenuClick', (data) => {
       this.onCurrentContextmenuClick(data);
     });
+    console.log(this.$store.state.app.tagNavList);
+    this.tagsViewRoutesList = this.$store.state.app.tagNavList;
   },
   mounted() {
-    this.getTagsViewRoutes();
+    // this.getTagsViewRoutes();
   },
   methods: {
     ...mapMutations(['setBreadCrumb', 'setTagNavList', 'addTag', 'setLocal', 'setHomeRoute', 'closeTag']),
@@ -192,7 +194,7 @@ export default {
     },
     // 存储 tagsViewList 到浏览器临时缓存中,页面刷新时,保留记录
     addBrowserSetSession(tagNavList) {
-      this.$store.commit('app/tagNavList', tagNavList);
+      this.setTagNavList(tagNavList);
     },
     // 初始化设置了 tagsView 数据
     initTagsViewList() {
@@ -259,13 +261,13 @@ export default {
     },
     // 2、关闭当前 tagsView:当前项 `tags-view` icon 关闭时点击,如果是设置了固定的(isAffix),不可以关闭
     closeCurrentTagsView(path) {
-      this.tagNavList.map((v, k, arr) => {
-        if (!v.isAffix) {
+      this.tagsViewList.map((v, k, arr) => {
+        if (!v.meta.isAffix) {
           if (v.path === path) {
-            this.tagNavList.splice(k, 1);
+            this.tagsViewList.splice(k, 1);
             setTimeout(() => {
               // 最后一个
-              if (this.tagNavList.length === k)
+              if (this.tagsViewList.length === k)
                 this.$router.push({ path: arr[arr.length - 1].path, query: arr[arr.length - 1].query });
               // 否则,跳转到下一个
               else this.$router.push({ path: arr[k].path, query: arr[k].query });
@@ -273,28 +275,31 @@ export default {
           }
         }
       });
-      this.setTagNavList();
+      this.setTagNavList(this.tagsViewList);
       //   this.addBrowserSetSession(this.tagNavList);
     },
     // 3、关闭其它 tagsView:如果是设置了固定的(isAffix),不进行关闭
     closeOtherTagsView(path) {
-      this.tagsViewList = [];
+      let tagsViewList = [];
       this.tagsViewRoutesList.map((v) => {
-        if (v.isAffix && !v.isHide) this.tagsViewList.push({ ...v });
+        if (v.meta.isAffix && !v.meta.isHide) tagsViewList.push({ ...v });
+        if ((v.path = path)) tagsViewList.push({ ...v });
+        console.log(tagsViewList);
       });
-      this.addTagsView(path);
+      this.addBrowserSetSession(tagsViewList);
+      // this.addTagsView(path);
     },
     // 4、关闭全部 tagsView:如果是设置了固定的(isAffix),不进行关闭
     closeAllTagsView(path) {
-      this.tagsViewList = [];
+      let tagsViewList = [];
       this.tagsViewRoutesList.map((v) => {
-        if (v.isAffix && !v.isHide) {
-          this.tagsViewList.push({ ...v });
-          if (this.tagsViewList.some((v) => v.path === path)) this.$router.push({ path, query: this.$route.query });
+        if (v.meta.isAffix && !v.meta.isHide) {
+          tagsViewList.push({ ...v });
+          if (tagsViewList.some((v) => v.path === path)) this.$router.push({ path, query: this.$route.query });
           else this.$router.push({ path: v.path, query: this.$route.query });
         }
       });
-      this.addBrowserSetSession(this.tagsViewList);
+      this.addBrowserSetSession(tagsViewList);
     },
   },
   watch: {

+ 1 - 1
template/admin/src/router/modules/index.js

@@ -58,7 +58,7 @@ export default {
       meta: {
         auth: ['admin-index-index'],
         title: '主页',
-        affix: true,
+        isAffix: true,
       },
       component: () => import('@/pages/index/index'),
     },