From 131abe876d5c698d03b2a8c821ac658c532e73e6 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Wed, 7 May 2025 13:22:43 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E8=8F=9C=E5=8D=95=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E9=94=AE=E7=9B=98=E9=80=89=E6=8B=A9&?= =?UTF-8?q?=E6=82=AC=E6=B5=AE=E4=B8=BB=E9=A2=98=E8=83=8C=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/assets/icons/svg/enter.svg | 1 + .../src/components/HeaderSearch/index.vue | 38 +++++++++++++++++-- 2 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 ruoyi-ui/src/assets/icons/svg/enter.svg diff --git a/ruoyi-ui/src/assets/icons/svg/enter.svg b/ruoyi-ui/src/assets/icons/svg/enter.svg new file mode 100644 index 00000000..f7cabf29 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/enter.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/components/HeaderSearch/index.vue b/ruoyi-ui/src/components/HeaderSearch/index.vue index 9159556a..41d9275c 100644 --- a/ruoyi-ui/src/components/HeaderSearch/index.vue +++ b/ruoyi-ui/src/components/HeaderSearch/index.vue @@ -16,11 +16,14 @@ prefix-icon="el-icon-search" placeholder="菜单搜索,支持标题、URL模糊查询" clearable + @keyup.enter.native="selectActiveResult" + @keydown.up.native="navigateResult('up')" + @keydown.down.native="navigateResult('down')" >
-
+
@@ -32,6 +35,7 @@ {{ item.path }}
+
@@ -51,11 +55,15 @@ export default { search: '', options: [], searchPool: [], + activeIndex: -1, show: false, fuse: undefined } }, computed: { + theme() { + return this.$store.state.settings.theme + }, routes() { return this.$store.getters.defaultRoutes } @@ -84,6 +92,7 @@ export default { this.search = '' this.options = [] this.show = false + this.activeIndex = -1 }, change(val) { const path = val.path @@ -162,11 +171,31 @@ export default { return res }, querySearch(query) { + this.activeIndex = -1 if (query !== '') { this.options = this.fuse.search(query).map((item) => item.item) ?? this.searchPool } else { this.options = this.searchPool } + }, + activeStyle(index) { + if (index !== this.activeIndex) return {} + return { + "background-color": this.theme, + "color": "#fff" + } + }, + navigateResult(direction) { + if (direction === "up") { + this.activeIndex = this.activeIndex <= 0 ? this.options.length - 1 : this.activeIndex - 1 + } else if (direction === "down") { + this.activeIndex = this.activeIndex >= this.options.length - 1 ? 0 : this.activeIndex + 1 + } + }, + selectActiveResult() { + if (this.options.length > 0 && this.activeIndex >= 0) { + this.change(this.options[this.activeIndex]) + } } } } @@ -189,11 +218,13 @@ export default { .result-wrap { height: 280px; - margin: 12px 0; + margin: 6px 0; .search-item { display: flex; height: 48px; + align-items: center; + padding-right: 10px; .left { width: 60px; @@ -202,16 +233,17 @@ export default { .menu-icon { width: 18px; height: 18px; - margin-top: 5px; } } .search-info { padding-left: 5px; + margin-top: 10px; width: 100%; display: flex; flex-direction: column; justify-content: flex-start; + flex: 1; .menu-title, .menu-path { From 9f39dfd0c18e7ab4ecf0fa67698f2c3d4455551a Mon Sep 17 00:00:00 2001 From: RuoYi Date: Fri, 9 May 2025 13:45:39 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E6=A0=8F=E6=98=BE=E7=A4=BA=E6=98=B5=E7=A7=B0&=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/assets/icons/svg/more-up.svg | 1 + ruoyi-ui/src/components/RightPanel/index.vue | 106 ------------------ ruoyi-ui/src/layout/components/Navbar.vue | 42 ++++--- .../src/layout/components/Settings/index.vue | 17 +-- ruoyi-ui/src/layout/index.vue | 11 +- ruoyi-ui/src/settings.js | 2 +- ruoyi-ui/src/store/getters.js | 8 +- ruoyi-ui/src/store/modules/user.js | 5 + 8 files changed, 52 insertions(+), 140 deletions(-) create mode 100644 ruoyi-ui/src/assets/icons/svg/more-up.svg delete mode 100644 ruoyi-ui/src/components/RightPanel/index.vue diff --git a/ruoyi-ui/src/assets/icons/svg/more-up.svg b/ruoyi-ui/src/assets/icons/svg/more-up.svg new file mode 100644 index 00000000..d30ac11c --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/more-up.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/components/RightPanel/index.vue b/ruoyi-ui/src/components/RightPanel/index.vue deleted file mode 100644 index 25ce3f81..00000000 --- a/ruoyi-ui/src/components/RightPanel/index.vue +++ /dev/null @@ -1,106 +0,0 @@ - - - - - diff --git a/ruoyi-ui/src/layout/components/Navbar.vue b/ruoyi-ui/src/layout/components/Navbar.vue index 14db4d34..258a9474 100644 --- a/ruoyi-ui/src/layout/components/Navbar.vue +++ b/ruoyi-ui/src/layout/components/Navbar.vue @@ -25,23 +25,24 @@ - +
- + {{ nickName }}
个人中心 - - 布局设置 - 退出登录
+ +
+ +
@@ -58,6 +59,7 @@ import RuoYiGit from '@/components/RuoYi/Git' import RuoYiDoc from '@/components/RuoYi/Doc' export default { + emits: ['setLayout'], components: { Breadcrumb, TopNav, @@ -72,17 +74,12 @@ export default { ...mapGetters([ 'sidebar', 'avatar', - 'device' + 'device', + 'nickName' ]), setting: { get() { return this.$store.state.settings.showSettings - }, - set(val) { - this.$store.dispatch('settings/changeSetting', { - key: 'showSettings', - value: val - }) } }, topNav: { @@ -95,6 +92,9 @@ export default { toggleSideBar() { this.$store.dispatch('app/toggleSideBar') }, + setLayout(event) { + this.$emit('setLayout') + }, logout() { this.$confirm('确定注销并退出系统吗?', '提示', { confirmButtonText: '确定', @@ -173,17 +173,25 @@ export default { } .avatar-container { - margin-right: 30px; + margin-right: 0px; + padding-right: 0px; .avatar-wrapper { - margin-top: 5px; + margin-top: 10px; position: relative; .user-avatar { cursor: pointer; - width: 40px; - height: 40px; - border-radius: 10px; + width: 30px; + height: 30px; + border-radius: 50%; + } + + .user-nickname{ + position: relative; + bottom: 10px; + font-size: 14px; + font-weight: bold; } .el-icon-caret-bottom { diff --git a/ruoyi-ui/src/layout/components/Settings/index.vue b/ruoyi-ui/src/layout/components/Settings/index.vue index 39043a06..8e24cae1 100644 --- a/ruoyi-ui/src/layout/components/Settings/index.vue +++ b/ruoyi-ui/src/layout/components/Settings/index.vue @@ -1,5 +1,5 @@