吉安感知网项目-前端
chenyao
2 days ago a53ece5036c1fa61a63fe5f9e0cd3519210ab928
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<template>
    <div style="width: 100%; height: 100%; background: #05050f"></div>
</template>
<script setup>
import { useStore } from 'vuex'
import { ElLoading } from 'element-plus'
import { logOutFun } from '@/utils/util'
 
const store = useStore()
const router = useRouter()
const userName = window.localStorage?.userName
const route = useRoute()
let loading = ElLoading.service({ background: 'rgba(0, 0, 0, 0.3)', text: '加载中...' })
const tagWel = computed(() => store.state.tags.tagWel)
const redirect = route.query.redirect
 
if (userName) {
    store
        .dispatch('LoginByUsername', {
            username: userName,
            password: userName === 'admin' ? 'admin' :'jadk@2026',
            tenantId: '000000',
            type: 'account',
        })
        .then(() => {
            loading.close()
            router.push(redirect || tagWel.value)
        })
        .catch(err => {
            loading.close()
            // 返回上一个路由
            window.history.go(-1)
        })
}else{
    loading.close()
    logOutFun()
}
 
 
</script>
 
<style scoped lang="scss"></style>