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 @@ > - - - 暂无图片 - - {{ club.name }} - - - 已加入 - - + :club="club" + :click="click" + @click="click && $emit('click', club)" + /> @@ -42,22 +23,19 @@ 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 }} + + + 进入主页 + + 加入社团 + + +