优化登录按钮交互

This commit is contained in:
china_ahhui
2024-06-02 12:07:46 +08:00
parent 6e3f05c58f
commit 30d7467369
3 changed files with 20 additions and 13 deletions

View File

@@ -54,6 +54,12 @@ other.elSvg(app);
app.use(VXETable) app.use(VXETable)
app.use(pinia).use(router).use(ElementPlus, { i18n: i18n.global.t }).use(i18n).use(VueGridLayout).use(fastCrud).mount('#app'); app.use(pinia)
.use(router)
.use(ElementPlus, { i18n: i18n.global.t })
.use(i18n)
.use(VueGridLayout)
.use(fastCrud)
.mount('#app');
app.config.globalProperties.mittBus = mitt(); app.config.globalProperties.mittBus = mitt();

View File

@@ -9,7 +9,7 @@ import {getBaseURL} from '/@/utils/baseUrl';
import ui from '@fast-crud/ui-element'; import ui from '@fast-crud/ui-element';
import {request} from '/@/utils/service'; import {request} from '/@/utils/service';
//扩展包 //扩展包
import {FsExtendsEditor, FsExtendsUploader,FsCropperUploader} from '@fast-crud/fast-extends'; import {FsExtendsEditor, FsExtendsUploader } from '@fast-crud/fast-extends';
import '@fast-crud/fast-extends/dist/style.css'; import '@fast-crud/fast-extends/dist/style.css';
import {successNotification} from '/@/utils/message'; import {successNotification} from '/@/utils/message';
import XEUtils from "xe-utils"; import XEUtils from "xe-utils";
@@ -75,6 +75,7 @@ export default {
}, */ }, */
}; };
}, },
logger: { off: { tableColumns: false } }
}); });
//富文本 //富文本
app.use(FsExtendsEditor, { app.use(FsExtendsEditor, {
@@ -89,7 +90,7 @@ export default {
action: `/api/system/file/`, action: `/api/system/file/`,
name: "file", name: "file",
withCredentials: false, withCredentials: false,
uploadRequest: async ({action, file, onProgress}) => { uploadRequest: async ({ action, file, onProgress }: { action: string; file: any; onProgress: Function }) => {
// @ts-ignore // @ts-ignore
const data = new FormData(); const data = new FormData();
data.append("file", file); data.append("file", file);
@@ -101,12 +102,12 @@ export default {
"Content-Type": "multipart/form-data" "Content-Type": "multipart/form-data"
}, },
data, data,
onUploadProgress: (p) => { onUploadProgress: (p: any) => {
onProgress({percent: Math.round((p.loaded / p.total) * 100)}); onProgress({percent: Math.round((p.loaded / p.total) * 100)});
} }
}); });
}, },
successHandle(ret) { successHandle(ret: any) {
// 上传完成后的结果处理, 此处应返回格式为{url:xxx,key:xxx} // 上传完成后的结果处理, 此处应返回格式为{url:xxx,key:xxx}
return { return {
url: getBaseURL(ret.data.url), url: getBaseURL(ret.data.url),
@@ -115,8 +116,8 @@ export default {
}; };
} }
}, },
valueBuilder(context){ valueBuilder(context: any){
const {row,key} = context const { row, key } = context
return getBaseURL(row[key]) return getBaseURL(row[key])
} }
}) })

View File

@@ -1,5 +1,5 @@
<template> <template>
<el-form ref="formRef" size="large" class="login-content-form" :model="state.ruleForm" :rules="rules"> <el-form ref="formRef" size="large" class="login-content-form" :model="state.ruleForm" :rules="rules" @keyup.enter="loginClick">
<el-form-item class="login-animation1" prop="username"> <el-form-item class="login-animation1" prop="username">
<el-input type="text" :placeholder="$t('message.account.accountPlaceholder1')" v-model="ruleForm.username" <el-input type="text" :placeholder="$t('message.account.accountPlaceholder1')" v-model="ruleForm.username"
clearable autocomplete="off"> clearable autocomplete="off">
@@ -39,7 +39,7 @@
</el-col> </el-col>
</el-form-item> </el-form-item>
<el-form-item class="login-animation4"> <el-form-item class="login-animation4">
<el-button type="primary" class="login-content-submit" round @keyup.enter="loginClick" @click="loginClick" <el-button type="primary" class="login-content-submit" round @click="loginClick"
:loading="loading.signIn"> :loading="loading.signIn">
<span>{{ $t('message.account.accountBtnText') }}</span> <span>{{ $t('message.account.accountBtnText') }}</span>
</el-button> </el-button>
@@ -126,7 +126,7 @@ export default defineComponent({
}); });
}; };
const refreshCaptcha = async () => { const refreshCaptcha = async () => {
state.ruleForm.captcha='' state.ruleForm.captcha=''
loginApi.getCaptcha().then((ret: any) => { loginApi.getCaptcha().then((ret: any) => {
state.ruleForm.captchaImgBase = ret.data.image_base; state.ruleForm.captchaImgBase = ret.data.image_base;
state.ruleForm.captchaKey = ret.data.key; state.ruleForm.captchaKey = ret.data.key;
@@ -153,9 +153,9 @@ export default defineComponent({
} }
} }
}).catch((err: any) => { }).catch((err: any) => {
// 登录错误之后,刷新验证码 // 登录错误之后,刷新验证码
refreshCaptcha(); refreshCaptcha();
}); });
} else { } else {
errorMessage("请填写登录信息") errorMessage("请填写登录信息")
} }