From 309b5a2eb4a99f20b2dcceca41c7ed1275bcc6ae Mon Sep 17 00:00:00 2001 From: zhangwei <1504152376@qq.com> Date: 星期二, 22 七月 2025 17:26:08 +0800 Subject: [PATCH] '注册导航上传loading' --- src/views/login/index.vue | 108 ++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 81 insertions(+), 27 deletions(-) diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 15a2618..6fdd381 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -30,7 +30,7 @@ // import darkIcon from "@/assets/svg/dark.svg?component"; import Lock from "~icons/ri/lock-fill"; import User from "~icons/ri/user-3-fill"; -import { captcha, phoneNumberCode, exRole } from "@/api/register/index.ts"; +import { captcha, phoneNumberCode, exRole } from "@/api/register/index"; defineOptions({ name: "Login" @@ -50,11 +50,8 @@ // 鑾峰彇楠岃瘉鐮� const getCaptcha = async () => { // if (!state.captchaEnabled) return; - state.ruleForm.code = ""; const res = await captcha(); - console.log(res); - state.captchaImage = "data:text/html;base64," + res.result?.img; state.expirySeconds = res.result?.expirySeconds; state.ruleForm.codeId = res.result?.id; @@ -66,9 +63,8 @@ nickName: "", phone: "", phoneVCode: "", - // tenantId: props.tenantInfo.id, code: "", - codeId: 0, + codeId: "", email: "", exRoleCode: "" }, @@ -110,7 +106,8 @@ hideTenantForLogin: false, expirySeconds: 60, // 楠岃瘉鐮佽繃鏈熸椂闂� phoneSeconds: 0, // 鎵嬫満楠岃瘉鐮佸�掕鏃� - roleList: [] + roleList: [], + nowRole: {} }); // 楠岃瘉鐮佽繃鏈熻鏃跺櫒 let timer: any = null; @@ -119,7 +116,7 @@ // 椤甸潰鍒濆鍖� onMounted(async () => { // 鑻RL甯︽湁Token鍙傛暟锛堢涓夋柟鐧诲綍锛� - const accessToken = route.query.token; + // if (accessToken) await saveTokenAndInitRoutes(accessToken); // watch( // () => themeConfig.value.isLoaded, @@ -132,8 +129,16 @@ // 鑾峰彇楠岃瘉鐮� getCaptcha(); + exRole().then(res => { state.roleList = res.result; + const role = route.query; + if (role.code) { + state.nowRole = role; + } else { + state.nowRole = state.roleList[0]; + } + state.ruleForm.exRoleCode = state.nowRole.code; }); // 娉ㄥ唽楠岃瘉鐮佽繃鏈熻鏃跺櫒 // if (state.captchaEnabled) { @@ -159,24 +164,33 @@ if (!formEl) return; await formEl.validate(valid => { if (valid) { + let obj = { + phone: state.ruleForm.phone, + code: state.ruleForm.phoneVCode, + exRuleCode: state.ruleForm.exRoleCode + }; loading.value = true; useUserStoreHook() - .loginByUsername({ - phone: state.ruleForm.phone, - code: state.ruleForm.phoneVCode, - exRuleCode: state.ruleForm.exRoleCode - }) + .loginByUsername(obj) .then(res => { if (res.code == 200) { // 鑾峰彇鍚庣璺敱 return initRouter().then(() => { - disabled.value = true; - router - .push(getTopMenu(true)?.path) - .then(() => { - message("鐧诲綍鎴愬姛", { type: "success" }); - }) - .finally(() => (disabled.value = false)); + console.log(res, "=-=-=-=", res.result.exRoles[0].hasFlsh); + if (!res.result.exRoles[0].hasFlsh) { + disabled.value = true; + router + .replace({ + name: "RegisterNav", + query: { code: res.result.exRoles[0].code } + }) + .then(() => { + message("鐧诲綍鎴愬姛", { type: "success" }); + }) + .finally(() => (disabled.value = false)); + } else { + router.replace("welcome"); + } }); } else { message(res?.message || "鐧诲綍澶辫触", { type: "error" }); @@ -224,16 +238,16 @@ <img width="400px" :src="logo1" class="logo1" /> </div> <!-- <img :src="bg" class="wave" /> --> - <div class="flex-c absolute right-5 top-3"> - <!-- 涓婚 --> - <el-switch + <!-- <div class="flex-c absolute right-5 top-3"> --> + <!-- 涓婚 --> + <!-- <el-switch v-model="dataTheme" inline-prompt :active-icon="dayIcon" :inactive-icon="darkIcon" @change="dataThemeChange" /> - </div> + </div> --> <div class="login-container"> <div class="img"> <!-- <component :is="toRaw(illustration)" /> --> @@ -242,7 +256,7 @@ <div class="login-form"> <!-- <avatar class="avatar" /> --> <Motion> - <h2 class="outline-hidden">{{ title }}</h2> + <h2 class="logintitle">{{ state.nowRole.name }}鐧诲綍</h2> </Motion> <el-form @@ -251,7 +265,7 @@ :rules="loginRules" size="large" > - <Motion :delay="150"> + <!-- <Motion :delay="150"> <el-form-item prop="exRoleCode"> <el-radio-group v-model="state.ruleForm.exRoleCode"> <el-radio @@ -262,7 +276,7 @@ > </el-radio-group> </el-form-item> - </Motion> + </Motion> --> <Motion :delay="100"> <el-form-item :rules="[ @@ -382,4 +396,44 @@ #suffix-span { cursor: pointer; } +.login-content-code { + display: flex; + align-items: center; + justify-content: space-around; + position: relative; + + .login-content-code-img { + width: 100%; + height: 40px; + line-height: 40px; + background-color: #ffffff; + // /* border: 1px solid rgb(220, 223, 230); */ + cursor: pointer; + transition: all ease 0.2s; + border-radius: 4px; + user-select: none; + + &:hover { + border-color: #c0c4cc; + transition: all ease 0.2s; + } + } +} + +.login-content-code-expired { + @extend .login-content-code; + &::before { + content: "楠岃瘉鐮佸凡杩囨湡"; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + border-radius: 4px; + background-color: rgba(0, 0, 0, 0.5); + color: #ffffff; + text-align: center; + line-height: 40px; + } +} </style> -- Gitblit v1.9.1