fix: 修复评论显示匿名用户和登出时清除cookie问题
- 在课程详情页中,当评论者姓名为空时显示"匿名用户" - 登出时增加清除currentUser cookie的逻辑 - 移除活动卡片中不再需要的位置信息显示
Showing
3 changed files
with
6 additions
and
5 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2025-03-20 20:36:36 | 2 | * @Date: 2025-03-20 20:36:36 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-11-11 16:28:41 | 4 | + * @LastEditTime: 2025-12-04 10:40:05 |
| 5 | * @FilePath: /mlaj/src/components/ui/ActivityCard.vue | 5 | * @FilePath: /mlaj/src/components/ui/ActivityCard.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -38,13 +38,13 @@ | ... | @@ -38,13 +38,13 @@ |
| 38 | 38 | ||
| 39 | <!-- Location and Time --> | 39 | <!-- Location and Time --> |
| 40 | <div class="text-xs text-gray-500 space-y-1"> | 40 | <div class="text-xs text-gray-500 space-y-1"> |
| 41 | - <div class="flex items-center"> | 41 | + <!-- <div class="flex items-center"> |
| 42 | <svg xmlns="http://www.w3.org/2000/svg" class="h-3.5 w-3.5 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | 42 | <svg xmlns="http://www.w3.org/2000/svg" class="h-3.5 w-3.5 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor"> |
| 43 | <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z" /> | 43 | <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z" /> |
| 44 | <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z" /> | 44 | <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z" /> |
| 45 | </svg> | 45 | </svg> |
| 46 | <span>{{ activity.location }}</span> | 46 | <span>{{ activity.location }}</span> |
| 47 | - </div> | 47 | + </div> --> |
| 48 | 48 | ||
| 49 | <div class="flex items-center"> | 49 | <div class="flex items-center"> |
| 50 | <svg xmlns="http://www.w3.org/2000/svg" class="h-3.5 w-3.5 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | 50 | <svg xmlns="http://www.w3.org/2000/svg" class="h-3.5 w-3.5 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | ... | ... |
| ... | @@ -179,7 +179,7 @@ | ... | @@ -179,7 +179,7 @@ |
| 179 | <div class="space-y-4"> | 179 | <div class="space-y-4"> |
| 180 | <div v-for="(item, index) in commentList" :key="index" class="border-b border-gray-100 pb-3"> | 180 | <div v-for="(item, index) in commentList" :key="index" class="border-b border-gray-100 pb-3"> |
| 181 | <div class="flex justify-between"> | 181 | <div class="flex justify-between"> |
| 182 | - <div class="font-medium text-gray-800">{{ item.name }}</div> | 182 | + <div class="font-medium text-gray-800">{{ item.name || '匿名用户' }}</div> |
| 183 | <div class="text-xs text-gray-500">{{ formatDate(item.created_time) }}</div> | 183 | <div class="text-xs text-gray-500">{{ formatDate(item.created_time) }}</div> |
| 184 | </div> | 184 | </div> |
| 185 | <p class="text-sm text-gray-600 mt-1"> | 185 | <p class="text-sm text-gray-600 mt-1"> | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2025-03-24 13:04:21 | 2 | * @Date: 2025-03-24 13:04:21 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-12-03 11:50:30 | 4 | + * @LastEditTime: 2025-12-04 10:32:03 |
| 5 | * @FilePath: /mlaj/src/views/profile/SettingsPage.vue | 5 | * @FilePath: /mlaj/src/views/profile/SettingsPage.vue |
| 6 | * @Description: 用户设置页面 | 6 | * @Description: 用户设置页面 |
| 7 | --> | 7 | --> |
| ... | @@ -149,6 +149,7 @@ const handleLogout = () => { | ... | @@ -149,6 +149,7 @@ const handleLogout = () => { |
| 149 | .then(() => { | 149 | .then(() => { |
| 150 | // 确认退出 | 150 | // 确认退出 |
| 151 | document.cookie = 'PHPSESSID=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;'; | 151 | document.cookie = 'PHPSESSID=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;'; |
| 152 | + document.cookie = 'currentUser=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;'; | ||
| 152 | logout(); // Clear any other auth state if present | 153 | logout(); // Clear any other auth state if present |
| 153 | showToast('已退出登录'); | 154 | showToast('已退出登录'); |
| 154 | router.replace('/'); | 155 | router.replace('/'); | ... | ... |
-
Please register or login to post a comment