TaskQuickList.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <view class="section">
  3. <view class="section-header">
  4. <text class="section-title">📝 我的任务({{ tasks.length }})</text>
  5. <view class="section-header-extra">
  6. <text class="task-family-count" @click="$emit('view-all')">家庭任务({{ familyTodoCount }})</text>
  7. <text class="section-more" @click="$emit('view-all')">全部 ›</text>
  8. </view>
  9. </view>
  10. <view v-if="tasks.length > 0" class="task-quick-list">
  11. <view
  12. v-for="task in tasks"
  13. :key="task.id"
  14. class="task-quick-item"
  15. :class="{ 'task-quick-item--overdue': task._isOverdue }"
  16. >
  17. <view class="task-quick-info">
  18. <text class="task-quick-title line-clamp-1">{{ task.title }}</text>
  19. <text class="task-quick-meta" v-if="!task._isOverdue">+{{ task.points }}CF</text>
  20. <text class="task-quick-meta task-quick-meta--overdue" v-else>已超期</text>
  21. </view>
  22. <button v-if="!task._isOverdue" class="btn-quick-complete" @click="$emit('complete', task)">{{ task._isLinked ? '去完成' : '完成' }}</button>
  23. <view v-else class="status-badge-overdue">⏰ 已超期</view>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. name: 'TaskQuickList',
  31. props: {
  32. tasks: {
  33. type: Array,
  34. default: function() { return [] }
  35. },
  36. familyTodoCount: {
  37. type: Number,
  38. default: 0
  39. }
  40. }
  41. }
  42. </script>
  43. <style scoped lang="scss">
  44. /* ④ 内容区 — 家庭动态(任务快捷列表);样式与 pages/index-home/index.vue 原内联区块一致 */
  45. .section {
  46. margin: 20rpx $uni-space-lg;
  47. }
  48. .section-header {
  49. display: flex;
  50. justify-content: space-between;
  51. align-items: center;
  52. margin-bottom: 20rpx;
  53. }
  54. .section-title {
  55. font-size: calc(30rpx * var(--font-scale, 1));
  56. font-weight: bold;
  57. color: $facade-text-strong;
  58. }
  59. .section-more {
  60. font-size: calc(24rpx * var(--font-scale, 1));
  61. color: $brand-primary;
  62. }
  63. /* 家庭任务右侧计数标(家庭任务 + 全部) */
  64. .section-header-extra {
  65. display: flex;
  66. flex-direction: row;
  67. align-items: center;
  68. }
  69. .task-family-count {
  70. margin-right: 16rpx;
  71. padding: 4rpx 16rpx;
  72. border-radius: $radius-full;
  73. background: rgba($brand-primary, 0.08);
  74. color: $brand-primary;
  75. font-size: calc(22rpx * var(--font-scale, 1));
  76. font-weight: 600;
  77. line-height: 1.5;
  78. }
  79. /* 我的任务快捷列表 */
  80. .task-quick-list {
  81. display: flex;
  82. flex-direction: column;
  83. gap: 12rpx;
  84. }
  85. .task-quick-item {
  86. display: flex;
  87. flex-direction: row;
  88. align-items: center;
  89. justify-content: space-between;
  90. background: $app-surface;
  91. border-radius: 16rpx;
  92. padding: 18rpx 24rpx;
  93. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
  94. }
  95. .task-quick-info {
  96. display: flex;
  97. flex-direction: column;
  98. min-width: 0;
  99. flex: 1;
  100. }
  101. .task-quick-title {
  102. font-size: calc(26rpx * var(--font-scale, 1));
  103. color: $facade-text-strong;
  104. font-weight: 500;
  105. line-height: 1.4;
  106. }
  107. .task-quick-meta {
  108. font-size: calc(22rpx * var(--font-scale, 1));
  109. color: $brand-primary;
  110. margin-top: 4rpx;
  111. font-weight: bold;
  112. }
  113. .line-clamp-1 {
  114. overflow: hidden;
  115. text-overflow: ellipsis;
  116. white-space: nowrap;
  117. }
  118. .btn-quick-complete {
  119. margin-left: 16rpx;
  120. padding: 8rpx 24rpx;
  121. background: linear-gradient(135deg, $brand-primary, $brand-primary-light);
  122. color: $app-surface;
  123. font-size: calc(24rpx * var(--font-scale, 1));
  124. font-weight: bold;
  125. border-radius: 24rpx;
  126. border: none;
  127. line-height: 1;
  128. height: 44rpx;
  129. flex-shrink: 0;
  130. }
  131. .btn-quick-complete::after {
  132. border: none;
  133. }
  134. /* 超期任务样式 */
  135. .task-quick-item--overdue .task-quick-meta--overdue {
  136. color: $status-danger-2;
  137. font-weight: bold;
  138. }
  139. .status-badge-overdue {
  140. margin-left: 16rpx;
  141. padding: 8rpx 20rpx;
  142. background: rgba(255,77,79,0.1);
  143. color: $status-danger-2;
  144. font-size: calc(24rpx * var(--font-scale, 1));
  145. font-weight: bold;
  146. border-radius: 24rpx;
  147. flex-shrink: 0;
  148. line-height: 1;
  149. height: 44rpx;
  150. display: flex;
  151. align-items: center;
  152. }
  153. </style>