feat: 首页新增课程列表区块 + 全部课程列表页 + 课程详情页

This commit is contained in:
gqt
2026-07-28 14:56:47 +08:00
parent 605d463a00
commit 4872f180dc
5 changed files with 266 additions and 1 deletions
@@ -0,0 +1,67 @@
<template>
<view class="article-detail container" v-if="course">
<text class="title">{{ course.title }}</text>
<text class="date">{{ formatDate(course.updated_at) }}</text>
<image v-if="course.cover_image" :src="course.cover_image" mode="aspectFill" class="cover" />
<view class="content-card card">
<rich-text :nodes="course.detail"></rich-text>
</view>
</view>
<view v-else class="loading-state container">
<text>加载中...</text>
</view>
</template>
<script setup>
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { courseInfoApi } from '@/modules/comprehensive/api/courseInfo'
import { formatDate } from '@/modules/comprehensive/utils/date'
const course = ref(null)
onLoad(async (query) => {
course.value = await courseInfoApi.getCourseDetail(query.id)
})
</script>
<style lang="scss" scoped>
.title,
.date {
display: block;
}
.title {
color: $text-color-main;
font-size: 42rpx;
font-weight: 900;
line-height: 1.35;
}
.date {
margin-top: $spacing-sm;
color: $text-color-muted;
font-size: 24rpx;
}
.cover {
width: 100%;
height: 360rpx;
margin: $spacing-lg 0;
border-radius: $border-radius-lg;
background: $bg-color-hover;
}
.content-card {
color: $text-color-regular;
font-size: 28rpx;
line-height: 1.8;
}
.loading-state {
padding: 200rpx 0;
text-align: center;
color: $text-color-light;
font-size: 24rpx;
}
</style>