diff --git a/web/src/main.js b/web/src/main.js index 31d6a7bc..d381a97e 100644 --- a/web/src/main.js +++ b/web/src/main.js @@ -151,7 +151,7 @@ console.log(` 欢迎使用 Gin-Vue-Admin 当前版本:V2.4.1 加群方式:微信:shouzi_1994 QQ群:622360840 - 默认自动化文档地址:http://127.0.0.1:` + process.env.VUE_APP_SERVER_PORT + `/swagger/index.html - 默认前端文件运行地址:http://127.0.0.1:`+ process.env.VUE_APP_CLI_PORT` + 默认自动化文档地址:http://127.0.0.1:${process.env.VUE_APP_SERVER_PORT}/swagger/index.html + 默认前端文件运行地址:http://127.0.0.1:${process.env.VUE_APP_CLI_PORT} 如果项目让您获得了收益,希望您能请团队喝杯可乐:https://www.gin-vue-admin.com/docs/coffee `) \ No newline at end of file diff --git a/web/src/permission.js b/web/src/permission.js index 1015217a..07cc154e 100644 --- a/web/src/permission.js +++ b/web/src/permission.js @@ -4,11 +4,11 @@ import getPageTitle from '@/utils/page' let asyncRouterFlag = 0 -const whiteList = ['login','init'] -router.beforeEach(async(to, from, next) => { +const whiteList = ['login', 'init'] +router.beforeEach(async (to, from, next) => { const token = store.getters['user/token'] - // 在白名单中的判断情况 - //修改网页标签名称 + // 在白名单中的判断情况 + //修改网页标签名称 document.title = getPageTitle(to.meta.title) if (whiteList.indexOf(to.name) > -1) { if (token) { @@ -24,10 +24,16 @@ router.beforeEach(async(to, from, next) => { asyncRouterFlag++ await store.dispatch('router/SetAsyncRouter') const asyncRouters = store.getters['router/asyncRouters'] - router.addRoutes(asyncRouters) - next({...to, replace: true }) + asyncRouters.forEach(item => { + router.addRoute(item) + }) + next({ ...to, replace: true }) } else { - next() + if (to.matched.length) { + next() + } else { + next({ path: "/layout/404" }) + } } } // 不在白名单中并且未登陆的时候 diff --git a/web/src/view/login/login.vue b/web/src/view/login/login.vue index 2a5a6da5..7aeb82af 100644 --- a/web/src/view/login/login.vue +++ b/web/src/view/login/login.vue @@ -90,14 +90,14 @@ export default { name: "Login", data() { const checkUsername = (rule, value, callback) => { - if (value.length < 5 || value.length > 12) { + if (value.length < 5) { return callback(new Error("请输入正确的用户名")); } else { callback(); } }; const checkPassword = (rule, value, callback) => { - if (value.length < 6 || value.length > 12) { + if (value.length < 6) { return callback(new Error("请输入正确的密码")); } else { callback(); diff --git a/web/src/view/superAdmin/user/user.vue b/web/src/view/superAdmin/user/user.vue index 7a625e69..100c26b5 100644 --- a/web/src/view/superAdmin/user/user.vue +++ b/web/src/view/superAdmin/user/user.vue @@ -121,7 +121,7 @@ export default { rules: { username: [ { required: true, message: "请输入用户名", trigger: "blur" }, - { min: 6, message: "最低6位字符", trigger: "blur" } + { min: 5, message: "最低5位字符", trigger: "blur" } ], password: [ { required: true, message: "请输入用户密码", trigger: "blur" },