优化: 修复安全隐患、路由权限、环境变量、CSS问题,新增组件,清理无用文件

This commit is contained in:
lihanqi
2026-02-13 18:15:46 +08:00
parent 492d839e9b
commit ca0e2f9370
38 changed files with 1992 additions and 1293 deletions

View File

@@ -2,8 +2,7 @@ import axios from 'axios'
// 创建axios实例
const api = axios.create({
// baseURL: 'http://localhost:8123/api',
baseURL: 'https://www.yicaishuzhi.com/api',
baseURL: import.meta.env.VITE_API_BASE_URL,
timeout: 300000, // 5分钟超时时间300秒
withCredentials: true, // 关键支持跨域携带cookie和session
headers: {
@@ -142,6 +141,32 @@ export const lotteryApi = {
return api.get('/user/get/login')
},
// 获取用户信息(用于编辑)
getUserInfo() {
return api.get('/user/get/login')
},
// 更新用户信息
updateUserInfo(userInfo) {
console.log('调用更新用户信息接口:', userInfo)
return api.post('/user/update', userInfo, {
headers: {
'Content-Type': 'application/json'
}
})
},
// 上传文件
uploadFile(file) {
const formData = new FormData()
formData.append('file', file)
return api.post('/file/upload', formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
})
},
// 获取用户统计信息总用户数和VIP用户数
getUserCount() {
return api.get('/user/count')
@@ -489,33 +514,11 @@ export const lotteryApi = {
return api.get(`/operation-history/user/${userId}/module/${operationModule}`)
},
// 管理员登录
// 管理员登录(复用用户登录接口,后台会根据角色判断权限)
adminLogin(username, password) {
// 模拟API请求实际项目中应该调用真实的后端API
return new Promise((resolve) => {
setTimeout(() => {
// 模拟验证管理员账号密码
if (username === 'admin' && password === '123456') {
resolve({
success: true,
data: {
id: 1,
userName: '系统管理员',
userAccount: 'admin',
userRole: 'admin',
avatar: null,
createTime: new Date().toISOString()
},
message: '登录成功'
})
} else {
resolve({
success: false,
data: null,
message: '账号或密码错误'
})
}
}, 1000) // 模拟网络延迟
return api.post('/user/login', {
userAccount: username,
userPassword: password
})
},