collabdocchat 2.5.8 → 2.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{index-DkEWw6lP.js → index-Dkrhl719.js} +96 -96
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/scripts/cleanup-scripts.js +2 -0
- package/scripts/fix-startup-issues.js +2 -0
- package/scripts/start-simple.js +2 -0
- package/server/public/index.html +2 -0
- package/src/pages/admin-dashboard.js +25 -6
- package/src/pages/user-dashboard.js +6 -2
package/dist/index.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>CollabDocChat - 协作文档聊天平台</title>
|
|
7
7
|
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
|
|
8
8
|
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-Dkrhl719.js"></script>
|
|
10
10
|
<link rel="stylesheet" crossorigin href="/assets/index-D8ZqeoaM.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
package/package.json
CHANGED
package/scripts/start-simple.js
CHANGED
|
@@ -1351,20 +1351,39 @@ export function renderAdminDashboard(user, wsService) {
|
|
|
1351
1351
|
<h3 style="margin-bottom: 16px;">投票选项</h3>
|
|
1352
1352
|
${poll.options.map((option, index) => {
|
|
1353
1353
|
const percentage = totalVotes > 0 ? (option.votes.length / totalVotes * 100).toFixed(1) : 0;
|
|
1354
|
+
|
|
1355
|
+
// 获取投票者列表
|
|
1356
|
+
let votersList = '';
|
|
1357
|
+
if (!poll.anonymous && option.votes.length > 0) {
|
|
1358
|
+
const voters = option.votes.map(v => {
|
|
1359
|
+
// 处理不同的数据结构
|
|
1360
|
+
if (typeof v === 'object' && v.username) {
|
|
1361
|
+
return v.username;
|
|
1362
|
+
} else if (typeof v === 'object' && v.user && v.user.username) {
|
|
1363
|
+
return v.user.username;
|
|
1364
|
+
}
|
|
1365
|
+
return '未知用户';
|
|
1366
|
+
}).filter(name => name !== '未知用户');
|
|
1367
|
+
|
|
1368
|
+
if (voters.length > 0) {
|
|
1369
|
+
votersList = `
|
|
1370
|
+
<div style="font-size: 13px; color: var(--text-secondary); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border);">
|
|
1371
|
+
<strong style="color: var(--text-primary);">👥 投票者:</strong> ${voters.join(', ')}
|
|
1372
|
+
</div>
|
|
1373
|
+
`;
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1354
1377
|
return `
|
|
1355
1378
|
<div style="margin-bottom: 16px; padding: 16px; background: var(--bg-tertiary); border-radius: 8px;">
|
|
1356
1379
|
<div style="display: flex; justify-content: space-between; margin-bottom: 8px;">
|
|
1357
1380
|
<span style="font-weight: 500; font-size: 16px;">${option.text}</span>
|
|
1358
1381
|
<span style="font-weight: 600; color: var(--primary); font-size: 16px;">${option.votes.length} 票 (${percentage}%)</span>
|
|
1359
1382
|
</div>
|
|
1360
|
-
<div style="height: 10px; background: var(--bg-secondary); border-radius: 5px; overflow: hidden;
|
|
1383
|
+
<div style="height: 10px; background: var(--bg-secondary); border-radius: 5px; overflow: hidden;">
|
|
1361
1384
|
<div style="height: 100%; background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%); width: ${percentage}%; transition: width 0.3s;"></div>
|
|
1362
1385
|
</div>
|
|
1363
|
-
${
|
|
1364
|
-
<div style="font-size: 13px; color: var(--text-secondary);">
|
|
1365
|
-
<strong>投票者:</strong> ${option.votes.map(v => v.username).join(', ')}
|
|
1366
|
-
</div>
|
|
1367
|
-
` : ''}
|
|
1386
|
+
${votersList}
|
|
1368
1387
|
</div>
|
|
1369
1388
|
`;
|
|
1370
1389
|
}).join('')}
|
|
@@ -783,12 +783,16 @@ export function renderUserDashboard(user, wsService) {
|
|
|
783
783
|
const fileIcon = getFileIcon(file.mimetype);
|
|
784
784
|
const fileSize = formatFileSize(file.size);
|
|
785
785
|
|
|
786
|
+
// 获取上传者ID(处理不同的数据结构)
|
|
787
|
+
const uploaderId = file.uploader._id || file.uploader.id || file.uploader;
|
|
788
|
+
const isOwner = String(uploaderId) === String(currentUserId);
|
|
789
|
+
|
|
786
790
|
fileCard.innerHTML = `
|
|
787
791
|
<div class="file-icon">${fileIcon}</div>
|
|
788
792
|
<div class="file-info">
|
|
789
793
|
<h4>${file.originalName}</h4>
|
|
790
794
|
<div class="file-meta">
|
|
791
|
-
<span>上传者: ${file.uploader.username}</span>
|
|
795
|
+
<span>上传者: ${file.uploader.username || '未知'}</span>
|
|
792
796
|
<span>大小: ${fileSize}</span>
|
|
793
797
|
<span>时间: ${new Date(file.createdAt).toLocaleString()}</span>
|
|
794
798
|
</div>
|
|
@@ -796,7 +800,7 @@ export function renderUserDashboard(user, wsService) {
|
|
|
796
800
|
</div>
|
|
797
801
|
<div class="file-actions">
|
|
798
802
|
<a href="${apiService.getFileDownloadUrl(file._id)}" class="btn-primary" download>下载</a>
|
|
799
|
-
${
|
|
803
|
+
${isOwner ? `<button class="btn-danger" data-id="${file._id}" data-action="delete-file">删除</button>` : ''}
|
|
800
804
|
</div>
|
|
801
805
|
`;
|
|
802
806
|
filesList.appendChild(fileCard);
|