zhangxiaoxu
2026-01-06 89761212ad3ac02b68276d82c26ab6cd767ea216
utils/index.js
@@ -18,7 +18,7 @@
   return fetch(url, opt)
}
// get请求
// get请求
// urlParam是拼接路径的参数
export const reqGet = (url, params, urlParam, opt = {}) => {
   opt.header = typeObj['headerGET'];
@@ -28,7 +28,7 @@
}
// post请求
export const reqPost = (url, params, form, opt = {}) => {
export const reqPost = (url, params,form, opt = {}) => {
   if(form == 'form'){
      opt.header = {'Content-Type': 'application/x-www-form-urlencoded'}
   } else {
@@ -36,5 +36,19 @@
   }
   opt.method = "POST";
   opt.data = params;
   opt.params = params;
   return fetch(url, opt)
}
// put请求
export const reqPut = (url, params,form, opt = {}) => {
    if(form == 'form'){
        opt.header = {'Content-Type': 'application/x-www-form-urlencoded'}
    } else {
        opt.header = typeObj['headerPOST'];
    }
    opt.method = "PUT";
    opt.data = params;
    opt.params = params;
    return fetch(url, opt)
}