This commit is contained in:
zhang zhuo 2025-05-29 17:18:25 +08:00
parent 3d0d0bb891
commit 477eb6bbe8
15 changed files with 821 additions and 47 deletions

BIN
public/images/bg.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

View File

@ -1,24 +1,24 @@
<template> <template>
<el-config-provider :locale="locale" :size="config.size" :zIndex="config.zIndex" :button="config.button"> <el-config-provider :locale="locale" :size="config.size" :zIndex="config.zIndex" :button="config.button">
<router-view></router-view> <router-view></router-view>
</el-config-provider> </el-config-provider>
</template> </template>
<script setup> <script setup>
import { useI18n } from 'vue-i18n' import {useI18n} from 'vue-i18n'
import { computed } from 'vue' import {computed} from 'vue'
const config = { const config = {
size: "default", size: "default",
zIndex: 2000, zIndex: 2000,
button: { button: {
autoInsertSpace: false autoInsertSpace: false
} }
} }
const locale = computed(() => { const locale = computed(() => {
const {locale, messages} = useI18n() const {locale, messages} = useI18n()
return messages.value[locale.value] return messages.value[locale.value]
}) })
</script> </script>

View File

@ -5,14 +5,14 @@ import 'element-plus/theme-chalk/display.css'
import i18n from './locales' import i18n from './locales'
import App from './App.vue' import App from './App.vue'
// import router from './router' import router from './router'
// import store from './store' import store from './store'
import pi from './pi' import pi from './pi'
const app = createApp(App); const app = createApp(App);
// app.use(store); app.use(store);
// app.use(router); app.use(router);
app.use(ElementPlus); app.use(ElementPlus);
app.use(i18n); app.use(i18n);
app.use(pi); app.use(pi);

View File

@ -1,5 +1,5 @@
import {createRouter, createWebHashHistory} from 'vue-router'; import {createRouter, createWebHashHistory} from 'vue-router';
import { ElNotification } from 'element-plus'; import {ElNotification} from 'element-plus';
import config from "@/config" import config from "@/config"
import NProgress from 'nprogress' import NProgress from 'nprogress'
import 'nprogress/nprogress.css' import 'nprogress/nprogress.css'
@ -15,9 +15,11 @@ const routes = sRouter
const routes_404 = { const routes_404 = {
path: "/:pathMatch(.*)*", path: "/:pathMatch(.*)*",
hidden: true, hidden: true,
component: () => import(/* webpackChunkName: "404" */ '@/layout/404'), component: () => import('@/layout/404'),
}
let routes_404_r = () => {
} }
let routes_404_r = ()=>{}
const router = createRouter({ const router = createRouter({
history: createWebHashHistory(), history: createWebHashHistory(),
@ -31,14 +33,12 @@ document.title = config.APP_NAME
var isGetRouter = false; var isGetRouter = false;
router.beforeEach(async (to, from, next) => { router.beforeEach(async (to, from, next) => {
NProgress.start() NProgress.start()
//动态标题 //动态标题
document.title = to.meta.title ? `${to.meta.title} - ${config.APP_NAME}` : `${config.APP_NAME}` document.title = to.meta.title ? `${to.meta.title} - ${config.APP_NAME}` : `${config.APP_NAME}`
let token = tools.data.get("TOKEN"); let token = tools.data.get("TOKEN");
if (to.path === "/login") {
if(to.path === "/login"){
//删除路由(替换当前layout路由) //删除路由(替换当前layout路由)
router.addRoute(routes[0]) router.addRoute(routes[0])
//删除路由(404) //删除路由(404)
@ -48,12 +48,12 @@ router.beforeEach(async (to, from, next) => {
return false; return false;
} }
if(routes.findIndex(r => r.path === to.path) >= 0){ if (routes.findIndex(r => r.path === to.path) >= 0) {
next(); next();
return false; return false;
} }
if(!token){ if (!token) {
next({ next({
path: '/login' path: '/login'
}); });
@ -61,18 +61,18 @@ router.beforeEach(async (to, from, next) => {
} }
//整页路由处理 //整页路由处理
if(to.meta.fullpage){ if (to.meta.fullpage) {
to.matched = [to.matched[to.matched.length-1]] to.matched = [to.matched[to.matched.length - 1]]
} }
console.log(11)
//加载动态/静态路由 //加载动态/静态路由
if(!isGetRouter){ if (!isGetRouter) {
// 动态加载菜单 // 动态加载菜单
const [res, err] = await tools.go(api.auth.menu()) // const [res, err] = await tools.go(api.auth.menu())
console.log(res) // console.log(res)
if (err) { // if (err) {
return false // return false
} // }
// tools.data.set("MENU", tools.makeMenu(res.data.menus, 0)) // tools.data.set("MENU", tools.makeMenu(res.data.menus, 0))
// tools.data.set("PERMISSIONS", res.data.buttons) // tools.data.set("PERMISSIONS", res.data.buttons)
// tools.data.set("ROLE", res.data.roles) // tools.data.set("ROLE", res.data.roles)
@ -80,7 +80,7 @@ router.beforeEach(async (to, from, next) => {
let apiMenu = tools.data.get("MENU") || [] let apiMenu = tools.data.get("MENU") || []
let userInfo = tools.data.get("USER_INFO") let userInfo = tools.data.get("USER_INFO")
let userMenu = treeFilter([], node => { let userMenu = treeFilter([], node => {
return node.meta.role ? node.meta.role.filter(item=>userInfo.role.indexOf(item)>-1).length > 0 : true return node.meta.role ? node.meta.role.filter(item => userInfo.role.indexOf(item) > -1).length > 0 : true
}) })
let menu = [...userMenu, ...apiMenu] let menu = [...userMenu, ...apiMenu]
var menuRouter = filterAsyncRouter(menu) var menuRouter = filterAsyncRouter(menu)
@ -126,9 +126,9 @@ router.onError((error) => {
function filterAsyncRouter(routerMap) { function filterAsyncRouter(routerMap) {
const accessedRouters = [] const accessedRouters = []
routerMap.forEach(item => { routerMap.forEach(item => {
item.meta = item.meta?item.meta:{}; item.meta = item.meta ? item.meta : {};
//处理外部链接特殊路由 //处理外部链接特殊路由
if(item.meta.type=='iframe'){ if (item.meta.type == 'iframe') {
item.meta.url = item.path; item.meta.url = item.path;
item.path = `/i/${item.name}`; item.path = `/i/${item.name}`;
} }
@ -145,24 +145,25 @@ function filterAsyncRouter(routerMap) {
}) })
return accessedRouters return accessedRouters
} }
function loadComponent(component){
if(component){ function loadComponent(component: string) {
return () => import(`@/views/${component}`) if (component) {
}else{ return () => import(/* @vite-ignore */`@/views/${component}`)
} else {
return () => import(`@/layout/empty`) return () => import(`@/layout/empty`)
} }
} }
//路由扁平化 //路由扁平化
function flatAsyncRoutes(routes, breadcrumb=[]) { function flatAsyncRoutes(routes, breadcrumb = []) {
let res = [] let res = []
routes.forEach(route => { routes.forEach(route => {
const tmp = {...route} const tmp = {...route}
if (tmp.children) { if (tmp.children) {
let childrenBreadcrumb = [...breadcrumb] let childrenBreadcrumb = [...breadcrumb]
childrenBreadcrumb.push(route) childrenBreadcrumb.push(route)
let tmpRoute = { ...route } let tmpRoute = {...route}
tmpRoute.meta.breadcrumb = childrenBreadcrumb tmpRoute.meta.breadcrumb = childrenBreadcrumb
delete tmpRoute.children delete tmpRoute.children
res.push(tmpRoute) res.push(tmpRoute)
@ -182,7 +183,7 @@ function flatAsyncRoutes(routes, breadcrumb=[]) {
//过滤树 //过滤树
function treeFilter(tree, func) { function treeFilter(tree, func) {
return tree.map(node => ({ ...node })).filter(node => { return tree.map(node => ({...node})).filter(node => {
node.children = node.children && treeFilter(node.children, func) node.children = node.children && treeFilter(node.children, func)
return func(node) || (node.children && node.children.length) return func(node) || (node.children && node.children.length)
}) })

103
src/style/app.scss Normal file
View File

@ -0,0 +1,103 @@
/* 全局 */
#app, body, html {width: 100%;height: 100%;background-color: #f6f8f9;font-size: 12px;}
a {color: #333;text-decoration: none;}
a:hover, a:focus {color: #000;text-decoration: none;}
a:link {text-decoration: none;}
a:-webkit-any-link {text-decoration: none;}
a,button,input,textarea{-webkit-tap-highlight-color:rgba(0,0,0,0);box-sizing: border-box;outline:none !important; -webkit-appearance: none;}
* {margin: 0;padding: 0;box-sizing: border-box;outline: none;}
/* 大布局样式 */
.aminui {display: flex;flex-flow: column;}
.aminui-wrapper {display: flex;flex:1;overflow: auto;}
/* 全局滚动条样式 */
.scrollable {-webkit-overflow-scrolling: touch;}
::-webkit-scrollbar {width: 5px;height: 5px;}
::-webkit-scrollbar-thumb {background-color: rgba(50, 50, 50, 0.3);}
::-webkit-scrollbar-thumb:hover {background-color: rgba(50, 50, 50, 0.6);}
::-webkit-scrollbar-track {background-color: rgba(50, 50, 50, 0.1);}
::-webkit-scrollbar-track:hover {background-color: rgba(50, 50, 50, 0.2);}
/*布局设置*/
.layout-setting {position: fixed;width: 40px;height: 40px;border-radius: 3px 0 0 3px;bottom: 100px;right: 0px;z-index: 100;background: #409EFF;display: flex;flex-direction: column;align-items: center;justify-content: center;cursor: pointer;}
.layout-setting i {font-size: 18px;color: #fff;}
/* 头部 */
.adminui-header {height: 58px;background: #222b45;color: #fff;display: flex;justify-content:space-between;}
.adminui-header-left {display: flex;align-items: center;padding-left:20px;}
.adminui-header-right {display: flex;align-items: center;}
.adminui-header .logo-bar {font-size: 20px;font-weight: bold;display: flex;align-items: center;}
.adminui-header .logo-bar .logo {margin-right: 10px;width: 35px;height: 35px;}
.adminui-header .nav {display: flex;height: 100%;margin-left: 40px;}
.adminui-header .nav li {padding:0 10px;margin: 0 10px 0 0;font-size: 14px;color: rgba(255, 255, 255, 0.6);list-style: none;height: 100%;display: flex;align-items: center;cursor: pointer;}
.adminui-header .nav li i {margin-right: 5px;}
.adminui-header .nav li:hover {color: #fff;}
.adminui-header .nav li.active {background: rgba(255, 255, 255, 0.1);color: #fff;}
.adminui-header .user-bar .panel-item:hover {background: rgba(255, 255, 255, 0.1)!important;}
.adminui-header .user-bar .user label{color: #fff;}
/* 左侧菜单 */
.aminui-side-split {width:65px;flex-shrink:0;background: #222b45;display: flex;flex-flow: column;}
.aminui-side-split-top {height: 49px;}
.aminui-side-split-top a {display: inline-block;width: 100%;height: 100%;display: flex;align-items: center;justify-content: center;}
.aminui-side-split-top .logo {height:30px;vertical-align: bottom;}
.adminui-side-split-scroll {overflow: auto;overflow-x:hidden;height: 100%;flex: 1;}
.aminui-side-split li {cursor: pointer;width: 65px;height: 65px;color: #fff;text-align: center;display: flex;flex-direction: column;align-items: center;justify-content: center;}
.aminui-side-split li i {font-size: 18px;}
.aminui-side-split li p {margin-top:5px;}
.aminui-side-split li:hover {background: rgba(255, 255, 255, 0.1);}
.aminui-side-split li.active {background: #409EFF;}
.adminui-side-split-scroll::-webkit-scrollbar-thumb {background-color: rgba(255, 255, 255, 0.4);border-radius:5px;}
.adminui-side-split-scroll::-webkit-scrollbar-thumb:hover {background-color: rgba(255, 255, 255, 0.5);}
.adminui-side-split-scroll::-webkit-scrollbar-track {background-color: rgba(255, 255, 255, 0);}
.adminui-side-split-scroll::-webkit-scrollbar-track:hover {background-color: rgba(255, 255, 255, 0);}
.aminui-side {display: flex;flex-flow: column;flex-shrink:0;width:210px;background: #fff;box-shadow: 2px 0 8px 0 rgba(29,35,41,.05);border-right: 1px solid #e6e6e6;transition:width 0.3s;}
.adminui-side-top {border-bottom: 1px solid #ebeef5;height:50px;line-height: 50px;}
.adminui-side-top h2 {padding:0 20px;font-size: 17px;color: #3c4a54;}
.adminui-side-scroll {overflow: auto;overflow-x:hidden;flex: 1;}
.adminui-side-bottom {border-top: 1px solid #ebeef5;height:51px;cursor: pointer;display: flex;align-items: center;justify-content: center;}
.adminui-side-bottom i {font-size: 16px;}
.adminui-side-bottom:hover {color: var(--el-color-primary);}
.aminui-side.isCollapse {width: 65px;}
.el-menu .menu-tag {position: absolute;height: 18px;line-height: 18px;background: var(--el-color-danger);font-size: 12px;color: #fff;right: 20px;border-radius:18px;padding:0 6px;}
.el-menu .el-sub-menu__title .menu-tag {right: 40px;}
.el-menu--horizontal > li .menu-tag {display: none;}
/* 右侧内容 */
.aminui-body {flex: 1;display: flex;flex-flow: column;}
.adminui-topbar {height: 50px;border-bottom: 1px solid #ebeef5;background: #fff;box-shadow: 0 1px 4px rgba(0,21,41,.08);display: flex;justify-content:space-between;}
.adminui-topbar .left-panel {display: flex;align-items: center;}
.adminui-topbar .right-panel {display: flex;align-items: center;}
.right-panel-search {display: flex;align-items: center;}
.right-panel-search > * + * {margin-left:10px;}
.adminui-tags {height:35px;background: #fff;border-bottom: 1px solid #e6e6e6;}
.adminui-tags ul {display: flex;overflow: hidden;}
.adminui-tags li {cursor: pointer;display: inline-block;float: left;height:34px;line-height: 34px;position: relative;flex-shrink: 0;}
.adminui-tags li::after {content: " ";width:1px;height:100%;position: absolute;right:0px;background-image: linear-gradient(#fff, #e6e6e6);}
.adminui-tags li a {display: inline-block;padding:0 10px;width:100%;height:100%;color: #999;text-decoration:none;display: flex;align-items: center;}
.adminui-tags li i {margin-left:10px;border-radius: 3px;width:18px;height:18px;display: flex;align-items: center;justify-content: center;}
.adminui-tags li i:hover {background: rgba(0,0,0,.2);color: #fff;}
.adminui-tags li:hover {background: #ecf5ff;}
.adminui-tags li.active {background: #409EFF;}
.adminui-tags li.active a {color: #fff;}
.adminui-tags li.sortable-ghost {opacity: 0;}
.adminui-main {overflow: auto;background-color: #f6f8f9;flex: 1;}
/*页面最大化*/
.aminui.main-maximize {
.main-maximize-exit {display: block;}
.aminui-side-split, .aminui-side, .adminui-header, .adminui-topbar, .adminui-tags {display: none;}
}
.main-maximize-exit {display: none;position: fixed;z-index: 3000;top:-20px;left:50%;margin-left: -20px;border-radius: 50%;width: 40px;height: 40px;cursor: pointer;background: rgba(0,0,0,0.2);text-align: center;}
.main-maximize-exit i {font-size: 14px;margin-top: 22px;color: #fff;}
.main-maximize-exit:hover {background: rgba(0,0,0,0.4);}
/*定宽页面*/
.sc-page {width: 1230px;margin: 0 auto;}

37
src/style/dark.scss Normal file
View File

@ -0,0 +1,37 @@
@import '~element-plus/theme-chalk/src/dark/css-vars.scss';
html.dark {
//变量
--el-text-color-primary: #d0d0d0;
--el-color-primary-dark-2: var(--el-color-primary-light-2) !important;
--el-color-primary-light-9: var(--el-color-primary-dark-8) !important;
--el-color-primary-light-8: var(--el-color-primary-dark-7) !important;
--el-color-primary-light-7: var(--el-color-primary-dark-6) !important;
--el-color-primary-light-5: var(--el-color-primary-dark-4) !important;
--el-color-primary-light-3: var(--el-color-primary-dark-3) !important;
//背景
#app {background: var(--el-bg-color);}
//登录背景
.login_bg {background: var(--el-bg-color);}
//框架
.adminui-header {background: var(--el-bg-color-overlay);border-bottom: 1px solid var(--el-border-color-light);height:59px;}
.aminui-side-split {background: var(--el-bg-color);}
.aminui-side-split li {color: var(--el-text-color-primary);}
.aminui-side {background: var(--el-bg-color-overlay);border-color: var(--el-border-color-light);}
.adminui-side-top, .adminui-side-bottom {border-color: var(--el-border-color-light);}
.adminui-side-top h2 {color: var(--el-text-color-primary);}
.adminui-topbar, .adminui-tags {background: var(--el-bg-color-overlay);border-color: var(--el-border-color-light);}
.adminui-main {background: var(--el-bg-color);}
.drawerBG {background: var(--el-bg-color);}
.adminui-header-menu .el-menu {--el-menu-bg-color:var(--el-bg-color-overlay) !important;--el-menu-hover-bg-color: #171819 !important;}
//组件
.el-header, .el-main.nopadding, .el-footer {background: var(--el-bg-color-overlay);border-color: var(--el-border-color-light);}
.el-main {background: var(--el-bg-color);}
.el-aside {background: var(--el-bg-color-overlay);border-color: var(--el-border-color-light);}
.el-table .el-table__body-wrapper {background: var(--el-bg-color);}
.el-table th.is-sortable:hover {background: #111;}
}

86
src/style/fix.scss Normal file
View File

@ -0,0 +1,86 @@
/* 覆盖element-plus样式 */
:root {
--el-color-primary: #409EFF;
--el-color-primary-light-1: #53a7ff;
--el-color-primary-light-2: #66b1ff;
--el-color-primary-light-3: #79bbff;
--el-color-primary-light-4: #8cc4ff;
--el-color-primary-light-5: #9fceff;
--el-color-primary-light-6: #b2d8ff;
--el-color-primary-light-7: #c5e1ff;
--el-color-primary-light-8: #d8ebff;
--el-color-primary-light-9: #ebf5ff;
--el-color-primary-dark-1: #398ee5;
--el-color-primary-dark-2: #337ecc;
--el-color-primary-dark-3: #2c6eb2;
--el-color-primary-dark-4: #265e99;
--el-color-primary-dark-5: #204f7f;
--el-color-primary-dark-6: #193f66;
--el-color-primary-dark-7: #132f4c;
--el-color-primary-dark-8: #0c1f32;
--el-color-primary-dark-9: #060f19;
}
.el-menu {border: none!important;}
.el-menu .el-menu-item a {color: inherit;text-decoration: none;display: block;width:100%;height:100%;position: absolute;top:0px;left:0px;}
.el-form-item-msg {font-size: 12px;color: #999;clear: both;width: 100%;}
.el-container {height: 100%;}
.el-aside {border-right: 1px solid var(--el-border-color-light);}
.el-container + .el-aside {border-right: 0;border-left: 1px solid var(--el-border-color-light);}
.el-header {background: #fff;border-bottom: 1px solid var(--el-border-color-light);padding:13px 15px;display: flex;justify-content: space-between;align-items: center;}
.el-header .left-panel {display: flex;align-items: center;}
.el-header .right-panel {display: flex;align-items: center;}
.el-header .right-panel > * + * {margin-left:10px;}
.el-footer {background: #fff;border-top: 1px solid var(--el-border-color-light);padding:13px 15px;height: 51px;}
.el-main {padding:15px;}
.el-main.nopadding {padding:0;background: #fff;}
.el-main.bgfff {background: #fff;}
.el-drawer__body {overflow: auto;padding:0;}
.el-popconfirm__main {margin: 14px 0;}
.el-card__header {border-bottom: 0;font-size: 17px;font-weight: bold;padding:15px 20px 0px 20px;}
.el-dialog__title {font-size: 17px;font-weight: bold;}
.el-drawer__header>:first-child {font-size: 17px;font-weight: bold;}
.el-tree.menu .el-tree-node__content {height:36px;}
.el-tree.menu .el-tree-node__content .el-tree-node__label .icon {margin-right: 5px;}
.el-progress__text {font-size: 12px!important;}
.el-progress__text i {font-size: 14.4px!important;}
.el-step.is-horizontal .el-step__line {height:1px;}
.el-step__title {font-size: 14px;}
.drawerBG {background: #f6f8f9;}
.el-button+.el-dropdown {margin-left: 10px;}
.el-button-group+.el-dropdown {margin-left: 10px;}
.el-tag+.el-tag {margin-left: 10px;}
.el-button-group+.el-button-group {margin-left: 10px;}
.el-tabs__nav-wrap::after {height: 1px;}
.el-table th.is-sortable {transition: .1s;}
.el-table th.is-sortable:hover {background: #eee;}
.el-table .el-table__body-wrapper {background: #f6f8f9;}
.el-col .el-card {margin-bottom: 15px;}
.el-main {flex-basis: 100%;}
.el-main > .scTable .el-table--border::before {display: none;}
.el-main > .scTable .el-table--border::after {display: none;}
.el-main > .scTable .el-table--border .el-table__inner-wrapper::after {display: none;}
.el-main > .scTable .el-table__border-left-patch {display: none;}
.el-main > .scTable .el-table--border .el-table__inner-wrapper tr:first-child td:first-child {border-left: 0;}
.el-main > .scTable .el-table--border .el-table__inner-wrapper tr:first-child th:first-child {border-left: 0;}
.el-table.el-table--large {font-size: 14px;}
.el-table.el-table--small {font-size: 12px;}
.el-table {font-size: 12px;}
.el-radio-button__inner {font-size: 12px;}
.el-checkbox-button__inner {font-size: 12px;}
.el-sub-menu .el-icon {font-size: 17px;}
.el-sub-menu .el-sub-menu__icon-arrow {font-size: 12px;}
.el-dropdown-link {cursor: pointer;color: var(--el-color-primary);line-height: 22px;font-size: 12px;}
.aminui-side-split li.active {background-color: var(--el-color-primary);}
.adminui-tags li:hover {background-color: var(--el-color-primary-light-9);}
.adminui-tags li.active {background-color: var(--el-color-primary)!important;}
.contextmenu li:hover {background-color: var(--el-color-primary-light-9)!important;color: var(--el-color-primary-light-2)!important;}
.data-box .item-background {background-color: var(--el-color-primary)!important;}
.layout-setting,.diy-grid-setting {background-color: var(--el-color-primary)!important;}
/* 覆盖tinymce样式 */
.sceditor .tox-tinymce {border: 1px solid #DCDFE6;border-radius: 0;}
body .tox-tinymce-aux {z-index: 5700;}

50
src/style/media.scss Normal file
View File

@ -0,0 +1,50 @@
@media (max-width: 992px){
// 移动端样式覆盖
.el-form-item {display: block;}
.el-form-item__label {display: block;text-align: left;padding: 0 0 10px;}
.el-dialog {width: 90%!important;}
.el-dialog.is-fullscreen {width: 100%!important;}
.el-drawer.rtl {width: 90%!important;}
.el-form-item__content {margin-left: 0px!important;}
.adminui-main {
>.el-container {display: block;height:auto;}
>.el-container > .el-aside {width: 100%!important;border: 0}
}
.scTable {
.el-table,
.el-table__body-wrapper {display: block!important;height:auto!important;}
.el-scrollbar__wrap {height:auto!important;}
.scTable-page {padding: 0 5px!important;}
.el-pagination__total,
.el-pagination__jump,
.el-pagination__sizes {display: none!important;}
}
.headerPublic {
height: auto!important;display: block;
.left-panel {overflow: auto;}
.left-panel::-webkit-scrollbar{display: none;}
.right-panel {display: block;border-top: 1px solid var(--el-border-color-light);margin-top: 15px;}
.right-panel .right-panel-search {display: block;}
.right-panel .right-panel-search >* {width: 100%;margin: 0;margin-top: 15px;}
}
.adminui-main > .el-container >*:first-child:not(.el-aside):not(.el-header) {border: 0;margin-top: 0;}
.adminui-main > .el-container >*:first-child:not(.el-aside):not(.el-header) + .el-aside {margin-top: 0;}
.adminui-main > .el-container > .el-aside {border-bottom: 1px solid var(--el-border-color-light)!important;}
.adminui-main > .el-container > .el-container {border-top: 1px solid var(--el-border-color-light);border-bottom: 1px solid var(--el-border-color-light);margin-top: 15px;}
.adminui-main > .el-container > .el-container + .el-aside {border-top: 1px solid var(--el-border-color-light);margin-top: 15px;}
.adminui-main > .el-container > .el-header {@extend .headerPublic;}
.adminui-main > .el-container > .el-main.nopadding {border-top: 1px solid var(--el-border-color-light);border-bottom: 1px solid var(--el-border-color-light);margin-top: 15px;}
.adminui-main > .el-container > .el-main + .el-aside {border-left: 0!important;border-top: 1px solid var(--el-border-color-light);margin-top: 15px;}
.adminui-main > .el-container > .el-footer {margin-top: 15px;border-bottom: 1px solid var(--el-border-color-light);}
.adminui-main > .el-container > .el-container > .el-header {@extend .headerPublic}
.adminui-main > .el-container > .el-container > .el-header .left-panel {display: block;}
.adminui-main > .el-container > .el-container > .el-header .right-panel {display: block;margin-top: 15px;}
.sc-page {width: 100%;margin: 0;}
.common-main .el-form {width: 100% !important;}
.common-header-logo label {display: none;}
.common-header-title {display: none;}
}

44
src/style/pages.scss Normal file
View File

@ -0,0 +1,44 @@
/* USERCENTER */
.page-user {
.user-info-top {text-align: center;}
.user-info-top h2 {font-size: 18px;margin-top: 5px;}
.user-info-top p {margin: 8px 0 10px 0;}
.menu {background: none;}
.menu .el-menu-item {font-size: 12px;--el-menu-item-height:50px;}
.menu .el-menu-item-group {border-top: 1px solid var(--el-border-color-light);}
.menu .el-menu-item-group:first-child {border: 0;}
}
/*static-table*/
.static-table {border-collapse: collapse;width: 100%;font-size: 14px;margin-bottom: 45px;line-height: 1.5em;}
.static-table th {text-align: left;white-space: nowrap;color: #909399;font-weight: 400;border-bottom: 1px solid #dcdfe6;padding: 15px;max-width: 250px;}
.static-table td {border-bottom: 1px solid #dcdfe6;padding: 15px;max-width: 250px;color: #606266;}
/*header-tabs*/
.header-tabs {padding:10px 0 0 0;display:block;border:0!important;height:50px;background: none;}
.header-tabs .el-tabs__header {padding-left:10px;margin: 0;}
.header-tabs .el-tabs__content {display: none;}
.header-tabs .el-tabs__nav {border-radius: 0 !important;}
.header-tabs .el-tabs__item {font-size: 13px;}
.header-tabs .el-tabs__item.is-active {background-color: var(--el-bg-color-overlay);}
/*common-page*/
.common-page {}
.common-header-left {display: flex;align-items: center;}
.common-header-logo {display: flex;align-items: center;}
.common-header-logo img {height:30px;margin-right: 10px;vertical-align: bottom;}
.common-header-logo label {font-size: 20px;}
.common-header-title {font-size: 16px;border-left: 1px solid var(--el-border-color-light);margin-left: 15px;padding-left: 15px;}
.common-header-right {display: flex;align-items: center;}
.common-header-right a {font-size: 14px;color: var(--el-color-primary);cursor: pointer;}
.common-header-right a:hover {color: var(--el-color-primary-light-3);}
.common-container {max-width: 1240px;margin:30px auto 30px auto;}
.common-main {padding:20px;}
.common-title {font-size: 26px;margin-bottom: 20px;font-weight: normal;}
.common-main .el-form {width: 500px;margin:30px auto;}
.common-main .el-steps .el-step__title {font-size: 14px;}
.common-main .el-steps .el-step__icon {border: 1px solid;}
.common-main .yzm {display: flex;width: 100%;}
.common-main .yzm .el-button {margin-left: 10px;}
.common-main .link {color: var(--el-color-primary);cursor: pointer;}
.common-main .link:hover {color: var(--el-color-primary-light-3);}

5
src/style/style.scss Normal file
View File

@ -0,0 +1,5 @@
@import 'app.scss';
@import 'fix.scss';
@import 'pages.scss';
@import 'media.scss';
@import 'dark.scss';

View File

@ -0,0 +1,35 @@
<template>
<el-container>
<el-header style="height:50px;">
<div class="common-header-left">
<div class="common-header-logo">
<img :alt="$CONFIG.APP_NAME" src="img/logo.png">
<label>{{$CONFIG.APP_NAME}}</label>
</div>
<div class="common-header-title">{{title}}</div>
</div>
<div class="common-header-right">
<router-link to="/login">{{$t('login.back_login')}}</router-link>
</div>
</el-header>
<el-main>
<div class="common-container">
<h2 class="common-title">{{title}}</h2>
<div class="common-main el-card">
<slot></slot>
</div>
</div>
</el-main>
</el-container>
</template>
<script>
export default {
props: {
title: { type: String, default: "" }
}
}
</script>
<style>
</style>

View File

@ -0,0 +1,130 @@
<template>
<el-form ref="loginForm" :model="form" :rules="rules" label-width="0" size="large">
<el-form-item prop="user">
<el-input v-model="form.username" prefix-icon="el-icon-user" clearable :placeholder="$t('login.userPlaceholder')"></el-input>
</el-form-item>
<el-form-item prop="password">
<el-input v-model="form.password" prefix-icon="el-icon-lock" clearable show-password :placeholder="$t('login.PWPlaceholder')"></el-input>
</el-form-item>
<el-form-item prop="veryCode">
<el-input v-model="form.code" prefix-icon="el-icon-iphone" clearable :placeholder="$t('login.codePlaceholder')">
<template #append>
<el-image :src="verImage" @click="getCode" style="padding: 1px;"/>
</template>
</el-input>
</el-form-item>
<el-form-item style="margin-bottom: 10px;">
<el-col :span="12">
<el-checkbox :label="$t('login.rememberMe')" v-model="form.autologin"></el-checkbox>
</el-col>
<el-col :span="12" class="login-forgot">
<router-link to="/reset_password">{{ $t('login.forgetPassword') }}</router-link>
</el-col>
</el-form-item>
<el-form-item>
<el-button type="primary" style="width: 100%;" :loading="islogin" round @click="login">{{ $t('login.signIn') }}</el-button>
</el-form-item>
</el-form>
</template>
<script lang="ts" setup>
</script>
<script>
export default {
data() {
return {
form: {
username: "",
password: "",
code: "",
uuid: "",
autologin: false
},
verImage: '',
rules: {
username: [
{required: true, message: this.$t('login.userError'), trigger: 'blur'}
],
password: [
{required: true, message: this.$t('login.PWError'), trigger: 'blur'}
],
code: [
{required: true, message: this.$t('login.codeError'), trigger: 'blur'}
]
},
islogin: false,
}
},
mounted() {
this.getCode()
this.rememberMe()
},
methods: {
rememberMe() {
const data = this.$TOOLS.data.get("ACCOUNT")
if (data) {
this.form.username = data.username
this.form.password = data.password
this.form.autologin = true
}
},
async getCode() {
// const res = await this.$API.auth.verify();
// this.form.uuid = res.data.uuid
// this.verImage = res.data.image
this.form.code = "";
},
async login(){
//
const validate = await this.$refs.loginForm.validate().catch(() => {});
if(!validate){ return false }
this.islogin = true
const data = {
username: this.form.username,
password: this.$TOOL.crypto.MD5(this.form.password),
uuid: this.form.uuid,
code: this.form.code
};
//
const [res, err] = await this.$TOOLS.go(this.$API.auth.token(data))
this.islogin = false
if (err) {
await this.getCode();
return false;
}
this.$TOOL.data.set("TOKEN", res.data.token, res.data.expireIn)
//
if (this.form.autologin) {
this.$TOOL.data.set("ACCOUNT", {
username: this.form.username,
password: this.form.password
})
}
//
await this.getInfo()
//
// await this.getMenu()
},
async getInfo() {
const [res, err] = await this.$TOOLS.go(this.$API.auth.getAccountInfo())
if (err) {
return false
}
this.$TOOL.data.set("USER_INFO", res.data)
//
this.$router.replace({path: '/'})
this.$message.success("Login Success 登录成功")
}
}
}
</script>
<style scoped>
:deep(.el-input-group__append, .el-input-group__prepend) {
padding: 0;
}
</style>

View File

@ -0,0 +1,151 @@
<template>
<sc-dialog v-model="showWechatLogin" title="扫码登录" :width="400" destroy-on-close :showFullscreen="false" @closed="$emit('closed')">
<div class="qrCodeLogin">
<sc-qr-code class="qrCode" :text="wechatLoginCode" :size="200"></sc-qr-code>
<p class="msg">{{wechatLoginMsg}}</p>
<div class="qrCodeLogin-result" v-if="isWechatLoginResult">
<el-result v-if="loading" icon="success" :sub-title="wechatLoginMsg"></el-result>
<el-result v-else icon="error" :sub-title="wechatLoginMsg">
<template #extra>
<el-button type="primary" link @click="reGetCode()">重新获取</el-button>
</template>
</el-result>
</div>
</div>
</sc-dialog>
</template>
<script>
export default {
name: "wechatLogin",
data() {
return {
showWechatLogin: false,
wechatLoginCode: "",
isWechatLoginResult: false,
wechatLoginMsg: "",
t1: null,
loading: true
}
},
unmounted() {
this.clearTimer()
},
methods: {
open() {
this.getLogin()
this.showWechatLogin = true;
return this
},
reGetCode() {
this.isWechatLoginResult = false
this.wechatLoginCode = ""
this.wechatLoginMsg = ""
this.loading = true
this.getLogin()
},
async getLogin() {
if (!this.wechatLoginCode) {
await this.getCode()
}
const that = this;
that.t1 = setInterval(async ()=>{
const res = await that.$API.auth.getQrCode({qrcode: this.wechatLoginCode});
that.wechatLoginMsg = res.msg
if (res.data.state == 1) { //
that.isWechatLoginResult = true
that.loading = true
}else if(res.data.state == 2) { //
that.isWechatLoginResult = true
that.loading = true
that.clearTimer()
//
this.$TOOL.data.set("TOKEN", res.data.token, res.data.expireIn)
//
await this.getInfo()
//
await this.getMenu()
}else if(res.data.state == 3) { //
that.clearTimer()
that.isWechatLoginResult = true
that.loading = false
}else {
that.isWechatLoginResult = false
that.loading = true
}
},1000)
},
clearTimer() {
clearInterval(this.t1)
this.t1 = null
},
async getCode() {
const res = await this.$API.auth.qrcode();
this.wechatLoginCode = res.data.qrcode
this.wechatLoginMsg = res.msg
},
async getInfo() {
const [res, err] = await this.$TOOL.go(this.$API.auth.getAccountInfo())
if (err) {
return false
}
this.$TOOL.data.set("USER_INFO", res.data)
},
async getMenu() {
const [res, err] = await this.$TOOL.go(this.$API.auth.getMenuInfo())
if (err) {
return false
}
if(res.data.menus.length===0){
this.islogin = false
this.$alert("当前用户无任何菜单权限,请联系系统管理员", "无权限访问", {
type: 'error',
center: true
})
return false
}
this.$TOOLS.data.set("MENU", this.makeMenu(res.data.menus, 0))
this.$TOOL.data.set("PERMISSIONS", res.data.buttons)
this.$TOOL.data.set("ROLE", res.data.roles)
//
this.$router.replace({
path: '/'
})
this.$message.success("Login Success 登录成功")
},
makeMenu(menus, parent_id = 0) {
const arr = [];
for (let item of menus) {
if(item.parent_id === parent_id){
//
const tmp = {
name: item['name'],
path: '/' + item['path'],
component: item['path'],
meta: {
'title': item['title'],
'icon': item['icon'],
'hidden': item['hidden'],
'type': 'menu'
}
};
const children = this.makeMenu(menus, item.menu_id);
if (children.length > 0) {
tmp['children'] = children
}
arr.push(tmp)
}
}
return arr
}
}
}
</script>
<style lang="scss" scoped>
.qrCodeLogin {text-align: center;position: relative;padding: 20px 0;}
.qrCodeLogin img.qrCode {background: #fff;padding:20px;border-radius:10px;}
.qrCodeLogin p.msg {margin-top: 15px;}
.qrCodeLogin .qrCodeLogin-result {position: absolute;top:0;left:0;right: 0;bottom: 0;text-align: center;background: var(--el-bg-color);}
</style>

View File

@ -1,13 +1,145 @@
<template> <template>
<div> <div class="login_bg">
12312 <div class="login_adv" style="background-image: url('./images/bg.jpg');">
</div>
<div class="login_main">
<div class="login_config">
<el-button :icon="config.dark?'el-icon-sunny':'el-icon-moon'" circle type="info" @click="configDark"></el-button>
<el-dropdown trigger="click" placement="bottom-end" @command="configLang">
<el-button circle>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 512 512"><path d="M478.33 433.6l-90-218a22 22 0 0 0-40.67 0l-90 218a22 22 0 1 0 40.67 16.79L316.66 406h102.67l18.33 44.39A22 22 0 0 0 458 464a22 22 0 0 0 20.32-30.4zM334.83 362L368 281.65L401.17 362z" fill="currentColor"></path><path d="M267.84 342.92a22 22 0 0 0-4.89-30.7c-.2-.15-15-11.13-36.49-34.73c39.65-53.68 62.11-114.75 71.27-143.49H330a22 22 0 0 0 0-44H214V70a22 22 0 0 0-44 0v20H54a22 22 0 0 0 0 44h197.25c-9.52 26.95-27.05 69.5-53.79 108.36c-31.41-41.68-43.08-68.65-43.17-68.87a22 22 0 0 0-40.58 17c.58 1.38 14.55 34.23 52.86 83.93c.92 1.19 1.83 2.35 2.74 3.51c-39.24 44.35-77.74 71.86-93.85 80.74a22 22 0 1 0 21.07 38.63c2.16-1.18 48.6-26.89 101.63-85.59c22.52 24.08 38 35.44 38.93 36.1a22 22 0 0 0 30.75-4.9z" fill="currentColor"></path></svg>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item v-for="item in lang" :key="item.value" :command="item" :class="{'selected':config.lang==item.value}">{{item.name}}</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
<div class="login-form">
<div class="login-header">
<div class="logo">
<img :alt="$CONFIG.APP_NAME" src="./images/logo.png">
<label>{{$CONFIG.APP_NAME}}</label>
</div>
</div>
<password-form></password-form>
<template v-if="$CONFIG.MY_SHOW_LOGIN_OAUTH">
<el-divider>{{ $t('login.signInOther') }}</el-divider>
<div class="login-oauth">
<el-button type="success" icon="sc-icon-wechat" circle @click="wechatLogin"></el-button>
</div>
</template>
</div>
</div>
</div> </div>
<wechat-dialog v-if="showWechatLogin" ref="wechatDialog" @closed="showWechatLogin=false"/>
</template> </template>
<script setup> <script>
import passwordForm from './components/passwordForm'
import wechatDialog from './components/wechatLogin'
export default {
name: "login",
components: {
passwordForm,
wechatDialog
},
data() {
return {
config: {
lang: this.$TOOLS.data.get('APP_LANG') || this.$CONFIG.LANG,
dark: this.$TOOLS.data.get('APP_DARK') || false
},
lang: [
{
name: '简体中文',
value: 'zh-cn',
},
{
name: 'English',
value: 'en',
}
],
showWechatLogin: false
}
},
watch:{
'config.dark'(val){
if(val){
document.documentElement.classList.add("dark")
this.$TOOLS.data.set("APP_DARK", val)
}else{
document.documentElement.classList.remove("dark")
this.$TOOLS.data.remove("APP_DARK")
}
},
'config.lang'(val){
this.$i18n.locale = val
this.$TOOLS.data.set("APP_LANG", val)
}
},
methods: {
configDark(){
this.config.dark = this.config.dark ? false : true
},
configLang(command){
this.config.lang = command.value
},
wechatLogin(){
this.showWechatLogin = true
this.$nextTick(() => {
this.$refs.wechatDialog.open()
})
}
}
}
</script> </script>
<style scoped> <style scoped>
.login_bg {width: 100%;height: 100%;background: #fff;display: flex;}
.login_adv {width: 33.3333%;background-color: #555;background-size: cover;background-repeat: no-repeat;position: relative;}
.login_adv__title {color: #fff;padding: 40px;position: absolute;top:0px;left:0px;right: 0px;z-index: 2;}
.login_adv__title h2 {font-size: 40px;}
.login_adv__title h4 {font-size: 18px;margin-top: 10px;font-weight: normal;}
.login_adv__title p {font-size: 14px;margin-top:10px;line-height: 1.8;color: rgba(255,255,255,0.6);}
.login_adv__title div {margin-top: 10px;display: flex;align-items: center;}
.login_adv__title div span {margin-right: 15px;}
.login_adv__title div i {font-size: 40px;}
.login_adv__title div i.add {font-size: 20px;color: rgba(255,255,255,0.6);}
.login_adv__bottom {position: absolute;left:0px;right: 0px;bottom: 0px;color: #fff;padding: 40px;z-index: 3;}
.login_adv__mask {position: absolute;top:0px;left:0px;right: 0px;bottom: 0px;z-index: 1;}
.login_main {flex: 1;overflow: auto;display:flex;}
.login-form {width: 400px;margin: auto;padding:20px 0;}
.login-header {margin-bottom: 40px;}
.login-header .logo {display: flex;align-items: center;}
.login-header .logo img {width: 40px;height: 40px;vertical-align: bottom;margin-right: 10px;}
.login-header .logo label {font-size: 26px;font-weight: bold;}
.login-oauth {display: flex;justify-content:space-around;}
.login-form .el-divider {margin-top:40px;}
.login-form {}
.login-form:deep(.el-tabs) .el-tabs__header {margin-bottom: 25px;}
.login-form:deep(.el-tabs) .el-tabs__header .el-tabs__item {font-size: 14px;}
.login-form:deep(.login-forgot) {text-align: right;}
.login-form:deep(.login-forgot) a {color: var(--el-color-primary);}
.login-form:deep(.login-forgot) a:hover {color: var(--el-color-primary-light-3);}
.login_config {position: absolute;top:20px;right: 20px;}
.login-form:deep(.login-msg-yzm) {display: flex;width: 100%;}
.login-form:deep(.login-msg-yzm) .el-button {margin-left: 10px;--el-button-size:42px;}
@media (max-width: 1200px){
.login-form {width: 340px;}
}
@media (max-width: 1000px){
.login_main {display: block;}
.login_main .login_config {position: static;padding:20px 20px 0 20px;text-align: right;}
.login-form {width:100%;padding:20px 40px;}
.login_adv {display: none;}
}
</style> </style>

View File

@ -49,7 +49,7 @@ export default defineConfig(({mode, command}) => {
css: { css: {
preprocessorOptions: { preprocessorOptions: {
scss: { scss: {
additionalData: `@use "@/styles/variables.scss" as *;` // additionalData: `@use "@/styles/variables.scss" as *;`
} }
} }
} }