<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>
|