|
1 | 1 | <template> |
2 | | - <div class="comment-item border-b dark:border-dark-border pb-4 last:border-b-0 last:pb-0"> |
| 2 | + <div class="comment-item border-b pb-4 last:border-b-0 last:pb-0"> |
3 | 3 | <!-- 主评论内容 --> |
4 | 4 | <div class="flex space-x-4"> |
5 | 5 | <!-- 用户头像 --> |
|
10 | 10 | alt="用户头像" |
11 | 11 | class="w-10 h-10 rounded-full object-cover" |
12 | 12 | > |
13 | | - <div v-else class="w-10 h-10 rounded-full bg-gray-300 dark:bg-dark-card flex items-center justify-center text-gray-600 dark:text-dark-muted"> |
| 13 | + <div v-else class="w-10 h-10 rounded-full bg-gray-300 flex items-center justify-center text-gray-600"> |
14 | 14 | {{ comment.user?.username?.[0] || '?' }} |
15 | 15 | </div> |
16 | 16 | </div> |
17 | 17 |
|
18 | 18 | <!-- 评论内容 --> |
19 | 19 | <div class="flex-grow"> |
20 | 20 | <div class="flex items-center mb-1"> |
21 | | - <span class="font-semibold text-gray-800 dark:text-dark-text">{{ comment.user?.username || '未知用户' }}</span> |
22 | | - <span class="text-xs text-gray-500 dark:text-dark-muted ml-2">{{ formatDate(comment.createdAt) }}</span> |
| 21 | + <span class="font-semibold text-gray-800">{{ comment.user?.username || '未知用户' }}</span> |
| 22 | + <span class="text-xs text-gray-500 ml-2">{{ formatDate(comment.createdAt) }}</span> |
23 | 23 | </div> |
24 | 24 |
|
25 | 25 | <!-- 编辑模式 --> |
26 | 26 | <div v-if="isEditing" class="mb-2"> |
27 | 27 | <textarea |
28 | 28 | v-model="editContent" |
29 | | - class="w-full p-2 border dark:border-dark-border bg-white dark:bg-dark-surface text-gray-900 dark:text-dark-text rounded focus:ring focus:ring-blue-200 dark:focus:ring-dark-accent/50 focus:border-blue-500 dark:focus:border-dark-accent" |
| 29 | + class="w-full p-2 border rounded focus:ring focus:ring-blue-200 focus:border-blue-500" |
30 | 30 | rows="3" |
31 | 31 | ></textarea> |
32 | 32 | <div class="flex justify-end space-x-2 mt-2"> |
33 | 33 | <button |
34 | 34 | @click="isEditing = false" |
35 | | - class="px-3 py-1 bg-gray-200 dark:bg-dark-card hover:bg-gray-300 dark:hover:bg-dark-card/80 text-gray-700 dark:text-dark-text rounded" |
| 35 | + class="px-3 py-1 bg-gray-200 hover:bg-gray-300 text-gray-700 rounded" |
36 | 36 | > |
37 | 37 | 取消 |
38 | 38 | </button> |
|
47 | 47 | </div> |
48 | 48 |
|
49 | 49 | <!-- 普通显示模式 --> |
50 | | - <p v-else class="text-gray-700 dark:text-dark-text mb-2">{{ comment.content }}</p> |
| 50 | + <p v-else class="text-gray-700 mb-2">{{ comment.content }}</p> |
51 | 51 |
|
52 | 52 | <!-- 操作按钮 --> |
53 | | - <div class="flex space-x-4 text-sm text-gray-500 dark:text-dark-muted"> |
| 53 | + <div class="flex space-x-4 text-sm text-gray-500"> |
54 | 54 | <button |
55 | 55 | v-if="!isEditing" |
56 | 56 | @click="toggleReplyForm" |
57 | | - class="hover:text-blue-600 dark:hover:text-dark-accent" |
| 57 | + class="hover:text-blue-600" |
58 | 58 | > |
59 | 59 | 回复 |
60 | 60 | </button> |
61 | 61 | <button |
62 | 62 | v-if="canEdit && !isEditing" |
63 | 63 | @click="startEditing" |
64 | | - class="hover:text-blue-600 dark:hover:text-dark-accent" |
| 64 | + class="hover:text-blue-600" |
65 | 65 | > |
66 | 66 | 编辑 |
67 | 67 | </button> |
68 | 68 | <button |
69 | 69 | v-if="canEdit && !isEditing" |
70 | 70 | @click="confirmDelete" |
71 | | - class="hover:text-red-600 dark:hover:text-red-400" |
| 71 | + class="hover:text-red-600" |
72 | 72 | > |
73 | 73 | 删除 |
74 | 74 | </button> |
|
78 | 78 | <div v-if="showReplyForm" class="mt-4"> |
79 | 79 | <textarea |
80 | 80 | v-model="replyContent" |
81 | | - class="w-full p-2 border dark:border-dark-border bg-white dark:bg-dark-surface text-gray-900 dark:text-dark-text placeholder-gray-500 dark:placeholder-dark-muted rounded focus:ring focus:ring-blue-200 dark:focus:ring-dark-accent/50 focus:border-blue-500 dark:focus:border-dark-accent" |
| 81 | + class="w-full p-2 border rounded focus:ring focus:ring-blue-200 focus:border-blue-500" |
82 | 82 | rows="2" |
83 | 83 | placeholder="写下你的回复..." |
84 | 84 | ></textarea> |
85 | 85 | <div class="flex justify-end space-x-2 mt-2"> |
86 | 86 | <button |
87 | 87 | @click="showReplyForm = false" |
88 | | - class="px-3 py-1 bg-gray-200 dark:bg-dark-card hover:bg-gray-300 dark:hover:bg-dark-card/80 text-gray-700 dark:text-dark-text rounded" |
| 88 | + class="px-3 py-1 bg-gray-200 hover:bg-gray-300 text-gray-700 rounded" |
89 | 89 | > |
90 | 90 | 取消 |
91 | 91 | </button> |
|
100 | 100 | </div> |
101 | 101 |
|
102 | 102 | <!-- 嵌套回复 --> |
103 | | - <div v-if="comment.replies && comment.replies.length > 0" class="mt-4 pl-4 border-l-2 border-gray-200 dark:border-dark-border space-y-4"> |
| 103 | + <div v-if="comment.replies && comment.replies.length > 0" class="mt-4 pl-4 border-l-2 border-gray-200 space-y-4"> |
104 | 104 | <!-- 递归显示每条回复 --> |
105 | 105 | <div v-for="reply in comment.replies" :key="reply.id" class="py-2"> |
106 | 106 | <div class="flex space-x-3"> |
|
112 | 112 | alt="用户头像" |
113 | 113 | class="w-8 h-8 rounded-full object-cover" |
114 | 114 | > |
115 | | - <div v-else class="w-8 h-8 rounded-full bg-gray-300 dark:bg-dark-card flex items-center justify-center text-gray-600 dark:text-dark-muted text-sm"> |
| 115 | + <div v-else class="w-8 h-8 rounded-full bg-gray-300 flex items-center justify-center text-gray-600 text-sm"> |
116 | 116 | {{ reply.user?.username?.[0] || '?' }} |
117 | 117 | </div> |
118 | 118 | </div> |
119 | 119 |
|
120 | 120 | <!-- 回复内容 --> |
121 | 121 | <div class="flex-grow"> |
122 | 122 | <div class="flex items-center mb-1"> |
123 | | - <span class="font-semibold text-gray-800 dark:text-dark-text">{{ reply.user?.username || '未知用户' }}</span> |
124 | | - <span class="text-xs text-gray-500 dark:text-dark-muted ml-2">{{ formatDate(reply.createdAt) }}</span> |
| 123 | + <span class="font-semibold text-gray-800">{{ reply.user?.username || '未知用户' }}</span> |
| 124 | + <span class="text-xs text-gray-500 ml-2">{{ formatDate(reply.createdAt) }}</span> |
125 | 125 | </div> |
126 | | - <p class="text-gray-700 dark:text-dark-text">{{ reply.content }}</p> |
| 126 | + <p class="text-gray-700">{{ reply.content }}</p> |
127 | 127 |
|
128 | 128 | <!-- 回复的操作按钮 --> |
129 | | - <div v-if="isLoggedIn" class="flex space-x-4 text-xs text-gray-500 dark:text-dark-muted mt-1"> |
| 129 | + <div v-if="isLoggedIn" class="flex space-x-4 text-xs text-gray-500 mt-1"> |
130 | 130 | <button |
131 | 131 | @click="toggleReplyForm" |
132 | | - class="hover:text-blue-600 dark:hover:text-dark-accent" |
| 132 | + class="hover:text-blue-600" |
133 | 133 | > |
134 | 134 | 回复 |
135 | 135 | </button> |
136 | 136 | <button |
137 | 137 | v-if="isCurrentUser(reply.userId)" |
138 | 138 | @click="confirmDeleteReply(reply.id)" |
139 | | - class="hover:text-red-600 dark:hover:text-red-400" |
| 139 | + class="hover:text-red-600" |
140 | 140 | > |
141 | 141 | 删除 |
142 | 142 | </button> |
|
0 commit comments