<template>
	<view>
		cas登录
	</view>
</template>

<script setup>
	import {
		Login
	} from "@/api/api.js";
	import {
		ElMessage
	} from 'element-plus'
	import {
		ref,nextTick,onMounted
	} from 'vue'
	onMounted(()=>{
		let access_token=getParameterByName('access_token')
		let refresh_token=getParameterByName('refresh_token')
		sessionStorage.setItem('token', access_token);
		sessionStorage.setItem('refreshToken', refresh_token);
		// sessionStorage.setItem('tk', JSON.stringify(res.data.tk));
		var token = sessionStorage.getItem('token');
		console.log(token)
		if (token!=null && token == access_token) {
			window.location.href = "./#/yewu/mainList"
		}else{
			ElMessage.error("登录失败")
		}
	})
	//获取url参数
	    function getParameterByName(name, url) {
	        if (!url) url = decodeURIComponent(window.location.href)
	        name = name.replace(/[\[\]]/g, '\\$&')
	        var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
	            results = regex.exec(url)
	        if (!results) return null
	        if (!results[2]) return ''
	        return decodeURIComponent(results[2].replace(/\+/g, ' '))
	    }
</script>

<style>
</style>