Files
mosr-web/src/views/cas-login/index.vue

31 lines
799 B
Vue

<script setup>
import {useRouter} from 'vue-router';
import {useAuthStore} from '@/stores/userstore'
import {ElLoading} from 'element-plus'
const authStore = useAuthStore()
const router = useRouter();
const tokenValue = reactive(router.currentRoute.value.query.token)
console.log('tokenValue', tokenValue)
const init = () => {
const loading = ElLoading.service({
lock: true,
text: '登录中...',
background: 'rgba(0, 0, 0, 0.7)',
})
if (authStore.casToken(tokenValue)) {
loading.close()
const toView = sessionStorage.getItem('toView')
console.log(toView, 'toView');
if (toView) {
let parse = JSON.parse(toView);
window.location.href = window.location.origin + parse.path + parse.query
} else {
router.push('/')
}
}
}
init()
</script>