From e7e0597026be4cd942078b2339e1463bfedc85dd Mon Sep 17 00:00:00 2001 From: chenghuan Date: Fri, 14 Nov 2025 09:13:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=EF=BC=9A=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E2=80=9C=E7=B2=BE=E5=BD=A9=E8=AF=95=E5=90=AC=E2=80=9D=E5=88=97?= =?UTF-8?q?=E8=A1=A8=EF=BC=9B=E5=B0=86=E8=AF=BE=E7=A8=8B=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=85=83=E7=B4=A0=E6=8F=90=E5=8F=96=E5=85=AC=E5=85=B1=E7=BB=84?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 6 + pages/course/index.vue | 4 +- pages/course/list/category.vue | 0 pages/course/list/components/list-item.vue | 141 ++++++++++++++ pages/course/list/tryListen.vue | 57 ++++++ pages/course/search.vue | 205 +-------------------- style/tailwind.css | 3 + 7 files changed, 214 insertions(+), 202 deletions(-) create mode 100644 pages/course/list/category.vue create mode 100644 pages/course/list/components/list-item.vue create mode 100644 pages/course/list/tryListen.vue diff --git a/pages.json b/pages.json index c647c8c..15a66c5 100644 --- a/pages.json +++ b/pages.json @@ -127,6 +127,12 @@ "navigationStyle": "custom", "navigationBarTitleText": "%courseSearch.title%" } + }, { + "path": "pages/course/list/tryListen", + "style": { + "navigationStyle": "custom", + "navigationBarTitleText": "%courseHome.tryListen%" + } } ], "tabBar": { diff --git a/pages/course/index.vue b/pages/course/index.vue index f22a31c..c2bb567 100644 --- a/pages/course/index.vue +++ b/pages/course/index.vue @@ -195,9 +195,7 @@ - {{ $t('courseHome.moreTryListen') }} + {{ $t('courseHome.moreTryListen') }} diff --git a/pages/course/list/category.vue b/pages/course/list/category.vue new file mode 100644 index 0000000..e69de29 diff --git a/pages/course/list/components/list-item.vue b/pages/course/list/components/list-item.vue new file mode 100644 index 0000000..e1bcf2f --- /dev/null +++ b/pages/course/list/components/list-item.vue @@ -0,0 +1,141 @@ + + + + + \ No newline at end of file diff --git a/pages/course/list/tryListen.vue b/pages/course/list/tryListen.vue new file mode 100644 index 0000000..1092177 --- /dev/null +++ b/pages/course/list/tryListen.vue @@ -0,0 +1,57 @@ + + + + + \ No newline at end of file diff --git a/pages/course/search.vue b/pages/course/search.vue index 91451e0..657c657 100644 --- a/pages/course/search.vue +++ b/pages/course/search.vue @@ -40,51 +40,13 @@ - - - - {{ item.title }} - - - - - {{ item.level === 1 ? $t('courseSearch.levelBeginner') : $t('courseSearch.levelAdvanced') }} - - - {{ $t('courseSearch.required') }} - - - {{ $t('courseSearch.elective') }} - - - - - - - {{ - item.courseCatalogueEntityList[0].halfFee === 0 - ? $t('courseSearch.free') - : `¥${item.courseCatalogueEntityList[0].halfFee}/${item.courseCatalogueEntityList[0].fee}` - }} - - - - {{ formatCatalogueTitle(v.title) }} - / - - {{ - item.courseCatalogueEntityList[0].halfFee === 0 - ? $t('courseSearch.free') - : ` ${$t('courseSearch.each')}${item.courseCatalogueEntityList[0].halfFee}/${item.courseCatalogueEntityList[0].fee}` - }} - - - + :data="item" + :showToDetail="false" + desc="content" + /> @@ -102,6 +64,7 @@ import { onShow } from '@dcloudio/uni-app' import { useI18n } from 'vue-i18n' import { courseApi } from '@/api/modules/course' import type { ICourse } from '@/types/search' +import listItem from './list/components/list-item.vue' const { t } = useI18n() @@ -207,32 +170,6 @@ const handleClear = () => { getHistory() } -/** - * 跳转到课程详情 - */ -const goCourseDetail = (courseId: number) => { - uni.navigateTo({ - url: `/pages/course/courseDetail?id=${courseId}` - }) -} - -/** - * 格式化课程目录标题 - * 提取"上/中/下" - */ -const formatCatalogueTitle = (title: string): string => { - const keywords = ['上部', '中部', '下部'] - const result: string[] = [] - - keywords.forEach((keyword) => { - if (title.includes(keyword)) { - result.push(keyword.substring(0, 1)) - } - }) - - return result.join('') -} - /** * 页面挂载 */ @@ -313,78 +250,6 @@ onShow(() => { text-shadow: 0 2rpx 4rpx rgba(0, 122, 255, 0.6); } -// 商品网格样式 -.product-section { - margin-bottom: 40rpx; -} - -.product-grid { - display: grid; - grid-template-columns: repeat(3, 1fr); - gap: 20rpx; -} - -.product-item { - background: #fff; - border-radius: 15rpx; - padding: 14rpx; - position: relative; - overflow: hidden; - - .vip-badge { - position: absolute; - top: 10rpx; - left: 10rpx; - z-index: 10; - background: #f94f04; - color: #fff; - font-size: 22rpx; - font-weight: bold; - padding: 4rpx 8rpx; - border-radius: 4rpx; - } - - .product-image { - width: 100%; - height: 220rpx; - border-radius: 10rpx; - background: #f0f0f0; - } - - .product-name { - font-size: 24rpx; - font-weight: bold; - margin-top: 10rpx; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - - .product-price { - font-size: 26rpx; - margin-top: 10rpx; - - .price-vip { - color: #e97512; - font-size: 26rpx; - font-weight: bold; - } - - .price-original { - color: #8a8a8a; - font-size: 22rpx; - margin-left: 8rpx; - text-decoration: line-through; - } - - .price-normal { - color: #e97512; - font-size: 26rpx; - font-weight: bold; - } - } -} - // 课程列表样式 .course-section { margin-bottom: 40rpx; @@ -395,62 +260,4 @@ onShow(() => { flex-direction: column; gap: 20rpx; } - -.course-item { - display: flex; - background: #fff; - border-radius: 20rpx; - padding: 20rpx; - position: relative; - box-shadow: 0 0 10rpx rgba(0, 0, 0, 0.1); - - .course-image { - width: 250rpx; - height: 250rpx; - margin-right: 20rpx; - border-radius: 10rpx; - background: #f0f0f0; - flex-shrink: 0; - } - - .course-info { - flex: 1; - display: flex; - flex-direction: column; - - .course-title { - font-size: 30rpx; - font-weight: bold; - color: #000; - margin-bottom: 10rpx; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - - .course-content { - font-size: 24rpx; - color: #9c9c9c; - line-height: 30rpx; - height: 60rpx; - overflow: hidden; - margin-bottom: 10rpx; - } - - .course-tags { - display: flex; - gap: 10rpx; - flex-wrap: wrap; - } - } - - .course-price { - position: absolute; - bottom: 20rpx; - right: 20rpx; - font-size: 32rpx; - font-weight: 500; - color: red; - } -} diff --git a/style/tailwind.css b/style/tailwind.css index 16aeac9..dbb1504 100644 --- a/style/tailwind.css +++ b/style/tailwind.css @@ -267,6 +267,9 @@ .text-\[\#fff\] { color: #fff; } + .text-\[red\] { + color: red; + } .lowercase { text-transform: lowercase; }