Files
airz-uniapp/packages/content/classroom/classroom.uvue
T

81 lines
5.6 KiB
Plaintext
Raw Normal View History

2026-09-10 10:57:40 +08:00
<template>
<view class="page" :style="pageStyle()">
2026-09-10 10:57:40 +08:00
<AppHeader title="融资课堂" />
<scroll-view scroll-y :style="contentStyle(96, false)">
2026-09-10 10:57:40 +08:00
<view class="classroom-content">
<view class="classroom-hero"><view class="hero-copy"><text class="hero-eyebrow">实用融资知识</text><text class="hero-title">准备更充分</text><text class="hero-title hero-title-next">申请更从容</text><text class="hero-desc">每次几分钟,掌握一个知识点</text></view><image src="/packages/content/static/news-policy.png" mode="aspectFill" class="hero-image"></image></view>
<view class="topic-section">
<text class="section-title">按场景学习</text>
<view class="topic-list">
<view v-for="item in topics" :key="item.id" :class="activeTopic == item.id ? 'topic-card selected-topic' : 'topic-card'" @click="selectTopic(item.id)">
<AppIcon :name="item.icon" :size="48" />
<view class="topic-copy"><text class="topic-title">{{ item.title }}</text><text class="topic-desc">{{ item.desc }}</text></view>
<text v-if="activeTopic == item.id" class="topic-selected">已选</text><AppIcon v-else name="chevron-right" :size="28" muted />
</view>
</view>
</view>
<view class="lesson-section">
<view class="section-head"><text class="section-title">{{ activeTopic == '' ? '精选课程' : activeTopicTitle }}</text><view class="all-lessons" @click="activeTopic = ''"><text class="lesson-count">{{ activeTopic == '' ? lessons.length + ' 门课程' : '查看全部' }}</text></view></view>
<view class="lesson-card" v-for="item in lessons" :key="item.id" @click="openLesson(item.id)">
<image :src="item.image" mode="aspectFill" class="lesson-card-image"></image>
<view class="lesson-copy"><text class="lesson-title">{{ item.title }}</text><text class="lesson-desc">{{ item.desc }}</text><view class="lesson-meta"><text class="lesson-duration">{{ item.duration }}</text><text class="lesson-tag">{{ item.tag }}</text></view></view>
</view>
</view>
2026-09-10 10:57:40 +08:00
</view>
</scroll-view>
</view>
</template>
<script setup lang="uts">
import { usePageLayout } from '@/services/layout.uts'
import { financeLessons, FinanceLesson } from '@/packages/content/services/content.uts'
2026-09-10 10:57:40 +08:00
import AppHeader from '@/components/AppHeader.uvue'
import AppIcon from '@/components/AppIcon.uvue'
const { contentStyle, pageStyle } = usePageLayout()
type LessonTopic = { id: string, title: string, desc: string, icon: string }
const topics: LessonTopic[] = [
{ id: 'credit', title: '个人信用提升', desc: '了解信用记录与还款能力', icon: 'user' },
{ id: 'business', title: '小微经营融资', desc: '梳理经营材料与融资成本', icon: 'building' },
{ id: 'documents', title: '材料准备清单', desc: '按申请场景,逐项检查资料', icon: 'file-text' }
2026-09-10 10:57:40 +08:00
]
const activeTopic = ref('')
const activeTopicTitle = computed((): string => topics.find((item: LessonTopic): boolean => item.id == activeTopic.value)?.title ?? '精选课程')
const lessons = computed((): FinanceLesson[] => {
if (activeTopic.value == '') return financeLessons
return financeLessons.filter((item: FinanceLesson): boolean => item.topics.includes(activeTopic.value))
})
const selectTopic = (id: string): void => { activeTopic.value = activeTopic.value == id ? '' : id }
const openLesson = (id: string): void => { uni.navigateTo({ url: '/packages/content/lesson/lesson?id=' + id }) }
2026-09-10 10:57:40 +08:00
</script>
<style>
.classroom-content { padding: 24rpx 28rpx 48rpx; }
.classroom-hero { border-radius: 20rpx; background-color: #e8f2ff; flex-direction: row; overflow: hidden; align-items: center; }
.hero-copy { flex: 1; padding: 28rpx 12rpx 28rpx 26rpx; }
.hero-eyebrow { color: #0868f7; font-size: 22rpx; font-weight: 600; }
.hero-title { color: #14335f; font-size: 37rpx; line-height: 51rpx; font-weight: 700; margin-top: 10rpx; }
.hero-title-next { margin-top: 0; }
.hero-desc { color: #4b6586; font-size: 23rpx; line-height: 36rpx; margin-top: 14rpx; }
.hero-image { width: 230rpx; height: 280rpx; flex-shrink: 0; }
.topic-section { margin-top: 28rpx; }
.topic-list { margin-top: 16rpx; }
.topic-card { flex-direction: row; align-items: center; min-height: 116rpx; padding: 18rpx 22rpx; border-radius: 16rpx; border: 1rpx solid #e5ecf5; background-color: #ffffff; margin-bottom: 12rpx; }
.selected-topic { background-color: #eef5ff; border-color: #99c1fb; }
.topic-copy { flex: 1; margin-left: 20rpx; }
.topic-title { color: #172640; font-size: 28rpx; line-height: 40rpx; font-weight: 600; }
.topic-desc { color: #66758a; font-size: 23rpx; line-height: 34rpx; margin-top: 4rpx; }
.topic-selected { color: #0868f7; font-size: 23rpx; margin-left: 10rpx; }
.lesson-section { margin-top: 18rpx; }
.section-head { flex-direction: row; align-items: center; justify-content: space-between; }
.all-lessons { padding: 12rpx 0 12rpx 20rpx; }
.lesson-count { color: #0868f7; font-size: 23rpx; }
.lesson-card { margin-top: 16rpx; padding: 20rpx; border-radius: 18rpx; background-color: #ffffff; border: 1rpx solid #e5ecf5; flex-direction: row; align-items: center; }
.lesson-card-image { width: 142rpx; height: 150rpx; border-radius: 12rpx; margin-right: 20rpx; flex-shrink: 0; }
.lesson-copy { flex: 1; }
.lesson-title { color: #172640; font-size: 30rpx; line-height: 42rpx; font-weight: 600; }
.lesson-desc { color: #66758a; font-size: 24rpx; line-height: 36rpx; margin-top: 8rpx; }
.lesson-meta { flex-direction: row; align-items: center; margin-top: 12rpx; }
.lesson-duration { color: #66758a; font-size: 22rpx; }
.lesson-tag { margin-left: 16rpx; color: #0868f7; font-size: 22rpx; }
2026-09-10 10:57:40 +08:00
</style>