Initial commit

This commit is contained in:
admin
2025-12-09 02:45:30 +08:00
commit 0bbb3d0a47
303 changed files with 22764 additions and 0 deletions

View File

@@ -0,0 +1,69 @@
const app = getApp()
Page({
data: {
project: null
},
onLoad(options) {
const { id } = options;
this.fetchProject(id);
},
fetchProject(id) {
const { request } = require('../../utils/request')
request({ url: `/projects/${id}` })
.then((data) => {
this.setData({ project: data })
})
.catch(() => {
const projects = [
{
id: 1,
title: 'Python 数据分析实战',
category: '编程开发',
image:
'https://images.unsplash.com/photo-1526379095098-d400fd0bf935?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.0.3',
students: 1205,
rating: 4.8,
duration: '12 周'
},
{
id: 2,
title: '零基础英语口语速成',
category: '语言学习',
image:
'https://images.unsplash.com/photo-1543269865-cbf427effbad?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.0.3',
students: 850,
rating: 4.9,
duration: '8 周'
},
{
id: 3,
title: 'UI/UX 设计全能班',
category: '设计创作',
image:
'https://images.unsplash.com/photo-1561070791-2526d30994b5?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.0.3',
students: 2340,
rating: 4.7,
duration: '16 周'
},
{
id: 4,
title: '职场高效沟通技巧',
category: '职场提升',
image:
'https://images.unsplash.com/photo-1552581234-26160f608093?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.0.3',
students: 5600,
rating: 4.6,
duration: '4 周'
}
]
this.setData({ project: projects.find((p) => p.id == id) })
})
},
handleEnroll() {
wx.showToast({
title: '报名成功',
icon: 'success'
})
}
})

View File

@@ -0,0 +1,5 @@
{
"navigationBarTitleText": "课程详情",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}

View File

@@ -0,0 +1,59 @@
<view class="container" wx:if="{{project}}">
<image class="hero-image" src="{{project.image}}" mode="aspectFill"></image>
<view class="content">
<view class="header">
<view class="badge">{{project.category}}</view>
<view class="rating">
<text class="star">⭐</text> {{project.rating}}
</view>
</view>
<view class="title">{{project.title}}</view>
<view class="meta-row">
<view class="meta-item">
<text class="icon">👥</text> {{project.students}} 人已报名
</view>
<view class="meta-item">
<text class="icon">🕒</text> {{project.duration}}
</view>
</view>
<view class="section">
<view class="section-title">课程简介</view>
<view class="desc">
本课程将带领你深入了解{{project.title}}的核心概念与实战技巧。通过{{project.duration}}的系统学习,你将掌握行业前沿知识,提升职业竞争力。
</view>
</view>
<view class="section" wx:if="{{project.outline}}">
<view class="section-title">课程大纲</view>
<view class="chapter-list">
<block wx:for="{{project.outline}}" wx:key="chapter" wx:for-item="chapter" wx:for-index="idx">
<view class="chapter-header">{{chapter.chapter}}</view>
<block wx:for="{{chapter.lessons}}" wx:key="title" wx:for-item="lesson">
<view class="lesson-item">
<view class="lesson-info">
<view class="lesson-title">{{lesson.title}}</view>
<view class="lesson-time">{{lesson.duration}}</view>
</view>
<view class="play-btn" wx:if="{{lesson.isFree}}">▶</view>
<view class="lock-btn" wx:else>🔒</view>
</view>
</block>
</block>
</view>
</view>
<!-- Fallback if no outline data -->
<view class="section" wx:else>
<view class="section-title">课程大纲</view>
<view class="desc">暂无大纲信息</view>
</view>
</view>
<view class="footer-bar">
<view class="price">¥ 299</view>
<button class="enroll-btn" bindtap="handleEnroll">立即报名</button>
</view>
</view>

View File

@@ -0,0 +1,139 @@
.container {
background-color: white;
min-height: 100vh;
padding-bottom: 120rpx;
}
.hero-image {
width: 100%;
height: 400rpx;
}
.content {
padding: 40rpx;
border-top-left-radius: 40rpx;
border-top-right-radius: 40rpx;
margin-top: -40rpx;
background-color: white;
position: relative;
z-index: 10;
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
}
.badge {
background-color: #dbeafe;
color: #2563eb;
font-size: 24rpx;
padding: 8rpx 20rpx;
border-radius: 12rpx;
font-weight: bold;
}
.rating {
color: #f59e0b;
font-size: 24rpx;
font-weight: bold;
}
.title {
font-size: 40rpx;
font-weight: bold;
color: #111827;
margin-bottom: 20rpx;
line-height: 1.4;
}
.meta-row {
display: flex;
gap: 30rpx;
margin-bottom: 40rpx;
}
.meta-item {
font-size: 24rpx;
color: #6b7280;
display: flex;
align-items: center;
}
.icon {
margin-right: 8rpx;
}
.section {
margin-bottom: 40rpx;
}
.section-title {
font-size: 32rpx;
font-weight: bold;
color: #1f2937;
margin-bottom: 20rpx;
border-left: 8rpx solid #2563eb;
padding-left: 20rpx;
}
.desc {
font-size: 28rpx;
color: #4b5563;
line-height: 1.6;
}
.chapter-header {
font-size: 28rpx;
font-weight: bold;
color: #374151;
margin: 30rpx 0 20rpx 0;
background-color: #f3f4f6;
padding: 10rpx 20rpx;
border-radius: 10rpx;
}
.lesson-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20rpx 0;
border-bottom: 1rpx solid #f3f4f6;
}
.lesson-info {
flex: 1;
}
.lesson-title {
font-size: 28rpx;
color: #1f2937;
margin-bottom: 6rpx;
}
.lesson-time {
font-size: 22rpx;
color: #9ca3af;
}
.play-btn {
color: #2563eb;
font-size: 32rpx;
}
.lock-btn {
color: #9ca3af;
font-size: 28rpx;
}
.footer-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background-color: white;
padding: 20rpx 40rpx;
box-shadow: 0 -4rpx 10rpx rgba(0,0,0,0.05);
display: flex;
justify-content: space-between;
align-items: center;
z-index: 20;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
.price {
font-size: 40rpx;
font-weight: bold;
color: #2563eb;
}
.enroll-btn {
background-color: #2563eb;
color: white;
font-size: 30rpx;
font-weight: bold;
padding: 20rpx 60rpx;
border-radius: 50rpx;
margin: 0;
}