|
@@ -40,7 +40,7 @@
|
|
{{ t('sys.login.registerButton') }}
|
|
{{ t('sys.login.registerButton') }}
|
|
</Button> -->
|
|
</Button> -->
|
|
</FormItem>
|
|
</FormItem>
|
|
- <ARow class="enter-x">
|
|
|
|
|
|
+ <!-- <ARow class="enter-x">
|
|
<ACol :xs="24" :md="8">
|
|
<ACol :xs="24" :md="8">
|
|
<Button block @click="setLoginState(LoginStateEnum.MOBILE)">
|
|
<Button block @click="setLoginState(LoginStateEnum.MOBILE)">
|
|
{{ t('sys.login.mobileSignInFormTitle') }}
|
|
{{ t('sys.login.mobileSignInFormTitle') }}
|
|
@@ -56,39 +56,39 @@
|
|
{{ t('sys.login.registerButton') }}
|
|
{{ t('sys.login.registerButton') }}
|
|
</Button>
|
|
</Button>
|
|
</ACol>
|
|
</ACol>
|
|
- </ARow>
|
|
|
|
|
|
+ </ARow> -->
|
|
|
|
|
|
<Divider class="enter-x">{{ t('sys.login.otherSignIn') }}</Divider>
|
|
<Divider class="enter-x">{{ t('sys.login.otherSignIn') }}</Divider>
|
|
|
|
|
|
<div class="flex justify-evenly enter-x" :class="`${prefixCls}-sign-in-way`">
|
|
<div class="flex justify-evenly enter-x" :class="`${prefixCls}-sign-in-way`">
|
|
- <GithubFilled />
|
|
|
|
|
|
+ <!-- <GithubFilled />
|
|
<WechatFilled />
|
|
<WechatFilled />
|
|
<AlipayCircleFilled />
|
|
<AlipayCircleFilled />
|
|
<GoogleCircleFilled />
|
|
<GoogleCircleFilled />
|
|
- <TwitterCircleFilled />
|
|
|
|
|
|
+ <TwitterCircleFilled /> -->
|
|
</div>
|
|
</div>
|
|
</Form>
|
|
</Form>
|
|
</template>
|
|
</template>
|
|
<script lang="ts">
|
|
<script lang="ts">
|
|
- import { defineComponent, reactive, ref, toRaw, unref, computed } from 'vue';
|
|
|
|
-
|
|
|
|
- import { Checkbox, Form, Input, Row, Col, Button, Divider } from 'ant-design-vue';
|
|
|
|
- import {
|
|
|
|
- GithubFilled,
|
|
|
|
- WechatFilled,
|
|
|
|
- AlipayCircleFilled,
|
|
|
|
- GoogleCircleFilled,
|
|
|
|
- TwitterCircleFilled,
|
|
|
|
- } from '@ant-design/icons-vue';
|
|
|
|
- import LoginFormTitle from './LoginFormTitle.vue';
|
|
|
|
-
|
|
|
|
- import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
|
- import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
|
-
|
|
|
|
- import { useUserStore } from '/@/store/modules/user';
|
|
|
|
- import { LoginStateEnum, useLoginState, useFormRules, useFormValid } from './useLogin';
|
|
|
|
- import { useDesign } from '/@/hooks/web/useDesign';
|
|
|
|
- import { onKeyStroke } from '@vueuse/core';
|
|
|
|
|
|
+ import { defineComponent, reactive, ref, toRaw, unref, computed, onMounted } from 'vue'
|
|
|
|
+
|
|
|
|
+ import { Checkbox, Form, Input, Row, Col, Button, Divider } from 'ant-design-vue'
|
|
|
|
+ // import {
|
|
|
|
+ // GithubFilled,
|
|
|
|
+ // WechatFilled,
|
|
|
|
+ // AlipayCircleFilled,
|
|
|
|
+ // GoogleCircleFilled,
|
|
|
|
+ // TwitterCircleFilled,
|
|
|
|
+ // } from '@ant-design/icons-vue';
|
|
|
|
+ import LoginFormTitle from './LoginFormTitle.vue'
|
|
|
|
+
|
|
|
|
+ import { useI18n } from '/@/hooks/web/useI18n'
|
|
|
|
+ import { useMessage } from '/@/hooks/web/useMessage'
|
|
|
|
+
|
|
|
|
+ import { useUserStore } from '/@/store/modules/user'
|
|
|
|
+ import { LoginStateEnum, useLoginState, useFormRules, useFormValid } from './useLogin'
|
|
|
|
+ import { useDesign } from '/@/hooks/web/useDesign'
|
|
|
|
+ import { onKeyStroke } from '@vueuse/core'
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
name: 'LoginForm',
|
|
name: 'LoginForm',
|
|
@@ -102,57 +102,61 @@
|
|
Input,
|
|
Input,
|
|
Divider,
|
|
Divider,
|
|
LoginFormTitle,
|
|
LoginFormTitle,
|
|
- InputPassword: Input.Password,
|
|
|
|
- GithubFilled,
|
|
|
|
- WechatFilled,
|
|
|
|
- AlipayCircleFilled,
|
|
|
|
- GoogleCircleFilled,
|
|
|
|
- TwitterCircleFilled,
|
|
|
|
|
|
+ InputPassword: Input.Password
|
|
|
|
+ // GithubFilled,
|
|
|
|
+ // WechatFilled,
|
|
|
|
+ // AlipayCircleFilled,
|
|
|
|
+ // GoogleCircleFilled,
|
|
|
|
+ // TwitterCircleFilled,
|
|
},
|
|
},
|
|
setup() {
|
|
setup() {
|
|
- const { t } = useI18n();
|
|
|
|
- const { notification } = useMessage();
|
|
|
|
- const { prefixCls } = useDesign('login');
|
|
|
|
- const userStore = useUserStore();
|
|
|
|
|
|
+ const { t } = useI18n()
|
|
|
|
+ const { notification } = useMessage()
|
|
|
|
+ const { prefixCls } = useDesign('login')
|
|
|
|
+ const userStore = useUserStore()
|
|
|
|
|
|
- const { setLoginState, getLoginState } = useLoginState();
|
|
|
|
- const { getFormRules } = useFormRules();
|
|
|
|
|
|
+ const { setLoginState, getLoginState } = useLoginState()
|
|
|
|
+ const { getFormRules } = useFormRules()
|
|
|
|
|
|
- const formRef = ref();
|
|
|
|
- const loading = ref(false);
|
|
|
|
- const rememberMe = ref(false);
|
|
|
|
|
|
+ const formRef = ref()
|
|
|
|
+ const loading = ref(false)
|
|
|
|
+ const rememberMe = ref(false)
|
|
|
|
|
|
const formData = reactive({
|
|
const formData = reactive({
|
|
- account: 'vben',
|
|
|
|
- password: '123456',
|
|
|
|
- });
|
|
|
|
|
|
+ account: '蔡频',
|
|
|
|
+ password: '123456'
|
|
|
|
+ })
|
|
|
|
|
|
- const { validForm } = useFormValid(formRef);
|
|
|
|
|
|
+ onMounted(() => {
|
|
|
|
+ userStore.getToken()
|
|
|
|
+ })
|
|
|
|
+ const { validForm } = useFormValid(formRef)
|
|
|
|
|
|
- onKeyStroke('Enter', handleLogin);
|
|
|
|
|
|
+ onKeyStroke('Enter', handleLogin)
|
|
|
|
|
|
- const getShow = computed(() => unref(getLoginState) === LoginStateEnum.LOGIN);
|
|
|
|
|
|
+ const getShow = computed(() => unref(getLoginState) === LoginStateEnum.LOGIN)
|
|
|
|
|
|
async function handleLogin() {
|
|
async function handleLogin() {
|
|
- const data = await validForm();
|
|
|
|
- if (!data) return;
|
|
|
|
|
|
+ const data = await validForm()
|
|
|
|
+ if (!data) return
|
|
try {
|
|
try {
|
|
- loading.value = true;
|
|
|
|
|
|
+ loading.value = true
|
|
const userInfo = await userStore.login(
|
|
const userInfo = await userStore.login(
|
|
toRaw({
|
|
toRaw({
|
|
- password: data.password,
|
|
|
|
- username: data.account,
|
|
|
|
|
|
+ staffName: data.account,
|
|
|
|
+ password: data.password
|
|
})
|
|
})
|
|
- );
|
|
|
|
|
|
+ )
|
|
|
|
+
|
|
if (userInfo) {
|
|
if (userInfo) {
|
|
notification.success({
|
|
notification.success({
|
|
message: t('sys.login.loginSuccessTitle'),
|
|
message: t('sys.login.loginSuccessTitle'),
|
|
- description: `${t('sys.login.loginSuccessDesc')}: ${userInfo.realName}`,
|
|
|
|
- duration: 3,
|
|
|
|
- });
|
|
|
|
|
|
+ // description: `${t('sys.login.loginSuccessDesc')}: ${userInfo.realName}`,
|
|
|
|
+ duration: 3
|
|
|
|
+ })
|
|
}
|
|
}
|
|
} finally {
|
|
} finally {
|
|
- loading.value = false;
|
|
|
|
|
|
+ loading.value = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -167,8 +171,8 @@
|
|
loading,
|
|
loading,
|
|
setLoginState,
|
|
setLoginState,
|
|
LoginStateEnum,
|
|
LoginStateEnum,
|
|
- getShow,
|
|
|
|
- };
|
|
|
|
- },
|
|
|
|
- });
|
|
|
|
|
|
+ getShow
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
</script>
|
|
</script>
|