1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <script setup>
- import {apiSystemCommon} from '@/api/system'
- import { useRoute, useRouter } from 'vue-router'
- const route=useRoute()
- const router=useRouter()
- // 获取有菜单跳转
- async function handleNavigation(){
- const res=await apiSystemCommon.menuList()
- if(res.Ret!==200) return
- const arr=res.Data.List||[]
- if(arr.length===0){
- MessagePlugin.warning('无任何菜单权限,请联系管理员')
- return
- }
- const path=arr[0].children[0].path
- router.replace(path)
- }
- function init(){
- const code=route.query.code
- if(!code) return
- apiSystemCommon.loginWithCode({
- AuthCode:code
- }).then(res=>{
- if(res.Ret===200){
- sessionStorage.setItem('token',res.Data.Authorization)
- sessionStorage.setItem('userInfo',JSON.stringify(res.Data))
- sessionStorage.setItem('Role',res.Data.RoleTypeCode)
- handleNavigation()
- }
- })
- }
- init()
- </script>
- <template>
- <div class="auto-login-page">
- 登录中...
- </div>
- </template>
- <style lang="scss" scoped>
- .auto-login-page{
- width: 100%;
- height: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- </style>
|