fix: 修复课程不存在时的跳转逻辑并添加匿名用户显示
当课程不存在时添加跳转回上一页的逻辑 在评论和评分页面为没有名字的用户显示'匿名用户'
Showing
3 changed files
with
9 additions
and
4 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2025-03-21 11:33:26 | 2 | * @Date: 2025-03-21 11:33:26 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-04-22 10:21:10 | 4 | + * @LastEditTime: 2025-12-03 20:00:05 |
| 5 | * @FilePath: /mlaj/src/views/courses/CourseReviewsPage.vue | 5 | * @FilePath: /mlaj/src/views/courses/CourseReviewsPage.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -23,7 +23,7 @@ | ... | @@ -23,7 +23,7 @@ |
| 23 | <div class="flex justify-between items-center mb-2"> | 23 | <div class="flex justify-between items-center mb-2"> |
| 24 | <div class="flex items-center flex-1 min-w-0 mr-2"> | 24 | <div class="flex items-center flex-1 min-w-0 mr-2"> |
| 25 | <div class="flex-grow"> | 25 | <div class="flex-grow"> |
| 26 | - <span class="font-medium text-sm block">{{ review.name }}</span> | 26 | + <span class="font-medium text-sm block">{{ review.name || '匿名用户' }}</span> |
| 27 | </div> | 27 | </div> |
| 28 | </div> | 28 | </div> |
| 29 | <van-rate v-model="review.score" readonly :size="20" color="#ffd21e" void-icon="star" void-color="#eee" /> | 29 | <van-rate v-model="review.score" readonly :size="20" color="#ffd21e" void-icon="star" void-color="#eee" /> | ... | ... |
| ... | @@ -379,6 +379,11 @@ onMounted(async () => { | ... | @@ -379,6 +379,11 @@ onMounted(async () => { |
| 379 | default_list.value = task_list.value; | 379 | default_list.value = task_list.value; |
| 380 | showTaskList.value = true; | 380 | showTaskList.value = true; |
| 381 | } | 381 | } |
| 382 | + else { | ||
| 383 | + // 课程不存在,跳转到课程主页面 | ||
| 384 | + showToast('课程不存在') | ||
| 385 | + router.go(-1); | ||
| 386 | + } | ||
| 382 | /** | 387 | /** |
| 383 | * 初始化时计算topWrapperHeight | 388 | * 初始化时计算topWrapperHeight |
| 384 | */ | 389 | */ | ... | ... |
| ... | @@ -130,7 +130,7 @@ | ... | @@ -130,7 +130,7 @@ |
| 130 | class="w-10 h-10 rounded-full flex-shrink-0" style="margin-right: 0.5rem;" /> | 130 | class="w-10 h-10 rounded-full flex-shrink-0" style="margin-right: 0.5rem;" /> |
| 131 | <div class="flex-1 ml-3"> | 131 | <div class="flex-1 ml-3"> |
| 132 | <div class="flex justify-between items-center mb-1"> | 132 | <div class="flex justify-between items-center mb-1"> |
| 133 | - <span class="font-medium text-gray-900">{{ comment.name }}</span> | 133 | + <span class="font-medium text-gray-900">{{ comment.name || '匿名用户' }}</span> |
| 134 | <div class="flex items-center space-x-1"> | 134 | <div class="flex items-center space-x-1"> |
| 135 | <span class="text-sm text-gray-500">{{ comment.like_count }}</span> | 135 | <span class="text-sm text-gray-500">{{ comment.like_count }}</span> |
| 136 | <van-icon :name="comment.is_like ? 'like' : 'like-o'" | 136 | <van-icon :name="comment.is_like ? 'like' : 'like-o'" |
| ... | @@ -163,7 +163,7 @@ | ... | @@ -163,7 +163,7 @@ |
| 163 | style="margin-right: 0.5rem;" /> | 163 | style="margin-right: 0.5rem;" /> |
| 164 | <div class="flex-1 ml-3"> | 164 | <div class="flex-1 ml-3"> |
| 165 | <div class="flex justify-between items-center mb-1"> | 165 | <div class="flex justify-between items-center mb-1"> |
| 166 | - <span class="font-medium text-gray-900">{{ comment.name }}</span> | 166 | + <span class="font-medium text-gray-900">{{ comment.name || '匿名用户' }}</span> |
| 167 | <div class="flex items-center space-x-1"> | 167 | <div class="flex items-center space-x-1"> |
| 168 | <span class="text-sm text-gray-500">{{ comment.like_count | 168 | <span class="text-sm text-gray-500">{{ comment.like_count |
| 169 | }}</span> | 169 | }}</span> | ... | ... |
-
Please register or login to post a comment