28 lines
1.1 KiB
Vue
28 lines
1.1 KiB
Vue
<template>
|
||
<!-- 页面无内容,自动跳转外部链接 -->
|
||
</template>
|
||
|
||
<script setup>
|
||
import { onMounted } from 'vue'
|
||
import { useRouter , useRoute } from 'vue-router'
|
||
|
||
const router = useRouter()
|
||
const route = useRoute()
|
||
|
||
|
||
onMounted(() => {
|
||
|
||
let externalUrl = 'https://allheartrates.yuedongsports.com/#/auth/login?token=' // 替换为你的外部链接
|
||
if (process.env.NODE_ENV == 'development') {
|
||
externalUrl = 'http://localhost:5666/auth/login?token='
|
||
}else if(window.location.host == 'smartsports-qa.yuedongsports.com'){
|
||
externalUrl = 'https://allheartrates-qa.yuedongsports.com/#/auth/login?token='
|
||
}
|
||
const token = 'Bearer' + JSON.parse(localStorage.getItem('user'))?.token || ''
|
||
// const token ='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIxNjIiLCJpYXQiOiIxNzUyODE5MzcyIiwibmJmIjoiMTc1MjgxOTM3MiIsImV4cCI6IjE3NTI4MjY1NzIiLCJpc3MiOiJ2b2wuY29yZS5vd25lciIsImF1ZCI6InZvbC5jb3JlIn0.fIlBVdJdMd7kcIrmtyKKKRDaqK8GhReheHfVse5FSk4'
|
||
window.open(externalUrl + token)
|
||
console.log(router, route.matched[route.matched.length - 2],localStorage.getItem('user'))
|
||
router.replace('/')
|
||
})
|
||
|
||
</script> |