update:添加全校心率跳转
This commit is contained in:
parent
114e7c93ac
commit
b3b8d74a8b
@ -10,6 +10,7 @@ import viewgird from './viewGird'
|
||||
import store from '../store/index'
|
||||
import redirect from './redirect'
|
||||
import charts from './charts'
|
||||
import links from './outlink'
|
||||
const routes = [{
|
||||
path: '/',
|
||||
name: 'index',
|
||||
@ -22,6 +23,7 @@ const routes = [{
|
||||
...viewgird,
|
||||
...redirect,
|
||||
...charts,
|
||||
...links, //外链
|
||||
// {
|
||||
// path: '/home',
|
||||
// name: 'home',
|
||||
|
8
src/router/outlink.js
Normal file
8
src/router/outlink.js
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
let links=[
|
||||
{
|
||||
path: '/heart',
|
||||
name: 'heart',
|
||||
component: () => import('@/views/outlink/heart/index.vue')
|
||||
}]
|
||||
export default links
|
28
src/views/outlink/heart/index.vue
Normal file
28
src/views/outlink/heart/index.vue
Normal file
@ -0,0 +1,28 @@
|
||||
<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>
|
Loading…
x
Reference in New Issue
Block a user