0d2c896510
- 全局 mixin 注册 onShareAppMessage/onShareTimeline,默认分享首页并携带 venue 参数 - 隐私/流程页(支付、登录、订单、预约、会员卡等)在 onShow 隐藏分享入口 - useShare 组合式工具,活动/排课/课程/商品等 6 个详情页自定义标题、封面与直达路径 - tab 壳页新增 useVenueRouteQuery,冷启动按 ?venue= 参数切换到对应场馆
80 lines
1.7 KiB
Vue
80 lines
1.7 KiB
Vue
<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'
|
|
import { useShare } from '@/utils/share'
|
|
|
|
const course = ref(null)
|
|
|
|
onLoad(async (query) => {
|
|
course.value = await courseInfoApi.getCourseDetail(query.id)
|
|
})
|
|
|
|
useShare(() => {
|
|
const data = course.value
|
|
if (!data) return null
|
|
return {
|
|
title: data.title,
|
|
path: `/pages/comprehensive/courses/info-detail?id=${data.id}`,
|
|
imageUrl: data.cover_image || '',
|
|
timelineQuery: `id=${data.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>
|