agilebuilder-ui 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/utils/request.js +14 -0
package/package.json
CHANGED
package/src/utils/request.js
CHANGED
|
@@ -170,6 +170,7 @@ export const apiUrlMappings = {}
|
|
|
170
170
|
* @param {*} options 是一个对象,包括data和param两个子对象属性,形如{param:{},data:{}}
|
|
171
171
|
*/
|
|
172
172
|
export function request(code, options) {
|
|
173
|
+
let requestParam
|
|
173
174
|
const config = {}
|
|
174
175
|
if (options) {
|
|
175
176
|
if (options.data) {
|
|
@@ -193,6 +194,9 @@ export function request(code, options) {
|
|
|
193
194
|
if (options.url) {
|
|
194
195
|
config.url = options.url
|
|
195
196
|
}
|
|
197
|
+
if (options.requestParam) {
|
|
198
|
+
requestParam = options.requestParam
|
|
199
|
+
}
|
|
196
200
|
}
|
|
197
201
|
if (code) {
|
|
198
202
|
if (!checkPermission(code)) {
|
|
@@ -226,6 +230,16 @@ export function request(code, options) {
|
|
|
226
230
|
showClose: true,
|
|
227
231
|
})
|
|
228
232
|
}
|
|
233
|
+
if(requestParam) {
|
|
234
|
+
for(let key in requestParam) {
|
|
235
|
+
if (config.url.indexOf('?') > 0) {
|
|
236
|
+
// 表示有参数
|
|
237
|
+
config.url = config.url + '&' + key + '=' + requestParam[key]
|
|
238
|
+
} else {
|
|
239
|
+
config.url = config.url + '?' + key + '=' + requestParam[key]
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
229
243
|
if (config.method && config.method.toLowerCase() === 'get') {
|
|
230
244
|
if (config.url.indexOf('?') > 0) {
|
|
231
245
|
// 表示有参数
|