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

Loading…
Cancel
Save