From a855bc6ae27cec13077bae5a137c93b6c4557f30 Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Thu, 12 Jan 2023 11:32:35 +0800
Subject: [PATCH] 首页携带token直接访问设置
---
src/main.js | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/src/main.js b/src/main.js
index 5daa98c..ebfc1d4 100644
--- a/src/main.js
+++ b/src/main.js
@@ -7,7 +7,7 @@
import './error'; // 日志
import './cache';//页面缓存
import store from './store';
-import {loadStyle} from './util/util'
+import { loadStyle } from './util/util'
import * as urls from '@/config/env';
import Element from 'element-ui';
import {
@@ -26,6 +26,24 @@
// 业务组件
import tenantPackage from './views/system/tenantpackage';
+
+import Cookies from 'js-cookie'
+// 携带token跳转页面设置
+
+const tokenLength = window.location.href.indexOf('=');
+if(tokenLength>0){
+ //取“=”之后的token
+ let z = window.location.href.substring(tokenLength + 1)
+ // 把token存进B系统
+ let obj = {
+ dataType: typeof (z),
+ content: z,
+ datetime: new Date().getTime()
+ }
+ window.localStorage.setItem('saber-token', JSON.stringify(obj));
+ Cookies.set('saber-access-token', z)
+}
+
// 注册全局crud驱动
window.$crudCommon = crudCommon;
// 加载Vue拓展
--
Gitblit v1.9.3