feat(custom): 游戏大厅合并
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-11-18 22:49:00 +08:00
parent a0e7966ee4
commit 7eed620962
13 changed files with 263 additions and 176 deletions

32
src/utils/game_request.ts Normal file
View File

@@ -0,0 +1,32 @@
import {app} from '@/config';
import Taro from '@tarojs/taro';
export interface RequestParams {
url: string;
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
header?: object;
data?: string | object;
}
const request = (request: RequestParams): Promise<any> => {
return new Promise((resolve, reject) => {
Taro.request({
url: `${app.API_URL()}${request.url}`,
method: request.method,
timeout: 5000,
dataType: 'json',
header: request.header || {},
data: request.data || {},
success: res => {
resolve(res.data);
// Taro.hideLoading()
},
fail: err => {
reject(err);
Taro.hideLoading();
},
});
});
};
export default request;