families.vue 4.7 KB

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