|
@@ -1,4 +1,5 @@
|
|
|
import router from './index';
|
|
|
+import http from '@/api';
|
|
|
const whiteList = ['/login', '/login/qrcode', '/login/mobile', '/login/sunshineRun', '/analysis/index', '/analysis/detail'];
|
|
|
const routers = router.getRoutes().map((item) => {
|
|
|
return item.path;
|
|
@@ -25,7 +26,12 @@ router.beforeEach(async (to, from, next) => {
|
|
|
next({ path: '/gesture' });
|
|
|
} else if (to.path === '/login/sunshineRun') {
|
|
|
next({ path: '/sunshineRun' });
|
|
|
- } else {
|
|
|
+ } else {
|
|
|
+ //获取百度TTS的token
|
|
|
+ http.common.baiduToken({}).then((res: any) => {
|
|
|
+ let tok = res.token;
|
|
|
+ localStorage.setItem('tok', tok);
|
|
|
+ });
|
|
|
next();
|
|
|
}
|
|
|
} else {
|
|
@@ -43,7 +49,7 @@ router.beforeEach(async (to, from, next) => {
|
|
|
// 否则全部重定向到登录页
|
|
|
if (to.path === '/gesture') {
|
|
|
next(`/login/qrcode`);
|
|
|
- }else if (to.path === '/sunshineRun') {
|
|
|
+ } else if (to.path === '/sunshineRun') {
|
|
|
next(`/login/sunshineRun`);
|
|
|
} else {
|
|
|
next(`/login`);
|