| | |
| | | // 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" |
| | |
| | | // 获取验证码 |
| | | 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; |
| | |
| | | nickName: "", |
| | | phone: "", |
| | | phoneVCode: "", |
| | | // tenantId: props.tenantInfo.id, |
| | | code: "", |
| | | codeId: 0, |
| | | codeId: "", |
| | | email: "", |
| | | exRoleCode: "" |
| | | }, |
| | |
| | | |
| | | // 获取验证码 |
| | | getCaptcha(); |
| | | |
| | | exRole().then(res => { |
| | | state.roleList = res.result; |
| | | const role = route.query; |
| | |
| | | } else { |
| | | state.nowRole = state.roleList[0]; |
| | | } |
| | | state.ruleForm.exRoleCode = state.nowRole?.code; |
| | | state.ruleForm.exRoleCode = state.nowRole.code; |
| | | }); |
| | | // 注册验证码过期计时器 |
| | | // if (state.captchaEnabled) { |
| | |
| | | if (!formEl) return; |
| | | await formEl.validate(valid => { |
| | | if (valid) { |
| | | loading.value = true; |
| | | useUserStoreHook() |
| | | .loginByUsername({ |
| | | let obj = { |
| | | phone: state.ruleForm.phone, |
| | | code: state.ruleForm.phoneVCode, |
| | | exRuleCode: state.ruleForm.exRoleCode |
| | | }) |
| | | }; |
| | | loading.value = true; |
| | | useUserStoreHook() |
| | | .loginByUsername(obj) |
| | | .then(res => { |
| | | if (res.code == 200) { |
| | | // 获取后端路由 |
| | | return initRouter().then(() => { |
| | | console.log(res, "=-=-=-="); |
| | | if (!res.result.exRoles.hasFlsh) { |
| | | 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.code } |
| | | query: { code: res.result.exRoles[0].code } |
| | | }) |
| | | .then(() => { |
| | | message("登录成功", { type: "success" }); |