From 07e215bdc9d6b57cb2c63d3f74a03d4e45d5ff9b Mon Sep 17 00:00:00 2001 From: Litrix Date: Mon, 6 Jan 2025 13:02:06 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=88=20perf:=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=A4=BE=E5=9B=A2=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/club/ClubList.vue | 38 +++++------------------- src/components/club/ClubListItem.vue | 44 ++++++++++++++++++++++++++++ src/router/index.ts | 1 + src/schemas/neusoft.ts | 4 ++- src/schemas/response.ts | 42 ++++++++++++-------------- src/views/club/ClubListPage.vue | 31 ++++++++++++++++---- src/views/manage/ManageClubPage.vue | 7 ++++- 7 files changed, 107 insertions(+), 60 deletions(-) create mode 100644 src/components/club/ClubListItem.vue diff --git a/src/components/club/ClubList.vue b/src/components/club/ClubList.vue index b5682a0..b189d37 100644 --- a/src/components/club/ClubList.vue +++ b/src/components/club/ClubList.vue @@ -9,31 +9,12 @@ > diff --git a/src/router/index.ts b/src/router/index.ts index d447f79..42ffa82 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -127,6 +127,7 @@ const routes: RouteRecordRaw[] = [ userPermission: { id: UserPermissionId.MANAGE_PAGE, }, + breadcrumb: '社团管理', }, }, ], diff --git a/src/schemas/neusoft.ts b/src/schemas/neusoft.ts index 1ce3fcf..4995fe9 100644 --- a/src/schemas/neusoft.ts +++ b/src/schemas/neusoft.ts @@ -1,3 +1,5 @@ +import { REQUEST_BASE_URL } from '@/env'; + export namespace Neusoft { export type BaseResp> = { code: number; @@ -30,6 +32,6 @@ export namespace Neusoft.SmartParty { export type GalleryResp = PagedResp; } export namespace Neusoft { - export const SMART_PARTY_BASE_URL = 'http://124.93.196.45:10091/Neusoft/party'; + export const SMART_PARTY_BASE_URL = `${REQUEST_BASE_URL}/neusoft`; export const isSucceed = (resp: BaseResp<{}>) => resp.code >= 200 && resp.code < 300; } diff --git a/src/schemas/response.ts b/src/schemas/response.ts index 110a478..08cd83c 100644 --- a/src/schemas/response.ts +++ b/src/schemas/response.ts @@ -11,8 +11,8 @@ const createRespSchema = (data: T) => .extend({ data: data }) .transform((raw) => Object.assign(raw, { - type: 'success', - } as const), + type: 'success' as const, + }), ), z .object({ @@ -22,10 +22,18 @@ const createRespSchema = (data: T) => }) .transform((raw) => Object.assign(raw, { - type: 'error', - } as const), + type: 'error' as const, + }), ), ]); +export const createPagedRespSchema = (data: T) => + createRespSchema( + z.object({ + data: data.array(), + total: z.number(), + }), + ); +export type AnyPagedRespSchema = ReturnType; export type SucceedRespOf = Extract; export type AnyRespSchema = ReturnType; export type ErrorResp = Extract, { type: 'error' }>; @@ -38,14 +46,16 @@ export const idAndNameSchema = z.object({ const authSchema = idAndNameSchema.extend({ permissions: idAndNameSchema.array(), }); +export const clubSchema = idAndNameSchema.extend({ + avatar: z.optional(z.string()), + commit: z.string(), +}); +export type Club = z.infer; +export const clubListRespSchema = createPagedRespSchema(clubSchema); const userInfoDataSchema = idAndNameSchema.extend({ avatar: z.optional(z.string()), auth: authSchema, - club: z.optional( - idAndNameSchema.extend({ - commit: z.string(), - }), - ), + club: z.optional(clubSchema), clubAuth: z.optional(authSchema), }); export const userInfoRespSchema = createRespSchema(userInfoDataSchema); @@ -65,17 +75,3 @@ export const verifyRespSchema = createRespSchema( }), ); export const uploadAvatarRespSchema = createRespSchema(z.string()); -export const clubSchema = idAndNameSchema.extend({ - avatar: z.optional(z.string()), - commit: z.string(), -}); -export type Club = z.infer; -export const createPagedRespSchema = (data: T) => - createRespSchema( - z.object({ - data: data.array(), - total: z.number(), - }), - ); -export type AnyPagedRespSchema = ReturnType; -export const clubListRespSchema = createPagedRespSchema(clubSchema); diff --git a/src/views/club/ClubListPage.vue b/src/views/club/ClubListPage.vue index 752fa3b..9a6f7d7 100644 --- a/src/views/club/ClubListPage.vue +++ b/src/views/club/ClubListPage.vue @@ -5,15 +5,34 @@ - + - - - + + +
+ +
简介:{{ showingClub.commit }}
+ +
+