|
@ -100,6 +100,7 @@ import { MessagePlugin } from 'tdesign-vue-next' |
|
|
import { loginApi } from '@/api/login' |
|
|
import { loginApi } from '@/api/login' |
|
|
import { useAccountStore } from '@/store' |
|
|
import { useAccountStore } from '@/store' |
|
|
import { storeToRefs } from 'pinia' |
|
|
import { storeToRefs } from 'pinia' |
|
|
|
|
|
import Cookie from '@/utils/cookie' |
|
|
const accountStore = useAccountStore() |
|
|
const accountStore = useAccountStore() |
|
|
const router = useRouter() |
|
|
const router = useRouter() |
|
|
const formData = ref({ |
|
|
const formData = ref({ |
|
@ -117,6 +118,7 @@ const onSubmit = async ({ validateResult, firstError }) => { |
|
|
// 将token存入store中 |
|
|
// 将token存入store中 |
|
|
accountStore.updateToken(res?.data?.token) |
|
|
accountStore.updateToken(res?.data?.token) |
|
|
accountStore.updateUsername(res?.data?.username) |
|
|
accountStore.updateUsername(res?.data?.username) |
|
|
|
|
|
Cookie.setCookie('t', res?.data?.token) |
|
|
router.push('/') |
|
|
router.push('/') |
|
|
} else { |
|
|
} else { |
|
|
MessagePlugin.error({ content: '请输入正确的用户名和密码!' }) |
|
|
MessagePlugin.error({ content: '请输入正确的用户名和密码!' }) |
|
|