| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <template>
- <view class="stats-page">
- <LoadingSkeleton v-if="loading" :rows="2" />
- <ErrorState v-else-if="error" message="记录加载失败" @retry="loadStats" />
- <EmptyState
- v-else-if="!stats.invited && !stats.paid"
- icon="📄"
- title="暂无来源记录"
- desc="有分享来源记录后会在此展示"
- />
- <template v-else>
- <view class="stat-card">
- <view class="stat-row">
- <view class="stat-item">
- <text class="stat-num">{{ stats.invited }}</text>
- <text class="stat-label">来源记录</text>
- </view>
- <view class="stat-item">
- <text class="stat-num">{{ stats.paid }}</text>
- <text class="stat-label">报名记录</text>
- </view>
- </view>
- </view>
- <view class="tip-card">
- <text class="tip-title">记录说明</text>
- <text class="tip-desc">1. 本页仅展示您的来源与报名记录</text>
- <text class="tip-desc">2. 记录仅供本人查看</text>
- <text class="tip-desc">3. 如对记录有疑问,请联系机构</text>
- </view>
- <view class="poster-link" @click="goPoster">
- <text>查看分享资料</text>
- <text class="arrow">›</text>
- </view>
- </template>
- </view>
- </template>
- <script>
- import { getInviteStats } from '@/utils/api.js'
- import { guardPage } from '@/utils/guard.js'
- import LoadingSkeleton from '@/components/loading-skeleton.vue'
- import ErrorState from '@/components/error-state.vue'
- import EmptyState from '@/components/empty-state.vue'
- export default {
- components: { LoadingSkeleton, ErrorState, EmptyState },
- data() {
- return {
- stats: { invited: 0, paid: 0 },
- loading: false,
- error: false
- }
- },
- onShow() {
- if (!guardPage()) return
- this.loadStats()
- },
- methods: {
- loadStats() {
- var self = this
- self.loading = true
- self.error = false
- getInviteStats().then(function(resp) {
- var data = resp.data || {}
- self.stats = {
- invited: data.invited || 0,
- paid: data.paid || 0
- }
- }).catch(function() {
- self.error = true
- }).finally(function() {
- self.loading = false
- })
- },
- goPoster() {
- uni.navigateBack({})
- }
- }
- }
- </script>
- <style scoped>
- .stats-page { min-height: 100vh; background: #F5FAFE; padding: 24rpx 32rpx; }
- .stat-card { background: #FFF; border-radius: 16rpx; padding: 40rpx 24rpx; margin-bottom: 24rpx; }
- .stat-row { display: flex; justify-content: space-around; }
- .stat-item { display: flex; flex-direction: column; align-items: center; flex: 1; }
- .stat-num { font-size: 56rpx; font-weight: 700; color: #2E6FA8; }
- .stat-label { font-size: 26rpx; color: #3B5A78; margin-top: 12rpx; }
- .tip-card { background: #FFF; border-radius: 16rpx; padding: 32rpx; margin-bottom: 24rpx; }
- .tip-title { display: block; font-size: 30rpx; font-weight: 700; color: #1E3A5F; margin-bottom: 16rpx; border-left: 8rpx solid #2E6FA8; padding-left: 16rpx; }
- .tip-desc { display: block; font-size: 26rpx; color: #3B5A78; line-height: 48rpx; }
- .poster-link { display: flex; align-items: center; justify-content: center; padding: 32rpx 0; color: #3B5A78; font-size: 28rpx; }
- .poster-link .arrow { color: #6B7B8C; font-size: 32rpx; margin-left: 8rpx; }
- </style>
|