feat(web): 迁移前端源代码(任务 T4.1)
- 删除 novalon 前端 src/ 下所有文件 - 从 gym-manage 复制前端 src/ 完整目录树 - 替换 gym-manage-api → novalon-manage-api - 替换 gym_system → manage_system - 无 gym 残留引用
This commit is contained in:
@@ -154,15 +154,21 @@ const handleDelete = async (row: any) => {
|
||||
|
||||
const handleModalOk = async () => {
|
||||
try {
|
||||
console.log('handleModalOk called, formState:', formState)
|
||||
if (formState.id) {
|
||||
await request.put(`/config/${formState.id}`, formState)
|
||||
console.log('Sending PUT request to /config/' + formState.id)
|
||||
const response = await request.put(`/config/${formState.id}`, formState)
|
||||
console.log('PUT response:', response)
|
||||
} else {
|
||||
await request.post('/config', formState)
|
||||
console.log('Sending POST request to /config')
|
||||
const response = await request.post('/config', formState)
|
||||
console.log('POST response:', response)
|
||||
}
|
||||
ElMessage.success('操作成功')
|
||||
modalVisible.value = false
|
||||
fetchData()
|
||||
} catch {
|
||||
} catch (error) {
|
||||
console.error('handleModalOk error:', error)
|
||||
ElMessage.error('操作失败')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ const handleDelete = async (row: any) => {
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
await request.delete(`/dict/${row.id}`)
|
||||
await request.delete(`/dict/types/${row.id}`)
|
||||
ElMessage.success('删除成功')
|
||||
fetchData()
|
||||
} catch (error) {
|
||||
|
||||
@@ -199,10 +199,10 @@ const fetchStats = async () => {
|
||||
request.get('/logs/operation/count')
|
||||
])
|
||||
|
||||
stats.userCount = userCountRes.status === 'fulfilled' ? (userCountRes.value || 0) : 0
|
||||
stats.roleCount = roleCountRes.status === 'fulfilled' ? (roleCountRes.value || 0) : 0
|
||||
stats.todayLogin = todayLoginRes.status === 'fulfilled' ? (todayLoginRes.value || 0) : 0
|
||||
stats.operationLog = operationLogRes.status === 'fulfilled' ? (operationLogRes.value || 0) : 0
|
||||
stats.userCount = userCountRes.status === 'fulfilled' ? Number(userCountRes.value || 0) : 0
|
||||
stats.roleCount = roleCountRes.status === 'fulfilled' ? Number(roleCountRes.value || 0) : 0
|
||||
stats.todayLogin = todayLoginRes.status === 'fulfilled' ? Number(todayLoginRes.value || 0) : 0
|
||||
stats.operationLog = operationLogRes.status === 'fulfilled' ? Number(operationLogRes.value || 0) : 0
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch stats:', error)
|
||||
} finally {
|
||||
|
||||
@@ -79,9 +79,12 @@ interface JwtPayload {
|
||||
const onFinish = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
console.log('开始登录请求...')
|
||||
const res: any = await request.post('/auth/login', formState)
|
||||
console.log('登录响应:', res)
|
||||
|
||||
if (!res || !res.token) {
|
||||
console.error('登录失败:未收到有效响应')
|
||||
ElMessage.error('登录失败:未收到有效响应')
|
||||
return
|
||||
}
|
||||
@@ -103,15 +106,19 @@ const onFinish = async () => {
|
||||
console.warn('解析Token中的角色信息失败:', decodeError)
|
||||
}
|
||||
|
||||
console.log('开始获取用户菜单...')
|
||||
try {
|
||||
await permissionStore.fetchUserMenus()
|
||||
console.log('获取用户菜单成功')
|
||||
} catch (menuError) {
|
||||
console.error('获取用户菜单失败:', menuError)
|
||||
}
|
||||
|
||||
ElMessage.success('登录成功')
|
||||
console.log('准备跳转到首页...')
|
||||
|
||||
await router.push('/')
|
||||
console.log('跳转完成')
|
||||
} catch (error: any) {
|
||||
console.error('登录错误:', error)
|
||||
ElMessage.error(error.response?.data?.message || error.message || '登录失败')
|
||||
|
||||
@@ -279,10 +279,10 @@ const fetchData = async () => {
|
||||
size: pagination.pageSize,
|
||||
sortBy: sortInfo.sortBy,
|
||||
sortOrder: sortInfo.sortOrder,
|
||||
name: searchKeyword.value || undefined
|
||||
roleName: searchKeyword.value || undefined
|
||||
})
|
||||
dataSource.value = res.content
|
||||
pagination.total = res.totalElements
|
||||
pagination.total = Number(res.totalElements) || 0
|
||||
} catch (error) {
|
||||
handleApiError(error)
|
||||
} finally {
|
||||
|
||||
@@ -226,7 +226,7 @@ import { Search } from '@element-plus/icons-vue'
|
||||
import { userApi, type User, type CreateUserRequest, type UpdateUserRequest } from '@/api/user.api'
|
||||
import { roleApi, type Role } from '@/api/role.api'
|
||||
import { handleApiError } from '@/utils/errorHandler'
|
||||
import { UserStatus, StatusHelper } from '@/constants/status'
|
||||
import { UserStatus } from '@/constants/status'
|
||||
import { formatDateTime } from '@/utils/dateFormat'
|
||||
|
||||
const loading = ref(false)
|
||||
@@ -279,9 +279,9 @@ const formRules = {
|
||||
}
|
||||
|
||||
const roleDialogVisible = ref(false)
|
||||
const selectedRoles = ref<number[]>([])
|
||||
const allRoles = ref<{ key: number; label: string }[]>([])
|
||||
const currentUserId = ref<number | null>(null)
|
||||
const selectedRoles = ref<string[]>([])
|
||||
const allRoles = ref<{ key: string; label: string }[]>([])
|
||||
const currentUserId = ref<string | null>(null)
|
||||
|
||||
const fetchData = async () => {
|
||||
loading.value = true
|
||||
@@ -294,7 +294,7 @@ const fetchData = async () => {
|
||||
keyword: searchKeyword.value || undefined
|
||||
})
|
||||
dataSource.value = res.content
|
||||
pagination.total = res.totalElements
|
||||
pagination.total = Number(res.totalElements) || 0
|
||||
} catch (error) {
|
||||
handleApiError(error)
|
||||
} finally {
|
||||
@@ -433,6 +433,7 @@ const handleAssignRolesOk = async () => {
|
||||
roleDialogVisible.value = false
|
||||
fetchData()
|
||||
} catch (error) {
|
||||
roleDialogVisible.value = false
|
||||
handleApiError(error)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user