diff --git a/src/api/dashboard/event.ts b/src/api/dashboard/event.ts index c820b36..40888e5 100644 --- a/src/api/dashboard/event.ts +++ b/src/api/dashboard/event.ts @@ -1,6 +1,6 @@ import Axios from "@/api"; -import { EditableEventType, EventType } from "@/types/event"; -import { List } from "@/types/Request"; +import type { EditableEventType, EventType } from "@/types/event"; +import type { List } from "@/types/Request"; export async function getEventList(params: { pageSize: number; diff --git a/src/api/dashboard/feature.ts b/src/api/dashboard/feature.ts new file mode 100644 index 0000000..0cc217a --- /dev/null +++ b/src/api/dashboard/feature.ts @@ -0,0 +1,34 @@ +import Axios from "@/api"; +import type { + CrateFeatureType, + EditableFeatureType, + FeatureType, +} from "@/types/feature"; +import type { List } from "@/types/Request"; + +export async function getFeatureList(params: { + pageSize: number; + current: number; +}) { + const res = await Axios.get>("/event/feature", { + params, + }); + + return res.data; +} + +export async function createFeature(feature: CrateFeatureType) { + const res = await Axios.post("/event/feature/create", { + feature, + }); + + return res.data; +} + +export async function updateFeature(feature: EditableFeatureType) { + const res = await Axios.post("/event/feature/update", { + feature, + }); + + return res.data; +} diff --git a/src/components/Error/index.tsx b/src/components/Error/index.tsx index 75e78c4..7ba39b2 100644 --- a/src/components/Error/index.tsx +++ b/src/components/Error/index.tsx @@ -6,7 +6,7 @@ export default function LoadError() { const navigate = useNavigate(); return ( - + 发生了错误... diff --git a/src/consts/event.ts b/src/consts/event.ts index 7ddbb72..1d9c24e 100644 --- a/src/consts/event.ts +++ b/src/consts/event.ts @@ -15,3 +15,11 @@ export const EventScaleLabel = { [EventScale.Large]: "大型(Large)", [EventScale.Mega]: "超大型(Mega)", }; + +export const EventStatusColor = { + [EventStatus.EventScheduled]: "blue", + [EventStatus.EventPostponed]: "gray", + [EventStatus.EventRescheduled]: "orange", + [EventStatus.EventMovedOnline]: "green", + [EventStatus.EventCancelled]: "red", +}; diff --git a/src/pages/dashboard/cacheManager/index.tsx b/src/pages/dashboard/cacheManager/index.tsx index e00f3f2..56c44fa 100644 --- a/src/pages/dashboard/cacheManager/index.tsx +++ b/src/pages/dashboard/cacheManager/index.tsx @@ -6,13 +6,13 @@ import { IconRefresh } from '@tabler/icons-react'; export default function CacheManager() { return ( <> - + 缓存刷新控制台 - + diff --git a/src/pages/dashboard/event/page.tsx b/src/pages/dashboard/event/page.tsx index 84fe584..8f9c94e 100644 --- a/src/pages/dashboard/event/page.tsx +++ b/src/pages/dashboard/event/page.tsx @@ -22,7 +22,7 @@ export default function EventPage() { return ( <> - + 展会列表 @@ -37,7 +37,7 @@ export default function EventPage() { -
+
void; + editingFeature: EditableFeatureType | null; +}) { + return ( + <> + + {opened && ( + + )} + + + ); +} + +function ModalComponent({ + editingFeature, + onClose, +}: { editingFeature: EditableFeatureType | null; onClose: () => void }) { + const form = useForm({ + mode: 'uncontrolled', + initialValues: { + name: editingFeature?.name || '', + category: editingFeature?.category || '', + description: editingFeature?.description || '', + }, + }); + + const handleSubmit = async (value: CrateFeatureType) => { + if (editingFeature?.id) { + const res = await updateFeature({ ...value, id: editingFeature.id }); + console.log(res); + notifications.show({ + title: '更新成功', + message: '更新标签成功', + color: 'teal', + }); + return onClose(); + } + const res = await createFeature(value); + console.log(res); + notifications.show({ + title: '创建成功', + message: '创建标签成功', + color: 'teal', + }); + return onClose(); + }; + + return ( + handleSubmit(values))}> + + + + +