2025-07-18 14:57:45 +08:00

28 lines
1.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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