| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291 |
- <template>
- <view class="container">
- <!-- 状态栏占位 -->
- <view class="status-bar" :style="{height: statusBarHeight}"></view>
-
- <!-- 顶部导航栏 -->
- <view class="header">
- <view class="back-btn" @click="goBack">
- <image src="@/static/image/back.png" mode="aspectFill"></image>
- </view>
- <view class="title">活动详情</view>
- <view class="header-right">
- <text class="more-icon">⋯</text>
- <text class="more-icon">○</text>
- </view>
- </view>
-
- <scroll-view class="content" scroll-y>
- <!-- 活动头部 -->
- <view class="activity-header">
- <view class="logo-section">
- <view class="logo-icon">预定</view>
- <view class="logo-text">YOUR LOGO</view>
- <view class="logo-url">www.gaoding.com</view>
- </view>
-
- <view class="activity-title">
- <view class="title-main">{{ activityData.title }}</view>
- <view class="title-en">{{ activityData.titleEn }}</view>
- <view class="title-date">{{ activityData.date }}</view>
- </view>
- </view>
-
- <!-- 活动主图 -->
- <view class="activity-banner">
- <image class="banner-image" :src="activityData.bannerImage" mode="aspectFill"></image>
- <view class="banner-text">{{ activityData.bannerText }}</view>
- </view>
- </scroll-view>
-
- <!-- 底部按钮 -->
- <view class="bottom-btn" :class="activityData.buttonClass" @click="handleAction">
- {{ activityData.buttonText }}
- </view>
- </view>
- </template>
- <script>
- import { getActivityDetail } from '@/api-js/medicationSurvey'
- export default {
- data() {
- return {
- statusBarHeight: uni.getSystemInfoSync().statusBarHeight + 'px',
- activityId: '',
- activityData: {
- title: '世界关节炎日',
- titleEn: 'WORLD ARTHRISTIS DAY',
- date: '2024年10月12日',
- bannerImage: '',
- bannerText: '早预防・早诊断・早治疗',
- status: 'notStarted', // notStarted, inProgress, ended
- buttonText: '活动未开始',
- buttonClass: 'not-started',
- completedCount: 0,
- totalCount: 3
- }
- }
- },
- onLoad(options) {
- if (options.id) {
- this.activityId = options.id
- this.loadData()
- }
- },
- methods: {
- goBack() {
- uni.navigateBack()
- },
- handleAction() {
- if (this.activityData.status === 'notStarted') {
- uni.showToast({
- icon: 'none',
- title: '活动未开始'
- })
- } else if (this.activityData.status === 'ended') {
- uni.showToast({
- icon: 'none',
- title: '活动已结束'
- })
- } else {
- // 跳转到病例征集页面
- uni.navigateTo({
- url: `/pages_task/caseCollection?activityId=${this.activityId}`
- })
- }
- },
- async loadData() {
- try {
- uni.showLoading({ title: '加载中...' })
- const res = await getActivityDetail({ id: this.activityId })
- uni.hideLoading()
- if (res.code === 200 && res.data) {
- this.activityData = { ...this.activityData, ...res.data }
- this.updateButtonText()
- }
- } catch (e) {
- uni.hideLoading()
- console.error('加载数据失败', e)
- }
- },
- updateButtonText() {
- if (this.activityData.status === 'notStarted') {
- this.activityData.buttonText = '活动未开始'
- this.activityData.buttonClass = 'not-started'
- } else if (this.activityData.status === 'ended') {
- this.activityData.buttonText = '活动已结束'
- this.activityData.buttonClass = 'ended'
- } else {
- this.activityData.buttonText = `上传病例 ${this.activityData.completedCount}/${this.activityData.totalCount}`
- this.activityData.buttonClass = 'upload-case'
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .container {
- min-height: 100vh;
- background: linear-gradient(180deg, #E6F3FF 0%, #FFFFFF 100%);
- display: flex;
- flex-direction: column;
- }
- .status-bar {
- width: 100%;
- background: transparent;
- }
- .header {
- position: relative;
- height: 88rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- background: transparent;
-
- .back-btn {
- position: absolute;
- left: 24rpx;
- width: 40rpx;
- height: 40rpx;
-
- image {
- width: 100%;
- height: 100%;
- }
- }
-
- .title {
- font-size: 36rpx;
- font-weight: bold;
- color: #333;
- }
-
- .header-right {
- position: absolute;
- right: 24rpx;
- display: flex;
- align-items: center;
- gap: 16rpx;
-
- .more-icon {
- font-size: 32rpx;
- color: #333;
- }
- }
- }
- .content {
- flex: 1;
- padding: 24rpx;
- }
- .activity-header {
- margin-bottom: 32rpx;
-
- .logo-section {
- display: flex;
- align-items: center;
- gap: 16rpx;
- margin-bottom: 24rpx;
-
- .logo-icon {
- width: 48rpx;
- height: 48rpx;
- background: #388BFF;
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 20rpx;
- color: #fff;
- }
-
- .logo-text {
- font-size: 28rpx;
- font-weight: bold;
- color: #388BFF;
- }
-
- .logo-url {
- font-size: 24rpx;
- color: #388BFF;
- }
- }
-
- .activity-title {
- .title-main {
- font-size: 48rpx;
- font-weight: bold;
- color: #388BFF;
- margin-bottom: 8rpx;
- }
-
- .title-en {
- font-size: 36rpx;
- font-weight: bold;
- color: #388BFF;
- margin-bottom: 8rpx;
- }
-
- .title-date {
- font-size: 28rpx;
- color: #388BFF;
- }
- }
- }
- .activity-banner {
- position: relative;
- width: 100%;
- height: 600rpx;
- border-radius: 16rpx;
- overflow: hidden;
- background: linear-gradient(135deg, #E6F3FF 0%, #FFFFFF 100%);
-
- .banner-image {
- width: 100%;
- height: 100%;
- }
-
- .banner-text {
- position: absolute;
- bottom: 40rpx;
- left: 50%;
- transform: translateX(-50%);
- font-size: 28rpx;
- color: #fff;
- white-space: nowrap;
- }
- }
- .bottom-btn {
- position: fixed;
- bottom: 0;
- left: 0;
- right: 0;
- height: 88rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 32rpx;
- color: #fff;
- font-weight: 500;
- z-index: 100;
-
- &.not-started {
- background: #87CEEB;
- }
-
- &.upload-case {
- background: #388BFF;
- }
-
- &.ended {
- background: #999;
- }
- }
- </style>
|