From 3835cf1ca8d5ac8475052d3876ebeb4a2c4160f1 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Mon, 22 Jan 2024 14:22:02 +0800
Subject: [PATCH] 根据角色,动态切换首页,及首页变更的一系列相关调整

---
 src/cache.js |   51 ++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 36 insertions(+), 15 deletions(-)

diff --git a/src/cache.js b/src/cache.js
index fdd723d..42d6359 100644
--- a/src/cache.js
+++ b/src/cache.js
@@ -1,30 +1,51 @@
-import Vue from 'vue'
-import store from './store';
+/*
+ * @Author: shuishen 1109946754@qq.com
+ * @Date: 2023-12-14 17:10:00
+ * @LastEditors: shuishen 1109946754@qq.com
+ * @LastEditTime: 2024-01-22 13:23:37
+ * @FilePath: \jczz_web\src\cache.js
+ * @Description:
+ *
+ * Copyright (c) 2024 by shuishen, All Rights Reserved.
+ */
+import Vue from "vue";
+import store from "./store";
 Vue.mixin({
   beforeRouteEnter: function (to, from, next) {
     next(() => {
-      let avueView = document.getElementById('avue-view');
+      let avueView = document.getElementById("avue-view");
       if (avueView && to.meta.savedPosition) {
-        avueView.scrollTop = to.meta.savedPosition
+        avueView.scrollTop = to.meta.savedPosition;
       }
-    })
+    });
   },
   beforeRouteLeave: function (to, from, next) {
-    let avueView = document.getElementById('avue-view');
+    let avueView = document.getElementById("avue-view");
     if (from && from.meta.keepAlive) {
       if (avueView) {
-        from.meta.savedPosition = avueView.scrollTop
+        from.meta.savedPosition = avueView.scrollTop;
       }
-      const result = this.$route.meta.keepAlive === true && store.state.tags.tagList.some(ele => {
-        return ele.value === this.$route.fullPath;
-      });
+      console.log(store.state.tags.tagList, this.$route.fullPath, 909999);
+      const result =
+        this.$route.meta.keepAlive === true &&
+        store.state.tags.tagList.some((ele) => {
+          return ele.value === this.$route.fullPath;
+        });
       if (this.$vnode && !result) {
-        from.meta.savedPosition = 0
-        if (this.$vnode.parent && this.$vnode.parent.componentInstance && this.$vnode.parent.componentInstance.cache) {
+        from.meta.savedPosition = 0;
+        if (
+          this.$vnode.parent &&
+          this.$vnode.parent.componentInstance &&
+          this.$vnode.parent.componentInstance.cache
+        ) {
           if (this.$vnode.componentOptions) {
-            let key = this.$vnode.key == null
-              ? this.$vnode.componentOptions.Ctor.cid + (this.$vnode.componentOptions.tag ? `::${this.$vnode.componentOptions.tag}` : '')
-              : this.$vnode.key;
+            let key =
+              this.$vnode.key == null
+                ? this.$vnode.componentOptions.Ctor.cid +
+                  (this.$vnode.componentOptions.tag
+                    ? `::${this.$vnode.componentOptions.tag}`
+                    : "")
+                : this.$vnode.key;
             let cache = this.$vnode.parent.componentInstance.cache;
             let keys = this.$vnode.parent.componentInstance.keys;
             if (cache[key]) {

--
Gitblit v1.9.3