|
@@ -1,5 +1,5 @@
|
|
<template>
|
|
<template>
|
|
- <n-form ref="formRef" :model="model" :rules="rules" size="large" :show-label="false">
|
|
|
|
|
|
+ <n-form ref="formRef" :model="model" :role="rules" size="large" :show-label="false">
|
|
<n-form-item path="userName">
|
|
<n-form-item path="userName">
|
|
<n-input v-model:value="model.userName" placeholder="请输入用户名" />
|
|
<n-input v-model:value="model.userName" placeholder="请输入用户名" />
|
|
</n-form-item>
|
|
</n-form-item>
|
|
@@ -9,7 +9,6 @@
|
|
<n-space :vertical="true" :size="24">
|
|
<n-space :vertical="true" :size="24">
|
|
<div class="flex-y-center justify-between">
|
|
<div class="flex-y-center justify-between">
|
|
<n-checkbox v-model:checked="rememberMe">记住我</n-checkbox>
|
|
<n-checkbox v-model:checked="rememberMe">记住我</n-checkbox>
|
|
- <n-button :text="true" @click="toLoginModule('reset-pwd')">忘记密码?</n-button>
|
|
|
|
</div>
|
|
</div>
|
|
<n-button
|
|
<n-button
|
|
type="primary"
|
|
type="primary"
|
|
@@ -21,33 +20,20 @@
|
|
>
|
|
>
|
|
确定
|
|
确定
|
|
</n-button>
|
|
</n-button>
|
|
- <div class="flex-y-center justify-between">
|
|
|
|
- <n-button class="flex-1" :block="true" @click="toLoginModule('code-login')">
|
|
|
|
- {{ loginModuleLabels['code-login'] }}
|
|
|
|
- </n-button>
|
|
|
|
- <div class="w-12px"></div>
|
|
|
|
- <n-button class="flex-1" :block="true" @click="toLoginModule('register')">
|
|
|
|
- {{ loginModuleLabels.register }}
|
|
|
|
- </n-button>
|
|
|
|
- </div>
|
|
|
|
</n-space>
|
|
</n-space>
|
|
- <other-account @login="handleLoginOtherAccount" />
|
|
|
|
|
|
+ <other-account @change="handleLoginOtherAccount" />
|
|
</n-form>
|
|
</n-form>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
import { reactive, ref } from 'vue';
|
|
import { reactive, ref } from 'vue';
|
|
import type { FormInst, FormRules } from 'naive-ui';
|
|
import type { FormInst, FormRules } from 'naive-ui';
|
|
-import { loginModuleLabels } from '@/constants';
|
|
|
|
import { useAuthStore } from '@/store';
|
|
import { useAuthStore } from '@/store';
|
|
-import { useRouterPush } from '@/composables';
|
|
|
|
import { formRules } from '@/utils';
|
|
import { formRules } from '@/utils';
|
|
import { OtherAccount } from './components';
|
|
import { OtherAccount } from './components';
|
|
-
|
|
|
|
const auth = useAuthStore();
|
|
const auth = useAuthStore();
|
|
-const { login } = useAuthStore();
|
|
|
|
-const { toLoginModule } = useRouterPush();
|
|
|
|
|
|
|
|
|
|
+const { login } = useAuthStore();
|
|
const formRef = ref<HTMLElement & FormInst>();
|
|
const formRef = ref<HTMLElement & FormInst>();
|
|
|
|
|
|
const model = reactive({
|
|
const model = reactive({
|
|
@@ -63,15 +49,13 @@ const rememberMe = ref(false);
|
|
|
|
|
|
async function handleSubmit() {
|
|
async function handleSubmit() {
|
|
await formRef.value?.validate();
|
|
await formRef.value?.validate();
|
|
-
|
|
|
|
const { userName, password } = model;
|
|
const { userName, password } = model;
|
|
-
|
|
|
|
login(userName, password);
|
|
login(userName, password);
|
|
}
|
|
}
|
|
|
|
|
|
-function handleLoginOtherAccount(param: { userName: string; password: string }) {
|
|
|
|
- const { userName, password } = param;
|
|
|
|
- login(userName, password);
|
|
|
|
|
|
+function handleLoginOtherAccount(param: { type: string }) {
|
|
|
|
+ const { type } = param;
|
|
|
|
+ console.log(type);
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|