refactor(StudyCoursePage): 优化课程详情和目录的空状态显示
- 使用模板统一管理课程详情显示逻辑 - 添加空状态提示组件替代注释掉的代码 - 移除不必要的条件渲染和注释
Showing
1 changed file
with
24 additions
and
21 deletions
| ... | @@ -40,28 +40,31 @@ | ... | @@ -40,28 +40,31 @@ |
| 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 | - <div v-if="course?.feature"> | 46 | + <template v-if="course?.feature || course?.highlights || course?.learning_goal"> |
| 47 | - <div class="text-black text-xl font-bold mb-2">课程特色</div> | 47 | + <div v-if="course?.feature"> |
| 48 | - <div class="text-gray-700 text-sm leading-relaxed" v-html="course?.feature"></div> | 48 | + <div class="text-black text-xl font-bold mb-2">课程特色</div> |
| 49 | - <br /> | 49 | + <div class="text-gray-700 text-sm leading-relaxed" v-html="course?.feature"></div> |
| 50 | - </div> | 50 | + <br /> |
| 51 | - <div v-if="course?.highlights"> | 51 | + </div> |
| 52 | - <div class="text-black text-xl font-bold mb-2">课程亮点</div> | 52 | + <div v-if="course?.highlights"> |
| 53 | - <div class="text-gray-700 text-sm leading-relaxed" v-html="course?.highlights"></div> | 53 | + <div class="text-black text-xl font-bold mb-2">课程亮点</div> |
| 54 | - <br /> | 54 | + <div class="text-gray-700 text-sm leading-relaxed" v-html="course?.highlights"></div> |
| 55 | - </div> | 55 | + <br /> |
| 56 | - <div v-if="course?.learning_goal"> | 56 | + </div> |
| 57 | - <div class="text-black text-xl font-bold mb-2">学习目标</div> | 57 | + <div v-if="course?.learning_goal"> |
| 58 | - <div class="text-gray-700 text-sm leading-relaxed" v-html="course?.learning_goal"></div> | 58 | + <div class="text-black text-xl font-bold mb-2">学习目标</div> |
| 59 | - <br /> | 59 | + <div class="text-gray-700 text-sm leading-relaxed" v-html="course?.learning_goal"></div> |
| 60 | - </div> | 60 | + <br /> |
| 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