From 09f598294949f96d91cdf0f583ce10862131b6f5 Mon Sep 17 00:00:00 2001 From: yangan <yangan0921@163.com> Date: 星期二, 15 十月 2024 16:11:21 +0800 Subject: [PATCH] feat:去除液氯限制 --- api/index.js | 32 +++++++++++++++++++++++++++++++- 1 files changed, 31 insertions(+), 1 deletions(-) diff --git a/api/index.js b/api/index.js index 24f4487..767fbf1 100644 --- a/api/index.js +++ b/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' }, @@ -32,6 +32,12 @@ opt.method = 'GET' 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鏄嫾鎺ヨ矾寰勭殑鍙傛暟 @@ -67,3 +73,27 @@ } return fetch(url, opt, urlType) } + +export const reqPut = (url, params, urlType, opt = {}) => { + opt.method = 'Put' + if (urlType == 'params') { + Object.keys(params).map(item => { + // 杩欓噷闈笉鑳界敤params.item锛岀偣杩愮畻绗﹀姞鏍囪瘑绗︾殑褰㈠紡鍙栧�硷紝鍥犱负item鏄疧bject.keys鐢熸垚鐨勬瘡涓�椤归敭閮芥槸瀛楃涓诧紝涓嶆槸鏍囪瘑绗︼紝鍙互鐢╗]鐨勫舰寮忚闂� + if (params[item] == null) { + params[item] = '' + } + }) + opt.params = params + opt.header = typeObj['headerPut'] + } else if (urlType == 'json') { + opt.header = typeObj['jsonPut'] + opt.data = params + } else if (urlType == 'utf8') { + opt.header = typeObj['utfPOSt'] + opt.data = params + } else { + opt.data = params + opt.header = typeObj['headerPut'] + } + return fetch(url, opt, urlType) +} \ No newline at end of file -- Gitblit v1.9.1