review-workbench.vue 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <view class="page">
  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. export default {
  33. data() {
  34. return {
  35. loading: true,
  36. families: []
  37. }
  38. },
  39. onLoad() {
  40. this.fetchFamilies()
  41. },
  42. methods: {
  43. async fetchFamilies() {
  44. this.loading = true
  45. try {
  46. const res = await getGuideMyFamilies()
  47. if (res && res.code === 200) {
  48. this.families = res.data || []
  49. } else {
  50. uni.showToast({ title: (res && res.message) || '加载失败', icon: 'none' })
  51. }
  52. } catch (e) {
  53. uni.showToast({ title: '网络异常', icon: 'none' })
  54. } finally {
  55. this.loading = false
  56. }
  57. },
  58. getFamilyKey(f) {
  59. return 'gf-' + f.familyId
  60. },
  61. formatTime(t) {
  62. if (!t) return '-'
  63. // 项目统一时间格式:取前19位并把 ISO 的 T 换成空格,避免 toLocaleString 的浏览器差异
  64. return String(t).substring(0, 19).replace('T', ' ')
  65. },
  66. goFamily(f) {
  67. uni.navigateTo({
  68. url: '/pages/teacher/review-family?familyId=' + f.familyId
  69. })
  70. }
  71. }
  72. }
  73. </script>
  74. <style scoped>
  75. .page { padding: 24rpx; background: #F5FAFE; min-height: 100vh; }
  76. .header { padding: 24rpx 8rpx; }
  77. .title { font-size: 36rpx; font-weight: 600; color: #1F2D3D; display: block; }
  78. .sub { font-size: 26rpx; color: #8A94A6; margin-top: 8rpx; display: block; }
  79. .card { background: #fff; border-radius: 16rpx; padding: 24rpx; margin-bottom: 20rpx; }
  80. .row { display: flex; flex-direction: row; align-items: center; justify-content: space-between; margin-bottom: 12rpx; }
  81. .name { font-size: 30rpx; color: #1F2D3D; font-weight: 500; }
  82. .badge { font-size: 22rpx; color: #4A9BD7; background: #EAF4FC; padding: 4rpx 12rpx; border-radius: 8rpx; }
  83. .meta { font-size: 24rpx; color: #8A94A6; }
  84. .empty { text-align: center; color: #8A94A6; font-size: 28rpx; padding: 80rpx 0; }
  85. </style>