Browse Source

🎟实现登录请求

master
wangxiang 3 years ago
parent
commit
5121e05c49
  1. 15
      kicc-ui/src/views/sys/login/LoginForm.vue

15
kicc-ui/src/views/sys/login/LoginForm.vue

@ -132,13 +132,14 @@
const getShow = computed(() => unref(getLoginState) === LoginStateEnum.LOGIN); const getShow = computed(() => unref(getLoginState) === LoginStateEnum.LOGIN);
function getCode() { async function getCode() {
getCaptcha().then(codeModel =>{ try {
const codeModel = await getCaptcha();
codeUrl.value = codeModel.img ?? captchaDefImg; codeUrl.value = codeModel.img ?? captchaDefImg;
formData.realKey = codeModel.realKey; formData.realKey = codeModel.realKey;
}).catch(() => { } catch(error) {
codeUrl.value = captchaDefImg; codeUrl.value = captchaDefImg;
}); }
} }
async function handleLogin() { async function handleLogin() {
@ -146,14 +147,12 @@
if (!data) return; if (!data) return;
try { try {
loading.value = true; loading.value = true;
const userInfo = await userStore.login( const userInfo = await userStore.login(toRaw({
toRaw({
password: data.password, password: data.password,
username: data.account, username: data.account,
realKey: data.realKey, realKey: data.realKey,
code: data.code, code: data.code,
}) }));
);
if (userInfo) { if (userInfo) {
notification.success({ notification.success({
message: t('sys.login.loginSuccessTitle'), message: t('sys.login.loginSuccessTitle'),

Loading…
Cancel
Save