移除 登录时候的默认密码
This commit is contained in:
parent
b871543d5e
commit
c00574ca59
|
|
@ -21,7 +21,7 @@ import Lock from "~icons/ri/lock-fill";
|
||||||
import User from "~icons/ri/user-3-fill";
|
import User from "~icons/ri/user-3-fill";
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: "Login"
|
name: "Login",
|
||||||
});
|
});
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
@ -37,21 +37,21 @@ dataThemeChange(overallStyle.value);
|
||||||
const { title } = useNav();
|
const { title } = useNav();
|
||||||
|
|
||||||
const ruleForm = reactive({
|
const ruleForm = reactive({
|
||||||
account: "admin",
|
account: "",
|
||||||
password: "123456"
|
password: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
const onLogin = async (formEl: FormInstance | undefined) => {
|
const onLogin = async (formEl: FormInstance | undefined) => {
|
||||||
if (!formEl) return;
|
if (!formEl) return;
|
||||||
await formEl.validate(valid => {
|
await formEl.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
useUserStoreHook()
|
useUserStoreHook()
|
||||||
.loginByUsername({
|
.loginByUsername({
|
||||||
account: ruleForm.account,
|
account: ruleForm.account,
|
||||||
password: ruleForm.password
|
password: ruleForm.password,
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then((res) => {
|
||||||
if ((res.code = 200)) {
|
if ((res.code = 200)) {
|
||||||
// 获取后端路由
|
// 获取后端路由
|
||||||
return initRouter().then(() => {
|
return initRouter().then(() => {
|
||||||
|
|
@ -72,18 +72,10 @@ const onLogin = async (formEl: FormInstance | undefined) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const immediateDebounce: any = debounce(
|
const immediateDebounce: any = debounce((formRef) => onLogin(formRef), 1000, true);
|
||||||
formRef => onLogin(formRef),
|
|
||||||
1000,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
useEventListener(document, "keydown", ({ code }) => {
|
useEventListener(document, "keydown", ({ code }) => {
|
||||||
if (
|
if (["Enter", "NumpadEnter"].includes(code) && !disabled.value && !loading.value)
|
||||||
["Enter", "NumpadEnter"].includes(code) &&
|
|
||||||
!disabled.value &&
|
|
||||||
!loading.value
|
|
||||||
)
|
|
||||||
immediateDebounce(ruleFormRef.value);
|
immediateDebounce(ruleFormRef.value);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -126,8 +118,8 @@ useEventListener(document, "keydown", ({ code }) => {
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入账号',
|
message: '请输入账号',
|
||||||
trigger: 'blur'
|
trigger: 'blur',
|
||||||
}
|
},
|
||||||
]"
|
]"
|
||||||
prop="account"
|
prop="account"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue