From 18de3f3e22336a33e40f7f67f1019e04da78f2ff Mon Sep 17 00:00:00 2001 From: feige996 <1020102647@qq.com> Date: Wed, 12 Mar 2025 09:57:56 +0800 Subject: [PATCH 1/4] chore: update version to 2.6.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c22e631..25935dd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "unibest", "type": "commonjs", - "version": "2.5.5", + "version": "2.6.2", "description": "unibest - 最好的 uniapp 开发模板", "author": { "name": "feige996", From b59e8993967659af24e038194d487adec2c94ba6 Mon Sep 17 00:00:00 2001 From: feige996 <1020102647@qq.com> Date: Sat, 12 Apr 2025 11:02:48 +0800 Subject: [PATCH 2/4] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0header=E7=9A=84?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/service/index/foo.ts | 4 ++-- src/utils/http.ts | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/service/index/foo.ts b/src/service/index/foo.ts index acf5aa8..340b8ba 100644 --- a/src/service/index/foo.ts +++ b/src/service/index/foo.ts @@ -6,10 +6,10 @@ export interface IFooItem { /** GET 请求 */ export const getFooAPI = (name: string) => { - return http.get('/foo', { name }) + return http.get('/foo', { name }, { 'Content-Type-100': '100' }) } /** POST 请求 */ export const postFooAPI = (name: string) => { - return http.post('/foo', { name }, { name }) + return http.post('/foo', { name }, { name }, { 'Content-Type-100': '100' }) } diff --git a/src/utils/http.ts b/src/utils/http.ts index 4e3f38c..13045c9 100644 --- a/src/utils/http.ts +++ b/src/utils/http.ts @@ -48,11 +48,16 @@ export const http = (options: CustomRequestOptions) => { * @param query 请求query参数 * @returns */ -export const httpGet = (url: string, query?: Record) => { +export const httpGet = ( + url: string, + query?: Record, + header?: Record, +) => { return http({ url, query, method: 'GET', + header, }) } @@ -67,12 +72,14 @@ export const httpPost = ( url: string, data?: Record, query?: Record, + header?: Record, ) => { return http({ url, query, data, method: 'POST', + header, }) } From cf2a9f5aa54e05bbe76d821ff8137218d7de97a8 Mon Sep 17 00:00:00 2001 From: feige996 <1020102647@qq.com> Date: Sat, 12 Apr 2025 14:05:58 +0800 Subject: [PATCH 3/4] =?UTF-8?q?feat:=20http=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/service/index/foo.ts | 12 ++++++++++++ src/utils/http.ts | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/service/index/foo.ts b/src/service/index/foo.ts index 340b8ba..34d523e 100644 --- a/src/service/index/foo.ts +++ b/src/service/index/foo.ts @@ -6,10 +6,22 @@ export interface IFooItem { /** GET 请求 */ export const getFooAPI = (name: string) => { + return http.get('/foo', { name }) +} +/** GET 请求;支持 传递 header 的范例 */ +export const getFooAPI2 = (name: string) => { return http.get('/foo', { name }, { 'Content-Type-100': '100' }) } /** POST 请求 */ export const postFooAPI = (name: string) => { + return http.post('/foo', { name }) +} +/** POST 请求;需要传递 query 参数的范例;微信小程序经常有同时需要query参数和body参数的场景 */ +export const postFooAPI2 = (name: string) => { + return http.post('/foo', { name }) +} +/** POST 请求;支持 传递 header 的范例 */ +export const postFooAPI3 = (name: string) => { return http.post('/foo', { name }, { name }, { 'Content-Type-100': '100' }) } diff --git a/src/utils/http.ts b/src/utils/http.ts index 13045c9..d46535a 100644 --- a/src/utils/http.ts +++ b/src/utils/http.ts @@ -46,6 +46,7 @@ export const http = (options: CustomRequestOptions) => { * GET 请求 * @param url 后台地址 * @param query 请求query参数 + * @param header 请求头,默认为json格式 * @returns */ export const httpGet = ( @@ -66,6 +67,7 @@ export const httpGet = ( * @param url 后台地址 * @param data 请求body参数 * @param query 请求query参数,post请求也支持query,很多微信接口都需要 + * @param header 请求头,默认为json格式 * @returns */ export const httpPost = ( From 7111a3593f2c0dbb40b3b321185d621e96381118 Mon Sep 17 00:00:00 2001 From: feige996 <1020102647@qq.com> Date: Sat, 12 Apr 2025 14:08:59 +0800 Subject: [PATCH 4/4] chore: v2.6.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 25935dd..556098d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "unibest", "type": "commonjs", - "version": "2.6.2", + "version": "2.6.3", "description": "unibest - 最好的 uniapp 开发模板", "author": { "name": "feige996",