Browse Source

vip去除缓存

1
mo 3 years ago
parent
commit
a5db86041f
1 changed files with 17 additions and 8 deletions
  1. 17 8
      src/views/buildVip/index.vue

+ 17 - 8
src/views/buildVip/index.vue

@@ -894,6 +894,22 @@ export default {
     //   this.$refs["leftForm"].resetFields();
     // }, 100);
     // 判断一下有没有缓存
+    this.$router.beforeEach(async (to, from, next) => {
+      if (this.leftForm?.classOrganId) {
+        this.$confirm("检测到您有未提交的数据, 离开将丢失该数据?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          closeOnClickModal: false,
+          type: "warning",
+        }).then(async () => {
+          next()
+        }).catch(err=>{
+
+        });
+      } else {
+        next();
+      }
+    });
     this.courseType = this.$route.query.courseType;
     if (this.courseType == "PRACTICE") {
       this.title = "网管课申请";
@@ -998,14 +1014,7 @@ export default {
     // }, 100);
     // this.init();
   },
-  async beforeDestroy() {
-    this.$confirm("检测到您有未提交的数据, 是否恢复?", "提示", {
-      confirmButtonText: "确定",
-      cancelButtonText: "取消",
-      closeOnClickModal: false,
-      type: "warning",
-    }).then(async () => {});
-  },
+  async beforeDestroy() {},
   methods: {
     resetFrom() {
       this.leftForm = {