diff --git a/src/assets/css/index.css b/src/assets/css/index.css index 012a4066ba2758abf4a625827f885cfd9e2e8773..8a8a37bdbe61f763c26b6454a53f9486d4077182 100644 --- a/src/assets/css/index.css +++ b/src/assets/css/index.css @@ -341,8 +341,8 @@ div { height: 36px; } .el-tree-node__content:hover { - background-image: linear-gradient(90deg, - rgba(255, 255, 255, 0.05) 83%, + background-image: linear-gradient(90deg, + rgba(255, 255, 255, 0.05) 83%, rgba(0, 0, 0, 0.05) 86%); } */ /* .usrrole .el-tree-node:focus>.el-tree-node__content{ @@ -570,7 +570,7 @@ border-radius:8px; z-index: 20000 !important; } -/* +/* 下拉选样式 此处勿删,apaasV3下拉选择样式统一用这个 */ @@ -1112,7 +1112,7 @@ border-radius:8px; /* 详情页公共样式 by xuyiming ~~~end */ -/* +/* form_content */ .from_content1 { @@ -1561,11 +1561,16 @@ border-radius:8px; } .register_btn { + display: flex; + align-items: center; background-color: #eff2fa; border-radius: 4px; border: solid 1px #b0bee8; color: #3759be; } +.register_btn .icon-arrow-right { + margin-left: 39px; +} .forget_psd { font-size: 14px; color: #3759be; diff --git a/src/components/login-by-account.vue b/src/components/login-by-account.vue index 5778c900ed1c0410bec0ce21c55d14cb89876381..3847f64f3ae1eb7194dbcca67430a218120de020 100644 --- a/src/components/login-by-account.vue +++ b/src/components/login-by-account.vue @@ -31,12 +31,12 @@ - 登 录 + 登录 - + - 还没有账号?前往注册  - + 还没有账号?前往注册 +
@@ -159,7 +159,7 @@ const getMenuObj = (menu, parentRowPath, menuObj) => { }); }; const getImg = (clearInput = false) => { - axios.get(`/apaas/system/v5/user/getCaptcha??width=240&height=32`).then((res) => { + axios.get(`/apaas/system/v5/user/getCaptcha??width=138&height=36`).then((res) => { if (res.data.code == 200) { state.imgId = res.data.data.id; state.imgSrc = res.data.data.captcha; @@ -193,6 +193,7 @@ const { loginForm, steploginFormRules, imgId, imgSrc, identifyCode, hidePassword justify-content: space-between; align-items: center; .yzm_img { + margin: 4px 0 0 16px; flex: 1; } @@ -205,7 +206,13 @@ const { loginForm, steploginFormRules, imgId, imgSrc, identifyCode, hidePassword background-color: #f7f8f9; } .regist_bottom { - line-height: 34px; + line-height: 1; + display: flex; + align-items: center; + justify-content: space-between; + :deep(.el-checkbox) { + height: auto; + } } } diff --git a/src/components/login-by-code.vue b/src/components/login-by-code.vue index e11d0b9547e97a56774c1880b8805c2f7a11a310..4491064d7fa06db230036031f6b0235c4ef93dde 100644 --- a/src/components/login-by-code.vue +++ b/src/components/login-by-code.vue @@ -33,13 +33,13 @@
- + 登 录 - + - 还没有账号?前往注册  - + 还没有账号?前往注册 +
diff --git a/src/main.js b/src/main.js index 4e0779d05030a7657d7a3cacdf0a691cee94b785..d9a7ff207eee8f5ae5fc18606f08545216d00a2b 100644 --- a/src/main.js +++ b/src/main.js @@ -75,7 +75,7 @@ function getMenuObj(menu, parentRowPath, menuObj) { } }); } - +store.commit("setWhiteList", ["/", "/login", "/register", "/password"]); Promise.all([getUser(), getMenu("dadb2d3f-e263-48d1-9389-42acb9ea49f8")]) .then((res) => { if (res[0].data.code == 200 && res[1].data.code == 200) { @@ -98,8 +98,9 @@ Promise.all([getUser(), getMenu("dadb2d3f-e263-48d1-9389-42acb9ea49f8")]) generateRoutes(); }) .catch((e) => { - console.error(e) - }).finally(() => { + console.error(e); + }) + .finally(() => { createVue.use(ElementPlus, { locale }).use(store).use(router).use(i18n).use(bgui); createVue.mount("#app"); }); diff --git a/src/page/login/index.vue b/src/page/login/index.vue index bd2b1e97a41a689a75343627e83b1f6de4b46e8f..c9b955886d23521a0fba65b824f9c584fe58e862 100644 --- a/src/page/login/index.vue +++ b/src/page/login/index.vue @@ -6,18 +6,14 @@ configOptions.backgroundUrl ? JSON.parse(configOptions.backgroundUrl)[0].url : getImageUrl('bg.png') })`, }"> -
系统有效期剩余345 天,请管理员及时更换license!
+
-
+ + +
密码已过期,请修改密码后再次登录
+ +
@@ -59,6 +64,8 @@ const pageType = ref("login"); const loginTab = ref("account"); const configOptions = ref({}); +const dialogPasswordChange = ref(false); + const switchPageType = (type) => { // pageType.value = type router.push("/register"); @@ -96,15 +103,13 @@ onBeforeMount(() => { background-image: url("@/assets/imgs/bg.png"); background-size: 100% 100%; background-position: center center; + background-size: cover; position: relative; .bg-main { position: absolute; - top: 50%; - right: 0; - margin-right: 16vw; - margin-bottom: 80px; - transform: translateY(calc(-50%)); + top: calc(50vh - 250px); + right: calc(28vw - 240px); width: 500px; max-height: calc(100vh - 100px); overflow: hidden auto; @@ -141,7 +146,18 @@ onBeforeMount(() => { } } - > .bg-content { + .bg-content { + :deep(.bg-tabs-content) { + padding: 32px 0; + } + } + :deep(.el-form) { + .el-form-item { + .el-input, + .el-button { + height: 40px; + } + } } } > .bg-warning { @@ -151,6 +167,8 @@ onBeforeMount(() => { font-size: 14px; height: 32px; line-height: 32px; + display: flex; + justify-content: center; } > .bg-msg { diff --git a/src/page/register/index.vue b/src/page/register/index.vue index 9fcddb97653513fdbcb2ca9712245efb2854d4ce..045c77b50c4ce7531a1dc61006bba3d2142d68a6 100644 --- a/src/page/register/index.vue +++ b/src/page/register/index.vue @@ -32,7 +32,7 @@ - + { - console.log(msg) -} +const tip = (msg) => { + console.log(msg); +}; -/** +/** * 跳转登录页 * 携带当前页面路由,以期在登录页面完成登录后返回当前页面 */ const toLogin = () => { - router.replace({ - path: '/login', - query: { - redirect: router.currentRoute.fullPath - } - }); -} + let path = router.currentRoute.value.path; + //白名单中的401不做跳转 + if (!store.state.whiteList.includes(path)) { + window.location.href = `/apaas/manage/ui/#/login`; + } + // router.replace({ + // path: '/login', + // query: { + // redirect: router.currentRoute.fullPath + // } + // }); +}; -/** - * 请求失败后的错误统一处理 +/** + * 请求失败后的错误统一处理 * @param {Number} status 请求失败的状态码 */ const errorHandle = (status, other) => { - // 状态码判断 - switch (status) { - case 400: tip('请求错误(400)'); break; - // 401: 未登录状态,跳转登录页 - case 401: - toLogin(); - break; - // 403 token过期 - // 清除token并跳转登录页 - case 403: - tip('登录过期,请重新登录'); - localStorage.removeItem('token'); - store.commit('loginSuccess', null); - setTimeout(() => { - // toLogin(); - }, 1000); - break; - case 404: tip('请求的资源不存在'); break; - case 408: tip('请求超时(408)'); - case 500: tip('服务器错误(500)'); - case 501: tip('服务未实现(501)'); - case 502: tip('网络错误(502)'); - case 503: tip('服务不可用(503)'); - case 504: tip('网络超时(504)'); - case 505: tip('HTTP版本不受支持(505)'); - default: tip(`连接出错,${other}`); - } -} + // 状态码判断 + switch (status) { + case 400: + tip("请求错误(400)"); + break; + // 401: 未登录状态,跳转登录页 + case 401: + toLogin(); + break; + // 403 token过期 + // 清除token并跳转登录页 + case 403: + tip("登录过期,请重新登录"); + localStorage.removeItem("token"); + store.commit("loginSuccess", null); + setTimeout(() => { + // toLogin(); + }, 1000); + break; + case 404: + tip("请求的资源不存在"); + break; + case 408: + tip("请求超时(408)"); + case 500: + tip("服务器错误(500)"); + case 501: + tip("服务未实现(501)"); + case 502: + tip("网络错误(502)"); + case 503: + tip("服务不可用(503)"); + case 504: + tip("网络超时(504)"); + case 505: + tip("HTTP版本不受支持(505)"); + default: + tip(`连接出错,${other}`); + } +}; // 创建axios实例 var instance = axios.create({ timeout: 1000 * 12 }); // 设置post请求头 -instance.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; -/** - * 请求拦截器 - * 每次请求前,如果存在token则在请求头中携带token +instance.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded"; +/** + * 请求拦截器 + * 每次请求前,如果存在token则在请求头中携带token */ instance.interceptors.request.use( - config => { - // const token = store.state.token; - // var token = 'Basic cm9vdA%3D%3D' - // token && (config.headers.Authorization = token); - // const token = store.state.token; - // var token = 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZXh0IjoibGltaW5nZSIsInR5cGUiOiJ1c2VyIn0.YUPQ-3nttgfRGOUV4T06JZ6osH46nZ0UUolYdEBhvSQ' - // token && (config.headers.Authorization = token); + (config) => { + // const token = store.state.token; + // var token = 'Basic cm9vdA%3D%3D' + // token && (config.headers.Authorization = token); + // const token = store.state.token; + // var token = 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZXh0IjoibGltaW5nZSIsInR5cGUiOiJ1c2VyIn0.YUPQ-3nttgfRGOUV4T06JZ6osH46nZ0UUolYdEBhvSQ' + // token && (config.headers.Authorization = token); - // if(config.headers.Authorization!="headers"){ - // const token = process.env.DRONE_TOKEN ? process.env.DRONE_TOKEN : Conf.token; - // var Authorization = `Bearer ${token}` - // token && (config.headers.Authorization = Authorization); - // }else{ - // config.headers.Authorization = ''; - // } - return config; - }, - error => Promise.error(error)) + // if(config.headers.Authorization!="headers"){ + // const token = process.env.DRONE_TOKEN ? process.env.DRONE_TOKEN : Conf.token; + // var Authorization = `Bearer ${token}` + // token && (config.headers.Authorization = Authorization); + // }else{ + // config.headers.Authorization = ''; + // } + return config; + }, + (error) => Promise.error(error) +); // 响应拦截器 instance.interceptors.response.use( - // 请求成功 - res => res.status === 200|| res.status === 201? Promise.resolve(res) : Promise.reject(res), - // 请求失败 - error => { - const { response } = error; - if (response) { - // 请求已发出,但是不在2xx的范围 - errorHandle(response.status, response.data.errmessage); - return Promise.reject(response); - } - }); + // 请求成功 + (res) => (res.status === 200 || res.status === 201 ? Promise.resolve(res) : Promise.reject(res)), + // 请求失败 + (error) => { + const { response } = error; + if (response) { + // 请求已发出,但是不在2xx的范围 + errorHandle(response.status, response.data.errmessage); + return Promise.reject(response); + } + } +); export default instance; diff --git a/src/router/index.js b/src/router/index.js index 71e0d53056d2cea83b500f9a9bc8bfd1ad957491..84ab6fd2680789e89a41e5e4994fadc9b2b453ec 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -48,7 +48,7 @@ const router = newRouterFunc(); function inWhiteList(toPath) { //配置白名单 - const whiteList = ["/login", "/register", "/password"]; + const whiteList = store.state.whiteList; const path = whiteList.find((value) => { // 使用正则匹配 const reg = new RegExp("^" + value); @@ -59,7 +59,6 @@ function inWhiteList(toPath) { router.beforeEach((to, from, next) => { const userInfo = store.state.userInfo; - //已登录不可跳转登陆页 if (userInfo && (to.path == "/login" || to.path == "/")) { next({ diff --git a/src/store/index.js b/src/store/index.js index 4d1f9a474a969334731d86455bc73cb3292a24c5..fa55f98188670c2c7b6ad8d86b1d809a90d2aa67 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1,61 +1,63 @@ -import {createStore} from 'vuex' - +import { createStore } from "vuex"; const store = createStore({ state: { - userInfo:null, - menu:null, - route:null, - nameFlag:false, - msgBoxFlag:false, - nowzz:null, - menuObj:{}, - treeFlag:false, - registerValid:false, + userInfo: null, + menu: null, + route: null, + nameFlag: false, + msgBoxFlag: false, + nowzz: null, + menuObj: {}, + treeFlag: false, + registerValid: false, msgUnreadNum: 0, systemLogo: "", + whiteList: [], }, getters: { count(state) { - return state.userInfo - } + return state.userInfo; + }, }, mutations: { setUserInfo(state, info) { - state.userInfo = info + state.userInfo = info; }, - setMenu(state,menu){ - state.menu = menu + setMenu(state, menu) { + state.menu = menu; }, - setMenuObj(state,menuObj){ - state.menuObj = menuObj + setMenuObj(state, menuObj) { + state.menuObj = menuObj; }, - setRoute(state,route){ - state.route = route + setRoute(state, route) { + state.route = route; }, - setNameFlag(state,nameFlag){ - state.nameFlag = nameFlag + setNameFlag(state, nameFlag) { + state.nameFlag = nameFlag; }, - setMsgBoxFlag(state,msgBoxFlag){ - state.msgBoxFlag = msgBoxFlag + setMsgBoxFlag(state, msgBoxFlag) { + state.msgBoxFlag = msgBoxFlag; }, - setNowzz(state,nowzz){ - state.nowzz = nowzz + setNowzz(state, nowzz) { + state.nowzz = nowzz; }, - setTreeFlag(state,treeFlag){ - state.treeFlag = treeFlag + setTreeFlag(state, treeFlag) { + state.treeFlag = treeFlag; }, - setRegisterValid(state,registerValid){ - state.registerValid = registerValid + setRegisterValid(state, registerValid) { + state.registerValid = registerValid; }, setUnreadNum(state, num) { - state.msgUnreadNum = num + state.msgUnreadNum = num; + }, + setSystemLogo(state, logo) { + state.systemLogo = logo; + }, + setWhiteList(state, arr) { + state.whiteList = arr; }, - setSystemLogo(state,logo) { - state.systemLogo = logo - } }, - actions: {} + actions: {}, }); export default store; -