refactor(StudyCoursePage): 优化课程详情和目录的空状态显示
- 使用模板统一管理课程详情显示逻辑 - 添加空状态提示组件替代注释掉的代码 - 移除不必要的条件渲染和注释
Showing
1 changed file
with
8 additions
and
5 deletions
| ... | @@ -40,9 +40,10 @@ | ... | @@ -40,9 +40,10 @@ |
| 40 | </div> | 40 | </div> |
| 41 | </div> | 41 | </div> |
| 42 | 42 | ||
| 43 | - <div v-if="!course?.feature && !course?.highlights && !course?.learning_goal" class="h-2 bg-gray-100"></div> | 43 | + <!-- <div v-if="!course?.feature && !course?.highlights && !course?.learning_goal" class="h-2 bg-gray-100"></div> --> |
| 44 | 44 | ||
| 45 | - <div v-if="course?.feature || course?.highlights || course?.learning_goal" id="detail" class="py-4 px-4"> | 45 | + <div id="detail" class="py-4 px-4"> |
| 46 | + <template v-if="course?.feature || course?.highlights || course?.learning_goal"> | ||
| 46 | <div v-if="course?.feature"> | 47 | <div v-if="course?.feature"> |
| 47 | <div class="text-black text-xl font-bold mb-2">课程特色</div> | 48 | <div class="text-black text-xl font-bold mb-2">课程特色</div> |
| 48 | <div class="text-gray-700 text-sm leading-relaxed" v-html="course?.feature"></div> | 49 | <div class="text-gray-700 text-sm leading-relaxed" v-html="course?.feature"></div> |
| ... | @@ -58,10 +59,12 @@ | ... | @@ -58,10 +59,12 @@ |
| 58 | <div class="text-gray-700 text-sm leading-relaxed" v-html="course?.learning_goal"></div> | 59 | <div class="text-gray-700 text-sm leading-relaxed" v-html="course?.learning_goal"></div> |
| 59 | <br /> | 60 | <br /> |
| 60 | </div> | 61 | </div> |
| 62 | + </template> | ||
| 63 | + <van-empty v-else description="暂无课程详情" /> | ||
| 61 | </div> | 64 | </div> |
| 62 | - <!-- <van-empty v-else description="暂无详情" /> --> | ||
| 63 | 65 | ||
| 64 | - <div v-if="course?.feature || course?.highlights || course?.learning_goal" class="h-2 bg-gray-100"></div> | 66 | + <!-- <div v-if="course?.feature || course?.highlights || course?.learning_goal" class="h-2 bg-gray-100"></div> --> |
| 67 | + <div class="h-2 bg-gray-100"></div> | ||
| 65 | 68 | ||
| 66 | <div id="catalog" class="py-4"> | 69 | <div id="catalog" class="py-4"> |
| 67 | <div v-if="course_lessons.length" class="space-y-4"> | 70 | <div v-if="course_lessons.length" class="space-y-4"> |
| ... | @@ -79,7 +82,7 @@ | ... | @@ -79,7 +82,7 @@ |
| 79 | </div> | 82 | </div> |
| 80 | </div> | 83 | </div> |
| 81 | </div> | 84 | </div> |
| 82 | - <!-- <van-empty v-else description="暂无目录" /> --> | 85 | + <van-empty v-else description="暂无课程目录" /> |
| 83 | </div> | 86 | </div> |
| 84 | 87 | ||
| 85 | <div v-if="course_lessons.length" class="h-2 bg-gray-100"></div> | 88 | <div v-if="course_lessons.length" class="h-2 bg-gray-100"></div> | ... | ... |
-
Please register or login to post a comment