瀏覽代碼

跳转拦截

1
mo 4 年之前
父節點
當前提交
9728f43237
共有 3 個文件被更改,包括 56 次插入31 次删除
  1. 45 27
      src/layout/components/TagsView.vue
  2. 2 1
      src/store/getters.js
  3. 9 3
      src/views/teamDetail/components/memberClassList.vue

+ 45 - 27
src/layout/components/TagsView.vue

@@ -108,18 +108,17 @@ export default {
       return route.path === this.$route.path;
     },
     syncTagViewAndSaveForm() {
-      const keys = this.$store.state.tagsView.visitedViews.map(
-        (item) => {
-          //  (item)
-          return item.path}
-      );
+      const keys = this.$store.state.tagsView.visitedViews.map((item) => {
+        //  (item)
+        return item.path;
+      });
       const searchs = new Searchs();
       const allSearch = searchs.getSearchs();
 
       const sks = Object.keys(allSearch);
       let route = this.$route;
       for (const item of sks) {
-       if (!(keys.includes(item) || keys.includes(allSearch[item].bind))) {
+        if (!(keys.includes(item) || keys.includes(allSearch[item].bind))) {
           searchs.removeByKey(item);
         }
 
@@ -160,24 +159,44 @@ export default {
         }
       });
     },
-    closeSelectedTag(view) {
-      activeKey = "1";
+    async closeSelectedTag(view) {
 
-      const searchs = new Searchs();
-      searchs.remove(this.$route.path);
-      this.$store
-        .dispatch("delVisitedViews", { ...view, dontNeedSave: true })
-        .then((views) => {
+      activeKey = "1";
+      //
+      if (this.$route.meta.nogo) {
+        try {
+          let views = await this.$store.getters.views;
           if (this.isActive(view)) {
-            const latestView = views.slice(-1)[0];
+
+            const latestView = views[views.length -2];
+            console.log(views)
             if (latestView) {
               this.$router.push(latestView.fullPath);
             } else {
-              let firstMenuUrl = localStorage.getItem('firstMenuUrl')
-              this.$router.push(firstMenuUrl || '/');
+              let firstMenuUrl = localStorage.getItem("firstMenuUrl");
+              this.$router.push(firstMenuUrl || "/");
             }
           }
-        });
+        } catch (e) {
+          console.log(e)
+        }
+      } else {
+        const searchs = new Searchs();
+        searchs.remove(this.$route.path);
+        this.$store
+          .dispatch("delVisitedViews", { ...view, dontNeedSave: true })
+          .then((views) => {
+            if (this.isActive(view)) {
+              const latestView = views.slice(-1)[0];
+              if (latestView) {
+                this.$router.push(latestView.fullPath);
+              } else {
+                let firstMenuUrl = localStorage.getItem("firstMenuUrl");
+                this.$router.push(firstMenuUrl || "/");
+              }
+            }
+          });
+      }
     },
     closeOthersTags() {
       this.$router.push(this.selectedTag.path);
@@ -195,19 +214,19 @@ export default {
       // this.selectedTag = tag;
       // this.left = e.clientX;
       // this.top = e.clientY - 55;
-      const menuMinWidth = 105
-      const offsetLeft = this.$el.getBoundingClientRect().left // container margin left
-      const offsetWidth = this.$el.offsetWidth // container width
-      const maxLeft = offsetWidth - menuMinWidth // left boundary
-      const left = e.clientX - offsetLeft + 15 // 15: margin right
+      const menuMinWidth = 105;
+      const offsetLeft = this.$el.getBoundingClientRect().left; // container margin left
+      const offsetWidth = this.$el.offsetWidth; // container width
+      const maxLeft = offsetWidth - menuMinWidth; // left boundary
+      const left = e.clientX - offsetLeft + 15; // 15: margin right
       if (left > maxLeft) {
-        this.left = maxLeft
+        this.left = maxLeft;
       } else {
-        this.left = left
+        this.left = left;
       }
       this.top = e.clientY - 55;
-      this.visible = true
-      this.selectedTag = tag
+      this.visible = true;
+      this.selectedTag = tag;
     },
     closeMenu() {
       this.visible = false;
@@ -219,7 +238,6 @@ export default {
       const searchs = new Searchs();
       let keyName = "";
 
-
       for (const key in searchs.searchs) {
         if (Object.hasOwnProperty.call(searchs.searchs, key)) {
           const item = searchs.searchs[key];

+ 2 - 1
src/store/getters.js

@@ -15,6 +15,7 @@ const getters = {
   newStudentinfo: state => state.buildTeam.newStudentList,
   reactClassStudentList:state=>state.reactClassStudent.classList ,
   buildIndex:state=>state.buildTeam.buildIndex,
-  draftIndex:state=>state.buildTeam.draftIndex
+  draftIndex:state=>state.buildTeam.draftIndex,
+  views:state=>state.tagsView.visitedViews
 }
 export default getters

+ 9 - 3
src/views/teamDetail/components/memberClassList.vue

@@ -45,6 +45,7 @@
         @expand-change="changeDetail"
         style
         ref="multipleTable"
+        row-key="id"
         :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
         tooltip-effect="dark"
         ><el-table-column type="expand">
@@ -294,6 +295,8 @@ export default {
   },
   mounted() {
     this.init();
+     this.$route.meta.nogo = true
+    // console.log()
   },
   methods: {
     async init() {
@@ -375,7 +378,7 @@ export default {
         path: "/business/resetTeaming",
         query: { ...this.$route.query },
       });
-      this.$store.dispatch("delVisitedViews", this.$route);
+
     },
     setStartTime() {
       this.$refs.form.validate(async (res) => {
@@ -480,10 +483,11 @@ export default {
           const res = await getPreCourseList({ classGroupId: row.id });
           this.activeSingleList.forEach((item, index) => {
             if (item.id == row.id) {
-              this.activeSingleList[index].courseData = res.data;
+              // this.activeSingleList[index].courseData = res.data;
+              this.$set( this.activeSingleList[index],'courseData',res.data)
             }
           });
-          console.log(this.activeSingleList);
+
         } catch (e) {
           console.log(e);
         }
@@ -534,11 +538,13 @@ export default {
         type: "warning",
       })
         .then(async () => {
+            this.$store.dispatch("delVisitedViews", this.$route);
           next();
           // musicGroupSchoolTermCourseDetailId
         })
         .catch(() => {});
     } else {
+        this.$store.dispatch("delVisitedViews", this.$route);
       next();
     }
   },