From 06fb8a260302fac3469c0d08664b908072e8ef35 Mon Sep 17 00:00:00 2001
From: hui <770260999@qq.com>
Date: Mon, 6 May 2024 08:56:51 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ruoyi-ui/src/store/modules/menu.js | 19 +++++-
.../components/RecentPages/ContextMenu.vue | 36 ++++++++++
.../components/RecentPages/index.vue | 66 ++++++++++++-------
ruoyi-ui/vue.config.js | 4 +-
4 files changed, 97 insertions(+), 28 deletions(-)
create mode 100644 ruoyi-ui/src/views/JiHeExpressway/components/RecentPages/ContextMenu.vue
diff --git a/ruoyi-ui/src/store/modules/menu.js b/ruoyi-ui/src/store/modules/menu.js
index 6f0103f4..c8d81166 100644
--- a/ruoyi-ui/src/store/modules/menu.js
+++ b/ruoyi-ui/src/store/modules/menu.js
@@ -29,6 +29,14 @@ const state = {
mutations.saveRecent(state);
},
+ pinRecent(state, item){
+ state.recentPages.forEach((unit, index) => {
+ if (unit.path == item.path) {
+ unit.isPinned = !unit.isPinned;
+ }
+ });
+ mutations.saveRecent(state);
+ },
openRecent(state){
state.isRecentOpen = true;
sessionStorage.setItem("isRecentOpen", true);
@@ -43,9 +51,14 @@ const state = {
mutations.saveRecent(state);
},
resetRecent(state, para){
- state.isRecentOpen = false;
- sessionStorage.setItem("isRecentOpen", false);
- sessionStorage.removeItem("recentPages")
+ temp = JSON.parse(sessionStorage.getItem("recentPages") || "[]");
+ state.recentPages = [];
+ temp.forEach((unit, index) => {
+ if (unit.isPinned) {
+ state.recentPages.push(unit);
+ }
+ });
+ state.isRecentOpen = true;
}
}
diff --git a/ruoyi-ui/src/views/JiHeExpressway/components/RecentPages/ContextMenu.vue b/ruoyi-ui/src/views/JiHeExpressway/components/RecentPages/ContextMenu.vue
new file mode 100644
index 00000000..8d61145c
--- /dev/null
+++ b/ruoyi-ui/src/views/JiHeExpressway/components/RecentPages/ContextMenu.vue
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ruoyi-ui/src/views/JiHeExpressway/components/RecentPages/index.vue b/ruoyi-ui/src/views/JiHeExpressway/components/RecentPages/index.vue
index 1450ffd4..eede637f 100644
--- a/ruoyi-ui/src/views/JiHeExpressway/components/RecentPages/index.vue
+++ b/ruoyi-ui/src/views/JiHeExpressway/components/RecentPages/index.vue
@@ -1,24 +1,34 @@
-
-
最近访问:
-
-
-
-
-
-
- {{item.title}}
-
-
+
+
+
+ 最近访问:
+
+
+
+
+
+
+
+ {{item.title}}
+
+
+
+
+
-
-