Initial project commit
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import { post } from "@/utils/request";
|
||||
import request from "@/utils/request";
|
||||
|
||||
export const register = (data) => post("/auth/register", data);
|
||||
|
||||
export const login = (data) =>
|
||||
request({
|
||||
url: "/auth/login",
|
||||
method: "POST",
|
||||
header: { "Content-Type": "application/x-www-form-urlencoded" },
|
||||
data: `username=${encodeURIComponent(data.account)}&password=${encodeURIComponent(data.password)}`,
|
||||
});
|
||||
|
||||
export const refreshToken = (data) => post("/auth/refresh", data);
|
||||
@@ -0,0 +1,6 @@
|
||||
import { get, post, del } from "@/utils/request";
|
||||
|
||||
export const getComments = (spotId, params) => get(`/spots/${spotId}/comments`, params);
|
||||
export const createComment = (spotId, data) => post(`/spots/${spotId}/comments`, data);
|
||||
export const deleteComment = (commentId) => del(`/comments/${commentId}`);
|
||||
export const reportComment = (commentId, data) => post(`/comments/${commentId}/report`, data);
|
||||
@@ -0,0 +1,7 @@
|
||||
import { get, post } from "@/utils/request";
|
||||
|
||||
export const submitCorrection = (spotId, data) =>
|
||||
post(`/spots/${spotId}/corrections`, data);
|
||||
|
||||
export const getCorrections = (spotId, params) =>
|
||||
get(`/spots/${spotId}/corrections`, params);
|
||||
@@ -0,0 +1,40 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
export const getEventList = (params = {}) =>
|
||||
request({ url: "/events/", method: "GET", data: params });
|
||||
|
||||
export const getMyEvents = (params = {}) =>
|
||||
request({ url: "/events/mine", method: "GET", data: params });
|
||||
|
||||
export const getMyRegistrations = (params = {}) =>
|
||||
request({ url: "/events/my-registrations", method: "GET", data: params });
|
||||
|
||||
export const getEventDetail = (id) =>
|
||||
request({ url: `/events/${id}`, method: "GET" });
|
||||
|
||||
export const createEvent = (data) =>
|
||||
request({ url: "/events/", method: "POST", data });
|
||||
|
||||
export const updateEvent = (id, data) =>
|
||||
request({ url: `/events/${id}`, method: "PUT", data });
|
||||
|
||||
export const cancelEvent = (id) =>
|
||||
request({ url: `/events/${id}/cancel`, method: "POST" });
|
||||
|
||||
export const registerEvent = (id) =>
|
||||
request({ url: `/events/${id}/register`, method: "POST" });
|
||||
|
||||
export const cancelRegistration = (id) =>
|
||||
request({ url: `/events/${id}/register`, method: "DELETE" });
|
||||
|
||||
export const getRegistrations = (id) =>
|
||||
request({ url: `/events/${id}/registrations`, method: "GET" });
|
||||
|
||||
export const getEventPhotos = (id) =>
|
||||
request({ url: `/events/${id}/photos`, method: "GET" });
|
||||
|
||||
export const addEventPhoto = (id, data) =>
|
||||
request({ url: `/events/${id}/photos`, method: "POST", data });
|
||||
|
||||
export const deleteEventPhoto = (eventId, photoId) =>
|
||||
request({ url: `/events/${eventId}/photos/${photoId}`, method: "DELETE" });
|
||||
@@ -0,0 +1,7 @@
|
||||
import { get, post, del } from "@/utils/request";
|
||||
|
||||
export const getFavorites = (params) => get("/favorites", params);
|
||||
|
||||
export const addFavorite = (spotId) => post(`/favorites/${spotId}`);
|
||||
|
||||
export const removeFavorite = (spotId) => del(`/favorites/${spotId}`);
|
||||
@@ -0,0 +1,10 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
export const getMembershipPlans = () =>
|
||||
request({ url: "/membership/plans", method: "GET" });
|
||||
|
||||
export const getMyMembership = () =>
|
||||
request({ url: "/membership/me", method: "GET" });
|
||||
|
||||
export const purchaseMembership = (planId) =>
|
||||
request({ url: "/membership/purchase", method: "POST", data: { plan_id: planId } });
|
||||
@@ -0,0 +1,9 @@
|
||||
import { get, post } from "@/utils/request";
|
||||
|
||||
export const getNotifications = (params) => get("/notifications", params);
|
||||
|
||||
export const getUnreadCount = () => get("/notifications/unread-count");
|
||||
|
||||
export const markAllRead = () => post("/notifications/read-all");
|
||||
|
||||
export const markRead = (id) => post(`/notifications/${id}/read`);
|
||||
@@ -0,0 +1,4 @@
|
||||
import { get } from "@/utils/request";
|
||||
|
||||
export const getMyPoints = () => get("/points/me");
|
||||
export const getMyPointRecords = (params) => get("/points/me/records", params);
|
||||
@@ -0,0 +1,7 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
export const getPromotions = (position = "home_banner") =>
|
||||
request({ url: "/promotions/", method: "GET", data: { position } });
|
||||
|
||||
export const recordClick = (promotionId) =>
|
||||
request({ url: "/promotions/click", method: "POST", data: { promotion_id: promotionId } });
|
||||
@@ -0,0 +1,4 @@
|
||||
import { get, post } from "@/utils/request";
|
||||
|
||||
export const rateSpot = (spotId, data) => post(`/spots/${spotId}/rate`, data);
|
||||
export const getSpotRatings = (spotId, params) => get(`/spots/${spotId}/ratings`, params);
|
||||
@@ -0,0 +1,3 @@
|
||||
import { get } from "@/utils/request";
|
||||
|
||||
export const searchSpots = (params) => get("/search", params);
|
||||
@@ -0,0 +1,46 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
export const getShootingList = (params = {}) =>
|
||||
request({ url: "/shooting/", method: "GET", data: params });
|
||||
|
||||
export const getMyShootings = (params = {}) =>
|
||||
request({ url: "/shooting/mine", method: "GET", data: params });
|
||||
|
||||
export const getMyApplications = (params = {}) =>
|
||||
request({ url: "/shooting/my-applications", method: "GET", data: params });
|
||||
|
||||
export const getShootingDetail = (id) =>
|
||||
request({ url: `/shooting/${id}`, method: "GET" });
|
||||
|
||||
export const createShooting = (data) =>
|
||||
request({ url: "/shooting/", method: "POST", data });
|
||||
|
||||
export const updateShooting = (id, data) =>
|
||||
request({ url: `/shooting/${id}`, method: "PUT", data });
|
||||
|
||||
export const closeShooting = (id) =>
|
||||
request({ url: `/shooting/${id}/close`, method: "POST" });
|
||||
|
||||
export const applyToShooting = (id, data = {}) =>
|
||||
request({ url: `/shooting/${id}/apply`, method: "POST", data });
|
||||
|
||||
export const getApplications = (id) =>
|
||||
request({ url: `/shooting/${id}/applications`, method: "GET" });
|
||||
|
||||
export const acceptApplication = (requestId, appId) =>
|
||||
request({
|
||||
url: `/shooting/${requestId}/applications/${appId}/accept`,
|
||||
method: "POST",
|
||||
});
|
||||
|
||||
export const rejectApplication = (requestId, appId) =>
|
||||
request({
|
||||
url: `/shooting/${requestId}/applications/${appId}/reject`,
|
||||
method: "POST",
|
||||
});
|
||||
|
||||
export const withdrawApplication = (requestId) =>
|
||||
request({
|
||||
url: `/shooting/${requestId}/applications/withdraw`,
|
||||
method: "DELETE",
|
||||
});
|
||||
@@ -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),
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
import { get, post, del } from "@/utils/request";
|
||||
|
||||
export const getTags = (params) => get("/tags", params);
|
||||
export const addTagToSpot = (spotId, data) => post(`/spots/${spotId}/tags`, data);
|
||||
export const removeTagFromSpot = (spotId, tagId) => del(`/spots/${spotId}/tags/${tagId}`);
|
||||
@@ -0,0 +1,14 @@
|
||||
import { get, put, post } from "@/utils/request";
|
||||
|
||||
export const getMyInfo = () => get("/users/me");
|
||||
|
||||
export const getMyStats = () => get("/users/me/stats");
|
||||
|
||||
export const updateMyInfo = (data) => put("/users/me", data);
|
||||
|
||||
export const changePassword = (data) => post("/users/me/change-password", data);
|
||||
|
||||
export const getUserInfo = (userId) => get(`/users/${userId}`);
|
||||
|
||||
export const getUserSpots = (userId, params) =>
|
||||
get("/spots", { creator_id: userId, ...params });
|
||||
Reference in New Issue
Block a user