From a4d305868fcb3e3029d9d59ee0c31c18729789dc Mon Sep 17 00:00:00 2001 From: xiaoxian521 <1923740402@qq.com> Date: Fri, 27 Aug 2021 00:45:40 +0800 Subject: [PATCH] fix: some bug --- .eslintrc.js | 3 ++- index.html | 42 +++++++++++++++++++++++++++++- src/main.ts | 2 +- src/plugins/element-plus/index.ts | 1 + src/router/index.ts | 9 ++++--- src/router/modules/remaining.ts | 14 ---------- src/utils/deviceDetection/index.ts | 18 +++++++++++++ 7 files changed, 69 insertions(+), 20 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 1ff81cb28..887fb823c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -22,6 +22,7 @@ module.exports = { }, rules: { "@typescript-eslint/no-explicit-any": "off", // any + "no-debugger": "off", "@typescript-eslint/explicit-module-boundary-types": "off", // setup() "@typescript-eslint/ban-types": "off", "@typescript-eslint/ban-ts-comment": "off", @@ -42,4 +43,4 @@ module.exports = { } ] } -}; +} diff --git a/index.html b/index.html index 9ba8791ea..ecdd57f42 100644 --- a/index.html +++ b/index.html @@ -33,11 +33,19 @@ } p { - font-size: 12vw; + font-size: 8vw; overflow: hidden; -webkit-text-stroke: 3px #7272a5; } + span { + display: block; + font-size: 20px; + overflow: hidden; + color: green; + text-align: center; + } + p::before { content: " "; width: 100%; @@ -70,8 +78,40 @@

Pure-Admin

+
+ diff --git a/src/main.ts b/src/main.ts index 39926660b..e3cfc1a1b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -6,7 +6,7 @@ import { setupStore } from "/@/store"; import { useElementPlus } from "../src/plugins/element-plus"; import { useTable } from "../src/plugins/vxe-table"; import { usI18n } from "../src/plugins/i18n"; -import "element-plus/dist/index.css"; + // 导入公共样式 import "./style/index.scss"; // 导入字体图标 diff --git a/src/plugins/element-plus/index.ts b/src/plugins/element-plus/index.ts index bbdb62249..2bd14e20e 100644 --- a/src/plugins/element-plus/index.ts +++ b/src/plugins/element-plus/index.ts @@ -32,6 +32,7 @@ import { ElRadioButton, ElRadioGroup } from "element-plus"; +import "element-plus/dist/index.css"; const components = [ ElAffix, diff --git a/src/router/index.ts b/src/router/index.ts index d64b46347..e8fce1051 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -120,13 +120,12 @@ export function resetRouter() { import NProgress from "../utils/progress"; -// const whiteList = ["/login", "/register"]; +const whiteList = ["/login", "/register"]; router.beforeEach((to, _from, next) => { const name = storageSession.getItem("info"); NProgress.start(); const { t } = i18n.global; - // @ts-ignore to.meta.title ? (document.title = t(to.meta.title)) : ""; // 动态title if (name) { if (_from?.name) { @@ -140,7 +139,11 @@ router.beforeEach((to, _from, next) => { } } else { if (to.path !== "/login") { - next({ path: "/login" }); + if (whiteList.indexOf(to.path) !== -1) { + next(); + } else { + next({ path: "/login" }); + } } else { next(); } diff --git a/src/router/modules/remaining.ts b/src/router/modules/remaining.ts index 6ccc8be77..2e6a52052 100644 --- a/src/router/modules/remaining.ts +++ b/src/router/modules/remaining.ts @@ -21,20 +21,6 @@ const remainingRouter = [ rank: 102 } }, - // { - // // 找不到路由重定向到404页面 - // path: "/:pathMatch(.*)", - // name: "pathMatch", - // component: Layout, - // redirect: "/error/404", - // meta: { - // icon: "el-icon-s-home", - // title: "message.hshome", - // showLink: false, - // savedPosition: false, - // rank: 103, - // }, - // }, { path: "/redirect", name: "redirect", diff --git a/src/utils/deviceDetection/index.ts b/src/utils/deviceDetection/index.ts index f491dac7d..4db22d05d 100644 --- a/src/utils/deviceDetection/index.ts +++ b/src/utils/deviceDetection/index.ts @@ -2,6 +2,11 @@ interface deviceInter { match: Fn; } +interface BrowserInter { + browser: string; + version: string; +} + // 检测设备类型(手机返回true,反之) export const deviceDetection = () => { const sUserAgent: deviceInter = navigator.userAgent.toLowerCase(); @@ -17,3 +22,16 @@ export const deviceDetection = () => { bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM ); }; + +// 获取浏览器型号以及版本 +export const getBrowserInfo = () => { + const ua = navigator.userAgent.toLowerCase(); + const re = /(msie|firefox|chrome|opera|version).*?([\d.]+)/; + const m = ua.match(re); + const Sys: BrowserInter = { + browser: m[1].replace(/version/, "'safari"), + version: m[2] + }; + + return Sys; +};