wip: 4.0
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-05-16 14:27:57 +08:00
parent b09c1d9537
commit 8f3b158032
72 changed files with 3931 additions and 2161 deletions

View File

@@ -1,4 +1,4 @@
import Taro from "@tarojs/taro";
import Taro from '@tarojs/taro';
export const BASE_URL = process.env.TARO_APP_API;
@@ -8,15 +8,15 @@ interface Res<T> {
msg: string;
}
type Method = "GET" | "POST" | "PUT" | "DELETE";
type Method = 'GET' | 'POST' | 'PUT' | 'DELETE';
// 忽略系统提示白名单
const IGNORED_TIPS = ["/user/find/phone"];
const IGNORED_TIPS = ['/user/find/phone', '/user/check/payPassword'];
const request = (
url: string,
data: object = {},
method: Method = "GET"
method: Method = 'GET',
): Promise<Res<any>> => {
return new Promise((resolve, reject) => {
Taro.request({
@@ -24,15 +24,15 @@ const request = (
data: data,
method: method,
header: {
"content-type": "application/json",
token: Taro.getStorageSync("token") || "",
'content-type': 'application/json',
token: Taro.getStorageSync('token') || '',
},
success: ({ data }) => {
success: ({data}) => {
if (data.code !== 200) {
if (!IGNORED_TIPS.includes(url)) {
Taro.showToast({
title: data.msg,
icon: "none",
icon: 'none',
});
}
reject(data);
@@ -40,7 +40,7 @@ const request = (
resolve(data);
}
},
fail: (err) => {
fail: err => {
reject(err);
},
});