添加api

This commit is contained in:
kron
2025-05-15 12:42:15 +08:00
parent aff7a2d3f6
commit a949786226

View File

@@ -1,10 +1,10 @@
const BASE_URL = "http://120.79.241.5:8000/api/shoot/index";
const BASE_URL = "http://120.79.241.5:8000/api/shoot";
// 获取全局配置
export const getAppConfig = () => {
return new Promise((resolve, reject) => {
uni.request({
url: `${BASE_URL}/appConfig`,
url: `${BASE_URL}/index/appConfig`,
method: "GET",
success: (res) => {
resolve(res.data);
@@ -12,10 +12,49 @@ export const getAppConfig = () => {
fail: (err) => {
reject(err);
uni.showToast({
title: "获取配置失败",
title: "获取数据失败",
icon: "none",
});
},
});
});
};
export const getHomeData = () => {
return new Promise((resolve, reject) => {
uni.request({
url: `${BASE_URL}/user/myHome`,
method: "GET",
success: (res) => {
resolve(res.data);
},
fail: (err) => {
reject(err);
uni.showToast({
title: "获取数据失败",
icon: "none",
});
},
});
});
};
// 获取省份及下属城市列表
export const getProvinceData = () => {
return new Promise((resolve, reject) => {
uni.request({
url: `${BASE_URL}/index/provinces/list`,
method: "GET",
success: (res) => {
resolve(res.data);
},
fail: (err) => {
reject(err);
uni.showToast({
title: "获取数据失败",
icon: "none",
});
},
});
});
};