wenbobowen 4 years ago
parent
commit
982d372a26
2 changed files with 21 additions and 3 deletions
  1. 16 0
      src/apiConfig/requestIP.js
  2. 5 3
      src/views/useCase/components/requirementCase.vue

+ 16 - 0
src/apiConfig/requestIP.js

@@ -16,6 +16,22 @@ if (location.host.indexOf('localhost') < 0) {
   }
 }
 
+export function getEnv() {
+  let env = 'test'
+  if (location.host.indexOf('localhost') < 0) {
+    host = 'http://' + location.host
+    requestIp = host + '/zuul'
+    loginUrl = host + '/sso/login?jumpto=' + location.href
+    logoutUrl = host + '/sso/logout?jumpto=' + location.href
+    if (host.indexOf('zhihui-pre.intra.xiaojukeji.com') >= 0) {
+      env = 'pre'
+    } else if (host.indexOf('zhihui.xiaojukeji.com') >= 0) {
+      env = 'online'
+    }
+  }
+  return env
+}
+
 export let ws = '10.78.128.20:10234'
 if (location.host.match(/localhost/) || location.host.match(/zhihui-test/)) {
   ws = '10.78.128.20:10232'

+ 5 - 3
src/views/useCase/components/requirementCase.vue

@@ -11,18 +11,21 @@
 <script>
 import { mapGetters } from 'vuex'
 import { EncryptId } from '@/utils/crypto-js.js'
+import { getEnv } from '@/apiConfig/requestIP.js'
+
 export default {
   data() {
     return {
       ifr: null,
-      srcHost: 'http://10.96.83.94:9000/index.html#/case/caseList/zhihui/'
+      srcHost: '/case/caseList/zhihui/'
     }
   },
   computed: {
     ...mapGetters(['bizId']),
     src() {
       const bizId = EncryptId(`${this.bizId}`)
-      const src = `${this.srcHost}${bizId}`
+      const host = getEnv() === 'test' ? 'http://10.96.83.94:9000/index.html#' : 'http://agiletc.intra.xiaojukeji.com/#'
+      const src = `${host}${this.srcHost}${bizId}`
       return src
     }
   },
@@ -37,7 +40,6 @@ export default {
   },
   mounted() {
     window.addEventListener('message', (e) => {
-      console.log(11111, e)
       if (e.data === 'useCaseDone') {
         this.loaded()
       }