From 627c3e0a6920131d75eafa4646db373ccc936546 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期四, 26 十月 2023 13:52:07 +0800
Subject: [PATCH] 小程序diamante
---
minipro_standard/uni_modules/uview-ui/libs/luch-request/core/mergeConfig.js | 206 +++++++++++++++++++++++++-------------------------
1 files changed, 103 insertions(+), 103 deletions(-)
diff --git a/minipro_standard/uni_modules/uview-ui/libs/luch-request/core/mergeConfig.js b/minipro_standard/uni_modules/uview-ui/libs/luch-request/core/mergeConfig.js
index 896a9dc..08f8b9b 100644
--- a/minipro_standard/uni_modules/uview-ui/libs/luch-request/core/mergeConfig.js
+++ b/minipro_standard/uni_modules/uview-ui/libs/luch-request/core/mergeConfig.js
@@ -1,103 +1,103 @@
-import { deepMerge, isUndefined } from '../utils'
-
-/**
- * 鍚堝苟灞�閮ㄩ厤缃紭鍏堢殑閰嶇疆锛屽鏋滃眬閮ㄦ湁璇ラ厤缃」鍒欑敤灞�閮紝濡傛灉鍏ㄥ眬鏈夎閰嶇疆椤瑰垯鐢ㄥ叏灞�
- * @param {Array} keys - 閰嶇疆椤�
- * @param {Object} globalsConfig - 褰撳墠鐨勫叏灞�閰嶇疆
- * @param {Object} config2 - 灞�閮ㄩ厤缃�
- * @return {{}}
- */
-const mergeKeys = (keys, globalsConfig, config2) => {
- const config = {}
- keys.forEach((prop) => {
- if (!isUndefined(config2[prop])) {
- config[prop] = config2[prop]
- } else if (!isUndefined(globalsConfig[prop])) {
- config[prop] = globalsConfig[prop]
- }
- })
- return config
-}
-/**
- *
- * @param globalsConfig - 褰撳墠瀹炰緥鐨勫叏灞�閰嶇疆
- * @param config2 - 褰撳墠鐨勫眬閮ㄩ厤缃�
- * @return - 鍚堝苟鍚庣殑閰嶇疆
- */
-export default (globalsConfig, config2 = {}) => {
- const method = config2.method || globalsConfig.method || 'GET'
- let config = {
- baseURL: globalsConfig.baseURL || '',
- method,
- url: config2.url || '',
- params: config2.params || {},
- custom: { ...(globalsConfig.custom || {}), ...(config2.custom || {}) },
- header: deepMerge(globalsConfig.header || {}, config2.header || {})
- }
- const defaultToConfig2Keys = ['getTask', 'validateStatus']
- config = { ...config, ...mergeKeys(defaultToConfig2Keys, globalsConfig, config2) }
-
- // eslint-disable-next-line no-empty
- if (method === 'DOWNLOAD') {
- // #ifdef H5 || APP-PLUS
- if (!isUndefined(config2.timeout)) {
- config.timeout = config2.timeout
- } else if (!isUndefined(globalsConfig.timeout)) {
- config.timeout = globalsConfig.timeout
- }
- // #endif
- } else if (method === 'UPLOAD') {
- delete config.header['content-type']
- delete config.header['Content-Type']
- const uploadKeys = [
- // #ifdef APP-PLUS || H5
- 'files',
- // #endif
- // #ifdef MP-ALIPAY
- 'fileType',
- // #endif
- // #ifdef H5
- 'file',
- // #endif
- 'filePath',
- 'name',
- // #ifdef H5 || APP-PLUS
- 'timeout',
- // #endif
- 'formData'
- ]
- uploadKeys.forEach((prop) => {
- if (!isUndefined(config2[prop])) {
- config[prop] = config2[prop]
- }
- })
- // #ifdef H5 || APP-PLUS
- if (isUndefined(config.timeout) && !isUndefined(globalsConfig.timeout)) {
- config.timeout = globalsConfig.timeout
- }
- // #endif
- } else {
- const defaultsKeys = [
- 'data',
- // #ifdef H5 || APP-PLUS || MP-ALIPAY || MP-WEIXIN
- 'timeout',
- // #endif
- 'dataType',
- // #ifndef MP-ALIPAY
- 'responseType',
- // #endif
- // #ifdef APP-PLUS
- 'sslVerify',
- // #endif
- // #ifdef H5
- 'withCredentials',
- // #endif
- // #ifdef APP-PLUS
- 'firstIpv4'
- // #endif
- ]
- config = { ...config, ...mergeKeys(defaultsKeys, globalsConfig, config2) }
- }
-
- return config
-}
+import { deepMerge, isUndefined } from '../utils'
+
+/**
+ * 鍚堝苟灞�閮ㄩ厤缃紭鍏堢殑閰嶇疆锛屽鏋滃眬閮ㄦ湁璇ラ厤缃」鍒欑敤灞�閮紝濡傛灉鍏ㄥ眬鏈夎閰嶇疆椤瑰垯鐢ㄥ叏灞�
+ * @param {Array} keys - 閰嶇疆椤�
+ * @param {Object} globalsConfig - 褰撳墠鐨勫叏灞�閰嶇疆
+ * @param {Object} config2 - 灞�閮ㄩ厤缃�
+ * @return {{}}
+ */
+const mergeKeys = (keys, globalsConfig, config2) => {
+ const config = {}
+ keys.forEach((prop) => {
+ if (!isUndefined(config2[prop])) {
+ config[prop] = config2[prop]
+ } else if (!isUndefined(globalsConfig[prop])) {
+ config[prop] = globalsConfig[prop]
+ }
+ })
+ return config
+}
+/**
+ *
+ * @param globalsConfig - 褰撳墠瀹炰緥鐨勫叏灞�閰嶇疆
+ * @param config2 - 褰撳墠鐨勫眬閮ㄩ厤缃�
+ * @return - 鍚堝苟鍚庣殑閰嶇疆
+ */
+export default (globalsConfig, config2 = {}) => {
+ const method = config2.method || globalsConfig.method || 'GET'
+ let config = {
+ baseURL: globalsConfig.baseURL || '',
+ method,
+ url: config2.url || '',
+ params: config2.params || {},
+ custom: { ...(globalsConfig.custom || {}), ...(config2.custom || {}) },
+ header: deepMerge(globalsConfig.header || {}, config2.header || {})
+ }
+ const defaultToConfig2Keys = ['getTask', 'validateStatus']
+ config = { ...config, ...mergeKeys(defaultToConfig2Keys, globalsConfig, config2) }
+
+ // eslint-disable-next-line no-empty
+ if (method === 'DOWNLOAD') {
+ // #ifdef H5 || APP-PLUS
+ if (!isUndefined(config2.timeout)) {
+ config.timeout = config2.timeout
+ } else if (!isUndefined(globalsConfig.timeout)) {
+ config.timeout = globalsConfig.timeout
+ }
+ // #endif
+ } else if (method === 'UPLOAD') {
+ delete config.header['content-type']
+ delete config.header['Content-Type']
+ const uploadKeys = [
+ // #ifdef APP-PLUS || H5
+ 'files',
+ // #endif
+ // #ifdef MP-ALIPAY
+ 'fileType',
+ // #endif
+ // #ifdef H5
+ 'file',
+ // #endif
+ 'filePath',
+ 'name',
+ // #ifdef H5 || APP-PLUS
+ 'timeout',
+ // #endif
+ 'formData'
+ ]
+ uploadKeys.forEach((prop) => {
+ if (!isUndefined(config2[prop])) {
+ config[prop] = config2[prop]
+ }
+ })
+ // #ifdef H5 || APP-PLUS
+ if (isUndefined(config.timeout) && !isUndefined(globalsConfig.timeout)) {
+ config.timeout = globalsConfig.timeout
+ }
+ // #endif
+ } else {
+ const defaultsKeys = [
+ 'data',
+ // #ifdef H5 || APP-PLUS || MP-ALIPAY || MP-WEIXIN
+ 'timeout',
+ // #endif
+ 'dataType',
+ // #ifndef MP-ALIPAY
+ 'responseType',
+ // #endif
+ // #ifdef APP-PLUS
+ 'sslVerify',
+ // #endif
+ // #ifdef H5
+ 'withCredentials',
+ // #endif
+ // #ifdef APP-PLUS
+ 'firstIpv4'
+ // #endif
+ ]
+ config = { ...config, ...mergeKeys(defaultsKeys, globalsConfig, config2) }
+ }
+
+ return config
+}
--
Gitblit v1.9.3