first commit

This commit is contained in:
编码猿
2024-09-27 02:06:13 +08:00
commit 852d94fbb9
36760 changed files with 3274413 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
import config from "../config";
class Http {
get(params) {
uni.showLoading({ title: '请求中..' });
return new Promise((success,error) => {
uni.request({
url: this.CheckBaseUrl()+params.url,
data: params.data,
method: 'GET',
header: Object.assign({
token: uni.getStorageSync('token')
},params.header),
success: (res) => {
success(this.ResponseCheck(res.data));
},
fail: (err) => {
console.log("6");
console.log(err);
}
});
})
}
post() {}
ResponseCheck(res) {
uni.hideLoading();
switch (res.resultCode) {
case '000':
return res.data
break;
case '500':
uni.showToast({
title: res.message,
duration: 2000
});
throw new Error(res.message);
break;
}
}
CheckBaseUrl() {
if (process.env.NODE_ENV === 'development') {
return config.devBaseUrl;
} else {
return config.prodBaseUrl;
}
}
}
export default new Http();