yangan
2024-06-03 5a35260ed13d1fb138ca7feb9e5840a24ad9248d
api/index.js
@@ -1,4 +1,4 @@
import { fetch } from '@/api/request.js'
import { fetch,fetchId } from '@/api/request.js'
const typeObj = {
   headerGET: { 'Content-type': 'application/x-www-from-urlencoded' },
@@ -33,6 +33,20 @@
   opt.data = params
   return fetch(url, opt)
}
export const reqGetId = (url, params, opt = {}) => {
   opt.header = typeObj['headerGET']
   opt.method = 'GET'
   opt.data = params
   return fetchId(url, opt)
}
// urlParam是拼接路径的参数
export const reqGet2 = (url, params, opt = {}) => {
   // opt.header = typeObj['headerGET']
   // opt.method = 'GET'
   // let newUrl = `${url}/${params}`
   // return fetch(newUrl, opt)
}
// post请求
// urlType是指定拼接路径还是传json格式参数