tasks.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783
  1. <template>
  2. <view class="page-bg" :style="{ '--font-scale': fontScale }">
  3. <!-- 退出切换(家庭主账号切换到成员状态时显示) -->
  4. <view class="exit-switch" v-if="isSwitchedChild" @click="exitSwitch">
  5. <text class="exit-switch__icon">🔄</text>
  6. <text class="exit-switch__text">退出切换</text>
  7. </view>
  8. <!-- 顶部标签栏 -->
  9. <view class="tab-bar clay-card">
  10. <view
  11. v-for="tab in tabs"
  12. :key="tab.key"
  13. class="tab-item"
  14. :class="{ 'tab-item--active': activeTab === tab.key }"
  15. hover-class="tab-item--hover"
  16. @click="switchTab(tab.key)"
  17. >
  18. <text class="tab-item__label">{{ tab.label }}</text>
  19. <text class="tab-item__count" v-if="tab.count > 0">{{ tab.count }}</text>
  20. </view>
  21. </view>
  22. <!-- 加载状态 -->
  23. <BaseLoading :loading="loading" text="小助理正在准备任务..." />
  24. <!-- 任务列表 -->
  25. <view class="task-list" v-if="!loading && filteredTasks.length > 0">
  26. <view
  27. v-for="(task, index) in filteredTasks"
  28. :key="task.id"
  29. class="animate-slide-up"
  30. :class="'animate-stagger-' + ((index % 20) + 1)"
  31. >
  32. <view
  33. class="task-card clay-card"
  34. :class="{
  35. 'task-card--completed': task.status === 'completed',
  36. 'task-card--overdue': getIsOverdue(task),
  37. 'task-card--completing': completingTaskId === task.id
  38. }"
  39. >
  40. <!-- 完成时庆祝遮罩 -->
  41. <view class="task-card__celebrate" v-if="completingTaskId === task.id">
  42. <text class="task-card__celebrate-icon">🎉</text>
  43. </view>
  44. <view class="task-card__inner">
  45. <!-- 左侧图标 -->
  46. <view class="task-icon">
  47. <text class="task-icon__emoji">{{ getCategoryIcon(task.category) }}</text>
  48. </view>
  49. <!-- 中间内容 -->
  50. <view class="task-content">
  51. <view class="task-title">{{ task.title }}</view>
  52. <view class="task-meta">
  53. <BaseBadge variant="warning" size="xs">
  54. <text class="points-text">+{{ task.points }} CF</text>
  55. </BaseBadge>
  56. <text
  57. class="task-time"
  58. v-if="task.status === 'pending' && !getIsOverdue(task)"
  59. >
  60. ⏱ {{ getTimeLeft(task) }}
  61. </text>
  62. <text
  63. class="task-time task-time--overdue"
  64. v-if="getIsOverdue(task)"
  65. >
  66. ⏰ 已超时{{ getOverdueDays(task) }}
  67. </text>
  68. </view>
  69. </view>
  70. <!-- 右侧操作 -->
  71. <view class="task-action">
  72. <!-- 待完成任务 -->
  73. <template v-if="task.status === 'pending' && !getIsOverdue(task)">
  74. <PlayfulButton
  75. variant="clay"
  76. size="sm"
  77. :disabled="completingTaskId === task.id"
  78. @click="handleTaskClick(task)"
  79. >
  80. <text>{{ getActionLabel(task) }}</text>
  81. </PlayfulButton>
  82. </template>
  83. <!-- 已超时且未完成的任务,显示已超时状态 -->
  84. <view
  85. class="status-badge status-badge--overdue"
  86. v-if="getIsOverdue(task) && task.status !== 'completed'"
  87. >
  88. <text class="status-badge__text">⏰ 已超时</text>
  89. </view>
  90. <!-- 已完成任务 -->
  91. <view
  92. class="status-badge status-badge--completed"
  93. v-if="task.status === 'completed'"
  94. >
  95. <text class="status-badge__text">✅ 已完成</text>
  96. </view>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. <!-- 空状态 -->
  103. <view class="empty-wrapper" v-if="!loading && filteredTasks.length === 0">
  104. <BaseEmpty
  105. :icon="emptyIcon"
  106. :title="emptyTitle"
  107. :description="emptyDescription"
  108. >
  109. </BaseEmpty>
  110. </view>
  111. </view>
  112. </template>
  113. <script>
  114. import PlayfulButton from '@/components/PlayfulButton.vue'
  115. import BaseBadge from '@/components/BaseBadge.vue'
  116. import BaseEmpty from '@/components/BaseEmpty.vue'
  117. import BaseLoading from '@/components/BaseLoading.vue'
  118. import { getTodayTasks, completeTask as completeTaskApi, getChildren, switchBackToParent, verifyPassword } from '../../utils/api.js'
  119. import { parseDate } from '../../utils/format.js'
  120. import fontScaleMixin from '@/mixins/font-scale.js'
  121. export default {
  122. mixins: [fontScaleMixin],
  123. components: { PlayfulButton, BaseBadge, BaseEmpty, BaseLoading },
  124. data() {
  125. return {
  126. tasks: [],
  127. currentChildId: '',
  128. isSwitchedChild: false,
  129. loading: false,
  130. activeTab: 'pending',
  131. completingTaskId: null
  132. }
  133. },
  134. computed: {
  135. tabs() {
  136. var pending = 0
  137. var completed = 0
  138. var overdue = 0
  139. var task, i
  140. for (i = 0; i < this.tasks.length; i++) {
  141. task = this.tasks[i]
  142. if (task.status === 'completed') {
  143. completed++
  144. } else if (this.checkIsOverdue(task)) {
  145. overdue++
  146. } else {
  147. pending++
  148. }
  149. }
  150. return [
  151. { key: 'pending', label: '📋 待完成', count: pending },
  152. { key: 'completed', label: '✅ 已完成', count: completed },
  153. { key: 'overdue', label: '⏰ 已超时', count: overdue }
  154. ]
  155. },
  156. filteredTasks() {
  157. var result = []
  158. var task, i
  159. for (i = 0; i < this.tasks.length; i++) {
  160. task = this.tasks[i]
  161. if (this.activeTab === 'pending') {
  162. if (task.status === 'pending' && !this.checkIsOverdue(task)) {
  163. result.push(task)
  164. }
  165. } else if (this.activeTab === 'completed') {
  166. if (task.status === 'completed') {
  167. result.push(task)
  168. }
  169. } else if (this.activeTab === 'overdue') {
  170. if (this.checkIsOverdue(task)) {
  171. result.push(task)
  172. }
  173. }
  174. }
  175. return result
  176. },
  177. emptyIcon() {
  178. var icons = {
  179. pending: '📝',
  180. completed: '🎉',
  181. overdue: '😴'
  182. }
  183. return icons[this.activeTab] || '📋'
  184. },
  185. emptyTitle() {
  186. var titles = {
  187. pending: '暂无待完成任务',
  188. completed: '还没有已完成的任务',
  189. overdue: '太棒了,没有超时任务!'
  190. }
  191. return titles[this.activeTab] || ''
  192. },
  193. emptyDescription() {
  194. var descs = {
  195. pending: '让家庭主账号布置一些任务吧~\n完成后可以获得积分奖励哦',
  196. completed: '完成的任务都会出现在这里,\n继续保持好习惯!',
  197. overdue: '继续保持良好的完成习惯,\n按时完成任务吧!'
  198. }
  199. return descs[this.activeTab] || ''
  200. }
  201. },
  202. onShow() {
  203. this.isSwitchedChild = uni.getStorageSync('isSwitchedChild') || false
  204. this.loadData()
  205. },
  206. methods: {
  207. async loadData() {
  208. var childrenRes, children, storedChildId, currentChild, i, res
  209. this.loading = true
  210. try {
  211. childrenRes = await getChildren()
  212. children = childrenRes.data || []
  213. storedChildId = uni.getStorageSync('currentChildId')
  214. currentChild = null
  215. for (i = 0; i < children.length; i++) {
  216. if (String(children[i].id) === String(storedChildId)) {
  217. currentChild = children[i]
  218. break
  219. }
  220. }
  221. if (!currentChild) {
  222. currentChild = children[0]
  223. }
  224. if (!currentChild) {
  225. this.tasks = []
  226. this.currentChildId = ''
  227. return
  228. }
  229. this.currentChildId = currentChild.id
  230. res = await getTodayTasks(currentChild.id)
  231. this.tasks = res.data || []
  232. } catch (e) {
  233. console.error('加载成员任务失败', e)
  234. } finally {
  235. this.loading = false
  236. }
  237. },
  238. async completeChildTask(taskId) {
  239. var res, points
  240. this.completingTaskId = taskId
  241. try {
  242. res = await completeTaskApi(taskId, this.currentChildId, '')
  243. if (res.data && res.data.needReview) {
  244. uni.showToast({ title: '已提交,待审核', icon: 'none' })
  245. } else {
  246. points = res.data.pointsEarned
  247. uni.showToast({ title: '获得 ' + points + ' CF', icon: 'success' })
  248. }
  249. setTimeout(() => {
  250. this.completingTaskId = null
  251. this.loadData()
  252. }, 600)
  253. } catch (e) {
  254. this.completingTaskId = null
  255. console.error('完成任务失败', e)
  256. }
  257. },
  258. handleTaskClick(task) {
  259. var gamePages, gamePage
  260. if (this.completingTaskId === task.id) return
  261. // 小游戏类保留原逻辑:按 minigameCode 跳转
  262. if (task.category === '小游戏类' && task.minigameCode) {
  263. gamePages = {
  264. 'schulte': '/pages/games/schulte',
  265. '1a2b': '/pages/games/1a2b',
  266. 'sudoku': '/pages/games/sudoku'
  267. }
  268. gamePage = gamePages[task.minigameCode]
  269. if (gamePage) {
  270. uni.navigateTo({
  271. url: gamePage + '?taskId=' + task.id + '&memberId=' + this.currentChildId
  272. })
  273. }
  274. return
  275. }
  276. // 打卡/联动类任务(饮食/运动/睡眠/阅读/购买/问卷/活动等):跳转对应功能页,
  277. // 提交后由后端回写完成;其余普通任务才直接完成
  278. if (this.navigateByAction(task)) return
  279. this.completeChildTask(task.id)
  280. },
  281. /** 按 action_type 跳转联动页面(与家庭端 pages/tasks/tasks.vue 的 navigateByAction 同款) */
  282. navigateByAction(task) {
  283. var at = task.actionType
  284. var taskId = task.id
  285. var cfg = {}
  286. try { cfg = typeof task.actionConfig === 'string' ? JSON.parse(task.actionConfig || '{}') : (task.actionConfig || {}) } catch (e) {}
  287. if (at === 'minigame') {
  288. var gameId = cfg.gameId || ''
  289. uni.navigateTo({ url: '/pages/games/index?taskId=' + taskId + (gameId ? '&gameId=' + gameId : '') })
  290. return true
  291. }
  292. if (at === 'focus') {
  293. uni.navigateTo({ url: '/pages/games/focus-timer?taskId=' + taskId })
  294. return true
  295. }
  296. if (at === 'survey') {
  297. uni.navigateTo({ url: '/pages/survey/index?taskId=' + taskId })
  298. return true
  299. }
  300. if (at === 'article') {
  301. var articleId = cfg.articleId || task.sourceId
  302. uni.navigateTo({ url: '/pages/article-center/article-detail?taskId=' + taskId + (articleId ? '&id=' + articleId : '') })
  303. return true
  304. }
  305. if (at === 'activity') {
  306. uni.navigateTo({ url: '/pages/activity/list?taskId=' + taskId })
  307. return true
  308. }
  309. if (at === 'cart' || at === 'order') {
  310. var isExternal = cfg.isExternal === 1 || cfg.isExternal === '1'
  311. if (isExternal) {
  312. var tTitle = encodeURIComponent(task.title || '外部平台商品')
  313. uni.navigateTo({ url: '/pages/tasks/task-upload-purchase?taskId=' + taskId + '&title=' + tTitle })
  314. } else {
  315. uni.navigateTo({ url: '/pages/shop/cart?taskId=' + taskId })
  316. }
  317. return true
  318. }
  319. if (at === 'diet') {
  320. uni.navigateTo({ url: '/pages/growth/diet-checkin?taskId=' + taskId })
  321. return true
  322. }
  323. if (at === 'sleep') {
  324. uni.navigateTo({ url: '/pages/growth/sleep-checkin?taskId=' + taskId })
  325. return true
  326. }
  327. if (at === 'exercise') {
  328. uni.navigateTo({ url: '/pages/growth/exercise-checkin?taskId=' + taskId })
  329. return true
  330. }
  331. return false
  332. },
  333. /** 按钮文案:按 action_type 分派(与家庭端 getActionLabel 同款) */
  334. getActionLabel(task) {
  335. if (task.category === '小游戏类' || task.actionType === 'minigame') return '🎮 开始游戏'
  336. var at = task.actionType
  337. if (at === 'focus') return '⏱️ 开始专注'
  338. if (at === 'survey') return '📝 去填写'
  339. if (at === 'article') return '📖 去阅读'
  340. if (at === 'activity') return '🎯 去报名'
  341. if (at === 'cart' || at === 'order') return '🛒 去购物'
  342. if (at === 'diet' || at === 'sleep' || at === 'exercise') return '✅ 去打卡'
  343. return '✅ 完成了!'
  344. },
  345. getCategoryIcon(category) {
  346. var icons = {
  347. '学习类': '📚',
  348. '生活类': '🏠',
  349. '运动类': '⚽',
  350. '小游戏类': '🎮',
  351. '其他': '⭐'
  352. }
  353. return icons[category] || '📝'
  354. },
  355. getTimeLeft(task) {
  356. var deadline, now, diff, hours, minutes, days
  357. if (!task.deadline) return '无截止时间'
  358. deadline = parseDate(task.deadline)
  359. if (!deadline) return ''
  360. now = new Date()
  361. diff = deadline - now
  362. if (diff < 0) return ''
  363. hours = Math.floor(diff / (1000 * 60 * 60))
  364. minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60))
  365. if (hours > 24) {
  366. days = Math.floor(hours / 24)
  367. return '还剩 ' + days + ' 天'
  368. }
  369. if (hours > 0) return '还剩 ' + hours + ' 小时'
  370. if (minutes > 0) return '还剩 ' + minutes + ' 分钟'
  371. return '即将截止'
  372. },
  373. checkIsOverdue(task) {
  374. var deadline, now
  375. if (task.status === 'completed') return false
  376. if (!task.deadline) return false
  377. deadline = parseDate(task.deadline)
  378. if (!deadline) return false
  379. now = new Date()
  380. return deadline < now
  381. },
  382. getOverdueDays(task) {
  383. var deadline, now, diff, days, hours
  384. if (!task.deadline) return ''
  385. deadline = parseDate(task.deadline)
  386. if (!deadline) return ''
  387. now = new Date()
  388. diff = now - deadline
  389. days = Math.floor(diff / (1000 * 60 * 60 * 24))
  390. if (days > 0) return ' ' + days + '天'
  391. hours = Math.floor(diff / (1000 * 60 * 60))
  392. if (hours > 0) return ' ' + hours + '小时'
  393. return ''
  394. },
  395. switchTab(tabKey) {
  396. this.activeTab = tabKey
  397. },
  398. exitSwitch() {
  399. var self = this
  400. if (!self.isSwitchedChild) return
  401. uni.showModal({
  402. title: '退出切换',
  403. content: '请输入家庭主账号密码以确认退出',
  404. editable: true,
  405. success: function(res) {
  406. if (res.confirm && res.content) {
  407. verifyPassword(res.content).then(function(verifyResult) {
  408. if (verifyResult.code === 200) {
  409. self.switchBackToParentMode()
  410. } else {
  411. uni.showToast({ title: '密码错误', icon: 'none' })
  412. }
  413. }).catch(function() {
  414. uni.showToast({ title: '密码验证失败', icon: 'none' })
  415. })
  416. }
  417. }
  418. })
  419. },
  420. async switchBackToParentMode() {
  421. var result
  422. try {
  423. result = await switchBackToParent()
  424. if (result.data) {
  425. this.$store.commit('switchBackToParent')
  426. uni.showToast({ title: '已切换回本人模式', icon: 'success' })
  427. uni.reLaunch({ url: '/pages/home-pages/parent-index' })
  428. }
  429. } catch (_) {
  430. uni.showToast({ title: '切换失败', icon: 'none' })
  431. }
  432. }
  433. }
  434. }
  435. </script>
  436. <style scoped lang="scss">
  437. /* =============================================
  438. 页面基础
  439. ============================================= */
  440. .page-bg {
  441. min-height: 100vh;
  442. background: var(--bg, $uni-bg-color);
  443. padding-bottom: 40rpx;
  444. }
  445. /* =============================================
  446. 退出切换横幅
  447. ============================================= */
  448. .exit-switch {
  449. display: flex;
  450. align-items: center;
  451. justify-content: center;
  452. gap: 12rpx;
  453. padding: 24rpx;
  454. margin: 24rpx 32rpx 0;
  455. background: var(--surface, $app-surface);
  456. border: 2rpx solid var(--border, $uni-border-color);
  457. border-radius: var(--radius-lg, 32rpx);
  458. box-shadow: var(--shadow-sm);
  459. }
  460. .exit-switch:active {
  461. opacity: 0.7;
  462. transform: scale(0.98);
  463. }
  464. .exit-switch__icon {
  465. font-size: calc(32rpx * var(--font-scale, 1));
  466. }
  467. .exit-switch__text {
  468. font-size: calc(28rpx * var(--font-scale, 1));
  469. color: var(--text-secondary, $uni-text-color-secondary);
  470. font-weight: var(--font-weight-medium, 500);
  471. }
  472. /* =============================================
  473. 顶部标签栏
  474. ============================================= */
  475. .tab-bar {
  476. display: flex;
  477. flex-direction: row;
  478. margin: 24rpx 32rpx 0;
  479. padding: 8rpx;
  480. border-radius: var(--radius-xl, 40rpx);
  481. background: var(--surface, $app-surface);
  482. position: relative;
  483. }
  484. .tab-item {
  485. flex: 1;
  486. display: flex;
  487. flex-direction: row;
  488. align-items: center;
  489. justify-content: center;
  490. gap: 8rpx;
  491. padding: 20rpx 12rpx;
  492. border-radius: var(--radius-lg, 32rpx);
  493. transition: background-color var(--transition-base, 0.25s ease), box-shadow var(--transition-base, 0.25s ease);
  494. position: relative;
  495. }
  496. .tab-item--hover {
  497. background: rgba(249,115,22,0.06);
  498. }
  499. .tab-item--active {
  500. background: linear-gradient(145deg, var(--color-primary-light, $brand-primary-light), var(--color-primary, $brand-primary));
  501. box-shadow: inset -2rpx -2rpx 8rpx rgba(255, 255, 255, 0.3),
  502. 4rpx 4rpx 12rpx rgba(249,115,22,0.2);
  503. }
  504. .tab-item__label {
  505. font-size: calc(26rpx * var(--font-scale, 1));
  506. font-weight: var(--font-weight-medium, 500);
  507. color: var(--text-secondary, $uni-text-color-secondary);
  508. transition: color var(--transition-fast, 0.15s ease);
  509. }
  510. .tab-item--active .tab-item__label {
  511. color: var(--text-color-inverse, $app-surface);
  512. font-weight: var(--font-weight-bold, 600);
  513. }
  514. .tab-item__count {
  515. display: inline-flex;
  516. align-items: center;
  517. justify-content: center;
  518. min-width: 36rpx;
  519. height: 36rpx;
  520. padding: 0 8rpx;
  521. border-radius: 999rpx;
  522. background: rgba(249,115,22,0.12);
  523. color: var(--color-primary, $brand-primary);
  524. font-size: calc(20rpx * var(--font-scale, 1));
  525. font-weight: var(--font-weight-bold, 600);
  526. line-height: 1;
  527. }
  528. .tab-item--active .tab-item__count {
  529. background: rgba(255, 255, 255, 0.25);
  530. color: $app-surface;
  531. }
  532. /* =============================================
  533. 任务列表
  534. ============================================= */
  535. .task-list {
  536. padding: 24rpx 32rpx;
  537. }
  538. /* =============================================
  539. 任务卡片(Claymorphism 风格)
  540. ============================================= */
  541. .task-card {
  542. position: relative;
  543. overflow: hidden;
  544. margin-bottom: 24rpx;
  545. transition: transform var(--transition-fast, 0.15s ease),
  546. opacity var(--transition-base, 0.25s ease);
  547. }
  548. .task-card:active {
  549. transform: scale(0.98);
  550. }
  551. /* --- 已完成状态 --- */
  552. .task-card--completed {
  553. opacity: 0.7;
  554. border-color: var(--color-success, $status-success-2);
  555. background: linear-gradient(145deg, $status-success-tint-2, $status-success-tint);
  556. box-shadow: inset -2rpx -2rpx 6rpx rgba(34, 197, 94, 0.05),
  557. 3rpx 3rpx 10rpx rgba(34, 197, 94, 0.08);
  558. }
  559. /* --- 超时状态 --- */
  560. .task-card--overdue {
  561. border-color: var(--color-error, $status-danger);
  562. background: linear-gradient(145deg, $status-danger-tint-2, $status-danger-soft);
  563. box-shadow: inset -2rpx -2rpx 6rpx rgba(239, 68, 68, 0.05),
  564. 3rpx 3rpx 10rpx rgba(239, 68, 68, 0.08);
  565. }
  566. /* --- 完成中动画 --- */
  567. .task-card--completing {
  568. animation: cardComplete 0.6s ease forwards;
  569. pointer-events: none;
  570. }
  571. .task-card__celebrate {
  572. position: absolute;
  573. inset: 0;
  574. display: flex;
  575. align-items: center;
  576. justify-content: center;
  577. background: rgba(255, 255, 255, 0.6);
  578. border-radius: var(--radius-md, 20rpx);
  579. z-index: 10;
  580. }
  581. .task-card__celebrate-icon {
  582. font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
  583. animation: celebrateBounce 0.6s ease both;
  584. }
  585. /* --- 内部布局 --- */
  586. .task-card__inner {
  587. display: flex;
  588. flex-direction: row;
  589. align-items: center;
  590. gap: 20rpx;
  591. }
  592. /* =============================================
  593. 任务图标
  594. ============================================= */
  595. .task-icon {
  596. width: 88rpx;
  597. height: 88rpx;
  598. border-radius: var(--radius-md, 20rpx);
  599. background: linear-gradient(145deg, $uni-bg-color, $uni-border-color-light);
  600. display: flex;
  601. align-items: center;
  602. justify-content: center;
  603. flex-shrink: 0;
  604. border: 2rpx solid var(--border-light, $uni-border-color-light);
  605. }
  606. .task-card--completed .task-icon {
  607. background: linear-gradient(145deg, $status-success-tint-2, $status-success-soft-2);
  608. border-color: $tint-green-line;
  609. }
  610. .task-card--overdue .task-icon {
  611. background: linear-gradient(145deg, $status-danger-tint-2, $danger-line);
  612. border-color: $danger-line;
  613. }
  614. .task-icon__emoji {
  615. font-size: calc(40rpx * var(--font-scale, 1));
  616. line-height: 1;
  617. }
  618. /* =============================================
  619. 任务内容区
  620. ============================================= */
  621. .task-content {
  622. flex: 1;
  623. min-width: 0;
  624. }
  625. .task-title {
  626. font-size: calc(32rpx * var(--font-scale, 1));
  627. font-weight: var(--font-weight-bold, 600);
  628. color: var(--text, $uni-text-color);
  629. line-height: 1.4;
  630. margin-bottom: 10rpx;
  631. overflow: hidden;
  632. text-overflow: ellipsis;
  633. white-space: nowrap;
  634. }
  635. .task-card--completed .task-title {
  636. text-decoration: line-through;
  637. color: var(--text-secondary, $uni-text-color-secondary);
  638. }
  639. .task-meta {
  640. display: flex;
  641. flex-direction: row;
  642. align-items: center;
  643. gap: 16rpx;
  644. flex-wrap: wrap;
  645. }
  646. .points-text {
  647. font-size: calc(22rpx * var(--font-scale, 1));
  648. line-height: 1.4;
  649. }
  650. .task-time {
  651. font-size: calc(22rpx * var(--font-scale, 1));
  652. color: var(--text-secondary, $uni-text-color-secondary);
  653. line-height: 1.4;
  654. }
  655. .task-time--overdue {
  656. color: var(--color-error, $status-danger);
  657. font-weight: var(--font-weight-medium, 500);
  658. }
  659. /* =============================================
  660. 右侧操作区
  661. ============================================= */
  662. .task-action {
  663. flex-shrink: 0;
  664. margin-left: 8rpx;
  665. }
  666. /* =============================================
  667. 状态徽章
  668. ============================================= */
  669. .status-badge {
  670. display: flex;
  671. align-items: center;
  672. justify-content: center;
  673. padding: 16rpx 24rpx;
  674. border-radius: 999rpx;
  675. font-weight: var(--font-weight-bold, 600);
  676. }
  677. .status-badge--completed {
  678. background: rgba(34, 197, 94, 0.12);
  679. color: var(--color-success, $status-success-2);
  680. border: 2rpx solid rgba(34, 197, 94, 0.2);
  681. }
  682. .status-badge--overdue {
  683. background: rgba(239, 68, 68, 0.12);
  684. color: var(--color-error, $status-danger);
  685. border: 2rpx solid rgba(239, 68, 68, 0.2);
  686. }
  687. .status-badge__text {
  688. font-size: calc(24rpx * var(--font-scale, 1));
  689. line-height: 1;
  690. }
  691. /* =============================================
  692. 空状态
  693. ============================================= */
  694. .empty-wrapper {
  695. padding-top: 60rpx;
  696. }
  697. /* =============================================
  698. 关键帧动画
  699. ============================================= */
  700. @keyframes cardComplete {
  701. 0% {
  702. transform: scale(1);
  703. opacity: 1;
  704. }
  705. 30% {
  706. transform: scale(1.05);
  707. opacity: 0.9;
  708. }
  709. 100% {
  710. transform: scale(0.95);
  711. opacity: 0.6;
  712. }
  713. }
  714. @keyframes celebrateBounce {
  715. 0% {
  716. transform: scale(0) rotate(-180deg);
  717. opacity: 0;
  718. }
  719. 50% {
  720. transform: scale(1.3) rotate(10deg);
  721. opacity: 1;
  722. }
  723. 70% {
  724. transform: scale(0.9) rotate(-5deg);
  725. }
  726. 100% {
  727. transform: scale(1) rotate(0deg);
  728. opacity: 1;
  729. }
  730. }
  731. </style>