lex-xin 3 年之前
父节点
当前提交
345f0bc04d
共有 3 个文件被更改,包括 25 次插入2 次删除
  1. 7 1
      src/layout/components/Navbar.vue
  2. 2 1
      src/utils/auth.js
  3. 16 0
      src/utils/validate.js

+ 7 - 1
src/layout/components/Navbar.vue

@@ -272,6 +272,8 @@ import { resetPassword } from "@/api/buildTeam";
 import AppLink from "./Sidebar/Link";
 import { getBelongTopMenuPath } from "@/utils/permission";
 import instructions from "./instructions";
+import { validOaUrl } from '@/utils/validate'
+import Cookies from 'js-cookie'
 import axios from 'axios'
 export default {
   data() {
@@ -391,7 +393,11 @@ export default {
       this.isShowIns = val;
     },
     gotoOa(){
-      window.open('http://localhost:9527/')
+      console.log(validOaUrl())
+      const Token = Cookies.get('cross-Token')
+      console.log(Token, validOaUrl().split('//')[1])
+      Cookies.set('Adminoken', Token, { domain: '.dayaedu.com' })
+      window.open(validOaUrl())
     }
   },
   watch: {

+ 2 - 1
src/utils/auth.js

@@ -1,7 +1,8 @@
 import Cookies from 'js-cookie'
 
 const TokenKey = 'dy_admin_token'
-const CrossTokenKey = 'Admin-Token'
+// const CrossTokenKey = 'Admin-Token'
+const CrossTokenKey = 'cross-Token'
 
 export function getToken () {
   return Cookies.get(TokenKey)

+ 16 - 0
src/utils/validate.js

@@ -70,6 +70,22 @@ export function vaildTeachingUrl() {
   return returnUrl
 }
 
+// 教务地址
+export function validOaUrl() {
+  let url = window.location.href
+  let returnUrl = ''
+  if (/online/.test(url)) { //线上
+    returnUrl = 'https://oaonline.dayaedu.com'
+  } else if (/dev/.test(url)) { // dev 环境
+    returnUrl = 'http://oadev.dayaedu.com'
+  } else if (/test/.test(url)) { // dev 环境
+    returnUrl = 'http://oatest.dayaedu.com'
+  } else { // 默认dev环境
+    returnUrl = 'http://oadev.dayaedu.com'
+  }
+  return returnUrl
+}
+
 
 export function nextMonthLastDay(year, month) { //日期显示为次月最后一天
   // var time = date ? new Date(date) : new Date();