精品课

This commit is contained in:
haomingming
2025-08-25 14:17:06 +08:00
parent 979c332454
commit 0de0b6732b
22 changed files with 3392 additions and 716 deletions
+34 -241
View File
@@ -28,7 +28,6 @@
<image :src="banner.sroll_img || banner.image || '/static/lunbo_bg.png'" mode="aspectFill" class="banner-image"></image>
<view class="banner-content">
<text class="banner-title">{{ banner.title || '课程标题' }}</text>
<text class="banner-subtitle">{{ banner.subtitle || '课程描述' }}</text>
</view>
</swiper-item>
</swiper>
@@ -54,7 +53,7 @@
:key="typeItem.id"
@click="goVideoType(typeItem.id, typeItem.name)">
<view class="function-icon">
<image :src="typeItem.img" mode="aspectFit"></image>
<image style="height: 50rpx;" :src="typeItem.img" mode="aspectFit"></image>
<!-- <uni-icons :type="getFunctionIconType(index)" size="24" :color="getFunctionIconColor(index)"></uni-icons> -->
</view>
<text class="function-text">{{ typeItem.name }}</text>
@@ -65,7 +64,7 @@
<view class="section">
<view class="section-header">
<text class="section-title">精品小课</text>
<view class="more-btn" @click="goMorePremium">
<view class="more-btn" @click="goMorePremium('精品小课')">
<text>更多</text>
<uni-icons type="arrowright" size="14" color="#999"></uni-icons>
</view>
@@ -80,7 +79,7 @@
<text class="course-title">{{ course.title }}</text>
<view class="course-meta">
<view class="participant-count">{{ course.study_num }}人</view>
<text class="course-price" v-if="course.discount_price > 0">¥{{ course.discount_price }}</text>
<text class="course-price" v-if="course.discount_price > 0">¥{{ (course.discount_price / 100).toFixed(2) }}</text>
<text class="course-price free" v-else>免费</text>
</view>
</view>
@@ -95,7 +94,7 @@
<view class="section">
<view class="section-header">
<text class="section-title">学完返现</text>
<view class="more-btn" @click="goMoreRewards">
<view class="more-btn" @click="goMoreRewards('学完返现')">
<text>更多</text>
<uni-icons type="arrowright" size="14" color="#999"></uni-icons>
</view>
@@ -114,7 +113,7 @@
<view class="section">
<view class="section-header">
<text class="section-title">福利课堂</text>
<view class="more-btn" @click="goMoreWelfare">
<view class="more-btn" @click="goMoreWelfare('福利课堂')">
<text>更多</text>
<uni-icons type="arrowright" size="14" color="#999"></uni-icons>
</view>
@@ -139,11 +138,11 @@
</scroll-view>
</view>
<!-- 热门课程 -->
<!-- 课程推荐 -->
<view class="section">
<view class="section-header">
<text class="section-title">热门课程</text>
<view class="more-btn" @click="goMoreHot">
<text class="section-title">课程推荐</text>
<view class="more-btn" @click="goMoreHot('课程推荐')">
<text>更多</text>
<uni-icons type="arrowright" size="14" color="#999"></uni-icons>
</view>
@@ -154,7 +153,7 @@
<view class="course-content">
<text class="course-name">{{ course.title }}</text>
<text class="course-desc">{{ course.tags || '' }}</text>
<text class="course-cost">¥{{ course.discount_price }}</text>
<text class="course-cost">¥{{ (course.discount_price / 100).toFixed(2) }}</text>
</view>
</view>
</view>
@@ -188,115 +187,7 @@ const premiumCourseList = ref([]) // 新增:精品小课数据
const rewardCourseList = ref([]) // 新增:学完返现数据
const welfareCourseList = ref([]) // 新增:福利课堂数据
const recommendedCourseList = ref([]) // 新增:课程推荐数据
const bannerList = ref([
{
id: 1,
title: "小懂医生讲HIV和感染",
subtitle: "授课专家: 黄湛镰 副主任医师 | 中山大学附属第三医院感染科",
image: "/static/lunbo_bg.png",
link: "/pages_course/hiv_detail"
},
{
id: 2,
title: "肝脏肿瘤临床影像学习",
subtitle: "授课专家: 王学浩 教授 | 南京医科大学第一附属医院",
image: "/static/paper_bg.png",
link: "/pages_course/tumor_detail"
},
{
id: 3,
title: "慢性肝病营养治疗指南",
subtitle: "授课专家: 段钟平 教授 | 首都医科大学附属北京佑安医院",
image: "/static/pap_bg.png",
link: "/pages_course/nutrition_detail"
},
{
id: 4,
title: "肝移植术后管理要点",
subtitle: "授课专家: 郑树森 院士 | 浙江大学医学院附属第一医院",
image: "/static/bo_bg.png",
link: "/pages_course/transplant_detail"
},
{
id: 5,
title: "肝癌早期筛查与预防",
subtitle: "授课专家: 陈孝平 院士 | 华中科技大学同济医学院",
image: "/static/livebg.png",
link: "/pages_course/screening_detail"
}
])
const hotCourses = ref([
{
id: 1,
title: "小懂医生讲HIV和感染-各类抗菌药特性解读III",
description: "小懂医生讲HIV和感染-各类抗菌药特性解读III",
price: "20.00",
thumbnail: "/static/jingpinkecheng.png"
},
{
id: 2,
title: "小懂医生讲HIV和感染-各类抗菌药特性解读III",
description: "小懂医生讲HIV和感染-各类抗菌药特性解读III",
price: "20.00",
thumbnail: "/static/jingpinkecheng.png"
},
{
id: 3,
title: "小懂医生讲HIV和感染-各类抗菌药特性解读III",
description: "小懂医生讲HIV和感染-各类抗菌药特性解读III",
price: "20.00",
thumbnail: "/static/jingpinkecheng.png"
},
{
id: 4,
title: "小懂医生讲HIV和感染物",
description: "",
price: "50.00",
thumbnail: "/static/jingpinkecheng.png"
}
])
const welfareList = ref([
{
id: 1,
title: "《中生肝脏病学》云解读系列会七",
subtitle: "汪晖 院士 北京大学医学院",
teacher: "汪晖 院士",
price: "免费",
image: "/static/fulicard.png"
},
{
id: 2,
title: "肝病诊疗新进展研讨会",
subtitle: "王学浩 教授 南京医科大学",
teacher: "王学浩 教授",
price: "免费",
image: "/static/paper_bg.png"
},
{
id: 3,
title: "肝癌早期筛查与预防",
subtitle: "陈孝平 院士 华中科技大学",
teacher: "陈孝平 院士",
price: "免费",
image: "/static/pap_bg.png"
},
{
id: 4,
title: "慢性肝病营养治疗指南",
subtitle: "段钟平 教授 首都医科大学",
teacher: "段钟平 教授",
price: "免费",
image: "/static/bo_bg.png"
},
{
id: 5,
title: "肝移植术后管理要点",
subtitle: "郑树森 院士 浙江大学医学院",
teacher: "郑树森 院士",
price: "免费",
image: "/static/livebg.png"
}
])
const bannerList = ref([])
// 方法
const getSystemInfo = () => {
@@ -311,7 +202,9 @@ const getSystemInfo = () => {
}
const goBack = () => {
uni.navigateBack()
uni.navigateTo({
url: '/pages/index/index'
})
}
const goSearch = () => {
@@ -322,6 +215,9 @@ const goSearch = () => {
const goCategory = (type, name) => {
console.log('跳转分类:', type, name)
uni.navigateTo({
url: `/pages_course/course_filter/course_filter?type=${type}`
})
}
const getCategoryIconClass = (index) => {
@@ -337,29 +233,6 @@ const getCategoryIconClass = (index) => {
}
}
const getFunctionIconClass = (index) => {
switch (index) {
case 0:
return 'fire-icon';
case 1:
return 'star-icon';
case 2:
return 'gift-icon';
case 3:
return 'heart-icon';
default:
return '';
}
}
const goHotCourses = () => {
console.log('跳转热门课程')
}
const goPremiumCourses = () => {
console.log('跳转精品小课')
}
const goPremiumCourse = (course) => {
console.log('跳转精品小课详情:', course)
@@ -369,9 +242,6 @@ const goPremiumCourse = (course) => {
})
}
const goStudyRewards = () => {
console.log('跳转学克返现')
}
const goRewardCourse = (course) => {
console.log('跳转返现课程:', course)
@@ -381,24 +251,32 @@ const goRewardCourse = (course) => {
})
}
const goWelfareCourses = () => {
console.log('跳转福利课堂')
}
const goMorePremium = () => {
const goMorePremium = (name) => {
console.log('查看更多精品课程')
uni.navigateTo({
url: `/pages_course/course_filter/course_filter?special_type=${specialTypeList.value.find(item => item.name == name).id}&special_name=${name}`
})
}
const goMoreRewards = () => {
const goMoreRewards = (name) => {
console.log('查看更多返现')
uni.navigateTo({
url: `/pages_course/course_filter/course_filter?special_type=${specialTypeList.value.find(item => item.name == name).id}&special_name=${name}`
})
}
const goMoreWelfare = () => {
const goMoreWelfare = (name) => {
console.log('查看更多福利')
uni.navigateTo({
url: `/pages_course/course_filter/course_filter?special_type=${specialTypeList.value.find(item => item.name == name).id}&special_name=${name}`
})
}
const goMoreHot = () => {
const goMoreHot = (name) => {
console.log('查看更多热门')
uni.navigateTo({
url: `/pages_course/course_filter/course_filter?special_type=${specialTypeList.value.find(item => item.name == name).id}&special_name=${name}`
})
}
const goCourseDetail = (course) => {
@@ -421,7 +299,7 @@ const goBannerDetail = (banner) => {
console.log('横幅详情:', banner)
// 跳转到课程详情页面
uni.navigateTo({
url: '/pages_course/course_detail/course_detail'
url: '/pages_course/course_detail/course_detail?id=' + banner.id
})
}
@@ -487,104 +365,19 @@ const getIndex = async () => {
}
} else {
console.warn('API返回数据格式异常:', res)
setDefaultData()
}
} catch (error) {
console.error('获取分类数据失败:', error)
setDefaultData()
}
}
// 设置默认数据
const setDefaultData = () => {
// 设置默认分类数据作为备用
firstTypeList.value = [
{ id: 185, name: "肝病", img: "/static/icon_home_my_patient.png" },
{ id: 188, name: "肿瘤", img: "/static/icon_home_my_library.png" },
{ id: 195, name: "感染", img: "/static/icon_home_video.png" }
]
// 设置默认功能按钮数据作为备用
specialTypeList.value = [
{ type_id: 189, type_name: "课程推荐" },
{ type_id: 190, type_name: "精品小课" },
{ type_id: 191, type_name: "学完返现" },
{ type_id: 192, type_name: "福利课堂" }
]
// 设置默认精品小课数据作为备用
premiumCourseList.value = [
{
id: 1,
title: "肝脏胖瘦临床、影像学习交流",
study_num: 28,
discount_price: 20,
index_img: "/static/jingpingke.png"
}
]
// 设置默认学完返现数据作为备用
rewardCourseList.value = [
{
id: 1,
title: "重症肝病的抗凝治疗",
discount_price: 2,
back_bon: 2,
index_img: "/static/paper_bg.png"
},
{
id: 2,
title: "重症肝病的抗凝治疗2",
discount_price: 2,
back_bon: 2,
index_img: "/static/pap_bg.png"
}
]
// 设置默认福利课堂数据作为备用
welfareCourseList.value = [
{
id: 1,
title: "《中生肝脏病学》云解读系列会七",
special_type_name: "福利课堂",
study_num: 8,
fuli_bon: 100,
index_img: "/static/fulicard.png"
},
{
id: 2,
title: "肝病诊疗新进展研讨会",
special_type_name: "福利课堂",
study_num: 5,
fuli_bon: 88,
index_img: "/static/paper_bg.png"
}
]
// 设置默认课程推荐数据作为备用
recommendedCourseList.value = [
{
id: 1,
title: "测试精品课上报02",
tags: "测试,肝胆相照",
discount_price: 100,
index_img: "/static/jingpinkecheng.png"
},
{
id: 2,
title: "测试精品课上报01",
tags: "肝胆相照,健康中国",
discount_price: 100,
index_img: "/static/jingpinkecheng.png"
}
]
}
const goVideoType = (typeId, typeName) => {
console.log('跳转视频类型:', typeId, typeName)
// 跳转到视频类型详情页面
uni.navigateTo({
url: `/pages_course/video_type_detail/video_type_detail?type_id=${typeId}`
url: `/pages_course/course_filter/course_filter?special_type=${typeId}&special_name=${typeName}`
})
}
// 生命周期