Initial project commit

This commit is contained in:
2026-05-09 16:40:29 +08:00
commit 02b0259a9e
267 changed files with 54891 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
import { get, post, put, del } from "@/utils/request";
import { API_BASE } from "@/utils/config";
export const getSpots = (params) => get("/spots", params);
export const getNearbySpots = (params) => get("/spots/nearby", params);
export const getSpotDetail = (id) => get(`/spots/${id}`);
export const createSpot = (data) => post("/spots", data);
export const updateSpot = (id, data) => put(`/spots/${id}`, data);
export const deleteSpot = (id) => del(`/spots/${id}`);
export const getMySpots = (params) => get("/spots/mine", params);
export const uploadImage = (filePath) => {
const token = uni.getStorageSync("access_token");
return new Promise((resolve, reject) => {
uni.uploadFile({
url: API_BASE + "/upload/image",
filePath,
name: "file",
header: token ? { Authorization: `Bearer ${token}` } : {},
success: (res) => {
if (res.statusCode >= 200 && res.statusCode < 300) {
resolve(JSON.parse(res.data));
} else {
reject(new Error("上传失败"));
}
},
fail: (err) => reject(err),
});
});
};