From 0f6153ab337c4ecca5579a79b03f3ba5f831e0c4 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期日, 18 九月 2022 02:03:48 +0800
Subject: [PATCH] 2022-09-18

---
 src/tabviews/zshare/actionList/exceloutbutton/index.jsx   |   17 +++++
 src/menu/components/chart/antv-bar/chartcompile/index.jsx |   37 +++++++++--
 src/utils/utils-datamanage.js                             |   10 +++
 src/api/index.js                                          |   57 +++++++++++++++---
 src/tabviews/zshare/actionList/normalbutton/index.jsx     |    5 +
 src/tabviews/zshare/actionList/excelInbutton/index.jsx    |    4 +
 src/tabviews/zshare/actionList/printbutton/index.jsx      |    5 +
 7 files changed, 115 insertions(+), 20 deletions(-)

diff --git a/src/api/index.js b/src/api/index.js
index f4b19fa..02782e6 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -227,17 +227,25 @@
 
     param.appkey = window.GLOB.appkey || ''
 
+    let url = '/webapi/dologon/s_visitor_login'
+    if (window.GLOB.mainSystemApi) {
+      param.rduri = window.GLOB.mainSystemApi.replace(/\/webapi(.*)/, '/webapi/dologon/s_visitor_login')
+    }
+
     if (binding_type === 'mk') {
       param.binding_type = 'mk'
       param.thd_party_member_id = memberid
       param.thd_party_openid = openid
       param.thd_party_appid = appid
       param.id = scanId
-    }
+    } else if (binding_type === 'login_check') { // appid 姝ゆ椂涓虹洰鏍�
+      param.v_type = 'login_check'
+      param.LoginUID = sessionStorage.getItem('LoginUID') || ''
+      url = appid.replace(/\/webapi(.*)/, '/webapi/dologon/s_visitor_login')
 
-    let url = '/webapi/dologon/s_visitor_login'
-    if (window.GLOB.mainSystemApi) {
-      param.rduri = window.GLOB.mainSystemApi.replace(/\/webapi(.*)/, '/webapi/dologon/s_visitor_login')
+      if (!param.rduri) {
+        param.rduri = window.GLOB.baseurl + 'webapi/dologon/s_visitor_login'
+      }
     }
 
     return axios({
@@ -775,7 +783,8 @@
     param.LoginUID = param.LoginUID || sessionStorage.getItem('LoginUID') || ''
     param.appkey = window.GLOB.appkey || ''
 
-    let url = '/webapi/dostars'
+    let login = false
+    let rduri = null
 
     if (param.rduri && /\s|\n/.test(param.rduri)) {
       param.rduri = param.rduri.replace(/\s|\n/g, '')
@@ -784,18 +793,44 @@
       }
     }
 
-    if (param.rduri && !window.GLOB.transfer && /\/dostars/.test(param.rduri) && param.func !== 'webapi_ChangeUser') { // 鍒囨崲鐢ㄦ埛闇�瑕侀�氳繃鏈湴
+    if (param.$login && !window.GLOB.transfer) {
+      login = true
+      rduri = param.rduri || ''
+    }
+    delete param.$login
+
+    let url = '/webapi/dostars'
+
+    if (param.rduri && !window.GLOB.transfer && /\/dostars/.test(param.rduri) && param.func !== 'webapi_ChangeUser') {
       url = param.rduri
       delete param.rduri
     }
 
     param = this.encryptParam(param)
 
-    return axios({
-      url: `${url}${param.func ? '/' + param.func : ''}`,
-      method: 'post',
-      data: param
-    })
+    if (login) {
+      return new Promise((resolve, reject) => {
+        this.getTouristMsg('login_check', rduri).then(res => {
+          if (res.status) {
+            axios({
+              url: `${url}${param.func ? '/' + param.func : ''}`,
+              method: 'post',
+              data: param
+            }).then(result => {
+              resolve(result)
+            })
+          } else {
+            resolve(res)
+          }
+        })
+      })
+    } else {
+      return axios({
+        url: `${url}${param.func ? '/' + param.func : ''}`,
+        method: 'post',
+        data: param
+      })
+    }
   }
 
   /**
diff --git a/src/menu/components/chart/antv-bar/chartcompile/index.jsx b/src/menu/components/chart/antv-bar/chartcompile/index.jsx
index b49ad23..70b73e8 100644
--- a/src/menu/components/chart/antv-bar/chartcompile/index.jsx
+++ b/src/menu/components/chart/antv-bar/chartcompile/index.jsx
@@ -262,20 +262,41 @@
       }
     })
 
-    if (config.plot.correction) {
-      delete config.plot.correction // 鏁版嵁淇锛堝凡寮冪敤锛�
-      config.plot.barSize = 35
+    let plot = fromJS(config.plot).toJS()
+
+    if (plot.correction) {
+      delete plot.correction // 鏁版嵁淇锛堝凡寮冪敤锛�
+      plot.barSize = 35
+    }
+
+    if (plot.datatype !== 'statistics') {
+      if (plot.colors) {
+        plot.colors = plot.colors.map(item => {
+          if (fieldName[item.type]) {
+            item.label = fieldName[item.type]
+          }
+          return item
+        })
+      }
+      if (plot.customs) {
+        plot.customs = plot.customs.map(item => {
+          if (fieldName[item.type]) {
+            item.name = fieldName[item.type]
+          }
+          return item
+        })
+      }
     }
 
     this.setState({
       visible: true,
       view: 'normal',
-      ramp: config.plot.ramp || 'false',
-      datatype: config.plot.datatype || 'query',
+      ramp: plot.ramp || 'false',
+      datatype: plot.datatype || 'query',
       fieldName: fieldName,
-      plot: fromJS(config.plot).toJS(),
-      baseFormlist: getBaseForm(config.plot, config.columns),
-      formlist: getOptionForm(config.plot, config.columns)
+      plot: plot,
+      baseFormlist: getBaseForm(plot, config.columns),
+      formlist: getOptionForm(plot, config.columns)
     })
   }
 
diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx
index 01747a5..0388670 100644
--- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx
@@ -430,6 +430,10 @@
             } else {
               param.rduri = btn.interface
             }
+            let host = window.GLOB.baseurl.replace(/http(s):\/\//, '')
+            if (param.rduri.indexOf(host) === -1 && /\/dostars/.test(param.rduri)) {
+              param.$login = true
+            }
           }
         }
 
diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
index ed16f15..a64d39f 100644
--- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
@@ -260,6 +260,10 @@
             } else {
               param.rduri = btn.interface
             }
+            let host = window.GLOB.baseurl.replace(/http(s):\/\//, '')
+            if (param.rduri.indexOf(host) === -1 && /\/dostars/.test(param.rduri)) {
+              param.$login = true
+            }
           }
         }
   
@@ -307,6 +311,10 @@
                   res.rduri = btn.proInterface
                 } else {
                   res.rduri = btn.interface
+                }
+                let host = window.GLOB.baseurl.replace(/http(s):\/\//, '')
+                if (res.rduri.indexOf(host) === -1 && /\/dostars/.test(res.rduri)) {
+                  res.$login = true
                 }
               }
             }
@@ -378,6 +386,10 @@
               res.rduri = btn.proInterface
             } else {
               res.rduri = btn.interface
+            }
+            let host = window.GLOB.baseurl.replace(/http(s):\/\//, '')
+            if (res.rduri.indexOf(host) === -1 && /\/dostars/.test(res.rduri)) {
+              res.$login = true
             }
           }
         }
@@ -453,6 +465,11 @@
           } else {
             param.rduri = btn.interface
           }
+
+          let host = window.GLOB.baseurl.replace(/http(s):\/\//, '')
+          if (param.rduri.indexOf(host) === -1 && /\/dostars/.test(param.rduri)) {
+            param.$login = true
+          }
         }
       }
       
diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx
index af088f7..73750e3 100644
--- a/src/tabviews/zshare/actionList/normalbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -1629,6 +1629,11 @@
         } else {
           result.rduri = btn.interface
         }
+
+        let host = window.GLOB.baseurl.replace(/http(s):\/\//, '')
+        if (result.rduri.indexOf(host) === -1 && /\/dostars/.test(result.rduri)) {
+          result.$login = true
+        }
       }
     }
 
diff --git a/src/tabviews/zshare/actionList/printbutton/index.jsx b/src/tabviews/zshare/actionList/printbutton/index.jsx
index ba05bff..776ede5 100644
--- a/src/tabviews/zshare/actionList/printbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/printbutton/index.jsx
@@ -844,6 +844,11 @@
           } else {
             res.rduri = btn.interface
           }
+
+          let host = window.GLOB.baseurl.replace(/http(s):\/\//, '')
+          if (res.rduri.indexOf(host) === -1 && /\/dostars/.test(res.rduri)) {
+            res.$login = true
+          }
         }
       }
 
diff --git a/src/utils/utils-datamanage.js b/src/utils/utils-datamanage.js
index b707582..1c66177 100644
--- a/src/utils/utils-datamanage.js
+++ b/src/utils/utils-datamanage.js
@@ -67,7 +67,15 @@
         if (setting.sysInterface === 'true' && window.GLOB.mainSystemApi) {
           param.rduri = window.GLOB.mainSystemApi
         } else if (setting.sysInterface !== 'true') {
-          param.rduri = window.GLOB.systemType === 'production' ? (setting.proInterface || setting.interface) : setting.interface
+          if (window.GLOB.systemType === 'production' && setting.proInterface) {
+            param.rduri = setting.proInterface
+          } else {
+            param.rduri = setting.interface
+          }
+          let host = window.GLOB.baseurl.replace(/http(s):\/\//, '')
+          if (param.rduri.indexOf(host) === -1 && /\/dostars/.test(param.rduri)) {
+            param.$login = true
+          }
         }
       }
 

--
Gitblit v1.8.0