From 0605f89a675849f84971724a85f77639bf2feeed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=9D=E5=85=88=E7=91=9E?= <1490493387@qq.com> Date: Sat, 15 Apr 2023 23:51:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20:bug:=20=E4=BB=A3=E7=A0=81=E8=A7=84?= =?UTF-8?q?=E8=8C=83=E6=A3=80=E6=B5=8B=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 6e75bc91ce33ea9e7a17fbcb896f086f768896f4 --- src/components/Breadcrumb/index.vue | 28 ++--- src/components/GithubCorner/index.vue | 13 +- src/components/Hamburger/index.vue | 9 +- src/components/IconSelect/index.vue | 32 ++--- src/components/Pagination/index.vue | 39 +++--- src/components/RightPanel/index.vue | 57 ++++----- src/components/SvgIcon/index.vue | 16 +-- src/components/Upload/SingleUpload.vue | 28 ++--- src/layout/components/AppMain.vue | 9 +- src/layout/components/Navbar.vue | 41 +++---- src/layout/components/Settings/index.vue | 111 ++++++++---------- src/layout/components/TagsView/ScrollPane.vue | 32 +++-- src/layout/components/TagsView/index.vue | 81 +++++++------ src/layout/index.vue | 38 +++--- src/styles/dark.scss | 32 ++--- src/styles/index.scss | 26 ++-- src/styles/reset.scss | 48 ++++---- src/styles/sidebar.scss | 48 ++++---- src/styles/variables.scss | 19 ++- src/views/dashboard/index.vue | 58 ++++----- src/views/demo/apidoc.vue | 6 +- src/views/error-page/401.vue | 16 +-- src/views/error-page/404.vue | 40 +++---- src/views/login/index.vue | 63 +++++----- 24 files changed, 440 insertions(+), 450 deletions(-) diff --git a/src/components/Breadcrumb/index.vue b/src/components/Breadcrumb/index.vue index d582fac6..a17fc3f0 100644 --- a/src/components/Breadcrumb/index.vue +++ b/src/components/Breadcrumb/index.vue @@ -18,11 +18,11 @@ @@ -38,6 +38,7 @@ function toggleClick() { width: 20px; height: 20px; vertical-align: -4px; + &.is-active { transform: rotate(180deg); } diff --git a/src/components/IconSelect/index.vue b/src/components/IconSelect/index.vue index 88c834eb..1f8c57b4 100644 --- a/src/components/IconSelect/index.vue +++ b/src/components/IconSelect/index.vue @@ -2,18 +2,18 @@ const props = defineProps({ modelValue: { type: String, - require: false - } + require: false, + }, }); -const emit = defineEmits(['update:modelValue']); -const inputValue = toRef(props, 'modelValue'); +const emit = defineEmits(["update:modelValue"]); +const inputValue = toRef(props, "modelValue"); const visible = ref(false); // 弹窗显示状态 const iconNames: string[] = []; // 所有的图标名称集合 -const filterValue = ref(''); // 筛选的值 +const filterValue = ref(""); // 筛选的值 const filterIconNames = ref([]); // 过滤后的图标名称集合 const iconSelectorRef = ref(null); @@ -21,9 +21,9 @@ const iconSelectorRef = ref(null); * icon 加载 */ function loadIcons() { - const icons = import.meta.glob('../../assets/icons/*.svg'); + const icons = import.meta.glob("../../assets/icons/*.svg"); for (const icon in icons) { - const iconName = icon.split('assets/icons/')[1].split('.svg')[0]; + const iconName = icon.split("assets/icons/")[1].split(".svg")[0]; iconNames.push(iconName); } filterIconNames.value = iconNames; @@ -34,7 +34,7 @@ function loadIcons() { */ function handleFilter() { if (filterValue.value) { - filterIconNames.value = iconNames.filter(iconName => + filterIconNames.value = iconNames.filter((iconName) => iconName.includes(filterValue.value) ); } else { @@ -46,7 +46,7 @@ function handleFilter() { * icon 选择 */ function handleSelect(iconName: string) { - emit('update:modelValue', iconName); + emit("update:modelValue", iconName); visible.value = false; } @@ -125,6 +125,7 @@ onMounted(() => { .el-divider--horizontal { margin: 10px auto !important; } + .iconselect-container { position: relative; width: 400px; @@ -137,18 +138,19 @@ onMounted(() => { margin-top: 10px; .icon-item { - cursor: pointer; - width: 10%; - margin: 0 10px 10px 0; - padding: 5px; display: flex; flex-direction: column; - justify-items: center; align-items: center; + justify-items: center; + width: 10%; + padding: 5px; + margin: 0 10px 10px 0; + cursor: pointer; border: 1px solid #ccc; + &:hover { - border-color: var(--el-color-primary); color: var(--el-color-primary); + border-color: var(--el-color-primary); transition: all 0.2s; transform: scaleX(1.1); } diff --git a/src/components/Pagination/index.vue b/src/components/Pagination/index.vue index 32737e69..7e1c82bd 100644 --- a/src/components/Pagination/index.vue +++ b/src/components/Pagination/index.vue @@ -14,54 +14,54 @@ @@ -18,10 +18,11 @@ const tagsViewStore = useTagsViewStore(); diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index 7bf14c33..90a9fc0f 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -1,9 +1,9 @@ @@ -133,6 +133,7 @@ onMounted(() => { diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue index 8723bad2..4f920ae4 100644 --- a/src/layout/components/TagsView/index.vue +++ b/src/layout/components/TagsView/index.vue @@ -5,19 +5,19 @@ import { ref, watch, onMounted, - ComponentInternalInstance -} from 'vue'; -import { storeToRefs } from 'pinia'; + ComponentInternalInstance, +} from "vue"; +import { storeToRefs } from "pinia"; -import path from 'path-browserify'; +import path from "path-browserify"; -import { useRoute, useRouter } from 'vue-router'; +import { useRoute, useRouter } from "vue-router"; -import { translateRouteTitleI18n } from '@/utils/i18n'; +import { translateRouteTitleI18n } from "@/utils/i18n"; -import { usePermissionStore } from '@/store/modules/permission'; -import { useTagsViewStore, TagView } from '@/store/modules/tagsView'; -import ScrollPane from './ScrollPane.vue'; +import { usePermissionStore } from "@/store/modules/permission"; +import { useTagsViewStore, TagView } from "@/store/modules/tagsView"; +import ScrollPane from "./ScrollPane.vue"; const { proxy } = getCurrentInstance() as ComponentInternalInstance; const router = useRouter(); @@ -42,30 +42,30 @@ watch( }, { //初始化立即执行 - immediate: true + immediate: true, } ); const tagMenuVisible = ref(false); // 标签操作菜单显示状态 -watch(tagMenuVisible, value => { +watch(tagMenuVisible, (value) => { if (value) { - document.body.addEventListener('click', closeTagMenu); + document.body.addEventListener("click", closeTagMenu); } else { - document.body.removeEventListener('click', closeTagMenu); + document.body.removeEventListener("click", closeTagMenu); } }); -function filterAffixTags(routes: any[], basePath = '/') { +function filterAffixTags(routes: any[], basePath = "/") { let tags: TagView[] = []; - routes.forEach(route => { + routes.forEach((route) => { if (route.meta && route.meta.affix) { const tagPath = path.resolve(basePath, route.path); tags.push({ fullPath: tagPath, path: tagPath, name: route.name, - meta: { ...route.meta } + meta: { ...route.meta }, }); } @@ -123,7 +123,7 @@ function isFirstView() { return ( (selectedTag.value as TagView).fullPath === tagsViewStore.visitedViews[1].fullPath || - (selectedTag.value as TagView).fullPath === '/index' + (selectedTag.value as TagView).fullPath === "/index" ); } catch (err) { return false; @@ -145,7 +145,7 @@ function refreshSelectedTag(view: TagView) { tagsViewStore.delCachedView(view); const { fullPath } = view; nextTick(() => { - router.replace({ path: '/redirect' + fullPath }).catch(err => { + router.replace({ path: "/redirect" + fullPath }).catch((err) => { console.warn(err); }); }); @@ -158,11 +158,11 @@ function toLastView(visitedViews: TagView[], view?: any) { } else { // now the default is to redirect to the home page if there is no tags-view, // you can adjust it according to your needs. - if (view.name === 'Dashboard') { + if (view.name === "Dashboard") { // to reload home page - router.replace({ path: '/redirect' + view.fullPath }); + router.replace({ path: "/redirect" + view.fullPath }); } else { - router.push('/'); + router.push("/"); } } } @@ -210,7 +210,7 @@ function closeAllTags(view: TagView) { function openTagMenu(tag: TagView, e: MouseEvent) { const menuMinWidth = 105; - console.log('test', proxy?.$el); + console.log("test", proxy?.$el); const offsetLeft = proxy?.$el.getBoundingClientRect().left; // container margin left const offsetWidth = proxy?.$el.offsetWidth; // container width @@ -300,18 +300,19 @@ onMounted(() => { diff --git a/src/styles/dark.scss b/src/styles/dark.scss index 89bc98c3..0f988d59 100644 --- a/src/styles/dark.scss +++ b/src/styles/dark.scss @@ -1,33 +1,33 @@ -html.dark{ - --menuBg:var(--el-bg-color-overlay); - --menuText:#fff; - --menuActiveText:var(--el-menu-active-color); - --menuHover:rgba(0,0,0,.2); - +html.dark { + --menuBg: var(--el-bg-color-overlay); + --menuText: #fff; + --menuActiveText: var(--el-menu-active-color); + --menuHover: rgb(0 0 0 / 20%); --subMenuBg: var(--el-menu-bg-color); - --subMenuActiveText:var(--el-menu-active-color); - --subMenuHover: rgba(0,0,0,.2); - + --subMenuActiveText: var(--el-menu-active-color); + --subMenuHover: rgb(0 0 0 / 20%); .navbar { - background-color: var(--el-bg-color); color: var(--el-text-color-regular); - .navbar-setting-item:hover{ + background-color: var(--el-bg-color); + + .navbar-setting-item:hover { background: var(--el-fill-color-light); } } - .right-panel-btn{ + .right-panel-btn { background-color: var(--el-color-primary-dark); } - .svg-icon,svg{ + + .svg-icon, + svg { fill: var(--el-text-color-regular); } - - .sidebar-container{ + .sidebar-container { .el-menu-item.is-active .svg-icon { - fill: var(--el-color-primary); + fill: var(--el-color-primary); } } } diff --git a/src/styles/index.scss b/src/styles/index.scss index 6d465bfd..5f0e69f0 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,18 +1,16 @@ -@import './sidebar.scss'; -@import './reset.scss'; -@import './dark.scss'; - +@import "./sidebar"; +@import "./reset"; +@import "./dark"; .app-container { - padding: 20px; - .search { - padding: 18px 0 0 10px; - margin-bottom: 10px; - border-radius: 4px; - border: 1px solid var(--el-border-color-light); - box-shadow: var(--el-box-shadow-light); - background-color: var(--el-bg-color-overlay); + padding: 20px; + + .search { + padding: 18px 0 0 10px; + margin-bottom: 10px; + background-color: var(--el-bg-color-overlay); + border: 1px solid var(--el-border-color-light); + border-radius: 4px; + box-shadow: var(--el-box-shadow-light); } - } - diff --git a/src/styles/reset.scss b/src/styles/reset.scss index cd586c34..9b19e4c4 100644 --- a/src/styles/reset.scss +++ b/src/styles/reset.scss @@ -2,9 +2,9 @@ ::before, ::after { box-sizing: border-box; - border-width: 0; + border-color: currentcolor; border-style: solid; - border-color: currentColor; + border-width: 0; } #app { @@ -13,69 +13,63 @@ } html { - line-height: 1.5; - -webkit-text-size-adjust: 100%; - -moz-tab-size: 4; - tab-size: 4; + box-sizing: border-box; width: 100%; height: 100%; - box-sizing: border-box; + line-height: 1.5; + tab-size: 4; + text-size-adjust: 100%; } body { - margin: 0; - line-height: inherit; width: 100%; height: 100%; + margin: 0; + font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", + "Microsoft YaHei", "微软雅黑", Arial, sans-serif; + line-height: inherit; -moz-osx-font-smoothing: grayscale; -webkit-font-smoothing: antialiased; text-rendering: optimizelegibility; - font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", - "Microsoft YaHei", "微软雅黑", Arial, sans-serif; } - a { color: inherit; text-decoration: inherit; } - img, -svg - { +svg { display: inline-block; } + svg { vertical-align: -0.15em; //因icon大小被设置为和字体大小一致,而span等标签的下边缘会和字体的基线对齐,故需设置一个往下的偏移比例,来纠正视觉上的未对齐效果 } - -ul,li{ - margin: 0; +ul, +li { padding: 0; + margin: 0; list-style: none; } - *, *::before, *::after { box-sizing: inherit; } -a:focus, -a:active , -div:focus -{ - outline: none; -} - a, a:focus, a:hover { - cursor: pointer; color: inherit; text-decoration: none; + cursor: pointer; } +a:focus, +a:active, +div:focus { + outline: none; +} diff --git a/src/styles/sidebar.scss b/src/styles/sidebar.scss index 45e84090..efaa4e97 100644 --- a/src/styles/sidebar.scss +++ b/src/styles/sidebar.scss @@ -1,22 +1,22 @@ #app { .main-container { - min-height: 100%; - transition: margin-left 0.28s; - margin-left: $sideBarWidth; position: relative; + min-height: 100%; + margin-left: $sideBarWidth; + transition: margin-left 0.28s; } .sidebar-container { - transition: width 0.28s; - width: $sideBarWidth !important; - background-color: $menuBg; - height: 100%; position: fixed; top: 0; bottom: 0; left: 0; z-index: 1001; + width: $sideBarWidth !important; + height: 100%; overflow: hidden; + background-color: $menuBg; + transition: width 0.28s; // reset element-ui css .horizontal-collapse-transition { @@ -29,7 +29,7 @@ } .el-scrollbar__bar.is-vertical { - right: 0px; + right: 0; } .el-scrollbar { @@ -46,7 +46,6 @@ display: none; } - .svg-icon { margin-right: 16px; } @@ -57,9 +56,9 @@ } .el-menu { - border: none; - height: 100%; width: 100% !important; + height: 100%; + border: none; } // menu hover @@ -69,11 +68,11 @@ } } - .is-active>.el-sub-menu__title { + .is-active > .el-sub-menu__title { color: $subMenuActiveText !important; } - & .nest-menu .el-sub-menu>.el-sub-menu__title, + & .nest-menu .el-sub-menu > .el-sub-menu__title, & .el-sub-menu .el-menu-item { min-width: $sideBarWidth !important; background-color: $subMenuBg !important; @@ -89,7 +88,7 @@ width: 54px !important; .svg-icon { - margin-right: 0px; + margin-right: 0; } } @@ -100,7 +99,7 @@ .el-sub-menu { overflow: hidden; - &>.el-sub-menu__title { + & > .el-sub-menu__title { padding: 0 !important; .svg-icon { @@ -119,13 +118,13 @@ .el-menu--collapse { .el-sub-menu { - &>.el-sub-menu__title { - &>span { - height: 0; + & > .el-sub-menu__title { + & > span { + display: inline-block; width: 0; + height: 0; overflow: hidden; visibility: hidden; - display: inline-block; } } } @@ -139,12 +138,12 @@ // mobile responsive .mobile { .main-container { - margin-left: 0px; + margin-left: 0; } .sidebar-container { - transition: transform 0.28s; width: $sideBarWidth !important; + transition: transform 0.28s; } &.hideSidebar { @@ -157,7 +156,6 @@ } .withoutAnimation { - .main-container, .sidebar-container { transition: none; @@ -167,7 +165,7 @@ // when menu collapsed .el-menu--vertical { - &>.el-menu { + & > .el-menu { .svg-icon { margin-right: 16px; } @@ -178,7 +176,7 @@ } } - .nest-menu .el-sub-menu>.el-sub-menu__title, + .nest-menu .el-sub-menu > .el-sub-menu__title, .el-menu-item { &:hover { // you can use $subMenuHover @@ -187,7 +185,7 @@ } // the scroll bar appears when the subMenu is too long - >.el-menu--popup { + > .el-menu--popup { max-height: 100vh; overflow-y: auto; diff --git a/src/styles/variables.scss b/src/styles/variables.scss index 0c6d3868..e11df304 100644 --- a/src/styles/variables.scss +++ b/src/styles/variables.scss @@ -1,25 +1,22 @@ // 全局SCSS变量 -:root{ - --menuBg:#304156; - --menuText:#bfcbd9; - --menuActiveText:#409eff; - --menuHover:#263445; - +:root { + --menuBg: #304156; + --menuText: #bfcbd9; + --menuActiveText: #409eff; + --menuHover: #263445; --subMenuBg: #1f2d3d; --subMenuActiveText: #f4f4f5; --subMenuHover: #001528; - } - $menuBg: var(--menuBg); $menuText: var(--menuText); $menuActiveText: var(--menuActiveText); $menuHover: var(--menuHover); -$subMenuBg:var(--subMenuBg); -$subMenuActiveText:var(--subMenuActiveText); -$subMenuHover:var(--subMenuHover); +$subMenuBg: var(--subMenuBg); +$subMenuActiveText: var(--subMenuActiveText); +$subMenuHover: var(--subMenuHover); $sideBarWidth: 210px; diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue index 900c3a2c..7df0c778 100644 --- a/src/views/dashboard/index.vue +++ b/src/views/dashboard/index.vue @@ -1,16 +1,16 @@ @@ -215,34 +215,36 @@ orderCount.value = 2000; diff --git a/src/views/demo/apidoc.vue b/src/views/demo/apidoc.vue index efcd6140..1200d7b0 100644 --- a/src/views/demo/apidoc.vue +++ b/src/views/demo/apidoc.vue @@ -2,7 +2,7 @@