families.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <view class="container">
  3. <view class="family-card entry" @click="goWorkbench">
  4. <text class="family-name">审核工作台</text>
  5. <text class="family-meta">查看待审核方案与任务</text>
  6. </view>
  7. <view class="filter-bar">
  8. <view class="filter-item" :class="{ active: filterType === 'all' }" @click="changeFilter('all')">全部</view>
  9. <view class="filter-item" :class="{ active: filterType === 'active' }" @click="changeFilter('active')">活跃</view>
  10. <view class="filter-item" :class="{ active: filterType === 'pending' }" @click="changeFilter('pending')">待审核</view>
  11. </view>
  12. <view class="family-list">
  13. <view class="family-card" v-for="family in families" :key="family.id" @click="viewFamily(family)">
  14. <view class="family-header">
  15. <text class="family-name">{{ family.familyName || '家庭' + family.familyId }}</text>
  16. <text class="family-status">{{ family.status === 'active' ? '服务中' : '已暂停' }}</text>
  17. </view>
  18. <view class="family-info">
  19. <text class="info-item">👶 {{ family.childrenCount || 0 }}位成员</text>
  20. <text class="info-item">📍 {{ family.address || '未设置地址' }}</text>
  21. </view>
  22. <view class="family-tasks">
  23. <text class="task-info">今日任务: {{ family.todayTaskCount || 0 }}/{{ family.totalTaskCount || 0 }}</text>
  24. </view>
  25. <view class="family-actions">
  26. <button class="btn-action" size="mini" @click.stop="viewDetail(family)">查看详情</button>
  27. <!-- 聊天功能已隐藏(临时): <button class="btn-action primary" size="mini" @click.stop="sendMessage(family)">发消息</button> -->
  28. </view>
  29. </view>
  30. <view class="empty-tip" v-if="families.length === 0">
  31. <text>暂无服务家庭</text>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import { getBoundFamilies } from '../../utils/api.js'
  38. export default {
  39. data() {
  40. return {
  41. filterType: 'all',
  42. families: []
  43. }
  44. },
  45. onLoad() {
  46. this.loadFamilies()
  47. },
  48. methods: {
  49. async loadFamilies() {
  50. try {
  51. const res = await getBoundFamilies()
  52. if (res.data) {
  53. this.families = res.data
  54. }
  55. } catch (e) {
  56. console.error(e)
  57. }
  58. },
  59. changeFilter(type) {
  60. this.filterType = type
  61. },
  62. viewFamily(family) {
  63. uni.navigateTo({
  64. url: `/pages/family/detail?id=${family.familyId}`
  65. })
  66. },
  67. viewDetail(family) {
  68. this.viewFamily(family)
  69. },
  70. sendMessage(family) {
  71. uni.navigateTo({
  72. url: `/pages/teacher/messages?familyId=${family.familyId}`
  73. })
  74. },
  75. goWorkbench() {
  76. uni.navigateTo({ url: '/pages/teacher/review-workbench' })
  77. }
  78. }
  79. }
  80. </script>
  81. <style scoped>
  82. .container {
  83. padding: 30rpx;
  84. background: #f5f5f5;
  85. min-height: 100vh;
  86. }
  87. .filter-bar {
  88. display: flex;
  89. background: #fff;
  90. border-radius: 16rpx;
  91. padding: 20rpx;
  92. margin-bottom: 30rpx;
  93. }
  94. .filter-item {
  95. flex: 1;
  96. text-align: center;
  97. padding: 16rpx 0;
  98. font-size: 28rpx;
  99. color: #666;
  100. border-radius: 8rpx;
  101. }
  102. .filter-item.active {
  103. background: #667eea;
  104. color: #fff;
  105. }
  106. .family-card {
  107. background: #fff;
  108. border-radius: 16rpx;
  109. padding: 30rpx;
  110. margin-bottom: 20rpx;
  111. }
  112. .family-card.entry {
  113. border-left: 8rpx solid #4A9BD7;
  114. }
  115. .family-meta {
  116. display: block;
  117. font-size: 26rpx;
  118. color: #666;
  119. margin-top: 8rpx;
  120. }
  121. .family-header {
  122. display: flex;
  123. justify-content: space-between;
  124. align-items: center;
  125. margin-bottom: 20rpx;
  126. }
  127. .family-name {
  128. font-size: 32rpx;
  129. font-weight: bold;
  130. color: #333;
  131. }
  132. .family-status {
  133. font-size: 24rpx;
  134. color: #67C23A;
  135. background: #f0f9eb;
  136. padding: 8rpx 16rpx;
  137. border-radius: 8rpx;
  138. }
  139. .family-info {
  140. margin-bottom: 16rpx;
  141. }
  142. .info-item {
  143. font-size: 26rpx;
  144. color: #666;
  145. display: block;
  146. margin-bottom: 8rpx;
  147. }
  148. .family-tasks {
  149. padding: 16rpx 0;
  150. border-top: 1rpx solid #f0f0f0;
  151. border-bottom: 1rpx solid #f0f0f0;
  152. margin-bottom: 20rpx;
  153. }
  154. .task-info {
  155. font-size: 26rpx;
  156. color: #666;
  157. }
  158. .family-actions {
  159. display: flex;
  160. justify-content: flex-end;
  161. }
  162. .btn-action {
  163. margin-left: 20rpx;
  164. font-size: 24rpx;
  165. }
  166. .btn-action.primary {
  167. background: #667eea;
  168. color: #fff;
  169. }
  170. .empty-tip {
  171. text-align: center;
  172. color: #999;
  173. padding: 60rpx 0;
  174. }
  175. </style>