review-workbench.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <view class="page" :style="{ '--font-scale': fontScale }">
  3. <view class="header">
  4. <text class="title">审核工作台</text>
  5. <text class="sub">我服务的家庭</text>
  6. </view>
  7. <view v-if="loading" class="empty">加载中…</view>
  8. <view v-else-if="families.length === 0" class="empty">
  9. 尚未绑定任何家庭
  10. </view>
  11. <view v-else>
  12. <view
  13. v-for="f in families"
  14. :key="getFamilyKey(f)"
  15. class="card"
  16. @click="goFamily(f)"
  17. >
  18. <view class="row">
  19. <text class="name">{{ f.familyName || ('家庭 #' + f.familyId) }}</text>
  20. <text class="badge">{{ f.serviceType === 'paid' ? '收费' : '免费' }}</text>
  21. </view>
  22. <view class="row">
  23. <text class="meta">成员 {{ f.memberCount || 0 }} 人</text>
  24. <text class="meta">绑定于 {{ formatTime(f.boundAt) }}</text>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import { getGuideMyFamilies } from '@/utils/api.js'
  32. import fontScaleMixin from '@/mixins/font-scale.js'
  33. export default {
  34. mixins: [fontScaleMixin],
  35. data() {
  36. return {
  37. loading: true,
  38. families: []
  39. }
  40. },
  41. onLoad() {
  42. this.fetchFamilies()
  43. },
  44. methods: {
  45. async fetchFamilies() {
  46. this.loading = true
  47. try {
  48. const res = await getGuideMyFamilies()
  49. if (res && res.code === 200) {
  50. this.families = res.data || []
  51. } else {
  52. uni.showToast({ title: (res && res.message) || '加载失败', icon: 'none' })
  53. }
  54. } catch (e) {
  55. uni.showToast({ title: '网络异常', icon: 'none' })
  56. } finally {
  57. this.loading = false
  58. }
  59. },
  60. getFamilyKey(f) {
  61. return 'gf-' + f.familyId
  62. },
  63. formatTime(t) {
  64. if (!t) return '-'
  65. // 项目统一时间格式:取前19位并把 ISO 的 T 换成空格,避免 toLocaleString 的浏览器差异
  66. return String(t).substring(0, 19).replace('T', ' ')
  67. },
  68. goFamily(f) {
  69. uni.navigateTo({
  70. url: '/pages/teacher/review-family?familyId=' + f.familyId
  71. })
  72. }
  73. }
  74. }
  75. </script>
  76. <style scoped lang="scss">
  77. .page { padding: 24rpx; background: $facade-fill-blue-ghost; min-height: 100vh; }
  78. .header { padding: 24rpx 8rpx; }
  79. .title { font-size: calc(36rpx * var(--font-scale, 1)); font-weight: 600; color: $ink-steel; display: block; }
  80. .sub { font-size: calc(26rpx * var(--font-scale, 1)); color: $text-steel; margin-top: 8rpx; display: block; }
  81. .card { background: $app-surface; border-radius: 16rpx; padding: 24rpx; margin-bottom: 20rpx; }
  82. .row { display: flex; flex-direction: row; align-items: center; justify-content: space-between; margin-bottom: 12rpx; }
  83. .name { font-size: calc(30rpx * var(--font-scale, 1)); color: $ink-steel; font-weight: 500; }
  84. .badge { font-size: calc(22rpx * var(--font-scale, 1)); color: $uni-info; background: $tint-sky-soft-2; padding: 4rpx 12rpx; border-radius: 8rpx; }
  85. .meta { font-size: calc(24rpx * var(--font-scale, 1)); color: $text-steel; }
  86. .empty { text-align: center; color: $text-steel; font-size: calc(28rpx * var(--font-scale, 1)); padding: 80rpx 0; }
  87. </style>