|
|
@ -7,7 +7,7 @@ import user from '@/components/icons/user.vue'; |
|
|
|
import { NSwitch } from 'naive-ui'; |
|
|
|
import { NSwitch } from 'naive-ui'; |
|
|
|
import { Sign } from '@/api/index.js'; |
|
|
|
import { Sign } from '@/api/index.js'; |
|
|
|
import { useRouter } from 'vue-router'; |
|
|
|
import { useRouter } from 'vue-router'; |
|
|
|
import Pacman from '@/components/Pacman/index.vue' |
|
|
|
import Pacman from '@/components/Pacman/index.vue'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const systemStore = useSystemStore(); |
|
|
|
const systemStore = useSystemStore(); |
|
|
@ -29,7 +29,7 @@ const userTarget = ref(false); |
|
|
|
const passTarget = ref(false); |
|
|
|
const passTarget = ref(false); |
|
|
|
|
|
|
|
|
|
|
|
// ! 正在登陆 |
|
|
|
// ! 正在登陆 |
|
|
|
const isLoading = ref(false) |
|
|
|
const isLoading = ref(false); |
|
|
|
|
|
|
|
|
|
|
|
// ! 获取用户名输入 |
|
|
|
// ! 获取用户名输入 |
|
|
|
const restrictUsername = (event) => { |
|
|
|
const restrictUsername = (event) => { |
|
|
@ -58,12 +58,16 @@ const handleSignIn = async () => { |
|
|
|
return passTarget.value = true; |
|
|
|
return passTarget.value = true; |
|
|
|
} |
|
|
|
} |
|
|
|
isLoading.value = true; |
|
|
|
isLoading.value = true; |
|
|
|
const resd = await Sign.signIn(username.value, password.value); |
|
|
|
try { |
|
|
|
systemStore.setToken({ |
|
|
|
const resd = await Sign.signIn(username.value, password.value); |
|
|
|
...resd, |
|
|
|
systemStore.setToken({ |
|
|
|
remember: toValue(remember), |
|
|
|
...resd, |
|
|
|
}); |
|
|
|
remember: toValue(remember), |
|
|
|
// router.push(systemStore.defaultRoute); |
|
|
|
}); |
|
|
|
|
|
|
|
router.push(systemStore.defaultRoute); |
|
|
|
|
|
|
|
}catch(err) { |
|
|
|
|
|
|
|
isLoading.value = false; |
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// ! 聚焦 |
|
|
|
// ! 聚焦 |
|
|
@ -79,6 +83,7 @@ const handleFocus = (name) => { |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<div class="SignIn"> |
|
|
|
<div class="SignIn"> |
|
|
|
<div class="maskLayer"> |
|
|
|
<div class="maskLayer"> |
|
|
|
|
|
|
|
<Pacman :loading="isLoading"/> |
|
|
|
<div class="container"> |
|
|
|
<div class="container"> |
|
|
|
<header>{{ systemStore.title }}</header> |
|
|
|
<header>{{ systemStore.title }}</header> |
|
|
|
<main> |
|
|
|
<main> |
|
|
@ -86,7 +91,6 @@ const handleFocus = (name) => { |
|
|
|
<div><img :src="hutao" alt="" /></div> |
|
|
|
<div><img :src="hutao" alt="" /></div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="right"> |
|
|
|
<div class="right"> |
|
|
|
<Pacman :loading="isLoading"/> |
|
|
|
|
|
|
|
<header> |
|
|
|
<header> |
|
|
|
<div>登录</div> |
|
|
|
<div>登录</div> |
|
|
|
</header> |
|
|
|
</header> |
|
|
|