优化: 修复安全隐患、路由权限、环境变量、CSS问题,新增组件,清理无用文件
This commit is contained in:
@@ -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
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user