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,8 @@
export default {
devBaseUrl: 'http://47.114.153.249:3000/api/json',
testBaseUrl: '',
prodBaseUrl: '',
apiList: {
index: '/index', // 首页
}
}

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.status) {
case 200:
return res.result
break;
case 500:
uni.showToast({
title: res.msg,
duration: 2000
});
throw new Error(res.msg);
break;
}
}
CheckBaseUrl() {
if (process.env.NODE_ENV === 'development') {
return config.devBaseUrl;
} else {
return config.prodBaseUrl;
}
}
}
export default new Http();

View File

@@ -0,0 +1,3 @@
li {
font-size: 30px;
}

View File

@@ -0,0 +1,12 @@
import http from "../http";
import config from "../config";
export default class IndexServer {
async getIndex(data = {}, header = {}) {
return await http.get({
url: config.apiList.index,
data: data,
header: header
});
}
}

View File

@@ -0,0 +1,5 @@
import IndexServer from "./IndexServer";
export default {
index: new IndexServer()
}