From 89ee68c59cdcaa4b7fa0178be42d58bec651ee73 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 09 七月 2020 12:15:03 +0800 Subject: [PATCH] 2020-07-09 --- src/api/index.js | 56 ++++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 44 insertions(+), 12 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 956b4f9..d2082ee 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -13,7 +13,7 @@ config.method = 'post' if (config.url.includes('LoginAndRedirect') || config.url.includes('getjsonresult')) { config.data = qs.stringify(config.data) - } else if (config.url.includes('Upload')) { + } else if (config.url.includes('Upload') || config.url.includes('doupload') || config.url.includes('dopreload')) { config.headers = { 'Content-Type': 'multipart/form-data' } } else { // config.headers.token = sessionStorage.getItem('TOKEN') || '' @@ -54,9 +54,8 @@ class Api { constructor() { - let service = window.GLOB.service ? (/\/$/.test(window.GLOB.service) ? window.GLOB.service : window.GLOB.service + '/') : '' if (process.env.NODE_ENV === 'production') { - axios.defaults.baseURL = document.location.origin + '/' + service + axios.defaults.baseURL = document.location.origin + '/' + window.GLOB.service } else { // axios.defaults.baseURL = 'http://127.0.0.1:8888' } @@ -83,15 +82,18 @@ // func: 'webapi_login', UserName: username, Password: password, - systemType: options.systemType, + systemType: options.sysType, Type: 'X' } param.Password = Utils.formatOptions(param.Password) param.appkey = window.GLOB.appkey || '' - if (isCloud && options.cloudLoginApi) { - param.rduri = options.cloudLoginApi + if (isCloud) { + param.debug = 'Y' + if (options.cloudServiceApi) { + param.rduri = options.cloudServiceApi.replace(/\/webapi(.*)/, '/webapi/dologon') + } } else if (!isCloud && window.GLOB.mainSystemApi) { param.rduri = window.GLOB.mainSystemApi.replace(/\/webapi(.*)/, '/webapi/dologon') } @@ -141,7 +143,7 @@ param.t = new Date().getTime() return axios({ - url: '/webapi/dostars', + url: `/webapi/dostars${param.func ? '/' + param.func : ''}`, data: param }) } @@ -181,7 +183,7 @@ param.t = new Date().getTime() return axios({ - url: '/webapi/dostars', + url: `/webapi/dostars${param.func ? '/' + param.func : ''}`, data: param }) } @@ -212,7 +214,7 @@ param.t = new Date().getTime() return axios({ - url: '/webapi/dostars', + url: `/webapi/dostars${param.func ? '/' + param.func : ''}`, data: param }) } @@ -266,7 +268,7 @@ return new Promise(resolve => { axios({ - url: '/webapi/dostars', + url: `/webapi/dostars${param.func ? '/' + param.func : ''}`, data: param }).then(res => { if (res.status) { @@ -288,7 +290,7 @@ param.LoginUID = sessionStorage.getItem('LoginUID') || '' param.appkey = window.GLOB.appkey || '' - if (sessionStorage.getItem('isEditState') === 'true' && param.rduri === options.cloudServiceApi) { // HS涓嬭彍鍗� + if (sessionStorage.getItem('isEditState') === 'true') { // HS涓嬭彍鍗� param.userid = sessionStorage.getItem('CloudUserID') param.SessionUid = sessionStorage.getItem('CloudSessionUid') || '' param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' @@ -310,7 +312,7 @@ param.t = new Date().getTime() return axios({ - url: '/webapi/dostars', + url: `/webapi/dostars${param.func ? '/' + param.func : ''}`, data: param }) } @@ -426,6 +428,36 @@ } /** + * @description 澶ф枃浠朵笂浼� + */ + getLargeFileUpload (param) { + return axios({ + url: '/webapi/doupload', + data: param + }) + } + + /** + * @description 鏌ヨ鏂囦欢鏄惁宸蹭笂浼� + */ + getFilePreUpload (param) { + return axios({ + url: '/webapi/dopreload', + data: param + }) + } + + /** + * @description 鑾峰彇寰俊鏀粯浜岀淮鐮� + */ + getWxNativePay (param) { + return axios({ + url: '/wxpay/wxNativePay', + data: param + }) + } + + /** * @description 鏂囦欢涓婁紶 */ getFileUpload (param) { -- Gitblit v1.8.0