优化: 修复安全隐患、路由权限、环境变量、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

@@ -108,7 +108,7 @@
</div>
<div class="form-footer">
<p>© 2024 彩票推测系统 - 后台管理</p>
<p>© 2025-2026 彩票推测系统 - 后台管理</p>
</div>
</div>
</div>

View File

@@ -33,7 +33,7 @@
<el-card class="table-card">
<el-table :data="tableData" style="width: 100%" v-loading="loading" border stripe>
<el-table-column prop="id" label="ID" width="80" />
<el-table-column prop="userId" label="用户ID" width="100" />
<el-table-column prop="userId" label="用户ID" width="180" />
<el-table-column prop="drawId" label="期号" width="100" />
<el-table-column label="前区号码" min-width="180">
<template #default="scope">

View File

@@ -31,7 +31,7 @@
<el-card class="table-card">
<el-table :data="tableData" style="width: 100%" v-loading="loading" border stripe>
<el-table-column prop="id" label="ID" width="80" />
<el-table-column prop="userId" label="用户ID" width="100" />
<el-table-column prop="userId" label="用户ID" width="180" />
<el-table-column prop="drawId" label="期号" width="100" />
<el-table-column label="前区号码" min-width="180">
<template #default="scope">

View File

@@ -30,7 +30,7 @@
<el-card class="table-card">
<el-table :data="tableData" style="width: 100%" v-loading="loading" border stripe>
<el-table-column prop="id" label="ID" width="80" />
<el-table-column prop="userId" label="用户ID" width="100" />
<el-table-column prop="userId" label="用户ID" width="180" />
<el-table-column prop="drawId" label="期号" width="100" />
<el-table-column label="红球" min-width="200">
<template #default="scope">

View File

@@ -28,7 +28,7 @@
<el-card class="table-card">
<el-table :data="tableData" style="width: 100%" v-loading="loading" border stripe>
<el-table-column prop="id" label="ID" width="80" />
<el-table-column prop="userId" label="用户ID" width="100" />
<el-table-column prop="userId" label="用户ID" width="180" />
<el-table-column prop="drawId" label="期号" width="100" />
<el-table-column label="红球" min-width="200">
<template #default="scope">

View File

@@ -320,9 +320,23 @@
{{ currentUserDetail.isVip === 1 ? '是' : '否' }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="套餐类别">
<el-tag :type="getVipTypeTag(currentUserDetail.vipType)">
{{ currentUserDetail.vipType || '体验会员' }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="VIP到期时间">
{{ currentUserDetail.vipExpire ? formatDate(currentUserDetail.vipExpire) : '-' }}
</el-descriptions-item>
<el-descriptions-item label="所在省市">
{{ currentUserDetail.location || '-' }}
</el-descriptions-item>
<el-descriptions-item label="彩票偏好">
{{ currentUserDetail.preference || '-' }}
</el-descriptions-item>
<el-descriptions-item label="获客渠道">
{{ currentUserDetail.channel || '-' }}
</el-descriptions-item>
<el-descriptions-item label="注册时间" :span="2">
{{ formatDate(currentUserDetail.createTime) }}
</el-descriptions-item>
@@ -958,6 +972,16 @@ export default {
return (rate * 100).toFixed(2) + '%'
}
// 获取会员类型标签颜色
const getVipTypeTag = (vipType) => {
const typeMap = {
'年度会员': 'warning',
'月度会员': 'primary',
'体验会员': 'info'
}
return typeMap[vipType] || 'info'
}
return {
searchForm,
userList,
@@ -999,7 +1023,8 @@ export default {
usageStatsDialogVisible,
usageStatsLoading,
usageStats,
formatHitRate
formatHitRate,
getVipTypeTag
}
}
}

View File

@@ -178,6 +178,10 @@
<el-icon><List /></el-icon>
<span>会员码列表</span>
<div class="header-actions">
<el-button type="success" @click="exportToExcel">
<el-icon><Download /></el-icon>
导出
</el-button>
<el-button type="primary" @click="refreshList">
<el-icon><Refresh /></el-icon>
刷新
@@ -755,6 +759,70 @@ export default {
return date.toLocaleString('zh-CN')
}
// 导出到Excel
const exportToExcel = async () => {
try {
tableLoading.value = true
// 获取所有数据(不分页)
const params = {
page: 1,
size: 10000, // 获取所有数据
...searchForm
}
const response = await lotteryApi.getVipCodeList(params)
if (response && response.success) {
const allData = response.data.records || []
if (allData.length === 0) {
ElMessage.warning('没有数据可以导出')
return
}
// 准备CSV数据
const headers = ['VIP编号', '会员码', '有效期', '状态', '创建人', '创建时间', '使用人ID', '使用时间']
const csvContent = [
headers.join(','),
...allData.map(row => [
row.vipNumber || 1,
row.code,
`${row.vipExpireTime}个月`,
row.isUse === 0 ? '可用' : '已使用',
row.createdUserName || '-',
formatDate(row.createTime),
row.usedUserName || '-',
row.updateTime ? formatDate(row.updateTime) : '-'
].join(','))
].join('\n')
// 添加BOM以支持中文
const BOM = '\uFEFF'
const blob = new Blob([BOM + csvContent], { type: 'text/csv;charset=utf-8;' })
// 创建下载链接
const link = document.createElement('a')
const url = URL.createObjectURL(blob)
link.setAttribute('href', url)
link.setAttribute('download', `会员码列表_${new Date().toLocaleDateString('zh-CN').replace(/\//g, '-')}.csv`)
link.style.visibility = 'hidden'
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
ElMessage.success(`成功导出 ${allData.length} 条数据`)
} else {
ElMessage.error(response?.message || '导出失败')
}
} catch (error) {
console.error('导出失败:', error)
ElMessage.error('导出失败,请重试')
} finally {
tableLoading.value = false
}
}
// 验证表单
const validateGenerateForm = () => {
generateFormRef.value?.validateField('vipExpireTime')
@@ -800,7 +868,8 @@ export default {
confirmActionLoading,
confirmGenerateVipCodes,
confirmGetAvailableCode,
cancelDialog
cancelDialog,
exportToExcel
}
}
}