Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
mlaj
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2025-09-24 23:10:57 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a895504371bd84120dfb171aeb88c5ae086d5a5c
a8955043
1 parent
7e361394
fix: 修复免费课程价格显示问题
为免费课程添加条件判断,当价格为0.00时显示"免费"而非价格
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
6 deletions
src/components/ui/CourseCard.vue
src/views/courses/CourseDetailPage.vue
src/views/profile/StudyCoursePage.vue
src/components/ui/CourseCard.vue
View file @
a895504
<!--
* @Date: 2025-03-20 20:36:36
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-0
4-29 14:12:16
* @LastEditTime: 2025-0
9-24 22:59:47
* @FilePath: /mlaj/src/components/ui/CourseCard.vue
* @Description: 文件描述
-->
...
...
@@ -20,7 +20,10 @@
<div class="text-gray-500 text-xs">{{ course.subtitle }}</div>
</div>
<div class="flex justify-between items-end mt-1">
<div class="text-orange-500 font-semibold">¥{{ course.price }}</div>
<div v-if="course?.price !== '0.00'" class="text-orange-500 font-semibold">¥{{ course.price }}</div>
<div v-else class="text-orange-500 text-xs font-semibold">
免费
</div>
<div class="text-gray-400 text-xs">
{{ course.buy_count }}人订阅
</div>
...
...
src/views/courses/CourseDetailPage.vue
View file @
a895504
...
...
@@ -16,7 +16,10 @@
<h1 class="text-2xl text-white font-bold mb-1">{{ course?.title }}</h1>
<h2 class="text-lg text-white/90">{{ course?.subtitle }}</h2>
<div class="mt-4 flex justify-between items-center">
<div class="text-orange-300 font-bold text-2xl">¥{{ course?.price }}</div>
<div v-if="course?.price !== '0.00'" class="text-orange-300 font-bold text-2xl">¥{{ course?.price }}</div>
<div v-else class="text-orange-300 text-sm">
免费
</div>
<div class="bg-orange-500/30 text-orange-100 text-xs px-3 py-1 rounded-full">
限时优惠
</div>
...
...
@@ -233,8 +236,8 @@
</div>
<div class="flex items-center">
<div v-if="!course?.is_buy" class="mr-2">
<div class="text-red-500 font-bold">¥{{ course?.price || 0 }}</div>
<div class="text-xs text-gray-400 line-through">
<div
v-if="course?.price !== '0.00'"
class="text-red-500 font-bold">¥{{ course?.price || 0 }}</div>
<div
v-if="course?.price !== '0.00'"
class="text-xs text-gray-400 line-through">
¥{{ Math.round((course?.price || 0) * 1.2) }}
</div>
</div>
...
...
src/views/profile/StudyCoursePage.vue
View file @
a895504
...
...
@@ -14,7 +14,8 @@
<!-- 标题和价格区域 -->
<div class="flex items-start justify-between gap-3 mb-2">
<h1 class="text-black text-xl font-bold flex-1 min-w-0">{{ course?.title }}</h1>
<div class="text-orange-500 font-bold text-xl flex-shrink-0">¥{{ course?.price || '0' }}</div>
<div v-if="course?.price !== '0.00'" class="text-orange-500 font-bold text-xl flex-shrink-0">¥{{ course?.price || '0' }}</div>
<div v-else class="text-orange-500 text-base font-semibold"> 免费 </div>
</div>
<div class="flex items-center text-gray-500 text-sm">
<span>已更新 {{ course?.count }} 期</span>
...
...
Please
register
or
login
to post a comment