update prettier 替换为 oxfmt 格式化整个项目的代码结构

This commit is contained in:
疯狂的狮子Li
2026-04-01 17:03:20 +08:00
parent 199771997d
commit 16d9e1e7fe
131 changed files with 3750 additions and 1571 deletions
+3 -1
View File
@@ -26,7 +26,9 @@ watch(
() => useSettingsStore().animationEnable,
(val: boolean) => {
if (val) {
animate.value = proxy?.animate.animateList[Math.round(Math.random() * proxy?.animate.animateList.length)] as string;
animate.value = proxy?.animate.animateList[
Math.round(Math.random() * proxy?.animate.animateList.length)
] as string;
} else {
animate.value = proxy?.animate.defaultAnimate as string;
}
+1 -1
View File
@@ -19,7 +19,7 @@ const tagsViewStore = useTagsViewStore();
function iframeUrl(url: string | undefined, query: any) {
if (Object.keys(query).length > 0) {
const params = Object.keys(query)
.map((key) => key + '=' + query[key])
.map(key => key + '=' + query[key])
.join('&');
return url + '?' + params;
}
+9 -2
View File
@@ -2,7 +2,12 @@
<div class="navbar" :class="'nav' + navType">
<div class="navbar-left">
<div v-if="navType !== NavTypeEnum.TOP" class="hamburger-shell">
<hamburger id="hamburger-container" :is-active="appStore.sidebar.opened" class="hamburger-container" @toggle-click="toggleSideBar" />
<hamburger
id="hamburger-container"
:is-active="appStore.sidebar.opened"
class="hamburger-container"
@toggle-click="toggleSideBar"
/>
</div>
<router-link v-else-if="showLogo" to="/" class="navtop-logo-shell">
<img :src="appLogo" class="navtop-logo-icon" alt="logo" />
@@ -31,7 +36,9 @@
<el-popover placement="bottom" trigger="click" transition="el-zoom-in-top" :width="300" :persistent="false">
<template #reference>
<el-badge :value="noticeStore.unreadCount.value > 0 ? noticeStore.unreadCount.value : ''" :max="99">
<div class="right-menu-item hover-effect message-trigger"><svg-icon icon-class="message" /></div>
<div class="right-menu-item hover-effect message-trigger">
<svg-icon icon-class="message" />
</div>
</el-badge>
</template>
<template #default>
+33 -7
View File
@@ -1,5 +1,12 @@
<template>
<el-drawer v-model="showSettings" class="settings-drawer" :with-header="false" direction="rtl" size="300px" close-on-click-modal>
<el-drawer
v-model="showSettings"
class="settings-drawer"
:with-header="false"
direction="rtl"
size="300px"
close-on-click-modal
>
<h3 class="drawer-title">菜单导航设置</h3>
<div class="nav-wrap">
<el-tooltip content="左侧菜单" placement="bottom">
@@ -9,7 +16,8 @@
:style="{ '--theme': theme }"
:class="{ activeItem: navType == NavTypeEnum.LEFT }"
>
<b></b><b></b>
<b></b>
<b></b>
</div>
</el-tooltip>
@@ -20,7 +28,8 @@
:style="{ '--theme': theme }"
:class="{ activeItem: navType == NavTypeEnum.MIX }"
>
<b></b><b></b>
<b></b>
<b></b>
</div>
</el-tooltip>
<el-tooltip content="顶部菜单" placement="bottom">
@@ -30,7 +39,8 @@
:style="{ '--theme': theme }"
:class="{ activeItem: navType == NavTypeEnum.TOP }"
>
<b></b><b></b>
<b></b>
<b></b>
</div>
</el-tooltip>
</div>
@@ -42,7 +52,15 @@
<img src="@/assets/images/dark.svg" alt="dark" />
<div v-if="sideTheme === 'theme-dark'" class="setting-drawer-block-checbox-selectIcon" style="display: block">
<i aria-label="图标: check" class="anticon anticon-check">
<svg viewBox="64 64 896 896" data-icon="check" width="1em" height="1em" :fill="theme" aria-hidden="true" focusable="false">
<svg
viewBox="64 64 896 896"
data-icon="check"
width="1em"
height="1em"
:fill="theme"
aria-hidden="true"
focusable="false"
>
<path
d="M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 0 0-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"
/>
@@ -54,7 +72,15 @@
<img src="@/assets/images/light.svg" alt="light" />
<div v-if="sideTheme === 'theme-light'" class="setting-drawer-block-checbox-selectIcon" style="display: block">
<i aria-label="图标: check" class="anticon anticon-check">
<svg viewBox="64 64 896 896" data-icon="check" width="1em" height="1em" :fill="theme" aria-hidden="true" focusable="false">
<svg
viewBox="64 64 896 896"
data-icon="check"
width="1em"
height="1em"
:fill="theme"
aria-hidden="true"
focusable="false"
>
<path
d="M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 0 0-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"
/>
@@ -169,7 +195,7 @@ const toggleDark = () => useToggle(isDark);
/** 菜单导航设置 */
watch(
navType,
(val) => {
val => {
if (val === NavTypeEnum.TOP) {
appStore.toggleSideBarHide(true);
permissionStore.setSidebarRouters(permissionStore.defaultRoutes as any);
+2 -9
View File
@@ -1,8 +1,5 @@
<template>
<div
class="sidebar-logo-container"
:class="{ collapse: collapse }"
>
<div class="sidebar-logo-container" :class="{ collapse: collapse }">
<transition :enter-active-class="proxy?.animate.logoAnimate.enter" mode="out-in">
<router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
<img v-if="logo" :src="logo" class="sidebar-logo" />
@@ -94,11 +91,7 @@ const logoTextColor = computed(() => (isDarkSide.value ? '#f8fbff' : 'var(--app-
line-height: 1;
font-size: 15px;
letter-spacing: 0.02em;
font-family:
'MiSans',
'HarmonyOS Sans SC',
'PingFang SC',
sans-serif;
font-family: 'MiSans', 'HarmonyOS Sans SC', 'PingFang SC', sans-serif;
vertical-align: middle;
}
}
+16 -3
View File
@@ -1,6 +1,12 @@
<template>
<div v-if="!item.hidden">
<template v-if="hasOneShowingChild(item, item.children) && (!onlyOneChild.children || onlyOneChild.noShowingChildren) && !item.alwaysShow">
<template
v-if="
hasOneShowingChild(item, item.children) &&
(!onlyOneChild.children || onlyOneChild.noShowingChildren) &&
!item.alwaysShow
"
>
<app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path, onlyOneChild.query)">
<el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{ 'submenu-title-noDropdown': !isNest }">
<svg-icon :icon-class="onlyOneChild.meta.icon || (item.meta && item.meta.icon)" />
@@ -11,7 +17,14 @@
</app-link>
</template>
<el-sub-menu v-else ref="subMenu" :index="resolvePath(item.path)" :popper-offset="isNest ? 4 : 12" :popper-class="popperClass" teleported>
<el-sub-menu
v-else
ref="subMenu"
:index="resolvePath(item.path)"
:popper-offset="isNest ? 4 : 12"
:popper-class="popperClass"
teleported
>
<template v-if="item.meta" #title>
<svg-icon :icon-class="item.meta ? item.meta.icon : ''" />
<span class="menu-title" :title="hasTitle(item.meta?.title)">{{ item.meta?.title }}</span>
@@ -61,7 +74,7 @@ const hasOneShowingChild = (parent: RouteRecordRaw, children?: RouteRecordRaw[])
if (!children) {
children = [];
}
const showingChildren = children.filter((item) => {
const showingChildren = children.filter(item => {
if (item.hidden) {
return false;
}
@@ -62,7 +62,7 @@ const moveToTarget = (currentTag: RouteLocationNormalized) => {
const containerWidth = container.offsetWidth;
const tagKey = currentTag.fullPath || currentTag.path;
const tagListDom = Array.from(document.querySelectorAll('.tags-view-item')) as HTMLElement[];
const currentIndex = tagListDom.findIndex((item) => item.dataset.tagKey === tagKey);
const currentIndex = tagListDom.findIndex(item => item.dataset.tagKey === tagKey);
if (currentIndex === -1) {
return;
}
+43 -14
View File
@@ -45,7 +45,7 @@
<span>全屏显示</span>
</template>
<template v-else>
<CloseBold />
<CloseBold />
<span>退出全屏</span>
</template>
</el-dropdown-item>
@@ -59,18 +59,47 @@
</span>
<ul v-show="visible" :style="{ left: left + 'px', top: top + 'px' }" class="contextmenu">
<li @click="refreshSelectedTag(selectedTag)"><RefreshRight style="width: 1em; height: 1em" /> 刷新页面</li>
<li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)"><Close style="width: 1em; height: 1em" /> 关闭当前</li>
<li @click="closeOthersTags"><CircleClose style="width: 1em; height: 1em" /> 关闭其他</li>
<li v-if="!isFirstView()" @click="closeLeftTags"><Back style="width: 1em; height: 1em" /> 关闭左侧</li>
<li v-if="!isLastView()" @click="closeRightTags"><Right style="width: 1em; height: 1em" /> 关闭右侧</li>
<li @click="closeAllTags(selectedTag)"><CircleClose style="width: 1em; height: 1em" /> 全部关闭</li>
<li @click="refreshSelectedTag(selectedTag)">
<RefreshRight style="width: 1em; height: 1em" />
刷新页面
</li>
<li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">
<Close style="width: 1em; height: 1em" />
关闭当前
</li>
<li @click="closeOthersTags">
<CircleClose style="width: 1em; height: 1em" />
关闭其他
</li>
<li v-if="!isFirstView()" @click="closeLeftTags">
<Back style="width: 1em; height: 1em" />
关闭左侧
</li>
<li v-if="!isLastView()" @click="closeRightTags">
<Right style="width: 1em; height: 1em" />
关闭右侧
</li>
<li @click="closeAllTags(selectedTag)">
<CircleClose style="width: 1em; height: 1em" />
全部关闭
</li>
</ul>
</div>
</template>
<script setup lang="ts">
import { ArrowDown, ArrowLeft, ArrowRight, Back, CircleClose, Close, CloseBold, FullScreen, RefreshRight, Right } from '@element-plus/icons-vue';
import {
ArrowDown,
ArrowLeft,
ArrowRight,
Back,
CircleClose,
Close,
CloseBold,
FullScreen,
RefreshRight,
Right
} from '@element-plus/icons-vue';
import ScrollPane from './ScrollPane.vue';
import { getNormalPath } from '@/utils/ruoyi';
import { useSettingsStore } from '@/store/modules/settings';
@@ -100,7 +129,7 @@ const visitedViews = computed(() => tagsViewStore.getVisitedViews());
const routes = computed(() => permissionStore.getRoutes());
const tagsIcon = computed(() => settingsStore.tagsIcon);
const selectedDropdownTag = computed<RouteLocationNormalized | undefined>(() => {
return visitedViews.value.find((tag) => isActive(tag)) || selectedTag.value;
return visitedViews.value.find(tag => isActive(tag)) || selectedTag.value;
});
watch(route, () => {
@@ -108,7 +137,7 @@ watch(route, () => {
moveToCurrentTag();
});
watch(visible, (value) => {
watch(visible, value => {
if (value) {
document.body.addEventListener('click', closeMenu);
} else {
@@ -172,7 +201,7 @@ const isLastView = () => {
const filterAffixTags = (routeList: RouteRecordRaw[], basePath = '') => {
let tags: RouteLocationNormalized[] = [];
routeList.forEach((item) => {
routeList.forEach(item => {
if (item.meta?.affix) {
const tagPath = getNormalPath(basePath + '/' + item.path);
tags.push({
@@ -261,7 +290,7 @@ const closeRightTags = () => {
return;
}
proxy?.$tab.closeRightPage(tag).then((views: RouteLocationNormalized[]) => {
if (!views.find((item) => item.fullPath === route.fullPath)) {
if (!views.find(item => item.fullPath === route.fullPath)) {
toLastView(views);
}
});
@@ -273,7 +302,7 @@ const closeLeftTags = () => {
return;
}
proxy?.$tab.closeLeftPage(tag).then((views: RouteLocationNormalized[]) => {
if (!views.find((item) => item.fullPath === route.fullPath)) {
if (!views.find(item => item.fullPath === route.fullPath)) {
toLastView(views);
}
});
@@ -292,7 +321,7 @@ const closeOthersTags = () => {
const closeAllTags = (view?: RouteLocationNormalized) => {
proxy?.$tab.closeAllPage().then(({ visitedViews: views }: { visitedViews: RouteLocationNormalized[] }) => {
if (affixTags.value.some((tag) => tag.path === route.path)) {
if (affixTags.value.some(tag => tag.path === route.path)) {
return;
}
toLastView(views, view);
+52 -29
View File
@@ -1,59 +1,82 @@
<template>
<el-menu class="topbar-menu" :ellipsis="false" :default-active="activeMenu" :active-text-color="theme" mode="horizontal">
<sidebar-item :key="route.path + index" v-for="(route, index) in topMenus" :item="route" :base-path="route.path" popper-class="topbar-menu-popper" />
<el-menu
class="topbar-menu"
:ellipsis="false"
:default-active="activeMenu"
:active-text-color="theme"
mode="horizontal"
>
<sidebar-item
:key="route.path + index"
v-for="(route, index) in topMenus"
:item="route"
:base-path="route.path"
popper-class="topbar-menu-popper"
/>
<el-sub-menu index="more" class="el-sub-menu__hide-arrow" popper-class="topbar-menu-popper" v-if="moreRoutes.length > 0">
<el-sub-menu
index="more"
class="el-sub-menu__hide-arrow"
popper-class="topbar-menu-popper"
v-if="moreRoutes.length > 0"
>
<template #title>
<span>更多菜单</span>
</template>
<sidebar-item :key="route.path + index" v-for="(route, index) in moreRoutes" :item="route" :base-path="route.path" popper-class="topbar-menu-popper" />
<sidebar-item
:key="route.path + index"
v-for="(route, index) in moreRoutes"
:item="route"
:base-path="route.path"
popper-class="topbar-menu-popper"
/>
</el-sub-menu>
</el-menu>
</template>
<script setup lang="ts">
import SidebarItem from '../Sidebar/SidebarItem'
import {useSettingsStore} from '@/store/modules/settings'
import {usePermissionStore} from '@/store/modules/permission'
import SidebarItem from '../Sidebar/SidebarItem';
import { useSettingsStore } from '@/store/modules/settings';
import { usePermissionStore } from '@/store/modules/permission';
const route = useRoute()
const settingsStore = useSettingsStore()
const permissionStore = usePermissionStore()
const route = useRoute();
const settingsStore = useSettingsStore();
const permissionStore = usePermissionStore();
const theme = computed(() => settingsStore.theme)
const theme = computed(() => settingsStore.theme);
const activeMenu = computed(() => {
const { meta, path } = route
const { meta, path } = route;
if (meta.activeMenu) {
return meta.activeMenu
return meta.activeMenu;
}
return path
})
return path;
});
const visibleNumber = ref(5)
const visibleNumber = ref(5);
const topMenus = computed(() => {
return permissionStore.sidebarRouters.filter((f) => !f.hidden).slice(0, visibleNumber.value)
})
return permissionStore.sidebarRouters.filter(f => !f.hidden).slice(0, visibleNumber.value);
});
const moreRoutes = computed(() => {
return permissionStore.sidebarRouters.filter((f) => !f.hidden).slice(visibleNumber.value)
})
return permissionStore.sidebarRouters.filter(f => !f.hidden).slice(visibleNumber.value);
});
function setVisibleNumber() {
let width = document.body.getBoundingClientRect().width
let width = document.body.getBoundingClientRect().width;
if (width >= 1000) {
width -= 420
width -= 420;
}
visibleNumber.value = Math.max(1, Math.floor(width / 3 / 92) + 2)
visibleNumber.value = Math.max(1, Math.floor(width / 3 / 92) + 2);
}
onMounted(() => {
window.addEventListener('resize', setVisibleNumber)
})
window.addEventListener('resize', setVisibleNumber);
});
onBeforeUnmount(() => {
window.removeEventListener('resize', setVisibleNumber)
})
window.removeEventListener('resize', setVisibleNumber);
});
onMounted(() => {
setVisibleNumber()
})
setVisibleNumber();
});
</script>
<style lang="scss">
+21 -7
View File
@@ -26,7 +26,9 @@
</el-input>
<div v-if="state.menuQuery && state.options.length > 0" class="result-count">
找到 <strong>{{ state.options.length }}</strong> 个结果
找到
<strong>{{ state.options.length }}</strong>
个结果
</div>
<el-scrollbar wrap-class="layout-search-scrollbar">
@@ -57,7 +59,9 @@
<div v-else-if="state.menuQuery" class="empty-state">
<el-icon class="empty-icon"><Search /></el-icon>
<p class="empty-text">
未找到 "<strong>{{ state.menuQuery }}</strong>" 相关菜单
未找到 "
<strong>{{ state.menuQuery }}</strong>
" 相关菜单
</p>
<p class="empty-tip">试试其他关键词或路径</p>
</div>
@@ -65,9 +69,19 @@
</el-scrollbar>
<div class="search-footer">
<span class="shortcut-item"><kbd>↑</kbd><kbd>↓</kbd> 切换</span>
<span class="shortcut-item"><kbd>↵</kbd> 选择</span>
<span class="shortcut-item"><kbd>Esc</kbd> 关闭</span>
<span class="shortcut-item">
<kbd>↑</kbd>
<kbd>↓</kbd>
切换
</span>
<span class="shortcut-item">
<kbd>↵</kbd>
选择
</span>
<span class="shortcut-item">
<kbd>Esc</kbd>
关闭
</span>
</div>
</el-dialog>
</div>
@@ -143,7 +157,7 @@ const handleClose = () => {
const generateRoutes = (routeList: RouteRecordRaw[], basePath = '', prefixTitle: string[] = []): SearchMenuItem[] => {
let result: SearchMenuItem[] = [];
routeList.forEach((route) => {
routeList.forEach(route => {
if (route.hidden) {
return;
}
@@ -183,7 +197,7 @@ const querySearch = (query: string) => {
}
const keyword = query.toLowerCase();
state.options = state.menuList.filter((item) => {
state.options = state.menuList.filter(item => {
return item.fullTitle.toLowerCase().includes(keyword) || item.path.toLowerCase().includes(keyword);
});
};
+1 -1
View File
@@ -94,7 +94,7 @@ const readAll = () => {
flex-direction: column;
min-width: 0;
.head-box {
.head-box {
display: flex;
border-bottom: 1px solid rgba(148, 163, 184, 0.14);
box-sizing: border-box;