📃 docs: 暂存
This commit is contained in:
parent
cd631ef10c
commit
bb45d79951
@ -9,7 +9,13 @@
|
||||
<el-icon size="50" @click="navigate" color="var(--el-color-primary)">
|
||||
<icon-cs-club />
|
||||
</el-icon>
|
||||
<h3 v-show="showAppTitle" class="app__title" @click="navigate">社团展示系统</h3>
|
||||
<h3
|
||||
v-show="showAppTitle"
|
||||
class="overflow-hidden text-ellipsis whitespace-nowrap"
|
||||
@click="navigate"
|
||||
>
|
||||
社团展示系统
|
||||
</h3>
|
||||
</router-link>
|
||||
<header-menu v-show="!mdLess" mode="horizontal" />
|
||||
<el-dropdown v-if="!mdLess && userStore.logined">
|
||||
|
@ -16,7 +16,7 @@ declare module 'axios' {
|
||||
// 自动添加token到请求中.
|
||||
axiosInstance.interceptors.request.use((config) => {
|
||||
const userStore = useUserStore();
|
||||
if (config.addAuth !== undefined && config.addAuth) {
|
||||
if (config.addAuth === undefined || config.addAuth) {
|
||||
config.headers.setAuthorization(userStore.token, false);
|
||||
}
|
||||
return config;
|
||||
|
@ -14,11 +14,13 @@
|
||||
:layout="paginationLayout"
|
||||
:total="total"
|
||||
:page-size="num"
|
||||
1
|
||||
:current="page"
|
||||
hide-on-single-page
|
||||
/>
|
||||
</template>
|
||||
<template v-else>
|
||||
<slot name="error">
|
||||
<slot name="empty">
|
||||
<div class="font-5 font-bold">暂无数据</div>
|
||||
</slot>
|
||||
</template>
|
||||
@ -44,7 +46,7 @@ const { schema, getRequestOptions, num } = defineProps<{
|
||||
}>();
|
||||
defineSlots<{
|
||||
default: (props: { data: DataList }) => unknown;
|
||||
error: () => unknown;
|
||||
empty: () => unknown;
|
||||
}>();
|
||||
const loading = ref(true);
|
||||
const resp = ref<Succeed>();
|
||||
|
@ -7,7 +7,7 @@
|
||||
@select="$emit('select')"
|
||||
>
|
||||
<el-menu-item index="/">首页</el-menu-item>
|
||||
<el-menu-item v-if="isValid($router.resolve('/club'))" index="/club">社团</el-menu-item>
|
||||
<el-menu-item v-if="isValid('/club')" index="/club">社团</el-menu-item>
|
||||
<el-sub-menu class="festival-menu" index="festival">
|
||||
<template #title>社团文化节</template>
|
||||
<template v-for="{ imgURL, title, to } of festivalMenuItems">
|
||||
@ -20,6 +20,7 @@
|
||||
/>
|
||||
</template>
|
||||
</el-sub-menu>
|
||||
<el-menu-item v-if="isValid('/manage')" index="/manage">管理</el-menu-item>
|
||||
</el-menu>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
@ -63,12 +64,19 @@ const festivalMenuItems = reactive<MenuItem[]>([
|
||||
to: router.resolve('/gobang'),
|
||||
},
|
||||
]);
|
||||
const isValid = ({
|
||||
meta: { shouldLogin, userPermissionId, clubPermissionId },
|
||||
}: RouteLocationGeneric) =>
|
||||
(!shouldLogin || userStore.logined) &&
|
||||
userStore.hasUserPermissions(userPermissionId) &&
|
||||
userStore.hasClubPermissions(clubPermissionId);
|
||||
function isValid(to: string | RouteLocationGeneric) {
|
||||
if (typeof to === 'string') {
|
||||
to = router.resolve(to);
|
||||
}
|
||||
const {
|
||||
meta: { shouldLogin, userPermissionId, clubPermissionId },
|
||||
} = to;
|
||||
return (
|
||||
(!shouldLogin || userStore.logined) &&
|
||||
userStore.hasUserPermissions(userPermissionId) &&
|
||||
userStore.hasClubPermissions(clubPermissionId)
|
||||
);
|
||||
}
|
||||
defineProps<{
|
||||
mode: 'horizontal' | 'vertical';
|
||||
}>();
|
||||
|
@ -4,7 +4,6 @@ import type { MaybeArray } from '@/utils/types';
|
||||
import { PageErrorType, type PageErrorReason } from '@/views/ErrorPage.vue';
|
||||
import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router';
|
||||
import { ClubPermissionId, UserPermissionId } from './permissions';
|
||||
|
||||
declare module 'vue-router' {
|
||||
interface RouteMeta {
|
||||
routeId?: number;
|
||||
@ -79,6 +78,14 @@ const routes: RouteRecordRaw[] = [
|
||||
shouldLogin: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/manage',
|
||||
name: 'Manage',
|
||||
component: () => import('@/views/manage/ManagePage.vue'),
|
||||
meta: {
|
||||
userPermissionId: UserPermissionId.MANAGE_PAGE,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/:path(.*)*',
|
||||
name: 'NotFound',
|
||||
|
@ -17,30 +17,33 @@
|
||||
<div>
|
||||
<div class="title">社团活动</div>
|
||||
</div>
|
||||
<paged-wrapper
|
||||
class="grid-col-span-2"
|
||||
pagination-background
|
||||
:schema="clubListRespSchema"
|
||||
:num="10"
|
||||
pagination-class="w-min"
|
||||
pagination-layout="prev, pager, next"
|
||||
:get-request-options="getClubListRequestOptions"
|
||||
v-slot="{ data }"
|
||||
>
|
||||
<div v-show="data">
|
||||
<div class="title m-b-10px">社团列表</div>
|
||||
<div
|
||||
class="grid gap-10px justify-center max-sm-grid-cols-3 sm-grid-cols-5 md-grid-cols-7 lg-grid-cols-9"
|
||||
>
|
||||
<div v-for="club of data" class="flex flex-col items-center">
|
||||
<el-avatar :size="90" :src="getAvatarURL(club.avatar)">
|
||||
<div class="text-black">暂无图片</div>
|
||||
</el-avatar>
|
||||
<div class="text-5 font-bold">{{ club.name }}</div>
|
||||
<div class="grid-col-span-2">
|
||||
<div class="title m-b-10px">社团列表</div>
|
||||
<paged-wrapper
|
||||
pagination-background
|
||||
:schema="clubListRespSchema"
|
||||
:num="10"
|
||||
pagination-class="w-min"
|
||||
pagination-layout="prev, pager, next"
|
||||
:get-request-options="getClubListRequestOptions"
|
||||
>
|
||||
<template #default="{ data }">
|
||||
<div
|
||||
class="grid gap-10px justify-center max-sm-grid-cols-3 sm-grid-cols-5 md-grid-cols-7 lg-grid-cols-9"
|
||||
>
|
||||
<div v-for="club of data" class="flex flex-col items-center">
|
||||
<el-avatar :size="90" :src="getAvatarURL(club.avatar)">
|
||||
<div class="text-black">暂无图片</div>
|
||||
</el-avatar>
|
||||
<div class="text-5 font-bold">{{ club.name }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</paged-wrapper>
|
||||
</template>
|
||||
<template #empty>
|
||||
<div class="font-bold text-5">暂无社团</div>
|
||||
</template>
|
||||
</paged-wrapper>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-main>
|
||||
|
12
src/views/manage/ManagePage.vue
Normal file
12
src/views/manage/ManagePage.vue
Normal file
@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<el-main>
|
||||
<el-container>
|
||||
<el-aside class="manage-page-aside">
|
||||
<el-menu></el-menu>
|
||||
</el-aside>
|
||||
<el-main></el-main>
|
||||
</el-container>
|
||||
</el-main>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
@ -14,9 +14,6 @@
|
||||
</el-link>
|
||||
</template>
|
||||
</el-upload>
|
||||
<el-link type="danger" :icon="Close" :disabled="uploading" :underline="false">
|
||||
清除头像
|
||||
</el-link>
|
||||
</div>
|
||||
</div>
|
||||
<el-divider />
|
||||
|
@ -58,7 +58,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-1 flex flex-col overflow-hidden">
|
||||
<div class="user-menu-h-outer w-auto"><user-menu :user-info="userInfo" mobile /></div>
|
||||
<div class="user-menu-h-outer w-auto">
|
||||
<user-menu :user-info="userInfo" mobile />
|
||||
</div>
|
||||
<div class="main flex-1 bg-white">
|
||||
<router-view v-slot="{ Component }">
|
||||
<keep-alive>
|
||||
|
Loading…
x
Reference in New Issue
Block a user