v0.2.18 前端独立展示

v0.2o
bruce 2025-03-25 18:59:39 +08:00
parent 7e522ded1d
commit 336f062650
23 changed files with 1048 additions and 176 deletions

View File

@ -8,6 +8,6 @@
</head>
<body>
<div id="app"></div>
<script type="module" src="@/main.js"></script>
<script type="module" src="/src/main.js"></script>
</body>
</html>

View File

@ -9,7 +9,9 @@
"preview": "vite preview"
},
"dependencies": {
"@element-plus/icons-vue": "^2.3.1",
"axios": "^1.8.4",
"echarts": "^5.6.0",
"element-plus": "^2.9.7",
"jwt-decode": "^4.0.0",
"pinia": "^3.0.1",

View File

@ -8,9 +8,15 @@ importers:
.:
dependencies:
'@element-plus/icons-vue':
specifier: ^2.3.1
version: 2.3.1(vue@3.5.13)
axios:
specifier: ^1.8.4
version: 1.8.4
echarts:
specifier: ^5.6.0
version: 5.6.0
element-plus:
specifier: ^2.9.7
version: 2.9.7(vue@3.5.13)
@ -429,6 +435,9 @@ packages:
resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==}
engines: {node: '>= 0.4'}
echarts@5.6.0:
resolution: {integrity: sha512-oTbVTsXfKuEhxftHqL5xprgLoc0k7uScAwtryCgWF6hPYFLRwOUHiFmHGCBKP5NPFNkDVopOieyUqYGH8Fa3kA==}
element-plus@2.9.7:
resolution: {integrity: sha512-6vjZh5SXBncLhUwJGTVKS5oDljfgGMh6J4zVTeAZK3YdMUN76FgpvHkwwFXocpJpMbii6rDYU3sgie64FyPerQ==}
peerDependencies:
@ -605,6 +614,9 @@ packages:
resolution: {integrity: sha512-5JRxVqC8I8NuOUjzBbvVJAKNM8qoVuH0O77h4WInc/qC2q5IreqKxYwgkga3PfA22OayK2ikceb/B26dztPl+Q==}
engines: {node: '>=16'}
tslib@2.3.0:
resolution: {integrity: sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==}
vite@6.2.2:
resolution: {integrity: sha512-yW7PeMM+LkDzc7CgJuRLMW2Jz0FxMOsVJ8Lv3gpgW9WLcb9cTW+121UEr1hvmfR7w3SegR5ItvYyzVz1vxNJgQ==}
engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}
@ -669,6 +681,9 @@ packages:
typescript:
optional: true
zrender@5.6.1:
resolution: {integrity: sha512-OFXkDJKcrlx5su2XbzJvj/34Q3m6PvyCZkVPHGYpcCJ52ek4U/ymZyfuV1nKE23AyBJ51E/6Yr0mhZ7xGTO4ag==}
snapshots:
'@babel/helper-string-parser@7.25.9': {}
@ -984,6 +999,11 @@ snapshots:
es-errors: 1.3.0
gopd: 1.2.0
echarts@5.6.0:
dependencies:
tslib: 2.3.0
zrender: 5.6.1
element-plus@2.9.7(vue@3.5.13):
dependencies:
'@ctrl/tinycolor': 3.6.1
@ -1186,6 +1206,8 @@ snapshots:
dependencies:
copy-anything: 3.0.5
tslib@2.3.0: {}
vite@6.2.2:
dependencies:
esbuild: 0.25.1
@ -1210,3 +1232,7 @@ snapshots:
'@vue/runtime-dom': 3.5.13
'@vue/server-renderer': 3.5.13(vue@3.5.13)
'@vue/shared': 3.5.13
zrender@5.6.1:
dependencies:
tslib: 2.3.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 KiB

View File

@ -4,6 +4,14 @@
</template>
<script setup>
import { onMounted } from 'vue'
import { useUserStore } from '@/stores/user'
const userStore = useUserStore()
onMounted(async () => {
await userStore.initUserState()
})
</script>
<style>

View File

@ -1,14 +1,66 @@
import request from '@/utils/request'
// 获取活动列表
export function listActivity(params) {
return request({
url: '/activity/list',
method: 'get',
params
})
}
// 获取活动详情
export function getActivity(id) {
return request({
url: `/activity/${id}`,
method: 'get'
})
}
// 创建活动
export function createActivity(data) {
return request({
url: '/api/admin/activity/create',
url: '/activity',
method: 'post',
data
})
}
// 更新活动
export function updateActivity(id, data) {
return request({
url: `/activity/${id}`,
method: 'put',
data
})
}
// 删除活动
export function deleteActivity(id) {
return request({
url: `/activity/${id}`,
method: 'delete'
})
}
// 批量删除活动
export function batchDeleteActivity(ids) {
return request({
url: '/activity/batch',
method: 'delete',
data: { ids }
})
}
// 审批活动
export function approveActivity(id, status) {
return request({
url: `/activity/${id}/approve`,
method: 'put',
data: { status }
})
}
// 取消活动
export function cancelActivity(data) {
return request({
@ -18,15 +70,6 @@ export function cancelActivity(data) {
})
}
// 获取活动列表
export function getActivityList(params) {
return request({
url: '/api/admin/activity/list',
method: 'get',
params
})
}
// 获取活动详情
export function getActivityDetail(actId) {
return request({
@ -36,18 +79,10 @@ export function getActivityDetail(actId) {
}
// 更新活动信息
export function updateActivity(data) {
export function updateActivityInfo(data) {
return request({
url: '/api/admin/activity/update',
method: 'put',
data
})
}
// 删除活动
export function deleteActivity(actId) {
return request({
url: `/api/admin/activity/delete/${actId}`,
method: 'delete'
})
}

View File

@ -1,52 +1,78 @@
import request from '@/utils/request'
// 获取社团列表
export function listClub(params) {
return request({
url: '/club/list',
method: 'get',
params
})
}
// 获取社团详情
export function getClub(id) {
return request({
url: `/club/${id}`,
method: 'get'
})
}
// 添加社团
export function addClub(data) {
return request({
url: '/api/admin/club/add',
url: '/club',
method: 'post',
data
})
}
// 更新社团信息
export function updateClub(data) {
export function updateClub(id, data) {
return request({
url: '/api/admin/club/update',
url: `/club/${id}`,
method: 'put',
data
})
}
// 删除社团
export function deleteClub(clubId) {
export function deleteClub(id) {
return request({
url: `/api/admin/club/delete/${clubId}`,
url: `/club/${id}`,
method: 'delete'
})
}
// 获取社团详情
export function getClubDetail(clubId) {
// 审批社团
export function approveClub(id, status) {
return request({
url: `/api/admin/club/${clubId}`,
method: 'get'
url: `/club/${id}/approve`,
method: 'put',
data: { status }
})
}
// 获取社团列表
export function getClubList(params) {
// 搜索社团
export function searchClubs(params) {
return request({
url: '/api/admin/club/list',
url: '/club/search',
method: 'get',
params
})
}
// 加入社团
export function joinClub(id) {
return request({
url: `/club/${id}/join`,
method: 'post'
})
}
// 获取社团成员列表
export function getClubMembers(clubId) {
return request({
url: `/api/admin/club/${clubId}/members`,
url: `/club/${clubId}/members`,
method: 'get'
})
}
@ -54,7 +80,7 @@ export function getClubMembers(clubId) {
// 添加社团成员
export function addClubMember(data) {
return request({
url: '/api/admin/club/member/add',
url: '/club/member',
method: 'post',
data
})
@ -63,7 +89,7 @@ export function addClubMember(data) {
// 移除社团成员
export function removeClubMember(clubId, userId) {
return request({
url: `/api/admin/club/${clubId}/member/${userId}`,
url: `/club/${clubId}/member/${userId}`,
method: 'delete'
})
}

View File

@ -1,5 +1,80 @@
import request from '@/utils/request'
// 获取用户列表
export function listUser(params) {
return request({
url: '/user/list',
method: 'get',
params
})
}
// 获取用户详情
export function getUser(id) {
return request({
url: `/user/${id}`,
method: 'get'
})
}
// 创建用户
export function addUser(data) {
return request({
url: '/user',
method: 'post',
data
})
}
// 更新用户
export function updateUser(id, data) {
return request({
url: `/user/${id}`,
method: 'put',
data
})
}
// 删除用户
export function deleteUser(id) {
return request({
url: `/user/${id}`,
method: 'delete'
})
}
// 启用用户
export function enableUser(id) {
return request({
url: `/user/${id}/enable`,
method: 'put'
})
}
// 禁用用户
export function disableUser(id) {
return request({
url: `/user/${id}/disable`,
method: 'put'
})
}
// 获取用户信息
export function getUserInfo() {
return request({
url: '/user/info',
method: 'get'
})
}
// 退出登录
export function logout() {
return request({
url: '/logout',
method: 'post'
})
}
// 用户登录
export function login(data) {
return request({
@ -9,14 +84,6 @@ export function login(data) {
})
}
// 获取用户信息
export function getUserInfo(userId) {
return request({
url: `/api/user/${userId}`,
method: 'get'
})
}
// 修改密码
export function updatePassword(data) {
return request({

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -1,10 +1,14 @@
export default {
development: {
baseUrl: 'http://localhost:8080',
uploadUrl: 'http://localhost:8080/api/file/upload'
uploadUrl: 'http://localhost:8080/api/file/upload',
mockData: true,
skipAuth: true
},
production: {
baseUrl: 'http://your-production-domain',
uploadUrl: 'http://your-production-domain/api/file/upload'
uploadUrl: 'http://your-production-domain/api/file/upload',
mockData: false,
skipAuth: false
}
}

View File

@ -97,7 +97,7 @@
</template>
<script setup>
import { ref, computed } from 'vue'
import { ref, computed, onMounted } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import { ElMessage } from 'element-plus'
import {
@ -111,9 +111,11 @@ import {
} from '@element-plus/icons-vue'
import { removeToken } from '@/utils/auth'
import { isAdmin } from '@/utils/permission'
import { useUserStore } from '@/stores/user'
const router = useRouter()
const route = useRoute()
const userStore = useUserStore()
//
const isCollapse = ref(false)
@ -121,33 +123,44 @@ const isCollapse = ref(false)
//
const activeMenu = computed(() => route.path)
// API
const userInfo = ref({
name: '管理员',
avatar: 'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png'
})
//
const userInfo = computed(() => userStore.userInfo)
//
//
const toggleSidebar = () => {
isCollapse.value = !isCollapse.value
}
//
const handleCommand = (command) => {
const handleCommand = async (command) => {
switch (command) {
case 'profile':
router.push('/profile')
break
case 'password':
router.push('/password')
router.push('/user/password')
break
case 'logout':
removeToken()
router.push('/login')
ElMessage.success('退出登录成功')
await handleLogout()
break
}
}
// 退
const handleLogout = async () => {
try {
await userStore.clearUserInfo()
removeToken()
router.push('/login')
} catch (error) {
console.error('退出登录失败:', error)
}
}
//
onMounted(async () => {
await userStore.fetchUserInfo()
})
</script>
<style scoped>

View File

@ -47,37 +47,50 @@
</template>
<script setup>
import { ref, computed } from 'vue'
import { ref, computed, onMounted } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import { ElMessage } from 'element-plus'
import { CaretBottom } from '@element-plus/icons-vue'
import { removeToken } from '@/utils/auth'
import { useUserStore } from '@/stores/user'
const router = useRouter()
const route = useRoute()
const userStore = useUserStore()
//
const activeMenu = computed(() => route.path)
// API
const userInfo = ref({
name: '张三',
avatar: 'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png'
})
//
const userInfo = computed(() => userStore.userInfo)
//
const handleCommand = (command) => {
const handleCommand = async (command) => {
switch (command) {
case 'personal':
router.push('/personal')
break
case 'logout':
removeToken()
router.push('/login')
ElMessage.success('退出登录成功')
await handleLogout()
break
}
}
// 退
const handleLogout = async () => {
try {
await userStore.clearUserInfo()
removeToken()
router.push('/login')
} catch (error) {
console.error('退出登录失败:', error)
}
}
//
onMounted(async () => {
await userStore.fetchUserInfo()
})
</script>
<style scoped>

View File

@ -1,10 +1,15 @@
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
const app = createApp(App)
const pinia = createPinia()
app.use(pinia)
app.use(router)
app.use(ElementPlus)
app.mount('#app')

View File

@ -0,0 +1,92 @@
import Mock from 'mockjs'
// 设置延迟时间
Mock.setup({
timeout: '300-600'
})
// 用户相关接口
Mock.mock(/\/api\/user\/info/, 'get', {
code: 200,
data: {
userId: 1,
name: '测试用户',
username: 'test',
avatar: 'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png',
role: ['PARTICIPANT']
}
})
// 活动相关接口
Mock.mock(/\/api\/activity\/list/, 'get', {
code: 200,
data: {
total: 10,
list: [
{
id: 1,
title: '社团招新活动',
description: '欢迎加入我们的社团',
startTime: '2024-03-25 10:00:00',
endTime: '2024-03-25 12:00:00',
location: '教学楼A101',
status: 'APPROVED'
},
{
id: 2,
title: '社团文化节',
description: '展示社团文化特色',
startTime: '2024-03-26 14:00:00',
endTime: '2024-03-26 17:00:00',
location: '学生活动中心',
status: 'PENDING'
}
]
}
})
// 社团相关接口
Mock.mock(/\/api\/club\/list/, 'get', {
code: 200,
data: {
total: 5,
list: [
{
id: 1,
name: '摄影协会',
description: '记录美好瞬间',
memberCount: 50,
status: 'APPROVED'
},
{
id: 2,
name: '篮球社',
description: '热爱篮球的同学们',
memberCount: 30,
status: 'APPROVED'
}
]
}
})
// 公告相关接口
Mock.mock(/\/api\/notice\/list/, 'get', {
code: 200,
data: {
total: 3,
list: [
{
id: 1,
title: '系统维护通知',
content: '系统将于今晚进行维护升级',
createTime: '2024-03-25 09:00:00'
},
{
id: 2,
title: '社团活动周',
content: '本周将举办社团活动周',
createTime: '2024-03-24 14:00:00'
}
]
}
})

View File

@ -1,6 +1,7 @@
import { createRouter, createWebHistory } from 'vue-router'
import { getToken } from '@/utils/auth'
import jwtDecode from 'jwt-decode'
import { jwtDecode } from 'jwt-decode'
import config from '@/config'
// 公共路由
export const constantRoutes = [
@ -30,33 +31,27 @@ export const constantRoutes = [
export const studentRoutes = [
{
path: '/',
component: () => import('@/views/home/index.vue'),
meta: { title: '首页', roles: ['PARTICIPANT'] }
},
{
path: '/club',
component: () => import('@/views/club/index.vue'),
meta: { title: '社团中心', roles: ['PARTICIPANT'] }
},
{
path: '/activity',
component: () => import('@/views/activity/index.vue'),
meta: { title: '活动', roles: ['PARTICIPANT'] }
},
{
path: '/notice',
component: () => import('@/views/notice/index.vue'),
meta: { title: '公告', roles: ['PARTICIPANT'] }
},
{
path: '/personal',
component: () => import('@/views/personal/index.vue'),
meta: { title: '个人中心', roles: ['PARTICIPANT'] },
component: () => import('@/layout/student/index.vue'),
children: [
{
path: 'password',
component: () => import('@/views/profile/password.vue'),
meta: { title: '修改密码' }
path: '',
component: () => import('@/views/home/index.vue'),
meta: { title: '首页', roles: ['PARTICIPANT'] }
},
{
path: 'club',
component: () => import('@/views/club/index.vue'),
meta: { title: '社团中心', roles: ['PARTICIPANT'] }
},
{
path: 'activity',
component: () => import('@/views/activity/index.vue'),
meta: { title: '活动', roles: ['PARTICIPANT'] }
},
{
path: 'notice',
component: () => import('@/views/notice/index.vue'),
meta: { title: '公告', roles: ['PARTICIPANT'] }
}
]
}
@ -66,72 +61,68 @@ export const studentRoutes = [
export const adminRoutes = [
{
path: '/',
component: () => import('@/views/admin/home/index.vue'),
meta: { title: '首页', roles: ['ADMIN', 'COLLEGE_ADMIN', 'CLUB_ADMIN'] }
},
{
path: '/activity',
component: () => import('@/views/admin/activity/index.vue'),
meta: { title: '活动管理', roles: ['ADMIN', 'COLLEGE_ADMIN', 'CLUB_ADMIN'] },
component: () => import('@/layout/admin/index.vue'),
children: [
{
path: 'list',
component: () => import('@/views/admin/activity/list.vue'),
meta: { title: '活动列表' }
path: '',
component: () => import('@/views/admin/home/index.vue'),
meta: { title: '首页', roles: ['ADMIN', 'COLLEGE_ADMIN', 'CLUB_ADMIN'] }
},
{
path: 'add',
component: () => import('@/views/admin/activity/form.vue'),
meta: { title: '新增活动' }
path: 'activity',
component: () => import('@/views/admin/activity/index.vue'),
meta: { title: '活动管理', roles: ['ADMIN', 'COLLEGE_ADMIN', 'CLUB_ADMIN'] },
children: [
{
path: 'list',
component: () => import('@/views/admin/activity/list.vue'),
meta: { title: '活动列表' }
},
{
path: 'add',
component: () => import('@/views/admin/activity/form.vue'),
meta: { title: '新增活动' }
},
{
path: 'edit/:id',
component: () => import('@/views/admin/activity/form.vue'),
meta: { title: '编辑活动' }
}
]
},
{
path: 'edit/:id',
component: () => import('@/views/admin/activity/form.vue'),
meta: { title: '编辑活动' }
}
]
},
{
path: '/club',
component: () => import('@/views/admin/club/index.vue'),
meta: { title: '社团管理', roles: ['ADMIN', 'COLLEGE_ADMIN'] },
children: [
{
path: 'list',
component: () => import('@/views/admin/club/list.vue'),
meta: { title: '社团列表' }
path: 'club',
component: () => import('@/views/admin/club/index.vue'),
meta: { title: '社团管理', roles: ['ADMIN', 'COLLEGE_ADMIN'] },
children: [
{
path: 'list',
component: () => import('@/views/admin/club/list.vue'),
meta: { title: '社团列表' }
},
{
path: 'add',
component: () => import('@/views/admin/club/form.vue'),
meta: { title: '新增社团' }
},
{
path: 'edit/:id',
component: () => import('@/views/admin/club/form.vue'),
meta: { title: '编辑社团' }
}
]
},
{
path: 'member',
component: () => import('@/views/admin/club/member.vue'),
meta: { title: '审批列表' }
},
{
path: 'add',
component: () => import('@/views/admin/club/form.vue'),
meta: { title: '新增社团' }
},
{
path: 'edit/:id',
component: () => import('@/views/admin/club/form.vue'),
meta: { title: '编辑社团' }
}
]
},
{
path: '/user',
component: () => import('@/views/admin/user/index.vue'),
meta: { title: '人员管理', roles: ['ADMIN', 'COLLEGE_ADMIN'] },
children: [
{
path: 'list',
component: () => import('@/views/admin/user/list.vue'),
meta: { title: '成员管理' }
},
{
path: 'password',
component: () => import('@/views/profile/password.vue'),
meta: { title: '修改密码' }
path: 'user',
component: () => import('@/views/admin/user/index.vue'),
meta: { title: '人员管理', roles: ['ADMIN', 'COLLEGE_ADMIN'] },
children: [
{
path: 'password',
component: () => import('@/views/profile/password.vue'),
meta: { title: '修改密码' }
}
]
}
]
}
@ -154,10 +145,21 @@ const getRoutesByRoles = (roles) => {
// 路由守卫
router.beforeEach(async (to, from, next) => {
// 开发环境且配置了跳过认证,直接放行
if (process.env.NODE_ENV === 'development' && config.skipAuth) {
next()
return
}
const token = getToken()
// 白名单路由,不需要登录就可以访问
const whiteList = ['/login', '/forget', '/403', '/404']
if (token) {
// 已登录用户
if (to.path === '/login') {
// 已登录用户访问登录页,重定向到首页
next('/')
} else {
try {
@ -183,14 +185,18 @@ router.beforeEach(async (to, from, next) => {
}
} catch (error) {
console.error('路由解析错误:', error)
// token 解析失败,清除 token 并跳转到登录页
next('/login')
}
}
} else {
if (to.path === '/login') {
// 未登录用户
if (whiteList.includes(to.path)) {
// 访问白名单路由,直接放行
next()
} else {
next('/login')
// 访问其他路由,重定向到登录页
next(`/login?redirect=${to.path}`)
}
}
})

View File

@ -0,0 +1,68 @@
import { defineStore } from 'pinia'
import { getUserInfo } from '@/api/system/user'
import { getToken } from '@/utils/auth'
import config from '@/config'
// 模拟用户数据
const mockUserInfo = {
userId: 1,
name: '测试用户',
username: 'test',
avatar: 'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png',
role: ['PARTICIPANT']
}
export const useUserStore = defineStore('user', {
state: () => ({
userInfo: null,
token: null
}),
getters: {
isLoggedIn: (state) => !!state.token,
userAvatar: (state) => state.userInfo?.avatar || '',
userName: (state) => state.userInfo?.name || ''
},
actions: {
async fetchUserInfo() {
try {
// 开发环境且配置了模拟数据,使用模拟数据
if (process.env.NODE_ENV === 'development' && config.mockData) {
this.userInfo = mockUserInfo
return
}
const res = await getUserInfo()
this.userInfo = res.data
} catch (error) {
console.error('获取用户信息失败:', error)
}
},
setToken(token) {
this.token = token
},
clearUserInfo() {
this.userInfo = null
this.token = null
},
// 初始化用户状态
async initUserState() {
// 开发环境且配置了跳过认证,使用模拟数据
if (process.env.NODE_ENV === 'development' && config.skipAuth) {
this.token = 'mock-token'
this.userInfo = mockUserInfo
return
}
const token = getToken()
if (token) {
this.token = token
await this.fetchUserInfo()
}
}
}
})

View File

@ -1,4 +1,4 @@
import jwtDecode from 'jwt-decode'
import { jwtDecode } from 'jwt-decode'
const TOKEN_KEY = 'token'
const USER_INFO_KEY = 'userInfo'

View File

@ -1,5 +1,5 @@
import { getToken } from '@/utils/auth'
import jwtDecode from 'jwt-decode'
import { jwtDecode } from 'jwt-decode'
/**
* 获取用户角色

View File

@ -0,0 +1,7 @@
<!-- src/views/error/403.vue -->
<template>
<div style="text-align:center; padding:80px">
<h1>403 - 无权限访问</h1>
<p>您没有权限访问此页面</p>
</div>
</template>

View File

@ -0,0 +1,7 @@
<!-- src/views/error/404.vue -->
<template>
<div style="text-align:center; padding:80px">
<h1>404 - 页面未找到</h1>
<p>抱歉页面走丢了</p>
</div>
</template>

View File

@ -104,32 +104,40 @@
</template>
<script setup>
import { ref, onMounted } from 'vue'
import { ref, computed, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import { useUserStore } from '@/stores/user'
import { removeToken } from '@/utils/auth'
import { ElMessage } from 'element-plus'
import { getUserInfo, logout } from '@/api/system/user'
import { getActivityList } from '@/api/activity/activity'
import { getClubList } from '@/api/club/club'
import { Calendar, Location } from '@element-plus/icons-vue'
const router = useRouter()
const activeMenu = ref('/')
const userStore = useUserStore()
const userInfo = ref({
username: '',
avatar: ''
})
//
const activeMenu = computed(() => router.currentRoute.value.path)
//
const userInfo = computed(() => userStore.userInfo)
//
const banners = ref([
{
id: 1,
image: 'https://example.com/banner1.jpg',
link: '/activity/1'
image: '/banner1.jpg',
title: '社团活动展示'
},
{
id: 2,
image: 'https://example.com/banner2.jpg',
link: '/club/2'
image: '/banner2.jpg',
title: '社团招新'
},
{
id: 3,
image: '/banner3.jpg',
title: '社团文化节'
}
])
@ -175,10 +183,6 @@ const latestActivities = ref([
const fetchData = async () => {
try {
//
const userRes = await getUserInfo()
userInfo.value = userRes.data
//
const activityRes = await getActivityList({ page: 1, size: 3 })
latestActivities.value = activityRes.data.records
@ -193,11 +197,11 @@ const fetchData = async () => {
const handleLogout = async () => {
try {
await logout()
ElMessage.success('退出成功')
await userStore.clearUserInfo()
removeToken()
router.push('/login')
} catch (error) {
console.error('退出失败:', error)
console.error('退出登录失败:', error)
}
}
@ -209,8 +213,9 @@ const viewActivityDetail = (activityId) => {
router.push(`/activity/detail/${activityId}`)
}
onMounted(() => {
fetchData()
onMounted(async () => {
await userStore.fetchUserInfo()
await fetchData()
})
</script>

View File

@ -24,7 +24,7 @@
</div>
</div>
<div class="login-right">
<img src="@/assets/login-bg.png" class="bg-image" alt="login-bg" />
<img src="/login-bg.png" class="bg-image" alt="login-bg" />
</div>
</div>
</template>

View File

@ -0,0 +1,488 @@
-- MySQL dump 10.13 Distrib 8.0.41, for Linux (x86_64)
--
-- Host: 127.0.0.1 Database: SAMS
-- ------------------------------------------------------
-- Server version 8.0.41-0ubuntu0.22.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `ams_activity`
--
DROP TABLE IF EXISTS `ams_activity`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ams_activity` (
`act_id` bigint NOT NULL AUTO_INCREMENT COMMENT '活动ID',
`title` varchar(100) NOT NULL COMMENT '活动标题',
`description` text COMMENT '活动描述',
`start_time` datetime NOT NULL COMMENT '开始时间',
`end_time` datetime NOT NULL COMMENT '结束时间',
`location` varchar(255) DEFAULT NULL COMMENT '地点',
`budget` decimal(10,2) DEFAULT '0.00' COMMENT '预算',
`max_participants` int DEFAULT NULL COMMENT '最大参与人数',
`creator_id` bigint NOT NULL COMMENT '创建者ID',
`college_id` bigint DEFAULT NULL COMMENT '所属院系ID',
`club_id` bigint DEFAULT NULL COMMENT '所属社团ID',
`visibility` enum('public','private') DEFAULT 'public' COMMENT '是否公开',
`status` enum('DRAFT','PENDING_CLUB','PENDING_DEPARTMENT','PENDING_COLLEGE','APPROVED','ONGOING','COMPLETED','CANCELLED') DEFAULT 'DRAFT' COMMENT '活动状态',
`created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
`activity_type` enum('COLLEGE','DEPARTMENT','CLUB_INTERNAL','CLUB_EXTERNAL') DEFAULT 'DEPARTMENT' COMMENT '活动类型COLLEGE: 校级, DEPARTMENT: 院级, CLUB_INTERNAL: 社团内部, CLUB_EXTERNAL: 社团外部)',
`current_approver_id` bigint DEFAULT NULL COMMENT '当前审批人ID',
PRIMARY KEY (`act_id`),
KEY `creator_id` (`creator_id`),
KEY `club_id` (`club_id`),
KEY `ams_activity_ibfk_3` (`college_id`),
CONSTRAINT `ams_activity_ibfk_1` FOREIGN KEY (`creator_id`) REFERENCES `sys_user` (`user_id`),
CONSTRAINT `ams_activity_ibfk_2` FOREIGN KEY (`club_id`) REFERENCES `sms_club` (`club_id`),
CONSTRAINT `ams_activity_ibfk_3` FOREIGN KEY (`college_id`) REFERENCES `sms_college` (`college_id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='活动表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ams_activity`
--
LOCK TABLES `ams_activity` WRITE;
/*!40000 ALTER TABLE `ams_activity` DISABLE KEYS */;
/*!40000 ALTER TABLE `ams_activity` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ams_approval`
--
DROP TABLE IF EXISTS `ams_approval`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ams_approval` (
`appr_id` bigint NOT NULL AUTO_INCREMENT COMMENT '审批ID',
`act_id` bigint NOT NULL COMMENT '活动ID',
`user_id` bigint NOT NULL COMMENT '发起者ID',
`approver_id` bigint NOT NULL COMMENT '审批人ID',
`reason` text COMMENT '拒绝原因(如果适用)',
`status` enum('APPROVED','REJECTED','PENDING') DEFAULT 'PENDING' COMMENT '审批状态',
`created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`appr_id`),
KEY `act_id` (`act_id`),
KEY `user_id` (`user_id`),
KEY `approver_id` (`approver_id`),
CONSTRAINT `ams_approval_ibfk_1` FOREIGN KEY (`act_id`) REFERENCES `ams_activity` (`act_id`),
CONSTRAINT `ams_approval_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`user_id`),
CONSTRAINT `ams_approval_ibfk_3` FOREIGN KEY (`approver_id`) REFERENCES `sys_user` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='活动审批表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ams_approval`
--
LOCK TABLES `ams_approval` WRITE;
/*!40000 ALTER TABLE `ams_approval` DISABLE KEYS */;
/*!40000 ALTER TABLE `ams_approval` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ams_comment`
--
DROP TABLE IF EXISTS `ams_comment`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ams_comment` (
`comment_id` bigint NOT NULL AUTO_INCREMENT COMMENT '评论ID',
`user_id` bigint NOT NULL COMMENT '用户ID',
`act_id` bigint NOT NULL COMMENT '活动ID',
`parent_comment_id` bigint DEFAULT NULL COMMENT '父评论ID为空表示是顶级评论',
`content` text NOT NULL COMMENT '评论内容',
`created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '评论时间',
PRIMARY KEY (`comment_id`),
KEY `user_id` (`user_id`),
KEY `act_id` (`act_id`),
KEY `ams_comment_ibfk_3` (`parent_comment_id`),
CONSTRAINT `ams_comment_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`user_id`) ON DELETE CASCADE,
CONSTRAINT `ams_comment_ibfk_2` FOREIGN KEY (`act_id`) REFERENCES `ams_activity` (`act_id`) ON DELETE CASCADE,
CONSTRAINT `ams_comment_ibfk_3` FOREIGN KEY (`parent_comment_id`) REFERENCES `ams_comment` (`comment_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='活动评论表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ams_comment`
--
LOCK TABLES `ams_comment` WRITE;
/*!40000 ALTER TABLE `ams_comment` DISABLE KEYS */;
/*!40000 ALTER TABLE `ams_comment` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ams_reaction`
--
DROP TABLE IF EXISTS `ams_reaction`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ams_reaction` (
`reaction_id` bigint NOT NULL AUTO_INCREMENT COMMENT '点赞/点踩ID',
`user_id` bigint NOT NULL COMMENT '用户ID',
`act_id` bigint NOT NULL COMMENT '活动ID',
`reaction_type` enum('like','dislike') NOT NULL COMMENT '反应类型like: 点赞, dislike: 点踩)',
`created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '反应时间',
PRIMARY KEY (`reaction_id`),
UNIQUE KEY `uniq_user_activity_reaction` (`user_id`,`act_id`),
KEY `act_id` (`act_id`),
CONSTRAINT `ams_reaction_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`user_id`) ON DELETE CASCADE,
CONSTRAINT `ams_reaction_ibfk_2` FOREIGN KEY (`act_id`) REFERENCES `ams_activity` (`act_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='活动点赞/点踩表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ams_reaction`
--
LOCK TABLES `ams_reaction` WRITE;
/*!40000 ALTER TABLE `ams_reaction` DISABLE KEYS */;
/*!40000 ALTER TABLE `ams_reaction` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ams_registration`
--
DROP TABLE IF EXISTS `ams_registration`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ams_registration` (
`reg_id` bigint NOT NULL AUTO_INCREMENT COMMENT '报名ID',
`act_id` bigint NOT NULL COMMENT '活动ID',
`user_id` bigint NOT NULL COMMENT '用户ID',
`role` enum('organizer','participant') DEFAULT 'participant' COMMENT '角色organizer: 组织者, participant: 参与者)',
`status` enum('registered','cancelled','attended','absent') DEFAULT 'registered' COMMENT '报名状态',
`register_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '报名时间',
`attend_time` datetime DEFAULT NULL COMMENT '参与时间',
PRIMARY KEY (`reg_id`),
KEY `act_id` (`act_id`),
KEY `user_id` (`user_id`),
CONSTRAINT `ams_registration_ibfk_1` FOREIGN KEY (`act_id`) REFERENCES `ams_activity` (`act_id`),
CONSTRAINT `ams_registration_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='活动报名表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ams_registration`
--
LOCK TABLES `ams_registration` WRITE;
/*!40000 ALTER TABLE `ams_registration` DISABLE KEYS */;
/*!40000 ALTER TABLE `ams_registration` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `sms_club`
--
DROP TABLE IF EXISTS `sms_club`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `sms_club` (
`club_id` bigint NOT NULL AUTO_INCREMENT COMMENT '社团ID',
`club_name` varchar(50) NOT NULL COMMENT '社团名称',
`description` text COMMENT '社团简介',
`category` enum('文化艺术','学术科技','社会公益','其他') NOT NULL COMMENT '社团类型',
`college_id` bigint NOT NULL COMMENT '所属院系',
`leader_id` bigint DEFAULT NULL COMMENT '负责人ID',
`created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`club_id`),
KEY `college_id` (`college_id`),
KEY `leader_id` (`leader_id`),
CONSTRAINT `sms_club_ibfk_1` FOREIGN KEY (`college_id`) REFERENCES `sms_college` (`college_id`),
CONSTRAINT `sms_club_ibfk_2` FOREIGN KEY (`leader_id`) REFERENCES `sys_user` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='社团表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `sms_club`
--
LOCK TABLES `sms_club` WRITE;
/*!40000 ALTER TABLE `sms_club` DISABLE KEYS */;
INSERT INTO `sms_club` VALUES (1,'编程爱好者协会','学习编程、算法与开发','学术科技',2,2,'2025-02-13 11:43:50'),(2,'篮球社','喜欢打篮球的同学们','其他',3,3,'2025-02-13 11:43:50');
/*!40000 ALTER TABLE `sms_club` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `sms_club_user`
--
DROP TABLE IF EXISTS `sms_club_user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `sms_club_user` (
`suc_id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
`user_id` bigint NOT NULL COMMENT '用户ID',
`club_id` bigint NOT NULL COMMENT '社团ID',
`is_active` tinyint(1) DEFAULT '1' COMMENT '是否活跃',
`join_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '加入日期',
PRIMARY KEY (`suc_id`),
UNIQUE KEY `uniq_user_club` (`user_id`,`club_id`),
KEY `club_id` (`club_id`),
CONSTRAINT `sms_club_user_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`user_id`),
CONSTRAINT `sms_club_user_ibfk_2` FOREIGN KEY (`club_id`) REFERENCES `sms_club` (`club_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='社团用户关系表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `sms_club_user`
--
LOCK TABLES `sms_club_user` WRITE;
/*!40000 ALTER TABLE `sms_club_user` DISABLE KEYS */;
/*!40000 ALTER TABLE `sms_club_user` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `sms_college`
--
DROP TABLE IF EXISTS `sms_college`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `sms_college` (
`college_id` bigint NOT NULL AUTO_INCREMENT COMMENT '院系ID',
`college_name` varchar(255) NOT NULL COMMENT '名称(高校或院系)',
`parent_id` bigint DEFAULT NULL COMMENT '父院系ID高校此值为空',
`email` varchar(50) DEFAULT '' COMMENT '邮箱',
`created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`college_id`),
KEY `parent_id` (`parent_id`),
CONSTRAINT `sms_college_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `sms_college` (`college_id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='高校及院系表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `sms_college`
--
LOCK TABLES `sms_college` WRITE;
/*!40000 ALTER TABLE `sms_college` DISABLE KEYS */;
INSERT INTO `sms_college` VALUES (1,'山东建筑大学',NULL,'contact@sdu.edu.cn','2025-02-13 11:40:45'),(2,'计算机科学与技术学院',1,'cs@sdu.edu.cn','2025-02-13 11:40:45'),(3,'土木工程学院',1,'civil@sdu.edu.cn','2025-02-13 11:40:45'),(4,'管理工程学院',1,'contact4@sdu.edu.cn','2025-02-13 11:51:12'),(5,'热能工程学院',1,'contact5@sdu.edu.cn','2025-02-13 11:51:12'),(6,'市政与环境工程学院',1,'contact6@sdu.edu.cn','2025-02-13 11:51:12'),(7,'机电工程学院',1,'contact7@sdu.edu.cn','2025-02-13 11:51:12'),(8,'理学院',1,'contact8@sdu.edu.cn','2025-02-13 11:51:12'),(9,'商学院',1,'contact9@sdu.edu.cn','2025-02-13 11:51:12'),(10,'交通工程学院',1,'contact10@sdu.edu.cn','2025-02-13 11:51:12'),(11,'艺术学院',1,'contact11@sdu.edu.cn','2025-02-13 11:51:12'),(12,'法学院',1,'contact12@sdu.edu.cn','2025-02-13 11:51:12'),(13,'外国语学院',1,'contact13@sdu.edu.cn','2025-02-13 11:51:12'),(20,'山东大学',NULL,'contact@su.edu.cn','2025-02-13 11:52:27'),(21,'计算机科学与技术学院',2,'cs@sdu.edu.cn','2025-02-13 11:52:48'),(22,'土木工程学院',2,'civil@sdu.edu.cn','2025-02-13 11:52:48'),(23,'管理工程学院',2,'contact4@sdu.edu.cn','2025-02-13 11:52:48'),(24,'热能工程学院',2,'contact5@sdu.edu.cn','2025-02-13 11:52:48'),(25,'市政与环境工程学院',2,'contact6@sdu.edu.cn','2025-02-13 11:52:48'),(26,'机电工程学院',2,'contact7@sdu.edu.cn','2025-02-13 11:52:48'),(27,'理学院',2,'contact8@sdu.edu.cn','2025-02-13 11:52:48'),(28,'商学院',2,'contact9@sdu.edu.cn','2025-02-13 11:52:48'),(29,'交通工程学院',2,'contact10@sdu.edu.cn','2025-02-13 11:52:48'),(30,'艺术学院',2,'contact11@sdu.edu.cn','2025-02-13 11:52:48'),(31,'法学院',2,'contact12@sdu.edu.cn','2025-02-13 11:52:48'),(32,'外国语学院',2,'contact13@sdu.edu.cn','2025-02-13 11:52:48');
/*!40000 ALTER TABLE `sms_college` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `sms_college_leader`
--
DROP TABLE IF EXISTS `sms_college_leader`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `sms_college_leader` (
`college_id` bigint NOT NULL COMMENT '院系ID',
`user_id` bigint NOT NULL COMMENT '负责人ID',
`assigned_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '指派时间',
PRIMARY KEY (`college_id`,`user_id`),
KEY `user_id` (`user_id`),
CONSTRAINT `sms_college_leader_ibfk_1` FOREIGN KEY (`college_id`) REFERENCES `sms_college` (`college_id`) ON DELETE CASCADE,
CONSTRAINT `sms_college_leader_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='院系负责人表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `sms_college_leader`
--
LOCK TABLES `sms_college_leader` WRITE;
/*!40000 ALTER TABLE `sms_college_leader` DISABLE KEYS */;
/*!40000 ALTER TABLE `sms_college_leader` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `sys_file`
--
DROP TABLE IF EXISTS `sys_file`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `sys_file` (
`file_id` bigint NOT NULL AUTO_INCREMENT COMMENT '文件ID',
`file_name` varchar(255) NOT NULL COMMENT '文件名称',
`file_path` varchar(255) NOT NULL COMMENT '存储路径',
`file_type` enum('document','club_image','other') NOT NULL COMMENT '文件类型',
`uploaded_by` bigint NOT NULL COMMENT '上传者ID',
`visibility` enum('public','private') DEFAULT 'private' COMMENT '文件可见性',
`created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '上传时间',
PRIMARY KEY (`file_id`),
KEY `uploaded_by` (`uploaded_by`),
CONSTRAINT `sys_file_ibfk_1` FOREIGN KEY (`uploaded_by`) REFERENCES `sys_user` (`user_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='系统文件表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `sys_file`
--
LOCK TABLES `sys_file` WRITE;
/*!40000 ALTER TABLE `sys_file` DISABLE KEYS */;
/*!40000 ALTER TABLE `sys_file` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `sys_logs`
--
DROP TABLE IF EXISTS `sys_logs`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `sys_logs` (
`log_id` bigint NOT NULL AUTO_INCREMENT COMMENT '日志ID',
`user_id` bigint NOT NULL COMMENT '用户ID',
`action` varchar(255) NOT NULL COMMENT '操作类型',
`description` text COMMENT '描述',
`created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '操作时间',
PRIMARY KEY (`log_id`),
KEY `idx_user_id` (`user_id`),
CONSTRAINT `sys_logs_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='系统日志表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `sys_logs`
--
LOCK TABLES `sys_logs` WRITE;
/*!40000 ALTER TABLE `sys_logs` DISABLE KEYS */;
/*!40000 ALTER TABLE `sys_logs` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `sys_notification`
--
DROP TABLE IF EXISTS `sys_notification`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `sys_notification` (
`notification_id` bigint NOT NULL AUTO_INCREMENT COMMENT '通知ID',
`title` varchar(255) NOT NULL COMMENT '通知标题',
`content` text NOT NULL COMMENT '通知内容',
`receiver_id` bigint NOT NULL COMMENT '接收者ID',
`is_read` tinyint(1) DEFAULT '0' COMMENT '是否已读',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`notification_id`),
KEY `idx_receiver_id` (`receiver_id`),
CONSTRAINT `sys_notification_ibfk_1` FOREIGN KEY (`receiver_id`) REFERENCES `sys_user` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='系统通知表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `sys_notification`
--
LOCK TABLES `sys_notification` WRITE;
/*!40000 ALTER TABLE `sys_notification` DISABLE KEYS */;
/*!40000 ALTER TABLE `sys_notification` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `sys_role`
--
DROP TABLE IF EXISTS `sys_role`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `sys_role` (
`role_id` bigint NOT NULL AUTO_INCREMENT COMMENT '角色ID',
`role_name` varchar(30) NOT NULL COMMENT '角色名称',
`role_key` varchar(64) NOT NULL COMMENT '角色标识',
`role_desc` varchar(255) DEFAULT NULL COMMENT '角色描述',
`status` enum('active','inactive') DEFAULT 'active' COMMENT '状态',
PRIMARY KEY (`role_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户角色表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `sys_role`
--
LOCK TABLES `sys_role` WRITE;
/*!40000 ALTER TABLE `sys_role` DISABLE KEYS */;
INSERT INTO `sys_role` VALUES (0,'系统管理员','ADMIN','最高权限,管理所有用户与活动','active'),(1,'参与者','PARTICIPANT','普通用户,可以报名活动、评论、点赞','active'),(2,'校级管理员','COLLEGE_ADMIN','管理校级活动及院系','active'),(3,'院级管理员','DEPARTMENT_ADMIN','管理院系活动','active'),(4,'社团管理员','CLUB_ADMIN','管理社团活动','active');
/*!40000 ALTER TABLE `sys_role` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `sys_user`
--
DROP TABLE IF EXISTS `sys_user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `sys_user` (
`user_id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户ID',
`nick_name` varchar(30) DEFAULT '' COMMENT '用户昵称',
`user_name` varchar(30) NOT NULL COMMENT '真实姓名',
`password` varchar(100) NOT NULL COMMENT '用户密码',
`school_id` char(12) NOT NULL COMMENT '学号/教职工号',
`college_id` bigint DEFAULT NULL COMMENT '所属院系',
`email` varchar(50) DEFAULT '' COMMENT '用户邮箱',
`avatar` varchar(100) DEFAULT '' COMMENT '头像地址',
`status` enum('active','inactive','banned') DEFAULT 'active' COMMENT '账号状态',
PRIMARY KEY (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='系统用户表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `sys_user`
--
LOCK TABLES `sys_user` WRITE;
/*!40000 ALTER TABLE `sys_user` DISABLE KEYS */;
INSERT INTO `sys_user` VALUES (1,'张三','zhangsan','$2a$10$s.VV5gOYzptj/W8H3bayie4.Hbz0oQdTau0XuuT1TN/HACCOmgUqW','202511110001',2,'zhangsan@example.com','','active'),(2,'李四','lisi','$2a$10$s.VV5gOYzptj/W8H3bayie4.Hbz0oQdTau0XuuT1TN/HACCOmgUqW','202511110002',2,'lisi@example.com','','active'),(3,'王五','wangwu','$2a$10$s.VV5gOYzptj/W8H3bayie4.Hbz0oQdTau0XuuT1TN/HACCOmgUqW','202511110003',2,'wangwu@example.com','','active'),(4,'赵六','zhaoliu','$2a$10$s.VV5gOYzptj/W8H3bayie4.Hbz0oQdTau0XuuT1TN/HACCOmgUqW','202511110004',3,'zhaoliu@example.com','','active'),(6,'用户6','user6','$2a$10$s.VV5gOYzptj/W8H3bayie4.Hbz0oQdTau0XuuT1TN/HACCOmgUqW','202588456301',4,'user6@example.com','','active'),(7,'用户7','user7','$2a$10$s.VV5gOYzptj/W8H3bayie4.Hbz0oQdTau0XuuT1TN/HACCOmgUqW','202598705123',5,'user7@example.com','','active'),(8,'用户8','user8','$2a$10$s.VV5gOYzptj/W8H3bayie4.Hbz0oQdTau0XuuT1TN/HACCOmgUqW','202556098765',6,'user8@example.com','','active'),(9,'用户9','user9','$2a$10$s.VV5gOYzptj/W8H3bayie4.Hbz0oQdTau0XuuT1TN/HACCOmgUqW','202512340987',7,'user9@example.com','','active');
/*!40000 ALTER TABLE `sys_user` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `sys_user_role`
--
DROP TABLE IF EXISTS `sys_user_role`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `sys_user_role` (
`user_id` bigint NOT NULL COMMENT '用户ID',
`role_id` bigint NOT NULL COMMENT '角色ID',
PRIMARY KEY (`user_id`,`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户和角色关联表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `sys_user_role`
--
LOCK TABLES `sys_user_role` WRITE;
/*!40000 ALTER TABLE `sys_user_role` DISABLE KEYS */;
INSERT INTO `sys_user_role` VALUES (1,0),(2,2),(3,3),(3,4),(4,4),(6,1),(7,1),(8,1),(9,1);
/*!40000 ALTER TABLE `sys_user_role` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2025-03-25 18:57:08