|
@@ -51,8 +51,9 @@ import { ref, reactive } from 'vue'
|
|
|
import { routers } from 'router/index'
|
|
|
import { setStore, clearStore } from 'utils/store'
|
|
|
import Cookies from 'js-cookie'
|
|
|
-import { submitLoginForm } from 'api/organize'
|
|
|
+import { submitLoginForm, checkTokenLegitimate } from 'api/organize'
|
|
|
import { ElNotification } from 'element-plus'
|
|
|
+import { useRoute } from 'vue-router'
|
|
|
|
|
|
export default {
|
|
|
name: 'Login',
|
|
@@ -70,6 +71,30 @@ export default {
|
|
|
{ required: true, message: '密码不能为空', trigger: 'blur' }
|
|
|
]
|
|
|
}
|
|
|
+ const route = useRoute()
|
|
|
+ if (route.query.token) {
|
|
|
+ checkTokenLegitimate({
|
|
|
+ token: route.query.token
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ clearStore({ type: 'session' })
|
|
|
+ Cookies.set('user', res.data.userName)
|
|
|
+ Cookies.set('access', 0)
|
|
|
+ setStore({ name: 'userIdJH', content: res.data.userId })
|
|
|
+ setStore({ name: 'userNameJH', content: res.data.userName })
|
|
|
+ setStore({ name: 'tokenJH', content: route.query.token })
|
|
|
+ routers.push({
|
|
|
+ path: '/index'
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ ElNotification({
|
|
|
+ title: '请求出错',
|
|
|
+ message: res.message,
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
function handleSubmit () {
|
|
|
submitForm.value.validate((valid) => {
|
|
|
if (valid) {
|