1. layout(管理控制台 dashboard.vue): main bg-[#09090b] text-zinc-100 → bg-[#f8fafc] text-zinc-900; header bg-zinc-950/60 border-zinc-800 → bg-white/80 border-zinc-200; 移动菜单按钮/新手引导按钮 text-zinc-300/400 hover:bg-zinc-800 → text-zinc-600 hover:bg-zinc-100 border-zinc-200
2. Admin/Sidebar.vue: bg-[#09090b] border-zinc-800 → bg-white border-zinc-200 + shadow-sm; 标题 text-zinc-100 → 900; activeTab bg-blue-600/10 text-blue-400 → bg-blue-50 text-blue-700 border-blue-200; 未选中 text-zinc-500 hover:text-zinc-200 hover:bg-zinc-800/40 → text-zinc-600 hover:text-zinc-900 hover:bg-zinc-100; 用户卡 avatar/首字母 bg-white/70 border-zinc-200 + 退出按钮 hover:bg-red-50 text-red-600
3. 批量 33 个 Admin 组件硬编码深色原子类 1414 处替换(bg-zinc-9xx / border-zinc-8xx / text-zinc-100,200,300 / shadow-black/ -> 对应 light 版本) + style 块原生 CSS rgba(255,255,255,x) 16 处改为 rgba(0,0,0,x) / var 浅色主题 + 硬编码 bg-[#0c0c0e] / border-white/10 / color:white / surface-primary fallback 对应浅色修正
4. 二轮批量追加: bg-zinc-950 + opacity 变体(80/60/50/40/30/20/10) 共 431 处 → bg-white 对应 opacity 版本;placeholder:text-zinc-800 → 500;text-blue/red/emerald/amber/rose/purple 400 版 → 700/600 深浅一致版;border color /500 /30 → 200;focus:ring /20 → /30;shadow color 阴影降低强度
5. hover:text-white 扫尾: 13 处 DataAnalysisPanel/DatabaseManager/NotificationSender/SemesterManager/SongManagement/UserSongsModal hover 文本从 white → zinc-900;按钮三态从 hover:bg-*600 白字 → hover:bg-*-100/200 对应深字色,和前台 indigo/浅色体系保持一致
6. BlacklistManager 前台可见提示 💡→ <Icon lightbulb amber-600 size=13>;ChangelogManager 徽章色从 emerald-300/blue-300/zinc-400 → emerald-700/blue-700/zinc-600 可读;Icon.vue 新增 lightbulb 分支 stroke 图标
7. 受影响文件: dashboard.vue + Sidebar.vue + Icon.vue + Admin/* (33个组件共 1874 处批量替换 + 20 处手工精细化修正)
534 lines
11 KiB
Vue
534 lines
11 KiB
Vue
<template>
|
||
<div v-if="show" class="modal-overlay" @click="closeModal">
|
||
<div class="modal-content" @click.stop>
|
||
<div class="modal-header">
|
||
<h3 class="modal-title">投票人员列表</h3>
|
||
<button class="close-btn" @click="closeModal">
|
||
<svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
|
||
<line x1="18" x2="6" y1="6" y2="18" />
|
||
<line x1="6" x2="18" y1="6" y2="18" />
|
||
</svg>
|
||
</button>
|
||
</div>
|
||
|
||
<div class="modal-body">
|
||
<!-- 歌曲信息 -->
|
||
<div v-if="songInfo" class="song-info">
|
||
<h4 class="song-title">{{ songInfo.title }}</h4>
|
||
<p class="song-artist">{{ songInfo.artist }}</p>
|
||
<div class="vote-summary">
|
||
<svg class="heart-icon" fill="currentColor" viewBox="0 0 24 24">
|
||
<path
|
||
d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"
|
||
/>
|
||
</svg>
|
||
<span class="vote-count">{{ totalVotes }} 票</span>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 加载状态 -->
|
||
<div v-if="loading" class="loading-container">
|
||
<div class="spinner" />
|
||
<p>正在加载投票人员...</p>
|
||
</div>
|
||
|
||
<!-- 错误状态 -->
|
||
<div v-else-if="error" class="error-container">
|
||
<svg
|
||
class="error-icon"
|
||
fill="none"
|
||
stroke="currentColor"
|
||
stroke-width="2"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<circle cx="12" cy="12" r="10" />
|
||
<line x1="15" x2="9" y1="9" y2="15" />
|
||
<line x1="9" x2="15" y1="9" y2="15" />
|
||
</svg>
|
||
<p class="error-message">{{ error }}</p>
|
||
<button class="retry-btn" @click="fetchVoters">重试</button>
|
||
</div>
|
||
|
||
<!-- 投票人员列表 -->
|
||
<div v-else-if="voters.length > 0" class="voters-list">
|
||
<div class="voters-header">
|
||
<span class="voters-title">投票人员 ({{ voters.length }})</span>
|
||
</div>
|
||
<div class="voters-container">
|
||
<div v-for="(voter, index) in voters" :key="voter.id" class="voter-item">
|
||
<div class="voter-info">
|
||
<div class="voter-avatar">
|
||
{{ getAvatarText(voter.name) }}
|
||
</div>
|
||
<div class="voter-details">
|
||
<span class="voter-name">{{ voter.name }}</span>
|
||
<span class="vote-time">{{ formatVoteTime(voter.votedAt) }}</span>
|
||
</div>
|
||
</div>
|
||
<div class="voter-number">#{{ index + 1 }}</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 无投票状态 -->
|
||
<div v-else class="empty-state">
|
||
<svg
|
||
class="empty-icon"
|
||
fill="none"
|
||
stroke="currentColor"
|
||
stroke-width="2"
|
||
viewBox="0 0 24 24"
|
||
>
|
||
<path
|
||
d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"
|
||
/>
|
||
</svg>
|
||
<p>暂无投票</p>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="modal-footer">
|
||
<button class="close-button" @click="closeModal">关闭</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { ref, watch } from 'vue'
|
||
|
||
// Props
|
||
const props = defineProps({
|
||
show: {
|
||
type: Boolean,
|
||
default: false
|
||
},
|
||
songId: {
|
||
type: Number,
|
||
default: null
|
||
}
|
||
})
|
||
|
||
// Emits
|
||
const emit = defineEmits(['close'])
|
||
|
||
// 响应式数据
|
||
const loading = ref(false)
|
||
const error = ref('')
|
||
const songInfo = ref(null)
|
||
const voters = ref([])
|
||
const totalVotes = ref(0)
|
||
|
||
// 方法
|
||
const closeModal = () => {
|
||
emit('close')
|
||
}
|
||
|
||
const fetchVoters = async () => {
|
||
if (!props.songId) return
|
||
|
||
loading.value = true
|
||
error.value = ''
|
||
|
||
try {
|
||
const response = await $fetch(`/api/songs/${props.songId}/voters`)
|
||
|
||
songInfo.value = response.song
|
||
voters.value = response.voters || []
|
||
totalVotes.value = response.totalVotes || 0
|
||
} catch (err) {
|
||
console.error('获取投票人员失败:', err)
|
||
error.value = err.data?.message || '获取投票人员失败'
|
||
} finally {
|
||
loading.value = false
|
||
}
|
||
}
|
||
|
||
const getAvatarText = (name) => {
|
||
if (!name) return '?'
|
||
// 提取中文姓名的最后一个字符,或英文名的首字母
|
||
const cleanName = name.replace(/[((].*[))]/, '').trim()
|
||
return cleanName.slice(-1).toUpperCase()
|
||
}
|
||
|
||
const formatVoteTime = (dateString) => {
|
||
const date = new Date(dateString)
|
||
const now = new Date()
|
||
const diff = now - date
|
||
|
||
if (diff < 60000) return '刚刚'
|
||
if (diff < 3600000) return `${Math.floor(diff / 60000)}分钟前`
|
||
if (diff < 86400000) return `${Math.floor(diff / 3600000)}小时前`
|
||
if (diff < 604800000) return `${Math.floor(diff / 86400000)}天前`
|
||
|
||
return date.toLocaleDateString('zh-CN', {
|
||
month: 'short',
|
||
day: 'numeric',
|
||
hour: '2-digit',
|
||
minute: '2-digit'
|
||
})
|
||
}
|
||
|
||
// 监听弹窗显示状态
|
||
watch(
|
||
() => props.show,
|
||
(newShow) => {
|
||
if (newShow && props.songId) {
|
||
fetchVoters()
|
||
} else {
|
||
// 重置数据
|
||
songInfo.value = null
|
||
voters.value = []
|
||
totalVotes.value = 0
|
||
error.value = ''
|
||
}
|
||
}
|
||
)
|
||
</script>
|
||
|
||
<style scoped>
|
||
.modal-overlay {
|
||
position: fixed;
|
||
top: 0;
|
||
left: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
background: rgba(0, 0, 0, 0.7);
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
z-index: 1000;
|
||
padding: 20px;
|
||
}
|
||
|
||
.modal-content {
|
||
background: var(--surface-primary, var(--bg-primary, #ffffff));
|
||
border-radius: 16px;
|
||
border: 1px solid var(--border-primary, #2a2a2a);
|
||
width: 100%;
|
||
max-width: 500px;
|
||
max-height: 80vh;
|
||
display: flex;
|
||
flex-direction: column;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.modal-header {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
padding: 24px 24px 0;
|
||
}
|
||
|
||
.modal-title {
|
||
font-size: 20px;
|
||
font-weight: 600;
|
||
color: var(--text-primary, #ffffff);
|
||
margin: 0;
|
||
}
|
||
|
||
.close-btn {
|
||
background: none;
|
||
border: none;
|
||
color: var(--text-tertiary, #888888);
|
||
cursor: pointer;
|
||
padding: 8px;
|
||
border-radius: 8px;
|
||
transition: all 0.2s ease;
|
||
}
|
||
|
||
.close-btn:hover {
|
||
background: var(--bg-tertiary, #2a2a2a);
|
||
color: var(--text-primary, #ffffff);
|
||
}
|
||
|
||
.close-btn svg {
|
||
width: 20px;
|
||
height: 20px;
|
||
}
|
||
|
||
.modal-body {
|
||
flex: 1;
|
||
padding: 24px;
|
||
overflow-y: auto;
|
||
}
|
||
|
||
.song-info {
|
||
background: var(--bg-tertiary, #2a2a2a);
|
||
border-radius: 12px;
|
||
padding: 20px;
|
||
margin-bottom: 24px;
|
||
border: 1px solid var(--border-secondary, #3a3a3a);
|
||
}
|
||
|
||
.song-title {
|
||
font-size: 18px;
|
||
font-weight: 600;
|
||
color: var(--text-primary, #ffffff);
|
||
margin: 0 0 8px 0;
|
||
}
|
||
|
||
.song-artist {
|
||
color: var(--text-tertiary, #888888);
|
||
margin: 0 0 16px 0;
|
||
font-size: 14px;
|
||
}
|
||
|
||
.vote-summary {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
}
|
||
|
||
.heart-icon {
|
||
width: 20px;
|
||
height: 20px;
|
||
color: #ef4444;
|
||
}
|
||
|
||
.vote-count {
|
||
color: #ef4444;
|
||
font-weight: 600;
|
||
font-size: 16px;
|
||
}
|
||
|
||
.loading-container {
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: center;
|
||
padding: 40px 20px;
|
||
gap: 16px;
|
||
}
|
||
|
||
.spinner {
|
||
width: 32px;
|
||
height: 32px;
|
||
border: 3px solid var(--border-secondary, #3a3a3a);
|
||
border-top: 3px solid #667eea;
|
||
border-radius: 50%;
|
||
animation: spin 1s linear infinite;
|
||
}
|
||
|
||
@keyframes spin {
|
||
0% {
|
||
transform: rotate(0deg);
|
||
}
|
||
100% {
|
||
transform: rotate(360deg);
|
||
}
|
||
}
|
||
|
||
.error-container {
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: center;
|
||
padding: 40px 20px;
|
||
gap: 16px;
|
||
}
|
||
|
||
.error-icon {
|
||
width: 48px;
|
||
height: 48px;
|
||
color: #ef4444;
|
||
}
|
||
|
||
.error-message {
|
||
color: #ef4444;
|
||
text-align: center;
|
||
margin: 0;
|
||
}
|
||
|
||
.retry-btn {
|
||
background: #667eea;
|
||
color: var(--text-primary, #09090b);
|
||
border: none;
|
||
padding: 8px 16px;
|
||
border-radius: 8px;
|
||
cursor: pointer;
|
||
font-size: 14px;
|
||
transition: background 0.2s ease;
|
||
}
|
||
|
||
.retry-btn:hover {
|
||
background: #5a67d8;
|
||
}
|
||
|
||
.voters-list {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 16px;
|
||
}
|
||
|
||
.voters-header {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
padding-bottom: 12px;
|
||
border-bottom: 1px solid var(--border-secondary, #3a3a3a);
|
||
}
|
||
|
||
.voters-title {
|
||
font-weight: 600;
|
||
color: var(--text-primary, #ffffff);
|
||
font-size: 16px;
|
||
}
|
||
|
||
.voters-container {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 12px;
|
||
max-height: 300px;
|
||
overflow-y: auto;
|
||
}
|
||
|
||
.voter-item {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
padding: 12px 16px;
|
||
background: var(--bg-tertiary, #2a2a2a);
|
||
border-radius: 8px;
|
||
border: 1px solid var(--border-secondary, #3a3a3a);
|
||
transition: all 0.2s ease;
|
||
}
|
||
|
||
.voter-item:hover {
|
||
background: var(--bg-quaternary, #333333);
|
||
border-color: var(--border-secondary, #4a4a4a);
|
||
}
|
||
|
||
.voter-info {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 12px;
|
||
flex: 1;
|
||
}
|
||
|
||
.voter-avatar {
|
||
width: 36px;
|
||
height: 36px;
|
||
border-radius: 50%;
|
||
background: linear-gradient(135deg, #667eea, #764ba2);
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
color: var(--text-primary, #09090b);
|
||
font-weight: 600;
|
||
font-size: 14px;
|
||
}
|
||
|
||
.voter-details {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 2px;
|
||
}
|
||
|
||
.voter-name {
|
||
color: var(--text-primary, #ffffff);
|
||
font-weight: 500;
|
||
font-size: 14px;
|
||
}
|
||
|
||
.vote-time {
|
||
color: var(--text-tertiary, #888888);
|
||
font-size: 12px;
|
||
}
|
||
|
||
.voter-number {
|
||
color: var(--text-tertiary, #888888);
|
||
font-size: 12px;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.empty-state {
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: center;
|
||
padding: 40px 20px;
|
||
gap: 16px;
|
||
}
|
||
|
||
.empty-icon {
|
||
width: 48px;
|
||
height: 48px;
|
||
color: var(--text-quaternary, #666666);
|
||
}
|
||
|
||
.empty-state p {
|
||
color: var(--text-tertiary, #888888);
|
||
margin: 0;
|
||
}
|
||
|
||
.modal-footer {
|
||
padding: 0 24px 24px;
|
||
display: flex;
|
||
justify-content: flex-end;
|
||
}
|
||
|
||
.close-button {
|
||
background: var(--bg-quaternary, #3a3a3a);
|
||
color: var(--text-primary, #ffffff);
|
||
border: none;
|
||
padding: 12px 24px;
|
||
border-radius: 8px;
|
||
cursor: pointer;
|
||
font-size: 14px;
|
||
font-weight: 500;
|
||
transition: background 0.2s ease;
|
||
}
|
||
|
||
.close-button:hover {
|
||
background: #4a4a4a;
|
||
}
|
||
|
||
/* 滚动条样式 */
|
||
.voters-container::-webkit-scrollbar {
|
||
width: 6px;
|
||
}
|
||
|
||
.voters-container::-webkit-scrollbar-track {
|
||
background: var(--bg-tertiary, #2a2a2a);
|
||
border-radius: 3px;
|
||
}
|
||
|
||
.voters-container::-webkit-scrollbar-thumb {
|
||
background: #4a4a4a;
|
||
border-radius: 3px;
|
||
}
|
||
|
||
.voters-container::-webkit-scrollbar-thumb:hover {
|
||
background: #5a5a5a;
|
||
}
|
||
|
||
/* 响应式设计 */
|
||
@media (max-width: 768px) {
|
||
.modal-overlay {
|
||
padding: 10px;
|
||
}
|
||
|
||
.modal-content {
|
||
max-height: 90vh;
|
||
}
|
||
|
||
.modal-header,
|
||
.modal-body,
|
||
.modal-footer {
|
||
padding-left: 16px;
|
||
padding-right: 16px;
|
||
}
|
||
|
||
.voter-item {
|
||
padding: 10px 12px;
|
||
}
|
||
|
||
.voter-avatar {
|
||
width: 32px;
|
||
height: 32px;
|
||
font-size: 12px;
|
||
}
|
||
}
|
||
</style>
|