From 530e033f9fdba1dfd02848d5839fd348ca6eeed1 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 16 九月 2022 00:09:45 +0800
Subject: [PATCH] 2022-09-16

---
 src/components/tabview/index.jsx              |   10 ----
 src/index.js                                  |    2 +
 src/components/breadview/index.jsx            |   10 ----
 src/api/index.js                              |   10 +---
 src/tabviews/custom/index.jsx                 |    6 ++
 src/views/appcheck/index.jsx                  |    9 ----
 src/views/appmanage/index.jsx                 |    9 ----
 src/tabviews/zshare/fileupload/index.jsx      |   11 +----
 src/components/editor/index.jsx               |    9 ----
 src/tabviews/zshare/fileupload-pice/index.jsx |   11 +----
 src/views/interface/history/index.jsx         |   16 +-------
 src/utils/utils.js                            |   11 +----
 12 files changed, 23 insertions(+), 91 deletions(-)

diff --git a/src/api/index.js b/src/api/index.js
index 1311362..2f890ec 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -81,11 +81,7 @@
 
 class Api {
   constructor() {
-    if (process.env.NODE_ENV === 'production') {
-      axios.defaults.baseURL = document.location.origin + '/' + window.GLOB.service
-    } else {
-      axios.defaults.baseURL = window.GLOB.location + '/' + window.GLOB.service
-    }
+    axios.defaults.baseURL = window.GLOB.baseurl
   }
   
   /**
@@ -106,7 +102,7 @@
    * @description 寰俊涓氬姟璇锋眰
    */
   wxAccessToken () {
-    let _url = document.location.origin + '/' + window.GLOB.service + 'wxpay/getaccesstoken'
+    let _url = window.GLOB.baseurl + 'wxpay/getaccesstoken'
     if (process.env.NODE_ENV !== 'production') {
       _url = document.location.origin + '/wxpay/getaccesstoken'
     }
@@ -922,7 +918,7 @@
    * @description 鑾峰彇寰俊鏀粯浜岀淮鐮�
    */
   getWxNativePay (param) {
-    let _url = document.location.origin + '/' + window.GLOB.service + 'wxpay/wxNativePay'
+    let _url = window.GLOB.baseurl + 'wxpay/wxNativePay'
     if (process.env.NODE_ENV !== 'production') {
       _url = document.location.origin + '/wxpay/wxNativePay'
     }
diff --git a/src/components/breadview/index.jsx b/src/components/breadview/index.jsx
index bd3d3cd..4e4e3e6 100644
--- a/src/components/breadview/index.jsx
+++ b/src/components/breadview/index.jsx
@@ -23,14 +23,6 @@
 const RoleManage = asyncComponent(() => import('@/tabviews/rolemanage'))
 const FormTab = asyncComponent(() => import('@/tabviews/formtab'))
 
-let service = ''
-
-if (process.env.NODE_ENV === 'production') {
-  service = document.location.origin + '/' + window.GLOB.service + 'zh-CN/'
-} else {
-  service = window.GLOB.location + '/' + window.GLOB.service + 'zh-CN/'
-}
-
 class BreadView extends Component {
   state = {
     tabview: null, // 鏍囩
@@ -108,7 +100,7 @@
     } else if (view.type === 'FormTab') {
       return (<FormTab MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>)
     } else if (view.type === 'iframe') {
-      return (<Iframe key={view.MenuID} MenuID={view.MenuID} MenuNo={view.MenuNo} title={view.MenuName} MenuName={view.MenuName} url={service + view.LinkUrl}/>)
+      return (<Iframe key={view.MenuID} MenuID={view.MenuID} MenuNo={view.MenuNo} title={view.MenuName} MenuName={view.MenuName} url={window.GLOB.baseurl + 'zh-CN/' + view.LinkUrl}/>)
     } else {
       return (<NotFount key={view.MenuID} />)
     }
diff --git a/src/components/editor/index.jsx b/src/components/editor/index.jsx
index dae66f6..fb02a69 100644
--- a/src/components/editor/index.jsx
+++ b/src/components/editor/index.jsx
@@ -14,13 +14,6 @@
 
 BraftEditor.use(Table())
 
-let service = ''
-if (process.env.NODE_ENV === 'production') {
-  service = document.location.origin + '/' + window.GLOB.service
-} else {
-  service = window.GLOB.location + '/' + window.GLOB.service
-}
-
 class NormalEditor extends Component {
   static propTpyes = {
     config: PropTypes.object,
@@ -87,7 +80,7 @@
     form.append('file', _param.binary)
     form.append('fileMd5', params.file.fileMd5)
     form.append('shardingMd5', _param.chunkMd5)
-    form.append('baseDomain', service)
+    form.append('baseDomain', window.GLOB.baseurl)
     form.append('rootPath', 'Content/images/upload/')
     form.append('fileName', params.file.fileName)
     form.append('fileExt', params.file.fileType)
diff --git a/src/components/tabview/index.jsx b/src/components/tabview/index.jsx
index ad4fec5..82043c0 100644
--- a/src/components/tabview/index.jsx
+++ b/src/components/tabview/index.jsx
@@ -26,14 +26,6 @@
 const RoleManage = asyncComponent(() => import('@/tabviews/rolemanage'))
 const FormTab = asyncComponent(() => import('@/tabviews/formtab'))
 
-let service = ''
-
-if (process.env.NODE_ENV === 'production') {
-  service = document.location.origin + '/' + window.GLOB.service + 'zh-CN/'
-} else {
-  service = window.GLOB.location + '/' + window.GLOB.service + 'zh-CN/'
-}
-
 class TabViews extends Component {
   static propTpyes = {
     collapse: PropTypes.bool
@@ -215,7 +207,7 @@
     } else if (view.type === 'FormTab') {
       return (<FormTab MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>)
     } else if (view.type === 'iframe') {
-      return (<Iframe key={view.MenuID} MenuID={view.MenuID} MenuNo={view.MenuNo} title={view.MenuName} MenuName={view.MenuName} url={service + view.LinkUrl}/>)
+      return (<Iframe key={view.MenuID} MenuID={view.MenuID} MenuNo={view.MenuNo} title={view.MenuName} MenuName={view.MenuName} url={window.GLOB.baseurl + 'zh-CN/' + view.LinkUrl}/>)
     } else {
       return (<NotFount key={view.MenuID} />)
     }
diff --git a/src/index.js b/src/index.js
index 34031a7..c094113 100644
--- a/src/index.js
+++ b/src/index.js
@@ -210,11 +210,13 @@
       }
       GLOB.service = _service ? _service + '/' : ''
       GLOB.host = window.location.host + (_service ? '_' + _service : '')
+      GLOB.baseurl = document.location.origin + '/' + GLOB.service
     } else {
       GLOB.linkurl = ''
       GLOB.location = config.host
       GLOB.service = config.service
       GLOB.host = config.host.replace(/http(s)?:\/\//ig, '') + (config.service ? '_' + config.service.replace(/\//ig, '') : '')
+      GLOB.baseurl = GLOB.location + '/' + GLOB.service
     }
 
     let mark = sessionStorage.getItem('system_mark')
diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx
index e9a7411..4540b99 100644
--- a/src/tabviews/custom/index.jsx
+++ b/src/tabviews/custom/index.jsx
@@ -86,7 +86,11 @@
       let shortcuts = []
 
       try { // 閰嶇疆淇℃伅瑙f瀽
-        config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam)))
+        config = window.decodeURIComponent(window.atob(result.LongParam))
+
+        config = config.replace(/@mywebsite@\//ig, window.GLOB.baseurl)
+
+        config = JSON.parse(config)
       } catch (e) {
         console.warn('Parse Failure')
         config = ''
diff --git a/src/tabviews/zshare/fileupload-pice/index.jsx b/src/tabviews/zshare/fileupload-pice/index.jsx
index 5148154..fc6b969 100644
--- a/src/tabviews/zshare/fileupload-pice/index.jsx
+++ b/src/tabviews/zshare/fileupload-pice/index.jsx
@@ -8,13 +8,6 @@
 import Api from '@/api'
 import './index.scss'
 
-let service = ''
-if (process.env.NODE_ENV === 'production') {
-  service = document.location.origin + '/' + window.GLOB.service
-} else {
-  service = window.GLOB.location + '/' + window.GLOB.service
-}
-
 class FileUpload extends Component {
   static propTpyes = {
     config: PropTypes.object,  // 琛ㄥ崟淇℃伅
@@ -184,7 +177,7 @@
     form.append('file', param.binary)
     form.append('fileMd5', params.file.fileMd5)
     form.append('shardingMd5', param.chunkMd5)
-    form.append('baseDomain', service)
+    form.append('baseDomain', window.GLOB.baseurl)
     form.append('rootPath', 'Content/images/upload/')
     form.append('fileName', params.file.fileName)
     form.append('fileExt', params.file.fileType)
@@ -315,7 +308,7 @@
   
             Api.fileuploadbase64(param).then(result => {
               if (result.status && result.Images) {
-                let url = service + result.Images
+                let url = window.GLOB.baseurl + result.Images
   
                 if (rduri) {
                   url = rduri.replace(/webapi(.*)$/, '') + result.Images
diff --git a/src/tabviews/zshare/fileupload/index.jsx b/src/tabviews/zshare/fileupload/index.jsx
index 20d0e56..54d9727 100644
--- a/src/tabviews/zshare/fileupload/index.jsx
+++ b/src/tabviews/zshare/fileupload/index.jsx
@@ -8,13 +8,6 @@
 import Api from '@/api'
 import './index.scss'
 
-let service = ''
-if (process.env.NODE_ENV === 'production') {
-  service = document.location.origin + '/' + window.GLOB.service
-} else {
-  service = window.GLOB.location + '/' + window.GLOB.service
-}
-
 class FileUpload extends Component {
   static propTpyes = {
     config: PropTypes.object,  // 琛ㄥ崟淇℃伅
@@ -182,7 +175,7 @@
     form.append('file', param.binary)
     form.append('fileMd5', param.fileMd5)
     form.append('shardingMd5', param.fileMd5)
-    form.append('baseDomain', service)
+    form.append('baseDomain', window.GLOB.baseurl)
     form.append('rootPath', 'Content/images/upload/')
     form.append('fileName', param.fileName)
     form.append('fileExt', param.fileType)
@@ -306,7 +299,7 @@
   
             Api.fileuploadbase64(param).then(result => {
               if (result.status && result.Images) {
-                let url = service + result.Images
+                let url = window.GLOB.baseurl + result.Images
   
                 if (rduri) {
                   url = rduri.replace(/webapi(.*)$/, '') + result.Images
diff --git a/src/utils/utils.js b/src/utils/utils.js
index b97fbde..82fedc6 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -730,14 +730,7 @@
   static getrealurl (url) {
     if (!url) return ''
 
-    let baseurl = ''
-    if (process.env.NODE_ENV === 'production') {
-      baseurl = document.location.origin + '/' + window.GLOB.service
-    } else {
-      baseurl = window.GLOB.location + '/' + window.GLOB.service
-    }
-
-    let realurl = url.match(/^http/) || url.match(/^\/\//) ? url : baseurl + url
+    let realurl = url.match(/^http/) || url.match(/^\/\//) ? url : window.GLOB.baseurl + url
     return realurl
   }
 
@@ -753,7 +746,7 @@
     if (options.cloudServiceApi) {
       baseurl = options.cloudServiceApi.replace(/webapi(.*)$/, '')
     } else {
-      baseurl = document.location.origin + '/' + window.GLOB.service
+      baseurl = window.GLOB.baseurl
     }
 
     return url.match(/^http/) || url.match(/^\/\//) ? url : baseurl + url
diff --git a/src/views/appcheck/index.jsx b/src/views/appcheck/index.jsx
index 1023652..8736e78 100644
--- a/src/views/appcheck/index.jsx
+++ b/src/views/appcheck/index.jsx
@@ -13,13 +13,6 @@
 const _locale = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS
 const Header = asyncComponent(() => import('./header'))
 
-let base_url = ''
-if (process.env.NODE_ENV === 'production') {
-  base_url = document.location.origin + '/' + window.GLOB.service
-} else {
-  base_url = window.GLOB.location + '/' + window.GLOB.service
-}
-
 const skinStyle = {
   bg_black_style_blue: {name: '钃濊壊', color: '#1890ff'},
   bg_black_style_red: {name: '绾㈣壊', color: '#f5222d'},
@@ -247,7 +240,7 @@
                       </Col>
                     </Row>
                     <div className="action">
-                      <Paragraph style={{display: 'inline-block', margin: 0}} copyable={{ text: `${base_url}${item.typename === 'pad' ? 'mob' : item.typename}/index.html#/index/${this.state.selectApp.kei_no}/${item.typename !== 'pc' ? item.typename + '/' : ''}${item.lang}` }}></Paragraph>
+                      <Paragraph style={{display: 'inline-block', margin: 0}} copyable={{ text: `${window.GLOB.baseurl}${item.typename === 'pad' ? 'mob' : item.typename}/index.html#/index/${this.state.selectApp.kei_no}/${item.typename !== 'pc' ? item.typename + '/' : ''}${item.lang}` }}></Paragraph>
                     </div>
                   </div>
                 )
diff --git a/src/views/appmanage/index.jsx b/src/views/appmanage/index.jsx
index a39380c..e66512e 100644
--- a/src/views/appmanage/index.jsx
+++ b/src/views/appmanage/index.jsx
@@ -23,13 +23,6 @@
 const ScriptForm = asyncComponent(() => import('./scriptform'))
 const SubMutilForm = asyncComponent(() => import('./submutilform'))
 
-let base_url = ''
-if (process.env.NODE_ENV === 'production') {
-  base_url = document.location.origin + '/' + window.GLOB.service
-} else {
-  base_url = window.GLOB.location + '/' + window.GLOB.service
-}
-
 sessionStorage.setItem('isEditState', 'true')
 
 const skinStyle = {
@@ -1188,7 +1181,7 @@
                       <Button type="link" onClick={() => this.setState({ selectSubApp: item, subVisible: 'edit' })} style={{color: '#8E44AD'}}>淇敼</Button>
                       <Button type="link" onClick={() => this.deleteSubApp(item)} style={{color: '#ff4d4f'}}>鍒犻櫎</Button>
                       <Button type="link" onClick={() => this.jumpApp(item)}>缂栬緫搴旂敤</Button>
-                      <Paragraph style={{display: 'inline-block', margin: 0}} copyable={{ text: `${base_url}${item.typename === 'pad' ? 'mob' : item.typename}/index.html#/index/${this.state.selectApp.kei_no}/${item.typename !== 'pc' ? item.typename + '/' : ''}${item.lang}` }}></Paragraph>
+                      <Paragraph style={{display: 'inline-block', margin: 0}} copyable={{ text: `${window.GLOB.baseurl}${item.typename === 'pad' ? 'mob' : item.typename}/index.html#/index/${this.state.selectApp.kei_no}/${item.typename !== 'pc' ? item.typename + '/' : ''}${item.lang}` }}></Paragraph>
                     </div>
                   </div>
                 )
diff --git a/src/views/interface/history/index.jsx b/src/views/interface/history/index.jsx
index a8d4321..5e882c2 100644
--- a/src/views/interface/history/index.jsx
+++ b/src/views/interface/history/index.jsx
@@ -195,18 +195,12 @@
   }
 
   uselogon = () => {
-    let baseurl = ''
-    if (process.env.NODE_ENV === 'production') {
-      baseurl = document.location.origin + '/' + window.GLOB.service
-    } else {
-      baseurl = window.GLOB.location + '/' + window.GLOB.service
-    }
     let m = {
       active: 'raw',
       createDate: '',
       formData: [],
       headers: [],
-      interface: baseurl + 'webapi/logon',
+      interface: window.GLOB.baseurl + 'webapi/logon',
       method: 'POST',
       params: [],
       raw: "{\n \"UserName\":\"******\",\n \"Password\":\"******\",\n \"systemType\":\"local\",\n \"Type\":\"鍏挜\",\n \"privatekey\":\"绉侀挜\",\n \"timestamp\":\"" + moment().format('YYYY-MM-DD HH:mm:ss') + "\",\n \"appkey\":\"" + window.GLOB.appkey + "\"\n}",
@@ -216,18 +210,12 @@
   }
 
   usedostars = () => {
-    let baseurl = ''
-    if (process.env.NODE_ENV === 'production') {
-      baseurl = document.location.origin + '/' + window.GLOB.service
-    } else {
-      baseurl = window.GLOB.location + '/' + window.GLOB.service
-    }
     let m = {
       active: 'raw',
       createDate: '',
       formData: [],
       headers: [],
-      interface: baseurl + 'webapi/dostars',
+      interface: window.GLOB.baseurl + 'webapi/dostars',
       method: 'POST',
       params: [],
       raw: "{\n \"func\":\"******\",\n \"LoginUID\":\"******\",\n \"UserID\":\"******\",\n \"nonc\":\"" + Utils.getguid() + "\",\n \"t\":" + parseInt(new Date().getTime() / 1000) + "\n}",

--
Gitblit v1.8.0