jazz
2023-12-08 bf4dca5344dee1a84b75d9993f4dfc59de3f3ee9
src/utils/jun_http.js
@@ -1,7 +1,7 @@
/**
 * Http 请求
 * * 小程序请使用增强编译
 *
 *
 * 调用例子
 * Req.http.post({
 *    url: '',
@@ -12,24 +12,24 @@
import Axios from '../libs/axios'
/* json转formdata(序列化),仅支持一级字面量和字面量数组 */
function jsonToFormData (json) {
    var arr = []
    var e = encodeURIComponent
    for (var key in json) {
        var item = json[key]
        var res
        if (item instanceof Array) {
            res = [];
            item.map(function (o, i) {
                res.push(e(key) + '=' + e(o))
            });
            res = res.join('&')
        } else {
            res = e(key) + '=' + e(item)
        }
        arr.push(res)
function jsonToFormData(json) {
  var arr = []
  var e = encodeURIComponent
  for (var key in json) {
    var item = json[key]
    var res
    if (item instanceof Array) {
      res = []
      item.map(function(o) {
        res.push(e(key) + '=' + e(o))
      })
      res = res.join('&')
    } else {
      res = e(key) + '=' + e(item)
    }
    return arr.join('&')
    arr.push(res)
  }
  return arr.join('&')
}
/**