| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <template>
- <view class="container" :style="{ '--font-scale': fontScale }">
- <view class="header">
- <text class="title">我的计划</text>
- <text class="subtitle">查看和管理家庭成长计划</text>
- </view>
- <!-- 加载中 -->
- <view class="loading" v-if="loading">
- <text>加载中...</text>
- </view>
- <!-- 空状态 -->
- <view class="empty" v-else-if="plans.length === 0">
- <text class="empty-icon">📋</text>
- <text class="empty-text">暂无计划</text>
- <text class="empty-hint">规划师可为您创建专属成长计划</text>
- </view>
- <!-- 计划列表 -->
- <view class="plan-list" v-else>
- <view class="plan-card" v-for="plan in plans" :key="plan.id" @click="goDetail(plan.id)">
- <view class="card-top">
- <text class="plan-title">{{ plan.title }}</text>
- <view class="plan-status" :class="'status-' + (plan.status || 0)">
- <text>{{ statusText(plan.status) }}</text>
- </view>
- </view>
- <text class="plan-desc" v-if="plan.description">{{ plan.description }}</text>
- <view class="card-meta">
- <text class="meta-item">成员:{{ plan.childName || '--' }}</text>
- <text class="meta-item">创建时间:{{ plan.createTime || '--' }}</text>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import { listFamilyPlans } from '../../../utils/api.js'
- import fontScaleMixin from '@/mixins/font-scale.js'
- export default {
- mixins: [fontScaleMixin],
- data() {
- return {
- loading: false,
- plans: []
- }
- },
- computed: {},
- onShow() {
- this.loadPlans()
- },
- methods: {
- loadPlans: function() {
- this.loading = true
- var self = this
- listFamilyPlans({}).then(function(res) {
- self.loading = false
- if (res.code === 200 && Array.isArray(res.data)) {
- self.plans = res.data
- } else if (res.code === 200 && res.data && res.data.records) {
- self.plans = res.data.records
- }
- }).catch(function() {
- self.loading = false
- self.plans = []
- })
- },
- goDetail: function(id) {
- uni.navigateTo({ url: './detail?planId=' + id })
- },
- statusText: function(status) {
- var map = { 0: '待审核', 1: '进行中', 2: '已完成', 3: '已取消' }
- return map[status] || '未知'
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .container { min-height: 100vh; background: $facade-fill-page; padding-bottom: $uni-space-lg; }
- .header { padding: 40rpx $uni-space-page 20rpx; }
- .title { font-size: calc(36rpx * var(--font-scale, 1)); font-weight: bold; color: $facade-text-strong; display: block; }
- .subtitle { font-size: calc(26rpx * var(--font-scale, 1)); color: $facade-text-muted; margin-top: 8rpx; display: block; }
- .loading, .empty { display: flex; flex-direction: column; align-items: center; padding: 100rpx 0; }
- .empty-icon { font-size: calc($uni-font-size-5xl * var(--font-scale, 1)); }
- .empty-text { font-size: calc(30rpx * var(--font-scale, 1)); color: $facade-text-body; margin-top: 20rpx; }
- .empty-hint { font-size: calc(26rpx * var(--font-scale, 1)); color: $facade-text-ghost-light; margin-top: 10rpx; }
- .plan-list { padding: 0 $uni-space-page; }
- .plan-card { background: $app-surface; border-radius: 16rpx; padding: $uni-space-page; margin-bottom: 20rpx; box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06); }
- .card-top { display: flex; justify-content: space-between; align-items: center; }
- .plan-title { font-size: calc(30rpx * var(--font-scale, 1)); font-weight: bold; color: $facade-text-strong; flex: 1; }
- .plan-status { font-size: calc(22rpx * var(--font-scale, 1)); padding: 4rpx 16rpx; border-radius: 24rpx; }
- .status-0 { background: $fortune-1-tint; color: $brand-primary; }
- .status-1 { background: $mat-green-tint; color: $mat-green; }
- .status-2 { background: $mat-blue-tint; color: $mat-blue-base; }
- .status-3 { background: $facade-fill-2; color: $facade-text-muted; }
- .plan-desc { font-size: calc(26rpx * var(--font-scale, 1)); color: $facade-text-body; margin-top: 12rpx; display: block; line-height: 1.5; }
- .card-meta { display: flex; flex-direction: column; margin-top: 16rpx; gap: 6rpx; }
- .meta-item { font-size: calc(24rpx * var(--font-scale, 1)); color: $facade-text-ghost-light; }
- </style>
|