parent-index.vue 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136
  1. <template>
  2. <view class="container">
  3. <!-- 加载状态 -->
  4. <view class="loading-state" v-if="loading">
  5. <view class="loading-spinner"></view>
  6. <text class="loading-text">加载中...</text>
  7. </view>
  8. <template v-if="!loading">
  9. <!-- 顶部欢迎区 -->
  10. <view class="welcome-section">
  11. <view class="welcome-header">
  12. <view class="welcome-text">
  13. <text class="greeting">{{ greetingText }}!</text>
  14. <text class="sub-greeting">{{ nickname || '家长' }}</text>
  15. </view>
  16. <view class="sun-icon">☀️</view>
  17. </view>
  18. <!-- 孩子卡片 -->
  19. <view class="children-row" v-if="children.length > 0">
  20. <scroll-view
  21. class="children-scroll"
  22. scroll-x
  23. :scroll-with-animation="true"
  24. :enhanced="true"
  25. :show-scrollbar="false"
  26. >
  27. <view
  28. v-for="child in children"
  29. :key="child.id"
  30. class="child-card"
  31. :class="{ 'child-card-single': children.length === 1 }"
  32. @click="goToChildDetail(child)"
  33. >
  34. <view class="child-avatar" :class="'child-avatar-color-' + (child.id % 6)">
  35. <text class="child-avatar-text">{{ child.nickname ? child.nickname[0] : '?' }}</text>
  36. </view>
  37. <view class="child-card-body">
  38. <text class="child-card-name">{{ child.nickname }}</text>
  39. <view class="child-card-stats">
  40. <text class="child-card-points">⭐ {{ child.totalPoints || 0 }}</text>
  41. <text class="child-card-dan" v-if="child.danLevel">DAN: {{ child.danLevel }}</text>
  42. </view>
  43. <view class="child-card-badges">
  44. <text class="badge badge-review" v-if="child.pendingReviewCount > 0">待审 {{ child.pendingReviewCount }}</text>
  45. <text class="badge badge-wish" v-if="child.pendingWishCount > 0">心愿 {{ child.pendingWishCount }}</text>
  46. </view>
  47. </view>
  48. <view class="child-card-arrow">›</view>
  49. </view>
  50. </scroll-view>
  51. <view class="scroll-hint" v-if="children.length > 1">
  52. <text class="scroll-hint-text">← 左右滑动查看更多 →</text>
  53. </view>
  54. </view>
  55. <view class="empty-children-card" v-else @click="goToAddChild">
  56. <view class="empty-children-icon">👶</view>
  57. <view class="empty-children-text">
  58. <text class="empty-children-title">还没有添加孩子</text>
  59. <text class="empty-children-hint">点击添加孩子,开始成长之旅</text>
  60. </view>
  61. <view class="empty-children-arrow">›</view>
  62. </view>
  63. </view>
  64. <!-- 成长数据 -->
  65. <view class="stats-section">
  66. <view class="section-title">成长数据</view>
  67. <view class="stats-grid">
  68. <view class="stat-card" @click="goToCompletionStats">
  69. <view class="stat-icon-wrap stat-icon-orange">
  70. <text class="stat-icon-symbol">📋</text>
  71. </view>
  72. <view class="stat-body">
  73. <text class="stat-value accent-color">{{ taskCompletionRate }}%</text>
  74. <text class="stat-label">任务完成</text>
  75. </view>
  76. <view class="stat-progress">
  77. <view class="progress-bar">
  78. <view class="progress-fill" :style="{ width: taskCompletionRate + '%' }"></view>
  79. </view>
  80. </view>
  81. <text class="stat-more">查看分析 ›</text>
  82. </view>
  83. <view class="stat-card">
  84. <view class="stat-icon-wrap stat-icon-gold">
  85. <text class="stat-icon-symbol">⭐</text>
  86. </view>
  87. <view class="stat-body">
  88. <text class="stat-value gold-color">{{ (selectedChild && selectedChild.totalPoints) || 0 }}</text>
  89. <text class="stat-label">成长积分</text>
  90. </view>
  91. <view class="stat-encourage">太棒了!</view>
  92. </view>
  93. <view class="stat-card">
  94. <view class="stat-icon-wrap stat-icon-red">
  95. <text class="stat-icon-symbol">🔥</text>
  96. </view>
  97. <view class="stat-body">
  98. <text class="stat-value red-color">{{ (selectedChild && selectedChild.streakDays) || 0 }}</text>
  99. <text class="stat-label">连续天数</text>
  100. </view>
  101. <view class="stat-encourage" v-if="selectedChild && selectedChild.streakDays > 0">加油保持!</view>
  102. <view class="stat-encourage muted" v-else>开始坚持吧</view>
  103. </view>
  104. <view class="stat-card">
  105. <view class="stat-icon-wrap stat-icon-teal">
  106. <text class="stat-icon-symbol">✨</text>
  107. </view>
  108. <view class="stat-body">
  109. <text class="stat-value teal-color">{{ habitCount }}</text>
  110. <text class="stat-label">习惯打卡</text>
  111. </view>
  112. <view class="stat-encourage">坚持就是胜利</view>
  113. </view>
  114. </view>
  115. </view>
  116. <!-- 今日重点 -->
  117. <view class="today-section">
  118. <view class="section-title">今日重点</view>
  119. <view class="today-card">
  120. <view class="today-header">
  121. <text class="today-label">今日待完成</text>
  122. <text class="today-count">{{ pendingTasks.length }}项任务</text>
  123. </view>
  124. <view class="task-list" v-if="pendingTasks.length > 0">
  125. <view class="task-item" v-for="task in pendingTasks.slice(0, 3)" :key="task.id">
  126. <view class="task-dot" :class="'dot-color-' + (task.id % 5)"></view>
  127. <text class="task-title">{{ task.title }}</text>
  128. </view>
  129. </view>
  130. <view class="empty-state" v-else>
  131. <text class="empty-icon">🎉</text>
  132. <text class="empty-text">今日任务已完成,太棒了!</text>
  133. </view>
  134. <view class="view-all" @click="goToTaskList">
  135. <text>查看全部</text>
  136. <text class="arrow">→</text>
  137. </view>
  138. </view>
  139. </view>
  140. <!-- 成长里程碑 -->
  141. <view class="milestone-section">
  142. <view class="section-title">成长里程碑</view>
  143. <view class="milestone-list">
  144. <view class="milestone-item" v-if="selectedChild && selectedChild.streakDays >= 7">
  145. <view class="milestone-icon-wrap milestone-star">
  146. <text class="milestone-icon">🌟</text>
  147. </view>
  148. <text class="milestone-text">连续7天打卡</text>
  149. </view>
  150. <view class="milestone-item" v-if="selectedChild && selectedChild.streakDays >= 30">
  151. <view class="milestone-icon-wrap milestone-trophy">
  152. <text class="milestone-icon">🏆</text>
  153. </view>
  154. <text class="milestone-text">坚持一个月啦!</text>
  155. </view>
  156. <view class="milestone-item" v-if="(selectedChild && selectedChild.totalPoints) >= 1000">
  157. <view class="milestone-icon-wrap milestone-sparkle">
  158. <text class="milestone-icon">💫</text>
  159. </view>
  160. <text class="milestone-text">积分突破1000</text>
  161. </view>
  162. <view class="milestone-empty" v-if="!hasMilestones">
  163. <text class="milestone-empty-icon">🌱</text>
  164. <text class="milestone-empty-text">开始养成好习惯,见证成长</text>
  165. </view>
  166. </view>
  167. </view>
  168. <!-- 待审核任务 -->
  169. <view class="review-section" v-if="pendingReviewTasks.length > 0">
  170. <view class="section-title">待审核任务</view>
  171. <view class="review-list">
  172. <view class="review-item" v-for="task in pendingReviewTasks" :key="task.id">
  173. <view class="review-info">
  174. <text class="task-name">{{ task.title }}</text>
  175. <text class="task-child" v-if="task.childName">提供者: {{ task.childName }}</text>
  176. </view>
  177. <view class="review-actions">
  178. <button class="btn-pass" @click="approveTask(task.id)">通过</button>
  179. <button class="btn-reject" @click="rejectTask(task.id)">拒绝</button>
  180. </view>
  181. </view>
  182. </view>
  183. </view>
  184. <!-- 快捷操作 -->
  185. <view class="quick-section">
  186. <view class="section-title">快捷操作</view>
  187. <view class="quick-actions">
  188. <view class="action-item" @click="addTask">
  189. <view class="action-icon act-add">
  190. <text class="action-icon-text">➕</text>
  191. </view>
  192. <text class="action-label">添加任务</text>
  193. </view>
  194. <view class="action-item" @click="goToReview">
  195. <view class="action-icon act-review">
  196. <text class="action-icon-text">📋</text>
  197. </view>
  198. <text class="action-label">审核任务</text>
  199. </view>
  200. <view class="action-item" @click="manageChildren">
  201. <view class="action-icon act-child">
  202. <text class="action-icon-text">👨‍👩‍👧</text>
  203. </view>
  204. <text class="action-label">孩子管理</text>
  205. </view>
  206. <view class="action-item" @click="goToRewards">
  207. <view class="action-icon act-reward">
  208. <text class="action-icon-text">🎁</text>
  209. </view>
  210. <text class="action-label">奖励中心</text>
  211. </view>
  212. <view class="action-item" @click="inviteFriend">
  213. <view class="action-icon act-invite">
  214. <text class="action-icon-text">📤</text>
  215. </view>
  216. <text class="action-label">邀请家人</text>
  217. </view>
  218. </view>
  219. </view>
  220. </template>
  221. </view>
  222. </template>
  223. <script>
  224. import { getFamilyMembers, getChildren, getPendingReviewTasks, getPendingWishes, approveTask, rejectTask, getChildCompletionStats, getParentDashboard } from '../../utils/api.js'
  225. export default {
  226. data() {
  227. return {
  228. nickname: '',
  229. familyMembers: [],
  230. children: [],
  231. selectedChild: null,
  232. pendingReviewTasks: [],
  233. pendingReviewWishes: [],
  234. pendingTasks: [],
  235. taskCompletionRate: 0,
  236. habitCount: 0,
  237. loading: true,
  238. currentChildId: '',
  239. _initialLoadDone: false,
  240. _familyId: null
  241. }
  242. },
  243. computed: {
  244. greetingText() {
  245. const hour = new Date().getHours()
  246. if (hour < 6) return '夜深了'
  247. if (hour < 9) return '早上好'
  248. if (hour < 12) return '上午好'
  249. if (hour < 14) return '中午好'
  250. if (hour < 18) return '下午好'
  251. if (hour < 22) return '晚上好'
  252. return '夜深了'
  253. },
  254. hasMilestones() {
  255. const c = this.selectedChild
  256. if (!c) return false
  257. return (c.streakDays >= 7) || (c.streakDays >= 30) || (c.totalPoints >= 1000)
  258. }
  259. },
  260. // 使用 mounted 而非 onLoad,因为本组件作为条件渲染子组件(v-if),
  261. // page 生命周期钩子(onLoad/onShow)可能在组件挂载前已触发完毕
  262. mounted() {
  263. if (!uni.getStorageSync('token')) {
  264. uni.reLaunch({ url: '/pages/login/login' })
  265. return
  266. }
  267. this.loadData()
  268. },
  269. onShow() {
  270. // 首次 onShow 紧接 mounted 之后,跳过避免双重加载
  271. if (!this._initialLoadDone) {
  272. this._initialLoadDone = true
  273. return
  274. }
  275. const currentRole = uni.getStorageSync('currentRole') || 'parent'
  276. if (currentRole === 'child') {
  277. uni.reLaunch({ url: '/pages/index/child-index' })
  278. return
  279. }
  280. if (uni.getStorageSync('token')) {
  281. this.loadData()
  282. }
  283. },
  284. methods: {
  285. async loadData() {
  286. this.loading = true
  287. try {
  288. const userInfo = uni.getStorageSync('userInfo')
  289. this.nickname = (userInfo && userInfo.nickname) ? userInfo.nickname : ''
  290. // 优先使用仪表盘接口(包含孩子列表 + 统计数据)
  291. let dashboardLoaded = false
  292. try {
  293. const dashRes = await getParentDashboard()
  294. const dashData = dashRes.data || {}
  295. const dashChildren = dashData.children || []
  296. if (dashChildren.length > 0) {
  297. this.children = dashChildren
  298. this.selectedChild = dashChildren[0]
  299. this.taskCompletionRate = dashData.avgCompletionRate || 0
  300. this.habitCount = dashData.totalHabitCount || 0
  301. // 从仪表盘获取 familyId
  302. if (dashData.familyId) {
  303. this._familyId = dashData.familyId
  304. }
  305. dashboardLoaded = true
  306. }
  307. } catch (e) {
  308. console.log('获取仪表盘数据失败,降级到单独接口', e)
  309. }
  310. // 降级:使用原有单独接口
  311. if (!dashboardLoaded) {
  312. try {
  313. const currentUserId = uni.getStorageSync('userId')
  314. const membersRes = await getFamilyMembers()
  315. const data = membersRes.data || {}
  316. const parents = (data.parents || []).filter(function(p) { return p && p.id && p.id !== currentUserId }).map(function(p) { return { ...p, role: 'parent' } })
  317. const children = (data.children || []).filter(function(c) { return c && c.id }).map(function(c) { return { ...c, role: 'child' } })
  318. this.familyMembers = [].concat(parents, children)
  319. if (children.length > 0) {
  320. this.selectedChild = children[0]
  321. }
  322. // 保存 familyId 用于后续请求
  323. if (data.familyId) {
  324. this._familyId = data.familyId
  325. }
  326. } catch (e) {
  327. console.log('获取家庭成员失败', e)
  328. }
  329. if (this.children.length === 0) {
  330. const childrenRes = await getChildren()
  331. const rawChildren = childrenRes.data || []
  332. this.children = rawChildren
  333. if (this.children.length > 0 && !this.selectedChild) {
  334. this.selectedChild = this.children[0]
  335. }
  336. }
  337. }
  338. const reviewRes = await getPendingReviewTasks()
  339. const allReviewTasks = reviewRes.data || []
  340. this.pendingReviewTasks = allReviewTasks.slice(0, 3)
  341. try {
  342. const wishRes = await getPendingWishes(this._familyId)
  343. this.pendingReviewWishes = wishRes.data || []
  344. } catch (e) {
  345. console.log('获取待处理心愿失败', e)
  346. this.pendingReviewWishes = []
  347. }
  348. const reviewMap = {}
  349. const wishMap = {}
  350. for (let i = 0; i < allReviewTasks.length; i++) {
  351. const task = allReviewTasks[i]
  352. const cid = task.childId || task.assigneeId
  353. if (cid) {
  354. reviewMap[cid] = (reviewMap[cid] || 0) + 1
  355. }
  356. }
  357. for (let j = 0; j < (this.pendingReviewWishes || []).length; j++) {
  358. const wish = this.pendingReviewWishes[j]
  359. const cid = wish.childId
  360. if (cid) {
  361. wishMap[cid] = (wishMap[cid] || 0) + 1
  362. }
  363. }
  364. this.children = this.children.map(function(c) {
  365. return {
  366. ...c,
  367. pendingReviewCount: reviewMap[c.id] || 0,
  368. pendingWishCount: wishMap[c.id] || 0
  369. }
  370. })
  371. // 如果仪表盘未加载到数据,降级到单独统计接口
  372. if (!dashboardLoaded && this.children.length > 0) {
  373. const targetChild = this.selectedChild || this.children[0]
  374. try {
  375. const statsRes = await getChildCompletionStats({ childId: targetChild.id })
  376. if (statsRes && statsRes.data) {
  377. this.taskCompletionRate = statsRes.data.completionRate || 0
  378. this.habitCount = statsRes.data.completedTasks || 0
  379. }
  380. } catch (e) {
  381. console.log('获取完成率失败', e)
  382. this.taskCompletionRate = 0
  383. }
  384. }
  385. // 待完成任务 - 使用真实统计中的pendingTasks
  386. this.pendingTasks = []
  387. if (this.children.length > 0) {
  388. const targetChild = this.selectedChild || this.children[0]
  389. try {
  390. const r2 = await getChildCompletionStats({ childId: targetChild.id })
  391. if (r2 && r2.data && r2.data.pendingTasks > 0) {
  392. for (let k = 0; k < Math.min(r2.data.pendingTasks, 3); k++) {
  393. this.pendingTasks.push({ id: 100 + k, title: '待完成任务 ' + (k + 1) })
  394. }
  395. }
  396. } catch (e) {
  397. this.pendingTasks = []
  398. }
  399. }
  400. } catch (e) {
  401. console.error('加载数据失败', e)
  402. } finally {
  403. this.loading = false
  404. }
  405. },
  406. async approveTask(taskId) {
  407. try {
  408. await approveTask(taskId)
  409. uni.showToast({ title: '已通过', icon: 'success' })
  410. this.loadData()
  411. } catch (e) {
  412. uni.showToast({ title: '操作失败', icon: 'none' })
  413. }
  414. },
  415. async rejectTask(taskId) {
  416. try {
  417. await rejectTask(taskId)
  418. uni.showToast({ title: '已拒绝', icon: 'success' })
  419. this.loadData()
  420. } catch (e) {
  421. uni.showToast({ title: '操作失败', icon: 'none' })
  422. }
  423. },
  424. goToCompletionStats() {
  425. if (this.children.length === 1) {
  426. uni.navigateTo({ url: '/pages/stats/completion-rate?childId=' + this.children[0].id })
  427. } else {
  428. uni.navigateTo({ url: '/pages/stats/completion-rate?familyView=1' })
  429. }
  430. },
  431. goToChildDetail(child) {
  432. uni.navigateTo({ url: '/pages/parent/child-detail?childId=' + child.id + '&childName=' + encodeURIComponent(child.nickname || '') })
  433. },
  434. addTask() { uni.navigateTo({ url: '/pages/tasks/create-task' }) },
  435. goToReview() { uni.navigateTo({ url: '/pages/tasks/review' }) },
  436. goToRewards() { uni.switchTab({ url: '/pages/rewards/rewards' }) },
  437. goToTaskList() { uni.switchTab({ url: '/pages/tasks/tasks' }) },
  438. manageChildren() { uni.navigateTo({ url: '/pages/profile/children' }) },
  439. inviteFriend() { uni.navigateTo({ url: '/pages/parent/invite/index' }) },
  440. goToAddChild() { uni.navigateTo({ url: '/pages/profile/create-child' }) }
  441. }
  442. }
  443. </script>
  444. <style scoped>
  445. /* ========================================
  446. Claymorphism Design System - 暖色琥珀黏土
  447. ======================================== */
  448. :root {
  449. --clay-br: 20rpx;
  450. --clay-br-lg: 26rpx;
  451. --clay-bw: 4rpx;
  452. --clay-shadow: inset -3rpx -3rpx 8rpx rgba(255,255,255,0.5), 6rpx 6rpx 18rpx rgba(255,140,66,0.10);
  453. --clay-shadow-sm: inset -2rpx -2rpx 6rpx rgba(255,255,255,0.4), 4rpx 4rpx 10rpx rgba(255,140,66,0.08);
  454. --clay-transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  455. }
  456. .container {
  457. padding: 32rpx;
  458. background: #FFF5EB;
  459. min-height: 100vh;
  460. }
  461. /* ========================================
  462. 加载状态
  463. ======================================== */
  464. .loading-state {
  465. display: flex;
  466. flex-direction: column;
  467. align-items: center;
  468. padding: 200rpx 0;
  469. }
  470. .loading-spinner {
  471. width: 64rpx;
  472. height: 64rpx;
  473. border: 8rpx solid #FFE0CC;
  474. border-top-color: #FF8C42;
  475. border-radius: 50%;
  476. animation: spin 0.8s linear infinite;
  477. box-shadow: inset -2rpx -2rpx 6rpx rgba(255,255,255,0.4), 2rpx 2rpx 6rpx rgba(255,140,66,0.08);
  478. }
  479. @keyframes spin {
  480. to { transform: rotate(360deg); }
  481. }
  482. .loading-text {
  483. font-size: 26rpx;
  484. color: #B2BEC3;
  485. margin-top: 20rpx;
  486. }
  487. /* ========================================
  488. 顶部欢迎区
  489. ======================================== */
  490. .welcome-section {
  491. margin-bottom: 48rpx;
  492. }
  493. .welcome-header {
  494. display: flex;
  495. justify-content: space-between;
  496. align-items: flex-start;
  497. margin-bottom: 24rpx;
  498. }
  499. .greeting {
  500. font-size: 40rpx;
  501. font-weight: 700;
  502. color: #2D3436;
  503. display: block;
  504. line-height: 1.2;
  505. }
  506. .sub-greeting {
  507. font-size: 28rpx;
  508. color: #636E72;
  509. display: block;
  510. margin-top: 8rpx;
  511. }
  512. .sun-icon {
  513. font-size: 64rpx;
  514. }
  515. /* ========================================
  516. 孩子卡片 - claymorphism
  517. ======================================== */
  518. .children-row {
  519. margin-top: 24rpx;
  520. }
  521. .children-scroll {
  522. display: flex;
  523. flex-direction: row;
  524. white-space: nowrap;
  525. overflow: hidden;
  526. }
  527. .child-card {
  528. display: inline-flex;
  529. align-items: center;
  530. background: #FFFFFF;
  531. border-radius: 26rpx;
  532. padding: 24rpx;
  533. margin-right: 20rpx;
  534. border: 4rpx solid #FFE0CC;
  535. box-shadow: inset -3rpx -3rpx 8rpx rgba(255,255,255,0.5), 6rpx 6rpx 18rpx rgba(255,140,66,0.10);
  536. min-width: 440rpx;
  537. width: auto;
  538. position: relative;
  539. transition: var(--clay-transition);
  540. }
  541. .child-card:active {
  542. box-shadow: inset 2rpx 2rpx 8rpx rgba(0,0,0,0.06), 3rpx 3rpx 10rpx rgba(255,140,66,0.08);
  543. transform: scale(0.98);
  544. }
  545. .child-card-single {
  546. width: 100%;
  547. margin-right: 0;
  548. }
  549. .child-avatar {
  550. width: 80rpx;
  551. height: 80rpx;
  552. border-radius: 50%;
  553. display: flex;
  554. align-items: center;
  555. justify-content: center;
  556. flex-shrink: 0;
  557. }
  558. .child-avatar-color-0 { background: linear-gradient(135deg, #FF8C42, #FF7A2E); }
  559. .child-avatar-color-1 { background: linear-gradient(135deg, #667eea, #764ba2); }
  560. .child-avatar-color-2 { background: linear-gradient(135deg, #4ECDC4, #44B09E); }
  561. .child-avatar-color-3 { background: linear-gradient(135deg, #FF6B6B, #FF8E53); }
  562. .child-avatar-color-4 { background: linear-gradient(135deg, #A8E063, #56AB2F); }
  563. .child-avatar-color-5 { background: linear-gradient(135deg, #F093FB, #F5576C); }
  564. .child-avatar-text {
  565. color: #FFFFFF;
  566. font-size: 36rpx;
  567. font-weight: 600;
  568. }
  569. .child-card-body {
  570. flex: 1;
  571. margin-left: 16rpx;
  572. min-width: 0;
  573. }
  574. .child-card-name {
  575. font-size: 30rpx;
  576. font-weight: 600;
  577. color: #2D3436;
  578. display: block;
  579. line-height: 1.3;
  580. }
  581. .child-card-stats {
  582. display: flex;
  583. align-items: center;
  584. margin-top: 6rpx;
  585. gap: 16rpx;
  586. }
  587. .child-card-points {
  588. font-size: 24rpx;
  589. color: #FF8C42;
  590. font-weight: 600;
  591. }
  592. .child-card-dan {
  593. font-size: 22rpx;
  594. color: #667eea;
  595. font-weight: 500;
  596. }
  597. .child-card-badges {
  598. display: flex;
  599. gap: 8rpx;
  600. margin-top: 8rpx;
  601. flex-wrap: wrap;
  602. }
  603. .badge {
  604. font-size: 20rpx;
  605. padding: 4rpx 14rpx;
  606. border-radius: 20rpx;
  607. font-weight: 500;
  608. border: 2rpx solid transparent;
  609. }
  610. .badge-review { background: #FFF5EB; color: #FF8C42; border-color: #FED7AA; }
  611. .badge-wish { background: #FFF0F0; color: #FF6B6B; border-color: #FECACA; }
  612. .child-card-arrow {
  613. font-size: 36rpx;
  614. color: #D5D5D5;
  615. margin-left: 8rpx;
  616. flex-shrink: 0;
  617. }
  618. .scroll-hint {
  619. text-align: center;
  620. margin-top: 12rpx;
  621. }
  622. .scroll-hint-text {
  623. font-size: 22rpx;
  624. color: #B2BEC3;
  625. }
  626. .empty-children-card {
  627. display: flex;
  628. align-items: center;
  629. background: #FFFFFF;
  630. border-radius: 26rpx;
  631. padding: 28rpx;
  632. border: 4rpx solid #FFE0CC;
  633. box-shadow: inset -3rpx -3rpx 8rpx rgba(255,255,255,0.5), 6rpx 6rpx 18rpx rgba(255,140,66,0.10);
  634. margin-top: 24rpx;
  635. transition: var(--clay-transition);
  636. }
  637. .empty-children-card:active {
  638. box-shadow: inset 2rpx 2rpx 8rpx rgba(0,0,0,0.06), 3rpx 3rpx 10rpx rgba(255,140,66,0.08);
  639. transform: scale(0.98);
  640. }
  641. .empty-children-icon { font-size: 56rpx; margin-right: 16rpx; }
  642. .empty-children-text { flex: 1; }
  643. .empty-children-title { font-size: 28rpx; font-weight: 600; color: #2D3436; display: block; }
  644. .empty-children-hint { font-size: 24rpx; color: #B2BEC3; margin-top: 6rpx; display: block; }
  645. .empty-children-arrow { font-size: 36rpx; color: #D5D5D5; }
  646. /* ========================================
  647. 区块标题
  648. ======================================== */
  649. .section-title {
  650. font-size: 32rpx;
  651. font-weight: 700;
  652. color: #2D3436;
  653. margin-bottom: 24rpx;
  654. }
  655. /* ========================================
  656. 成长数据 - claymorphism
  657. ======================================== */
  658. .stats-section {
  659. margin-bottom: 48rpx;
  660. }
  661. .stats-grid {
  662. display: flex;
  663. flex-wrap: wrap;
  664. gap: 16rpx;
  665. }
  666. .stat-card {
  667. width: calc(50% - 8rpx);
  668. background: #FFFFFF;
  669. border-radius: 24rpx;
  670. padding: 24rpx;
  671. border: 4rpx solid #FFE0CC;
  672. box-shadow: inset -3rpx -3rpx 8rpx rgba(255,255,255,0.5), 6rpx 6rpx 18rpx rgba(255,140,66,0.08);
  673. box-sizing: border-box;
  674. transition: var(--clay-transition);
  675. }
  676. .stat-card:active {
  677. box-shadow: inset 2rpx 2rpx 8rpx rgba(0,0,0,0.04), 3rpx 3rpx 10rpx rgba(255,140,66,0.06);
  678. }
  679. .stat-icon-wrap {
  680. width: 64rpx;
  681. height: 64rpx;
  682. border-radius: 20rpx;
  683. display: flex;
  684. align-items: center;
  685. justify-content: center;
  686. margin-bottom: 14rpx;
  687. border: 3rpx solid transparent;
  688. box-shadow: inset -2rpx -2rpx 5rpx rgba(255,255,255,0.4), 3rpx 3rpx 8rpx rgba(0,0,0,0.05);
  689. }
  690. .stat-icon-symbol {
  691. font-size: 32rpx;
  692. }
  693. .stat-icon-orange { background: rgba(255, 140, 66, 0.2); border-color: #FED7AA; }
  694. .stat-icon-gold { background: rgba(255, 217, 61, 0.25); border-color: #FDE68A; }
  695. .stat-icon-red { background: rgba(255, 107, 107, 0.2); border-color: #FECACA; }
  696. .stat-icon-teal { background: rgba(78, 205, 196, 0.2); border-color: #A7F3D0; }
  697. .stat-body {
  698. margin-bottom: 8rpx;
  699. }
  700. .stat-value {
  701. font-size: 40rpx;
  702. font-weight: 800;
  703. display: block;
  704. line-height: 1.1;
  705. }
  706. .stat-label {
  707. font-size: 22rpx;
  708. color: #636E72;
  709. display: block;
  710. margin-top: 4rpx;
  711. }
  712. .accent-color { color: #FF8C42; }
  713. .gold-color { color: #F59E0B; }
  714. .red-color { color: #FF6B6B; }
  715. .teal-color { color: #4ECDC4; }
  716. .stat-progress {
  717. margin-top: 8rpx;
  718. }
  719. .progress-bar {
  720. height: 8rpx;
  721. background: #FFF5EB;
  722. border-radius: 999rpx;
  723. overflow: hidden;
  724. }
  725. .progress-fill {
  726. height: 100%;
  727. background: linear-gradient(90deg, #FF8C42, #FFD93D);
  728. border-radius: 999rpx;
  729. transition: width 0.3s ease;
  730. }
  731. .stat-more {
  732. font-size: 20rpx;
  733. color: #4ECDC4;
  734. margin-top: 10rpx;
  735. font-weight: 500;
  736. display: block;
  737. }
  738. .stat-encourage {
  739. font-size: 20rpx;
  740. color: #4ECDC4;
  741. margin-top: 10rpx;
  742. font-weight: 500;
  743. }
  744. .stat-encourage.muted {
  745. color: #B2BEC3;
  746. }
  747. /* ========================================
  748. 今日重点 - claymorphism
  749. ======================================== */
  750. .today-section {
  751. margin-bottom: 48rpx;
  752. }
  753. .today-card {
  754. background: #FFFFFF;
  755. border-radius: 26rpx;
  756. padding: 28rpx;
  757. border: 4rpx solid #FFE0CC;
  758. box-shadow: inset -3rpx -3rpx 8rpx rgba(255,255,255,0.5), 6rpx 6rpx 18rpx rgba(255,140,66,0.08);
  759. }
  760. .today-header {
  761. display: flex;
  762. justify-content: space-between;
  763. align-items: center;
  764. margin-bottom: 20rpx;
  765. }
  766. .today-label {
  767. font-size: 28rpx;
  768. font-weight: 600;
  769. color: #2D3436;
  770. }
  771. .today-count {
  772. font-size: 24rpx;
  773. color: #FF8C42;
  774. font-weight: 600;
  775. }
  776. .task-list {
  777. margin-bottom: 16rpx;
  778. }
  779. .task-item {
  780. display: flex;
  781. align-items: center;
  782. padding: 18rpx 0;
  783. border-bottom: 1rpx solid #F0E8DE;
  784. }
  785. .task-item:last-child {
  786. border-bottom: none;
  787. }
  788. .task-dot {
  789. width: 14rpx;
  790. height: 14rpx;
  791. border-radius: 50%;
  792. margin-right: 16rpx;
  793. flex-shrink: 0;
  794. border: 2rpx solid transparent;
  795. }
  796. .dot-color-0 { background: #FF8C42; border-color: #FED7AA; }
  797. .dot-color-1 { background: #4ECDC4; border-color: #A7F3D0; }
  798. .dot-color-2 { background: #667eea; border-color: #C7D2FE; }
  799. .dot-color-3 { background: #F59E0B; border-color: #FDE68A; }
  800. .dot-color-4 { background: #FF6B6B; border-color: #FECACA; }
  801. .task-title {
  802. font-size: 28rpx;
  803. color: #2D3436;
  804. }
  805. .empty-state {
  806. display: flex;
  807. align-items: center;
  808. padding: 24rpx 0;
  809. }
  810. .empty-icon {
  811. font-size: 40rpx;
  812. margin-right: 16rpx;
  813. }
  814. .empty-text {
  815. font-size: 28rpx;
  816. color: #4ECDC4;
  817. }
  818. .view-all {
  819. display: flex;
  820. justify-content: flex-end;
  821. align-items: center;
  822. color: #636E72;
  823. font-size: 24rpx;
  824. padding-top: 16rpx;
  825. border-top: 1rpx solid #F0E8DE;
  826. }
  827. .view-all .arrow {
  828. margin-left: 8rpx;
  829. }
  830. /* ========================================
  831. 里程碑 - claymorphism
  832. ======================================== */
  833. .milestone-section {
  834. margin-bottom: 48rpx;
  835. }
  836. .milestone-list {
  837. background: #FFFFFF;
  838. border-radius: 26rpx;
  839. padding: 24rpx;
  840. border: 4rpx solid #FFE0CC;
  841. box-shadow: inset -3rpx -3rpx 8rpx rgba(255,255,255,0.5), 6rpx 6rpx 18rpx rgba(255,140,66,0.08);
  842. }
  843. .milestone-item {
  844. display: flex;
  845. align-items: center;
  846. padding: 18rpx 0;
  847. border-bottom: 1rpx solid #F0E8DE;
  848. }
  849. .milestone-item:last-child {
  850. border-bottom: none;
  851. }
  852. .milestone-icon-wrap {
  853. width: 56rpx;
  854. height: 56rpx;
  855. border-radius: 18rpx;
  856. display: flex;
  857. align-items: center;
  858. justify-content: center;
  859. margin-right: 16rpx;
  860. flex-shrink: 0;
  861. border: 3rpx solid transparent;
  862. box-shadow: inset -2rpx -2rpx 5rpx rgba(255,255,255,0.3), 3rpx 3rpx 8rpx rgba(0,0,0,0.04);
  863. }
  864. .milestone-icon {
  865. font-size: 28rpx;
  866. }
  867. .milestone-star { background: rgba(255, 215, 0, 0.25); border-color: #FDE68A; }
  868. .milestone-trophy { background: rgba(255, 140, 66, 0.2); border-color: #FED7AA; }
  869. .milestone-sparkle { background: rgba(78, 205, 196, 0.2); border-color: #A7F3D0; }
  870. .milestone-text {
  871. font-size: 28rpx;
  872. color: #2D3436;
  873. }
  874. .milestone-empty {
  875. display: flex;
  876. flex-direction: column;
  877. align-items: center;
  878. padding: 36rpx;
  879. }
  880. .milestone-empty-icon {
  881. font-size: 64rpx;
  882. margin-bottom: 16rpx;
  883. }
  884. .milestone-empty-text {
  885. font-size: 28rpx;
  886. color: #B2BEC3;
  887. text-align: center;
  888. }
  889. /* ========================================
  890. 待审核
  891. ======================================== */
  892. .review-section {
  893. margin-bottom: 48rpx;
  894. }
  895. .review-list {
  896. background: #FFFFFF;
  897. border-radius: 26rpx;
  898. padding: 8rpx 24rpx;
  899. border: 4rpx solid #FFE0CC;
  900. box-shadow: inset -3rpx -3rpx 8rpx rgba(255,255,255,0.5), 6rpx 6rpx 18rpx rgba(255,140,66,0.08);
  901. }
  902. .review-item {
  903. display: flex;
  904. justify-content: space-between;
  905. align-items: center;
  906. padding: 22rpx 0;
  907. border-bottom: 1rpx solid #F0E8DE;
  908. }
  909. .review-item:last-child {
  910. border-bottom: none;
  911. }
  912. .review-info {
  913. flex: 1;
  914. }
  915. .review-info .task-name {
  916. font-size: 28rpx;
  917. color: #2D3436;
  918. display: block;
  919. margin-bottom: 6rpx;
  920. }
  921. .review-info .task-child {
  922. font-size: 24rpx;
  923. color: #B2BEC3;
  924. }
  925. .review-actions {
  926. display: flex;
  927. gap: 16rpx;
  928. flex-shrink: 0;
  929. }
  930. .review-actions .btn-pass,
  931. .review-actions .btn-reject {
  932. font-size: 24rpx;
  933. padding: 12rpx 24rpx;
  934. border-radius: 14rpx;
  935. margin: 0;
  936. border: 3rpx solid transparent;
  937. }
  938. .btn-pass {
  939. background: #00B894;
  940. color: #FFFFFF;
  941. border-color: #059669;
  942. box-shadow: inset -2rpx -2rpx 6rpx rgba(255,255,255,0.3), 3rpx 3rpx 8rpx rgba(0,184,148,0.2);
  943. transition: var(--clay-transition);
  944. }
  945. .btn-pass:active {
  946. box-shadow: inset 2rpx 2rpx 6rpx rgba(0,0,0,0.1), 1rpx 1rpx 4rpx rgba(0,184,148,0.1);
  947. transform: scale(0.96);
  948. }
  949. .btn-reject {
  950. background: #FF6B6B;
  951. color: #FFFFFF;
  952. border-color: #E05555;
  953. box-shadow: inset -2rpx -2rpx 6rpx rgba(255,255,255,0.3), 3rpx 3rpx 8rpx rgba(255,107,107,0.2);
  954. transition: var(--clay-transition);
  955. }
  956. .btn-reject:active {
  957. box-shadow: inset 2rpx 2rpx 6rpx rgba(0,0,0,0.1), 1rpx 1rpx 4rpx rgba(255,107,107,0.1);
  958. transform: scale(0.96);
  959. }
  960. /* ========================================
  961. 快捷操作 - claymorphism
  962. ======================================== */
  963. .quick-section {
  964. margin-bottom: 48rpx;
  965. }
  966. .quick-actions {
  967. display: flex;
  968. flex-wrap: wrap;
  969. background: #FFFFFF;
  970. border-radius: 26rpx;
  971. padding: 24rpx 12rpx;
  972. border: 4rpx solid #FFE0CC;
  973. box-shadow: inset -3rpx -3rpx 8rpx rgba(255,255,255,0.5), 6rpx 6rpx 18rpx rgba(255,140,66,0.08);
  974. }
  975. .action-item {
  976. display: flex;
  977. flex-direction: column;
  978. align-items: center;
  979. width: 33.33%;
  980. margin-bottom: 20rpx;
  981. transition: var(--clay-transition);
  982. }
  983. .action-item:active {
  984. transform: scale(0.92);
  985. }
  986. .action-item:nth-last-child(-n+2) {
  987. margin-bottom: 0;
  988. }
  989. .action-icon {
  990. width: 88rpx;
  991. height: 88rpx;
  992. border-radius: 24rpx;
  993. display: flex;
  994. align-items: center;
  995. justify-content: center;
  996. margin-bottom: 12rpx;
  997. border: 3rpx solid transparent;
  998. box-shadow: inset -2rpx -2rpx 5rpx rgba(255,255,255,0.4), 3rpx 3rpx 8rpx rgba(0,0,0,0.05);
  999. transition: var(--clay-transition);
  1000. }
  1001. .action-item:active .action-icon {
  1002. box-shadow: inset 2rpx 2rpx 6rpx rgba(0,0,0,0.08), 1rpx 1rpx 3rpx rgba(0,0,0,0.04);
  1003. }
  1004. .action-icon-text {
  1005. font-size: 36rpx;
  1006. }
  1007. .act-add { background: rgba(255, 140, 66, 0.25); border-color: #FED7AA; }
  1008. .act-review { background: rgba(78, 205, 196, 0.2); border-color: #A7F3D0; }
  1009. .act-child { background: rgba(116, 185, 255, 0.2); border-color: #BFDBFE; }
  1010. .act-reward { background: rgba(255, 217, 61, 0.3); border-color: #FDE68A; }
  1011. .act-invite { background: rgba(0, 184, 148, 0.2); border-color: #A7F3D0; }
  1012. .action-label {
  1013. font-size: 24rpx;
  1014. color: #636E72;
  1015. font-weight: 500;
  1016. }
  1017. </style>