refactor(projects): 动态路由权限完善

This commit is contained in:
Soybean
2022-04-29 02:00:51 +08:00
parent 401f0c748d
commit 55ddc9cab0
36 changed files with 406 additions and 717 deletions

View File

@@ -1,10 +1,10 @@
<template>
<n-form ref="formRef" :model="model" :rules="rules" size="large" :show-label="false">
<n-form-item path="phone">
<n-input v-model:value="model.phone" placeholder="请输入手机号码" />
<n-form-item path="userName">
<n-input v-model:value="model.userName" placeholder="请输入用户名" />
</n-form-item>
<n-form-item path="pwd">
<n-input v-model:value="model.pwd" type="password" show-password-on="click" placeholder="请输入密码" />
<n-form-item path="password">
<n-input v-model:value="model.password" type="password" show-password-on="click" placeholder="请输入密码" />
</n-form-item>
<n-space :vertical="true" :size="24">
<div class="flex-y-center justify-between">
@@ -31,7 +31,7 @@
</n-button>
</div>
</n-space>
<other-login />
<other-account @login="handleLoginOtherAccount" />
</n-form>
</template>
@@ -42,7 +42,7 @@ import { EnumLoginModule } from '@/enum';
import { useAuthStore } from '@/store';
import { useRouterPush } from '@/composables';
import { formRules } from '@/utils';
import { OtherLogin } from './components';
import { OtherAccount } from './components';
const auth = useAuthStore();
const { login } = useAuthStore();
@@ -50,12 +50,11 @@ const { toLoginModule } = useRouterPush();
const formRef = ref<(HTMLElement & FormInst) | null>(null);
const model = reactive({
phone: '15170283876',
pwd: 'abc123456'
userName: 'Soybean',
password: 'soybean123'
});
const rules: FormRules = {
phone: formRules.phone,
pwd: formRules.pwd
password: formRules.pwd
};
const rememberMe = ref(false);
@@ -65,10 +64,15 @@ function handleSubmit(e: MouseEvent) {
formRef.value.validate(errors => {
if (!errors) {
const { phone, pwd } = model;
login(phone, pwd, 'pwd');
const { userName, password } = model;
login(userName, password);
}
});
}
function handleLoginOtherAccount(param: { userName: string; password: string }) {
const { userName, password } = param;
login(userName, password);
}
</script>
<style scoped></style>