fix: some bug

This commit is contained in:
xiaoxian521 2021-08-27 00:45:40 +08:00
parent a4f126ae7f
commit a4d305868f
7 changed files with 69 additions and 20 deletions

View File

@ -22,6 +22,7 @@ module.exports = {
}, },
rules: { rules: {
"@typescript-eslint/no-explicit-any": "off", // any "@typescript-eslint/no-explicit-any": "off", // any
"no-debugger": "off",
"@typescript-eslint/explicit-module-boundary-types": "off", // setup() "@typescript-eslint/explicit-module-boundary-types": "off", // setup()
"@typescript-eslint/ban-types": "off", "@typescript-eslint/ban-types": "off",
"@typescript-eslint/ban-ts-comment": "off", "@typescript-eslint/ban-ts-comment": "off",
@ -42,4 +43,4 @@ module.exports = {
} }
] ]
} }
}; }

View File

@ -33,11 +33,19 @@
} }
p { p {
font-size: 12vw; font-size: 8vw;
overflow: hidden; overflow: hidden;
-webkit-text-stroke: 3px #7272a5; -webkit-text-stroke: 3px #7272a5;
} }
span {
display: block;
font-size: 20px;
overflow: hidden;
color: green;
text-align: center;
}
p::before { p::before {
content: " "; content: " ";
width: 100%; width: 100%;
@ -70,8 +78,40 @@
</style> </style>
<div class="g-container"> <div class="g-container">
<p>Pure-Admin</p> <p>Pure-Admin</p>
<span class="_develop"></span>
</div> </div>
</div> </div>
<script>
window.onload = function () {
(function () {
const ua = navigator.userAgent.toLowerCase();
const re = /(msie|firefox|chrome|opera|version).*?([\d.]+)/;
const m = ua.match(re);
const Sys = {
browser: m[1].replace(/version/, "'safari"),
version: m[2]
};
const browser = Array.of("chrome", "firefox").includes(Sys.browser);
const version = parseFloat(Sys.version);
const el = document.querySelector("._develop");
if (browser && version >= 90) {
let success =
document.createTextNode("当前浏览器版本很适合开发!!! 😃");
el.appendChild(success);
} else {
let warn = document.createTextNode(
"当前浏览器版本不适合开发,建议使用最新版本的谷歌或者火狐浏览器!!!😯"
);
el.appendChild(warn);
el.style.color = "red";
}
return Sys;
})();
};
</script>
<script type="module" src="/src/main.ts"></script> <script type="module" src="/src/main.ts"></script>
</body> </body>
</html> </html>

View File

@ -6,7 +6,7 @@ import { setupStore } from "/@/store";
import { useElementPlus } from "../src/plugins/element-plus"; import { useElementPlus } from "../src/plugins/element-plus";
import { useTable } from "../src/plugins/vxe-table"; import { useTable } from "../src/plugins/vxe-table";
import { usI18n } from "../src/plugins/i18n"; import { usI18n } from "../src/plugins/i18n";
import "element-plus/dist/index.css";
// 导入公共样式 // 导入公共样式
import "./style/index.scss"; import "./style/index.scss";
// 导入字体图标 // 导入字体图标

View File

@ -32,6 +32,7 @@ import {
ElRadioButton, ElRadioButton,
ElRadioGroup ElRadioGroup
} from "element-plus"; } from "element-plus";
import "element-plus/dist/index.css";
const components = [ const components = [
ElAffix, ElAffix,

View File

@ -120,13 +120,12 @@ export function resetRouter() {
import NProgress from "../utils/progress"; import NProgress from "../utils/progress";
// const whiteList = ["/login", "/register"]; const whiteList = ["/login", "/register"];
router.beforeEach((to, _from, next) => { router.beforeEach((to, _from, next) => {
const name = storageSession.getItem("info"); const name = storageSession.getItem("info");
NProgress.start(); NProgress.start();
const { t } = i18n.global; const { t } = i18n.global;
// @ts-ignore
to.meta.title ? (document.title = t(to.meta.title)) : ""; // 动态title to.meta.title ? (document.title = t(to.meta.title)) : ""; // 动态title
if (name) { if (name) {
if (_from?.name) { if (_from?.name) {
@ -140,7 +139,11 @@ router.beforeEach((to, _from, next) => {
} }
} else { } else {
if (to.path !== "/login") { if (to.path !== "/login") {
next({ path: "/login" }); if (whiteList.indexOf(to.path) !== -1) {
next();
} else {
next({ path: "/login" });
}
} else { } else {
next(); next();
} }

View File

@ -21,20 +21,6 @@ const remainingRouter = [
rank: 102 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", path: "/redirect",
name: "redirect", name: "redirect",

View File

@ -2,6 +2,11 @@ interface deviceInter {
match: Fn; match: Fn;
} }
interface BrowserInter {
browser: string;
version: string;
}
// 检测设备类型(手机返回true,反之) // 检测设备类型(手机返回true,反之)
export const deviceDetection = () => { export const deviceDetection = () => {
const sUserAgent: deviceInter = navigator.userAgent.toLowerCase(); const sUserAgent: deviceInter = navigator.userAgent.toLowerCase();
@ -17,3 +22,16 @@ export const deviceDetection = () => {
bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM 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;
};