index.vue 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586
  1. <template>
  2. <view class="container">
  3. <!-- 品牌头部 -->
  4. <PageBanner theme="mind-wisdom"
  5. tagline="心智成长 · 智慧人生"
  6. quote="知己知彼,百战不殆" />
  7. <!-- 家庭成员切换条 -->
  8. <FamilyMemberStrip
  9. v-if="isLoggedIn && familyMembersVisible.length > 0"
  10. :members="familyMembersVisible"
  11. :selectedMemberId="selectedMemberId"
  12. :selectedMemberType="selectedMemberType"
  13. @select="onMemberSelect" />
  14. <!-- 游客登录引导卡 -->
  15. <template v-if="!isLoggedIn">
  16. <LoginGuideCard
  17. title="登录后查看心智成长报告"
  18. :items="[
  19. '查看EMI心理测评四维分析',
  20. '查看DAN认知六维雷达图',
  21. '阅读专属文章、参与认知训练'
  22. ]" />
  23. </template>
  24. <!-- 登录后:五维能量条 -->
  25. <FamilyEnergyBar
  26. v-if="isLoggedIn"
  27. dimensionCode="mind"
  28. :sandboxData="sandboxData"
  29. :dualDimension="dualDimension" />
  30. <!-- 关系图谱(登录后可见) -->
  31. <FamilyRelationGraph
  32. v-if="isLoggedIn && familyMembersVisible.length > 0"
  33. dimensionCode="mind"
  34. :selfId="activeChildId"
  35. :members="familyMembersVisible"
  36. :energyMap="energyMapForGraph"
  37. :intimacyMap="intimacyMapForGraph"
  38. @memberTap="goMemberDetail" />
  39. <!-- 登录后:用户快捷入口 -->
  40. <UserQuickEntry
  41. v-if="isLoggedIn"
  42. :userName="userName"
  43. roleName="家长"
  44. :currentChildName="currentChildName"
  45. :children="children"
  46. @childChanged="onChildChanged"
  47. @scrollTo="scrollToSection" />
  48. <!-- ===== 心/智 Tab栏 ===== -->
  49. <view class="tab-bar">
  50. <view
  51. :class="['tab-item', activeTab === 'emotion' ? 'active' : '']"
  52. @click="switchTab('emotion')">
  53. <text class="tab-icon">&#x2764;</text>
  54. <text class="tab-label">心·心理</text>
  55. </view>
  56. <view
  57. :class="['tab-item', activeTab === 'cognitive' ? 'active' : '']"
  58. @click="switchTab('cognitive')">
  59. <text class="tab-icon">&#x1F9E0;</text>
  60. <text class="tab-label">智·认知</text>
  61. </view>
  62. </view>
  63. <!-- ===== 心·心理 Tab ===== -->
  64. <template v-if="activeTab === 'emotion'">
  65. <!-- ===== 心理能量概况 ===== -->
  66. <view class="energy-overview" v-if="emiData">
  67. <view class="energy-badge">
  68. <text class="badge-icon">&#x2764;</text>
  69. <text class="badge-value">{{ emiData.overallScore || 0 }}</text>
  70. <text class="badge-label">心能量</text>
  71. </view>
  72. <view class="energy-badge">
  73. <text class="badge-icon">&#x1F4AA;</text>
  74. <text class="badge-value">{{ emiData.resilienceScore || 0 }}</text>
  75. <text class="badge-label">韧性评分</text>
  76. </view>
  77. <view class="energy-badge">
  78. <text class="badge-icon">&#x1F64F;</text>
  79. <text class="badge-value">{{ emiData.emotionScore || 0 }}</text>
  80. <text class="badge-label">情绪评分</text>
  81. </view>
  82. </view>
  83. <!-- EMI 四维条形图 -->
  84. <view class="emi-section" v-if="emiData">
  85. <view class="emi-card">
  86. <text class="emi-card-title">EMI 心理四维</text>
  87. <view class="emi-bar-item" v-for="dim in emiDimensions" :key="dim.key">
  88. <text class="emi-bar-label">{{ dim.label }}</text>
  89. <view class="emi-bar-track">
  90. <view class="emi-bar-fill" :style="{ width: (emiData[dim.key] || 0) + '%', background: dim.color }"></view>
  91. </view>
  92. <text class="emi-bar-score">{{ emiData[dim.key] || 0 }}</text>
  93. <text :class="['emi-bar-level', 'level-' + getScoreLevel(emiData[dim.key] || 0)]">{{ getScoreLevelText(emiData[dim.key] || 0) }}</text>
  94. </view>
  95. <view class="emi-footer">
  96. <text class="emi-overall">综合EQ分: {{ emiData.overallScore || 0 }}</text>
  97. <view class="emi-link" @click="goEmotionReport">
  98. <text class="emi-link-text">查看完整报告</text>
  99. <text class="emi-link-arrow">&#x2192;</text>
  100. </view>
  101. </view>
  102. </view>
  103. </view>
  104. <!-- 无 EMI 数据占位 -->
  105. <view class="placeholder-card" v-if="!emiData && !emiLoading">
  106. <text class="placeholder-icon">&#x1F9E0;</text>
  107. <text class="placeholder-title">心理评估</text>
  108. <text class="placeholder-desc">完成 EMI 心理测评后,可在此查看详细的心理分析报告</text>
  109. <view class="placeholder-btn" @click="goAssessment" v-if="isLoggedIn">预约测评</view>
  110. <view class="placeholder-btn" @click="goLogin" v-else>立即登录</view>
  111. </view>
  112. <!-- ===== 大五人格雷达图(从EMI数据中提取) ===== -->
  113. <view class="section personality-section" v-if="emiData">
  114. <view class="section-header">
  115. <text class="section-title">大五人格</text>
  116. </view>
  117. <RadarChart
  118. :dimensions="personalityDimensions"
  119. :scores="personalityScores"
  120. :childName="currentChildName || '孩子'"
  121. fillColor="#8B5CF6"
  122. gridColor="#EDE9FE"
  123. labelColor="#6D28D9" />
  124. </view>
  125. <!-- 每日心理 -->
  126. <view class="section" v-if="sectionVisible('daily_tip')">
  127. <view class="section-header">
  128. <text class="section-title">每日心理</text>
  129. </view>
  130. <view class="tip-card">
  131. <view class="tip-left-bar"></view>
  132. <view class="tip-body">
  133. <text class="tip-title">{{ dailyTip.title }}</text>
  134. <text class="tip-content">{{ dailyTip.content }}</text>
  135. <view class="tip-footer">
  136. <text class="tip-source">{{ dailyTip.source }}</text>
  137. </view>
  138. </view>
  139. </view>
  140. </view>
  141. <!-- 推荐阅读 -->
  142. <view class="section" v-if="sectionVisible('recommended_reading')">
  143. <view class="section-header">
  144. <text class="section-title">推荐阅读</text>
  145. </view>
  146. <view class="article-list">
  147. <view class="article-card" v-for="article in emotionArticles" :key="article.id" @click="goArticleDetail(article.id)">
  148. <view class="article-category" :style="{ background: article.categoryColor }">
  149. <text class="article-category-text">{{ article.category }}</text>
  150. </view>
  151. <text class="article-title">{{ article.title }}</text>
  152. <text class="article-summary">{{ article.summary }}</text>
  153. <view class="article-meta">
  154. <view class="meta-item">
  155. <text class="meta-icon">&#x1F4D6;</text>
  156. <text class="meta-text">{{ article.views }}</text>
  157. </view>
  158. <view class="meta-item">
  159. <text class="meta-icon">&#x1F44D;</text>
  160. <text class="meta-text">{{ article.likes }}</text>
  161. </view>
  162. <text class="article-date">{{ article.date }}</text>
  163. </view>
  164. </view>
  165. </view>
  166. </view>
  167. <!-- 心愿单入口(心理Tab) -->
  168. <view class="section wishlist-section" v-if="isLoggedIn">
  169. <view class="wishlist-card" @click="goWishlist">
  170. <view class="wishlist-left">
  171. <text class="wishlist-icon">💝</text>
  172. </view>
  173. <view class="wishlist-body">
  174. <text class="wishlist-title">心愿单</text>
  175. <text class="wishlist-desc">孩子可在此创建、兑换心愿</text>
  176. </view>
  177. <text class="wishlist-arrow">›</text>
  178. </view>
  179. </view>
  180. </template>
  181. <!-- ===== 智·认知 Tab ===== -->
  182. <template v-if="activeTab === 'cognitive'">
  183. <!-- ===== 认知区块 ===== -->
  184. <!-- 综合认知评分 -->
  185. <view class="cognitive-overview" v-if="assessmentData">
  186. <view class="cognitive-score-card">
  187. <view class="score-row">
  188. <view class="score-cell">
  189. <text class="score-label">DAN等级</text>
  190. <text class="score-value highlight">{{ assessmentData.danLevel || '-' }}</text>
  191. </view>
  192. <view class="score-cell">
  193. <text class="score-label">综合得分</text>
  194. <text class="score-value">{{ assessmentData.overallScore || 0 }}</text>
  195. </view>
  196. <view class="score-cell">
  197. <text class="score-label">上次测评</text>
  198. <text class="score-value small">{{ assessmentData.assessmentDate || '-' }}</text>
  199. </view>
  200. </view>
  201. <view class="score-actions">
  202. <view class="score-link" @click="goCognitiveReport">
  203. <text class="score-link-text">查看完整报告</text>
  204. <text class="score-link-arrow">&#x2192;</text>
  205. </view>
  206. <view class="score-link secondary" @click="goAssessment">
  207. <text class="score-link-text">预约测评</text>
  208. </view>
  209. </view>
  210. </view>
  211. </view>
  212. <!-- 无测评数据占位 -->
  213. <view class="placeholder-card" v-if="!assessmentData && !assessmentLoading">
  214. <text class="placeholder-icon">&#x1F9E0;</text>
  215. <text class="placeholder-title">认知评估</text>
  216. <text class="placeholder-desc">完成 DAN 认知测评后,可在此查看详细的六维认知分析报告</text>
  217. <view class="placeholder-btn" @click="goAssessment" v-if="isLoggedIn">预约测评</view>
  218. <view class="placeholder-btn" @click="goLogin" v-else>立即登录</view>
  219. </view>
  220. <!-- 认知六维雷达图 -->
  221. <view class="radar-section" v-if="assessmentData && familyMembers.length > 0">
  222. <scroll-view class="member-scroll" scroll-x show-scrollbar="false">
  223. <view class="member-row">
  224. <view
  225. v-for="member in familyMembers"
  226. :key="member.childId"
  227. :class="['member-tab', member.childId === selectedChildId ? 'active' : '']"
  228. @click="selectMember(member.childId)"
  229. >
  230. <text class="member-name">{{ member.childName }}</text>
  231. <text class="member-overall">{{ member.overallScore || 0 }}分</text>
  232. </view>
  233. </view>
  234. </scroll-view>
  235. <view class="radar-card">
  236. <RadarChart
  237. :dimensions="cognitiveDimensions"
  238. :scores="currentScores"
  239. :childName="currentChildName"
  240. @dimensionClick="goTraining"
  241. />
  242. <text class="radar-hint">点击维度标签进入能力训练</text>
  243. </view>
  244. </view>
  245. <!-- 认知训练入口 -->
  246. <view class="section" v-if="isLoggedIn">
  247. <view class="section-header">
  248. <text class="section-title">认知训练</text>
  249. </view>
  250. <view class="game-grid">
  251. <view class="game-item" @click="goGame('schulte')">
  252. <view class="game-icon-wrap" style="background: #FFF7ED">
  253. <text class="game-icon">&#x1F3AF;</text>
  254. </view>
  255. <text class="game-name">舒尔特方格</text>
  256. </view>
  257. <view class="game-item" @click="goGame('1a2b')">
  258. <view class="game-icon-wrap" style="background: #EFF6FF">
  259. <text class="game-icon">&#x1F522;</text>
  260. </view>
  261. <text class="game-name">猜数字</text>
  262. </view>
  263. <view class="game-item" @click="goGame('sudoku')">
  264. <view class="game-icon-wrap" style="background: #EDE9FE">
  265. <text class="game-icon">&#x1F9E9;</text>
  266. </view>
  267. <text class="game-name">数独</text>
  268. </view>
  269. </view>
  270. </view>
  271. <!-- 本月阅读统计 -->
  272. <view class="section" v-if="isLoggedIn && readingStats">
  273. <view class="section-header">
  274. <text class="section-title">本月阅读</text>
  275. </view>
  276. <view class="reading-card">
  277. <view class="reading-stats">
  278. <text class="reading-count">{{ readingStats.totalArticles || 0 }}篇</text>
  279. <text class="reading-divider">/</text>
  280. <text class="reading-duration">{{ readingMinutes }}分钟</text>
  281. </view>
  282. <view class="reading-progress-wrap">
  283. <view class="reading-progress-track">
  284. <view class="reading-progress-fill" :style="{ width: (readingStats.progress || 0) + '%' }"></view>
  285. </view>
  286. <text class="reading-progress-text">{{ readingStats.progress || 0 }}%</text>
  287. </view>
  288. <view class="reading-link" @click="goArticles">
  289. <text class="reading-link-text">去阅读 &#x2192;</text>
  290. </view>
  291. </view>
  292. </view>
  293. <!-- 推荐阅读(认知Tab内) -->
  294. <view class="section" v-if="sectionVisible('recommended_reading')">
  295. <view class="section-header">
  296. <text class="section-title">推荐阅读</text>
  297. </view>
  298. <view class="article-list">
  299. <view class="article-card" v-for="article in cognitiveArticles" :key="article.id" @click="goArticleDetail(article.id)">
  300. <view class="article-category" :style="{ background: article.categoryColor }">
  301. <text class="article-category-text">{{ article.category }}</text>
  302. </view>
  303. <text class="article-title">{{ article.title }}</text>
  304. <text class="article-summary">{{ article.summary }}</text>
  305. <view class="article-meta">
  306. <view class="meta-item">
  307. <text class="meta-icon">&#x1F4D6;</text>
  308. <text class="meta-text">{{ article.views }}</text>
  309. </view>
  310. <view class="meta-item">
  311. <text class="meta-icon">&#x1F44D;</text>
  312. <text class="meta-text">{{ article.likes }}</text>
  313. </view>
  314. <text class="article-date">{{ article.date }}</text>
  315. </view>
  316. </view>
  317. </view>
  318. </view>
  319. </template>
  320. <!-- ===== 底部:维度任务/活动/商品 ===== -->
  321. <DimensionTasks
  322. v-if="isLoggedIn"
  323. :dimensionCode="currentDimensionCode"
  324. :tasks="dimensionTasks"
  325. @taskClick="onTaskClick"
  326. @moreTasks="goTasks" />
  327. <DimensionActivities
  328. :dimensionCode="currentDimensionCode"
  329. :activities="dimensionActivities"
  330. @activityClick="goActivityDetail"
  331. @moreActivities="goMoreActivities" />
  332. <DimensionProducts
  333. :dimensionCode="currentDimensionCode"
  334. :products="dimensionProducts"
  335. @productClick="goProductDetail"
  336. @moreProducts="goMoreProducts" />
  337. <!-- ===== 底部:功能入口 Grid(通用) ===== -->
  338. <view class="func-section" v-if="sectionVisible('func_entries')">
  339. <view class="func-grid">
  340. <view class="func-item" v-for="item in funcList" :key="item.label" @click="onFuncClick(item)">
  341. <view class="func-icon-wrap">
  342. <text class="func-icon">{{ item.icon }}</text>
  343. </view>
  344. <text class="func-label">{{ item.label }}</text>
  345. </view>
  346. </view>
  347. </view>
  348. <!-- 底部占位 -->
  349. <view class="bottom-spacer"></view>
  350. </view>
  351. </template>
  352. <script>
  353. import PageBanner from '../../components/PageBanner.vue'
  354. import LoginGuideCard from '../../components/LoginGuideCard.vue'
  355. import RadarChart from '../../components/RadarChart.vue'
  356. import FamilyEnergyBar from '../../components/FamilyEnergyBar.vue'
  357. import UserQuickEntry from '../../components/UserQuickEntry.vue'
  358. import DimensionTasks from '../../components/DimensionTasks.vue'
  359. import DimensionActivities from '../../components/DimensionActivities.vue'
  360. import DimensionProducts from '../../components/DimensionProducts.vue'
  361. import FamilyMemberStrip from '../../components/FamilyMemberStrip.vue'
  362. import FamilyRelationGraph from '../../components/FamilyRelationGraph.vue'
  363. import { getVisibleSections, getFeaturedArticles, getEmiReport, getAssessmentLatestResult, getDailyTip, getReadingStats, getFamilyEnergySandbox, getTodayTasksByCategory, getActivityList, getProductsByDomain, getChildren, getVisibleFamilyMembers } from '../../utils/api.js'
  364. import config from '../../config.js'
  365. export default {
  366. components: { PageBanner, RadarChart, LoginGuideCard, FamilyEnergyBar, UserQuickEntry, DimensionTasks, DimensionActivities, DimensionProducts, FamilyMemberStrip, FamilyRelationGraph },
  367. data() {
  368. return {
  369. isLoggedIn: false,
  370. role: null,
  371. currentChildId: null,
  372. visibleSections: [],
  373. familyMembersVisible: [],
  374. selectedMemberId: 0,
  375. selectedMemberType: 'all',
  376. // 心理 Tab 数据
  377. emiData: null,
  378. emiLoading: true,
  379. personalityDimensions: [
  380. { key: 'opennessScore', label: '开放性' },
  381. { key: 'conscientiousnessScore', label: '尽责性' },
  382. { key: 'extraversionScore', label: '外向性' },
  383. { key: 'agreeablenessScore', label: '宜人性' },
  384. { key: 'neuroticismScore', label: '神经质' }
  385. ],
  386. dailyTip: {
  387. title: '成长型思维',
  388. content: '拥有成长型思维的孩子相信自己的能力可以通过努力提升,他们更愿意接受挑战,从失败中学习。作为家长,多鼓励孩子的努力而非天赋,可以帮助孩子建立成长型思维。',
  389. source: '—— 卡罗尔·德韦克《终身成长》'
  390. },
  391. emiDimensions: [
  392. { key: 'emotionScore', label: '情绪商数', color: '#FF6B35' },
  393. { key: 'resilienceScore', label: '心理韧性', color: '#F97316' },
  394. { key: 'stressCopingScore', label: '压力应对', color: '#FB923C' },
  395. { key: 'selfAwarenessScore', label: '自我认知', color: '#FBBF24' }
  396. ],
  397. // 认知 Tab 数据
  398. assessmentData: null,
  399. assessmentLoading: true,
  400. cognitiveDimensions: [
  401. { label: '感知', key: 'perception' },
  402. { label: '专注', key: 'focus' },
  403. { label: '记忆', key: 'memory' },
  404. { label: '逻辑', key: 'logic' },
  405. { label: '空间', key: 'spatial' },
  406. { label: '加工速度', key: 'processingSpeed' }
  407. ],
  408. familyMembers: [],
  409. selectedChildId: null,
  410. currentScores: [0, 0, 0, 0, 0, 0],
  411. currentChildName: '',
  412. readingStats: null,
  413. // 功能入口
  414. funcList: [
  415. { icon: '\u{1F4D6}', label: '阅读', needLogin: false, page: '/pages/mind/articles' },
  416. { icon: '\u{1F3AE}', label: '小游戏', needLogin: true, page: '/pages/games/list' },
  417. { icon: '\u{1F4CA}', label: '测评报告', needLogin: true, page: '/pages/mind/emotion-report' },
  418. { icon: '\u{1F9EA}', label: '训练中心', needLogin: true, page: '/pages/mind/training' },
  419. { icon: '\u{1F4DD}', label: '成长档案', needLogin: true, page: '/pages/growth/index' }
  420. ],
  421. articles: [],
  422. // 五维组件数据
  423. userName: '',
  424. children: [],
  425. sandboxData: null,
  426. dualDimension: null,
  427. dimensionTasks: [],
  428. dimensionActivities: [],
  429. dimensionProducts: [],
  430. activeTab: 'emotion'
  431. }
  432. },
  433. computed: {
  434. readingMinutes: function() {
  435. var stats = this.readingStats
  436. if (!stats || !stats.totalDurationSeconds) return 0
  437. return Math.floor((stats.totalDurationSeconds || 0) / 60)
  438. },
  439. personalityScores: function() {
  440. if (!this.emiData) return []
  441. return [
  442. this.emiData.opennessScore || 0,
  443. this.emiData.conscientiousnessScore || 0,
  444. this.emiData.extraversionScore || 0,
  445. this.emiData.agreeablenessScore || 0,
  446. this.emiData.neuroticismScore || 0
  447. ]
  448. },
  449. energyMapForGraph: function() {
  450. var map = {}
  451. if (this.sandboxData && this.sandboxData.members) {
  452. for (var i = 0; i < this.sandboxData.members.length; i++) {
  453. var m = this.sandboxData.members[i]
  454. map[m.memberId || m.id] = {
  455. bodyScore: m.bodyScore || 0,
  456. mindScore: m.mindScore || 0,
  457. actionScore: m.actionScore || 0
  458. }
  459. }
  460. }
  461. return map
  462. },
  463. intimacyMapForGraph: function() {
  464. return {}
  465. },
  466. emotionArticles: function() {
  467. if (!this.articles || this.articles.length === 0) return []
  468. var result = []
  469. for (var i = 0; i < this.articles.length; i++) {
  470. var a = this.articles[i]
  471. if (a.relatedDimensions && a.relatedDimensions.indexOf('mind') !== -1) {
  472. result.push(a)
  473. }
  474. }
  475. if (result.length === 0) return this.articles.slice(0, 5)
  476. return result.slice(0, 5)
  477. },
  478. cognitiveArticles: function() {
  479. if (!this.articles || this.articles.length === 0) return []
  480. var result = []
  481. for (var i = 0; i < this.articles.length; i++) {
  482. var a = this.articles[i]
  483. if (a.relatedDimensions && a.relatedDimensions.indexOf('wisdom') !== -1) {
  484. result.push(a)
  485. }
  486. }
  487. if (result.length === 0) return this.articles.slice(0, 5)
  488. return result.slice(0, 5)
  489. },
  490. currentDimensionCode: function() {
  491. return this.activeTab === 'emotion' ? 'mind' : 'wisdom'
  492. }
  493. },
  494. onShow() {
  495. var token = uni.getStorageSync('token')
  496. this.isLoggedIn = !!token
  497. if (this.isLoggedIn) {
  498. this.role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
  499. this.currentChildId = uni.getStorageSync('currentChildId') || null
  500. this.userName = uni.getStorageSync('nickname') || uni.getStorageSync('userName') || '家长'
  501. }
  502. this.loadSectionConfig()
  503. this.loadFeaturedArticles()
  504. this.loadDailyTip()
  505. if (this.isLoggedIn) {
  506. this.loadChildren()
  507. this.loadFamilyMembersVisible()
  508. this.loadSandboxData()
  509. this.loadEmiData()
  510. this.loadAssessmentData()
  511. this.loadReadingStats()
  512. this.loadFamilyCognitiveData()
  513. this.loadEnergyData()
  514. }
  515. // 游客也能浏览活动和商品
  516. this.loadDimensionActivities()
  517. this.loadDimensionProducts()
  518. },
  519. methods: {
  520. // ===== 区块可见性 =====
  521. loadSectionConfig: function() {
  522. var self = this
  523. var baseSections = ['func_entries', 'daily_tip', 'recommended_reading']
  524. if (!uni.getStorageSync('token')) {
  525. self.visibleSections = baseSections
  526. return
  527. }
  528. var role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
  529. getVisibleSections({ pageKey: 'mind', role: role }).then(function(res) {
  530. if (res.code === 200 && res.data) {
  531. var keys = res.data.map(function(s) { return s.sectionKey })
  532. var merged = baseSections.slice()
  533. keys.forEach(function(k) { if (merged.indexOf(k) === -1) merged.push(k) })
  534. self.visibleSections = merged
  535. }
  536. }).catch(function() {
  537. self.visibleSections = ['func_entries', 'daily_tip', 'recommended_reading', 'mind_tasks', 'related_activities', 'purchased_courses']
  538. })
  539. },
  540. sectionVisible: function(key) {
  541. return this.visibleSections.length === 0 || this.visibleSections.indexOf(key) !== -1
  542. },
  543. // ===== 心理 Tab:EMI 数据 =====
  544. loadEmiData: function() {
  545. var self = this
  546. var childId = self.currentChildId
  547. if (!childId) {
  548. self.emiLoading = false
  549. return
  550. }
  551. self.emiLoading = true
  552. getEmiReport(childId).then(function(res) {
  553. if (res.code === 200 && res.data) {
  554. self.emiData = res.data
  555. }
  556. self.emiLoading = false
  557. }).catch(function() {
  558. self.emiLoading = false
  559. })
  560. },
  561. // ===== 认知 Tab:测评数据 =====
  562. loadAssessmentData: function() {
  563. var self = this
  564. var childId = self.currentChildId
  565. if (!childId) {
  566. self.assessmentLoading = false
  567. return
  568. }
  569. self.assessmentLoading = true
  570. getAssessmentLatestResult(childId).then(function(res) {
  571. if (res.code === 200 && res.data) {
  572. self.assessmentData = res.data
  573. }
  574. self.assessmentLoading = false
  575. }).catch(function() {
  576. self.assessmentLoading = false
  577. })
  578. },
  579. // ===== 认知 Tab:六维认知数据 =====
  580. loadFamilyCognitiveData: function() {
  581. var self = this
  582. var token = uni.getStorageSync('token')
  583. var userId = uni.getStorageSync('userId') || ''
  584. if (!token) return
  585. uni.request({
  586. url: config.API_BASE_URL + '/api/cognitive/family',
  587. method: 'POST',
  588. header: {
  589. 'Content-Type': 'application/json',
  590. 'Authorization': 'Bearer ' + token,
  591. 'X-User-Id': userId
  592. },
  593. success: function(r) {
  594. if (r.statusCode === 200 && r.data && r.data.code === 200 && r.data.data) {
  595. var data = r.data.data
  596. if (Array.isArray(data) && data.length > 0) {
  597. self.familyMembers = data
  598. var first = data[0]
  599. self.selectedChildId = first.childId
  600. self.updateCurrentScores(first)
  601. }
  602. }
  603. }
  604. })
  605. },
  606. selectMember: function(childId) {
  607. if (childId === this.selectedChildId) return
  608. this.selectedChildId = childId
  609. var member = this.familyMembers.find(function(m) { return m.childId === childId })
  610. if (member) {
  611. this.updateCurrentScores(member)
  612. }
  613. },
  614. updateCurrentScores: function(member) {
  615. this.currentChildName = member.childName || ''
  616. this.currentScores = [
  617. member.perceptionScore || 0,
  618. member.focusScore || 0,
  619. member.memoryScore || 0,
  620. member.logicScore || 0,
  621. member.spatialScore || 0,
  622. member.processingSpeedScore || 0
  623. ]
  624. },
  625. goTraining: function(dimensionKey) {
  626. if (!this.selectedChildId) {
  627. uni.showToast({ title: '请先选择家庭成员', icon: 'none' })
  628. return
  629. }
  630. uni.navigateTo({ url: '/pages/mind/training?dimension=' + dimensionKey + '&childId=' + this.selectedChildId })
  631. },
  632. // ===== 每日心理 =====
  633. loadDailyTip: function() {
  634. var self = this
  635. getDailyTip().then(function(res) {
  636. if (res.code === 200 && res.data) {
  637. self.dailyTip = res.data
  638. }
  639. }).catch(function() {})
  640. },
  641. // ===== 阅读统计 =====
  642. loadReadingStats: function() {
  643. var self = this
  644. var childId = self.currentChildId
  645. if (!childId) return
  646. getReadingStats(childId).then(function(res) {
  647. if (res.code === 200 && res.data) {
  648. self.readingStats = res.data
  649. }
  650. }).catch(function() {})
  651. },
  652. // ===== 文章 =====
  653. loadFeaturedArticles: function() {
  654. var self = this
  655. getFeaturedArticles({ size: 5 }).then(function(res) {
  656. if (res.code === 200 && res.data) {
  657. var gradientColors = [
  658. 'linear-gradient(135deg, #8B5CF6, #A78BFA)',
  659. 'linear-gradient(135deg, #5B9BD5, #8FC5E8)',
  660. 'linear-gradient(135deg, #10B981, #34D399)',
  661. 'linear-gradient(135deg, #8B5CF6, #C084FC)',
  662. 'linear-gradient(135deg, #F97316, #FB923C)'
  663. ]
  664. var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
  665. self.articles = list.map(function(item, index) {
  666. return {
  667. id: item.id,
  668. category: item.categoryName || '成长文章',
  669. categoryColor: gradientColors[index % gradientColors.length],
  670. title: item.title || '',
  671. summary: item.summary || '',
  672. views: item.viewCount ? String(item.viewCount) : '0',
  673. likes: '0',
  674. date: item.publishedAt ? item.publishedAt.slice(0, 10) : '',
  675. relatedDimensions: item.relatedDimensions || []
  676. }
  677. })
  678. }
  679. }).catch(function() {})
  680. },
  681. // ===== EMI 分数评级 =====
  682. getScoreLevel: function(score) {
  683. if (score >= 85) return 'excellent'
  684. if (score >= 70) return 'good'
  685. if (score >= 55) return 'average'
  686. return 'low'
  687. },
  688. getScoreLevelText: function(score) {
  689. if (score >= 85) return '优秀'
  690. if (score >= 70) return '良好'
  691. if (score >= 55) return '一般'
  692. return '需提升'
  693. },
  694. // ===== 导航 =====
  695. goEmotionReport: function() {
  696. var childId = this.currentChildId || ''
  697. uni.navigateTo({ url: '/pages/mind/emotion-report?childId=' + childId })
  698. },
  699. goCognitiveReport: function() {
  700. var childId = this.currentChildId || ''
  701. uni.navigateTo({ url: '/pages/mind/emotion-report?childId=' + childId })
  702. },
  703. goGame: function(gameCode) {
  704. if (!this.isLoggedIn) {
  705. uni.showModal({
  706. title: '提示',
  707. content: '请先登录后使用此功能',
  708. success: function(res) { if (res.confirm) uni.navigateTo({ url: '/pages/login/login' }) }
  709. })
  710. return
  711. }
  712. uni.navigateTo({ url: '/pages/games/' + gameCode })
  713. },
  714. goArticles: function() {
  715. uni.navigateTo({ url: '/pages/mind/articles' })
  716. },
  717. onFuncClick: function(item) {
  718. if (item.needLogin && !this.isLoggedIn) {
  719. uni.showModal({
  720. title: '提示',
  721. content: '请先登录后使用此功能',
  722. success: function(res) { if (res.confirm) uni.navigateTo({ url: '/pages/login/login' }) }
  723. })
  724. return
  725. }
  726. if (item.page) uni.navigateTo({ url: item.page })
  727. },
  728. goArticleDetail: function(id) {
  729. var url = '/pages/mind/article-detail?id=' + id
  730. uni.navigateTo({ url: url })
  731. },
  732. // ===== 孩子列表与维度数据 =====
  733. loadChildren: function() {
  734. var self = this
  735. getChildren().then(function(res) {
  736. if (res.code === 200 && res.data) {
  737. self.children = res.data
  738. var savedChildId = uni.getStorageSync('currentChildId')
  739. var found = false
  740. for (var i = 0; i < self.children.length; i++) {
  741. if (self.children[i].childId === savedChildId) {
  742. self.currentChildId = savedChildId
  743. found = true
  744. break
  745. }
  746. }
  747. if (!found && self.children.length > 0) {
  748. self.currentChildId = self.children[0].childId
  749. uni.setStorageSync('currentChildId', self.currentChildId)
  750. }
  751. if (self.currentChildId) {
  752. self.loadDimensionData()
  753. }
  754. }
  755. }).catch(function(e) {
  756. console.log('获取孩子列表失败', e)
  757. })
  758. },
  759. loadDimensionData: function() {
  760. this.loadDimensionTasks()
  761. this.loadDimensionActivities()
  762. this.loadDimensionProducts()
  763. },
  764. loadSandboxData: function() {
  765. var self = this
  766. getFamilyEnergySandbox().then(function(res) {
  767. if (res && res.data) {
  768. self.sandboxData = res.data
  769. }
  770. }).catch(function() {})
  771. },
  772. loadEnergyData: function() {
  773. var self = this
  774. if (!this.currentChildId) return
  775. getEnergyOverview(this.currentChildId).then(function(res) {
  776. if (res && res.data) {
  777. var dims = res.data.dimensions
  778. if (dims && dims.length > 0) {
  779. var mindDim = null
  780. var wisdomDim = null
  781. for (var i = 0; i < dims.length; i++) {
  782. if (dims[i].code === 'mind') mindDim = dims[i]
  783. if (dims[i].code === 'wisdom') wisdomDim = dims[i]
  784. }
  785. self.dualDimension = {
  786. primary: mindDim || { code: 'mind', score: 0, label: '心理', color: '#8B5CF6' },
  787. secondary: wisdomDim || { code: 'wisdom', score: 0, label: '认知', color: '#3B82F6' }
  788. }
  789. }
  790. }
  791. }).catch(function(e) {
  792. console.log('获取能量概览失败', e)
  793. })
  794. },
  795. loadDimensionTasks: function() {
  796. var self = this
  797. if (!this.currentChildId) return
  798. getTodayTasksByCategory(this.currentChildId, 'mind').then(function(res) {
  799. if (res && res.data) {
  800. self.dimensionTasks = Array.isArray(res.data) ? res.data.slice(0, 5) : []
  801. }
  802. }).catch(function() { self.dimensionTasks = [] })
  803. },
  804. loadDimensionActivities: function() {
  805. var self = this
  806. var dimCode = self.currentDimensionCode
  807. getActivityList({ dimensionCode: dimCode, page: 1, size: 3 }).then(function(res) {
  808. if (res && res.data) {
  809. var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
  810. self.dimensionActivities = list.slice(0, 3)
  811. }
  812. }).catch(function() { self.dimensionActivities = [] })
  813. },
  814. loadDimensionProducts: function() {
  815. var self = this
  816. var dimCode = self.currentDimensionCode
  817. getProductsByDomain(dimCode, 1, 4).then(function(res) {
  818. if (res && res.data) {
  819. var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
  820. self.dimensionProducts = list.slice(0, 4)
  821. }
  822. }).catch(function() { self.dimensionProducts = [] })
  823. },
  824. onChildChanged: function(child) {
  825. this.currentChildId = child.childId
  826. uni.setStorageSync('currentChildId', child.childId)
  827. this.loadDimensionData()
  828. this.loadEmiData()
  829. this.loadAssessmentData()
  830. this.loadReadingStats()
  831. },
  832. loadFamilyMembersVisible: function() {
  833. var self = this
  834. getVisibleFamilyMembers().then(function(res) {
  835. self.familyMembersVisible = res.data || []
  836. }).catch(function(e) {
  837. console.log('获取可见家庭成员失败', e)
  838. self.familyMembersVisible = []
  839. })
  840. },
  841. onMemberSelect: function(member) {
  842. if (member.memberType === 'all') {
  843. this.selectedMemberId = 0
  844. this.selectedMemberType = 'all'
  845. } else {
  846. this.selectedMemberId = member.id
  847. this.selectedMemberType = member.memberType
  848. }
  849. // TODO: 根据选中成员重新加载对应维度数据
  850. },
  851. scrollToSection: function(section) {
  852. uni.pageScrollTo({ selector: '#' + section, duration: 300 })
  853. },
  854. onTaskClick: function(task) {
  855. uni.navigateTo({ url: '/pages/tasks/tasks' })
  856. },
  857. goActivityDetail: function(act) {
  858. if (act && act.id) uni.navigateTo({ url: '/pages/discover/index?type=activity&id=' + act.id })
  859. },
  860. goMoreActivities: function() {
  861. var dimCode = this.currentDimensionCode
  862. uni.navigateTo({ url: '/pages/discover/index?type=activity&dimension=' + dimCode })
  863. },
  864. goProductDetail: function(prod) {
  865. if (prod && prod.id) uni.navigateTo({ url: '/pages/discover/product-detail/product-detail?id=' + prod.id })
  866. },
  867. goMoreProducts: function() {
  868. var dimCode = this.currentDimensionCode
  869. uni.navigateTo({ url: '/pages/discover/index?type=product&domain=' + dimCode })
  870. },
  871. goTasks: function() { uni.switchTab({ url: '/pages/tasks/tasks' }) },
  872. goMemberDetail: function(member) {
  873. if (!member || !member.memberId) return
  874. uni.navigateTo({
  875. url: '/pages/mind/member-mind-detail?childId=' + member.memberId
  876. })
  877. },
  878. switchTab: function(tab) {
  879. if (tab === this.activeTab) return
  880. this.activeTab = tab
  881. this.loadDimensionActivities()
  882. this.loadDimensionProducts()
  883. },
  884. goWishlist: function() {
  885. uni.navigateTo({ url: '/pages/rewards/rewards' })
  886. },
  887. goAssessment: function() { uni.navigateTo({ url: '/pages/assessment/apply' }) },
  888. goLogin: function() { uni.navigateTo({ url: '/pages/login/login' }) }
  889. }
  890. }
  891. </script>
  892. <style scoped>
  893. .container {
  894. min-height: 100vh;
  895. background: #f5f7fa;
  896. padding-bottom: 120rpx;
  897. }
  898. /* ===== 心/智 Tab 栏 ===== */
  899. .tab-bar {
  900. display: flex;
  901. flex-direction: row;
  902. margin: 20rpx 30rpx;
  903. background: #fff;
  904. border-radius: 20rpx;
  905. padding: 8rpx;
  906. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  907. }
  908. .tab-item {
  909. flex: 1;
  910. display: flex;
  911. flex-direction: row;
  912. align-items: center;
  913. justify-content: center;
  914. padding: 20rpx 0;
  915. border-radius: 16rpx;
  916. transition: all 0.3s;
  917. }
  918. .tab-item.active {
  919. background: linear-gradient(135deg, #8B5CF6, #A78BFA);
  920. box-shadow: 0 4rpx 12rpx rgba(139,92,246,0.3);
  921. }
  922. .tab-icon {
  923. font-size: 28rpx;
  924. margin-right: 8rpx;
  925. }
  926. .tab-item.active .tab-icon {
  927. color: #fff;
  928. }
  929. .tab-label {
  930. font-size: 28rpx;
  931. font-weight: 500;
  932. color: #999;
  933. }
  934. .tab-item.active .tab-label {
  935. color: #fff;
  936. font-weight: bold;
  937. }
  938. /* ===== 心理能量概况 ===== */
  939. .energy-overview {
  940. display: flex;
  941. flex-direction: row;
  942. margin: 20rpx 30rpx;
  943. background: #fff;
  944. border-radius: 20rpx;
  945. padding: 24rpx 16rpx;
  946. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  947. justify-content: space-around;
  948. }
  949. .energy-badge {
  950. display: flex;
  951. flex-direction: column;
  952. align-items: center;
  953. flex: 1;
  954. }
  955. .badge-icon {
  956. font-size: 36rpx;
  957. margin-bottom: 8rpx;
  958. }
  959. .badge-value {
  960. font-size: 36rpx;
  961. font-weight: bold;
  962. color: #333;
  963. }
  964. .badge-label {
  965. font-size: 20rpx;
  966. color: #999;
  967. margin-top: 4rpx;
  968. }
  969. /* ===== EMI 四维条形图 ===== */
  970. .emi-section {
  971. margin: 20rpx 30rpx;
  972. }
  973. .emi-card {
  974. background: #fff;
  975. border-radius: 24rpx;
  976. padding: 30rpx;
  977. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  978. }
  979. .emi-card-title {
  980. font-size: 30rpx;
  981. font-weight: bold;
  982. color: #333;
  983. margin-bottom: 24rpx;
  984. display: block;
  985. }
  986. .emi-bar-item {
  987. display: flex;
  988. flex-direction: row;
  989. align-items: center;
  990. margin-bottom: 20rpx;
  991. }
  992. .emi-bar-label {
  993. font-size: 24rpx;
  994. color: #666;
  995. width: 120rpx;
  996. flex-shrink: 0;
  997. }
  998. .emi-bar-track {
  999. flex: 1;
  1000. height: 20rpx;
  1001. background: #f0f0f0;
  1002. border-radius: 10rpx;
  1003. overflow: hidden;
  1004. margin: 0 16rpx;
  1005. }
  1006. .emi-bar-fill {
  1007. height: 100%;
  1008. border-radius: 10rpx;
  1009. transition: width 0.5s;
  1010. }
  1011. .emi-bar-score {
  1012. font-size: 26rpx;
  1013. font-weight: bold;
  1014. color: #333;
  1015. width: 60rpx;
  1016. text-align: right;
  1017. flex-shrink: 0;
  1018. }
  1019. .emi-bar-level {
  1020. font-size: 20rpx;
  1021. width: 80rpx;
  1022. text-align: right;
  1023. flex-shrink: 0;
  1024. }
  1025. .level-excellent { color: #10B981; }
  1026. .level-good { color: #3B82F6; }
  1027. .level-average { color: #F97316; }
  1028. .level-low { color: #EF4444; }
  1029. .emi-footer {
  1030. display: flex;
  1031. flex-direction: row;
  1032. justify-content: space-between;
  1033. align-items: center;
  1034. margin-top: 20rpx;
  1035. padding-top: 20rpx;
  1036. border-top: 1rpx solid #f0f0f0;
  1037. }
  1038. .emi-overall {
  1039. font-size: 28rpx;
  1040. font-weight: bold;
  1041. color: #FF6B35;
  1042. }
  1043. .emi-link {
  1044. display: flex;
  1045. flex-direction: row;
  1046. align-items: center;
  1047. }
  1048. .emi-link-text {
  1049. font-size: 26rpx;
  1050. color: #FF6B35;
  1051. font-weight: 500;
  1052. }
  1053. .emi-link-arrow {
  1054. font-size: 26rpx;
  1055. color: #FF6B35;
  1056. margin-left: 8rpx;
  1057. }
  1058. /* ===== 占位卡 ===== */
  1059. .placeholder-card {
  1060. margin: 30rpx;
  1061. background: #fff;
  1062. border-radius: 24rpx;
  1063. padding: 60rpx 40rpx;
  1064. display: flex;
  1065. flex-direction: column;
  1066. align-items: center;
  1067. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  1068. }
  1069. .placeholder-icon {
  1070. font-size: 80rpx;
  1071. margin-bottom: 20rpx;
  1072. }
  1073. .placeholder-title {
  1074. font-size: 32rpx;
  1075. font-weight: bold;
  1076. color: #333;
  1077. margin-bottom: 16rpx;
  1078. }
  1079. .placeholder-desc {
  1080. font-size: 26rpx;
  1081. color: #999;
  1082. text-align: center;
  1083. line-height: 1.6;
  1084. margin-bottom: 30rpx;
  1085. }
  1086. .placeholder-btn {
  1087. background: linear-gradient(135deg, #FF6B35, #FFD700);
  1088. color: #fff;
  1089. font-size: 28rpx;
  1090. font-weight: bold;
  1091. padding: 16rpx 64rpx;
  1092. border-radius: 40rpx;
  1093. box-shadow: 0 4rpx 16rpx rgba(255,107,53,0.3);
  1094. }
  1095. /* ===== 认知评分卡 ===== */
  1096. .cognitive-overview {
  1097. margin: 20rpx 30rpx;
  1098. }
  1099. .cognitive-score-card {
  1100. background: #fff;
  1101. border-radius: 24rpx;
  1102. padding: 30rpx;
  1103. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  1104. }
  1105. .score-row {
  1106. display: flex;
  1107. flex-direction: row;
  1108. justify-content: space-around;
  1109. margin-bottom: 24rpx;
  1110. }
  1111. .score-cell {
  1112. display: flex;
  1113. flex-direction: column;
  1114. align-items: center;
  1115. flex: 1;
  1116. }
  1117. .score-label {
  1118. font-size: 24rpx;
  1119. color: #999;
  1120. margin-bottom: 10rpx;
  1121. }
  1122. .score-value {
  1123. font-size: 40rpx;
  1124. font-weight: bold;
  1125. color: #333;
  1126. }
  1127. .score-value.highlight {
  1128. color: #FFD700;
  1129. }
  1130. .score-value.small {
  1131. font-size: 24rpx;
  1132. color: #666;
  1133. }
  1134. .score-actions {
  1135. display: flex;
  1136. flex-direction: row;
  1137. justify-content: space-between;
  1138. align-items: center;
  1139. border-top: 1rpx solid #f0f0f0;
  1140. padding-top: 20rpx;
  1141. }
  1142. .score-link {
  1143. display: flex;
  1144. flex-direction: row;
  1145. align-items: center;
  1146. background: linear-gradient(135deg, #667eea, #764ba2);
  1147. border-radius: 32rpx;
  1148. padding: 12rpx 24rpx;
  1149. }
  1150. .score-link.secondary {
  1151. background: #f0f0f0;
  1152. }
  1153. .score-link-text {
  1154. font-size: 24rpx;
  1155. color: #fff;
  1156. font-weight: 500;
  1157. }
  1158. .score-link.secondary .score-link-text {
  1159. color: #666;
  1160. }
  1161. .score-link-arrow {
  1162. font-size: 24rpx;
  1163. color: #fff;
  1164. margin-left: 8rpx;
  1165. }
  1166. /* ===== 雷达图区域 ===== */
  1167. .radar-section {
  1168. margin: 20rpx 30rpx;
  1169. }
  1170. .member-scroll {
  1171. width: 100%;
  1172. margin-bottom: 16rpx;
  1173. }
  1174. .member-row {
  1175. display: flex;
  1176. flex-direction: row;
  1177. padding: 4rpx 0;
  1178. white-space: nowrap;
  1179. }
  1180. .member-tab {
  1181. display: inline-flex;
  1182. flex-direction: column;
  1183. align-items: center;
  1184. padding: 16rpx 32rpx;
  1185. margin-right: 16rpx;
  1186. background: #fff;
  1187. border-radius: 16rpx;
  1188. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.05);
  1189. min-width: 120rpx;
  1190. flex-shrink: 0;
  1191. }
  1192. .member-tab.active {
  1193. background: linear-gradient(135deg, #FF6B35, #FFD700);
  1194. box-shadow: 0 4rpx 16rpx rgba(255,107,53,0.3);
  1195. }
  1196. .member-tab.active .member-name {
  1197. color: #fff;
  1198. }
  1199. .member-tab.active .member-overall {
  1200. color: rgba(255,255,255,0.9);
  1201. }
  1202. .member-name {
  1203. font-size: 26rpx;
  1204. font-weight: bold;
  1205. color: #333;
  1206. }
  1207. .member-overall {
  1208. font-size: 20rpx;
  1209. color: #999;
  1210. margin-top: 4rpx;
  1211. }
  1212. .radar-card {
  1213. background: #fff;
  1214. border-radius: 24rpx;
  1215. padding: 30rpx 20rpx 20rpx;
  1216. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  1217. display: flex;
  1218. flex-direction: column;
  1219. align-items: center;
  1220. }
  1221. .radar-hint {
  1222. font-size: 22rpx;
  1223. color: #bbb;
  1224. margin-top: 16rpx;
  1225. }
  1226. /* ===== 认知训练入口 ===== */
  1227. .game-grid {
  1228. display: flex;
  1229. flex-direction: row;
  1230. justify-content: space-around;
  1231. background: #fff;
  1232. border-radius: 20rpx;
  1233. padding: 24rpx 16rpx;
  1234. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1235. }
  1236. .game-item {
  1237. display: flex;
  1238. flex-direction: column;
  1239. align-items: center;
  1240. flex: 1;
  1241. }
  1242. .game-icon-wrap {
  1243. width: 80rpx;
  1244. height: 80rpx;
  1245. border-radius: 40rpx;
  1246. display: flex;
  1247. align-items: center;
  1248. justify-content: center;
  1249. margin-bottom: 10rpx;
  1250. }
  1251. .game-icon {
  1252. font-size: 40rpx;
  1253. }
  1254. .game-name {
  1255. font-size: 22rpx;
  1256. color: #666;
  1257. font-weight: 500;
  1258. }
  1259. .game-item:active {
  1260. opacity: 0.7;
  1261. }
  1262. /* ===== 阅读统计 ===== */
  1263. .reading-card {
  1264. background: #fff;
  1265. border-radius: 20rpx;
  1266. padding: 28rpx 24rpx;
  1267. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1268. }
  1269. .reading-stats {
  1270. display: flex;
  1271. flex-direction: row;
  1272. align-items: baseline;
  1273. margin-bottom: 16rpx;
  1274. }
  1275. .reading-count {
  1276. font-size: 36rpx;
  1277. font-weight: bold;
  1278. color: #FF6B35;
  1279. }
  1280. .reading-divider {
  1281. font-size: 28rpx;
  1282. color: #ccc;
  1283. margin: 0 8rpx;
  1284. }
  1285. .reading-duration {
  1286. font-size: 36rpx;
  1287. font-weight: bold;
  1288. color: #333;
  1289. }
  1290. .reading-progress-wrap {
  1291. display: flex;
  1292. flex-direction: row;
  1293. align-items: center;
  1294. margin-bottom: 16rpx;
  1295. }
  1296. .reading-progress-track {
  1297. flex: 1;
  1298. height: 16rpx;
  1299. background: #f0f0f0;
  1300. border-radius: 8rpx;
  1301. overflow: hidden;
  1302. margin-right: 16rpx;
  1303. }
  1304. .reading-progress-fill {
  1305. height: 100%;
  1306. background: linear-gradient(90deg, #FF6B35, #FFD700);
  1307. border-radius: 8rpx;
  1308. transition: width 0.5s;
  1309. }
  1310. .reading-progress-text {
  1311. font-size: 24rpx;
  1312. color: #999;
  1313. width: 80rpx;
  1314. text-align: right;
  1315. flex-shrink: 0;
  1316. }
  1317. .reading-link {
  1318. display: flex;
  1319. justify-content: flex-end;
  1320. }
  1321. .reading-link-text {
  1322. font-size: 26rpx;
  1323. color: #FF6B35;
  1324. font-weight: 500;
  1325. }
  1326. /* ===== 每日心理 ===== */
  1327. .tip-card {
  1328. background: #fff;
  1329. border-radius: 20rpx;
  1330. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1331. display: flex;
  1332. flex-direction: row;
  1333. overflow: hidden;
  1334. }
  1335. .tip-left-bar {
  1336. width: 6rpx;
  1337. background: linear-gradient(180deg, #5B9BD5, #8FC5E8);
  1338. flex-shrink: 0;
  1339. }
  1340. .tip-body {
  1341. flex: 1;
  1342. padding: 28rpx 24rpx;
  1343. }
  1344. .tip-title {
  1345. font-size: 28rpx;
  1346. font-weight: bold;
  1347. color: #5B9BD5;
  1348. display: block;
  1349. margin-bottom: 12rpx;
  1350. }
  1351. .tip-content {
  1352. font-size: 24rpx;
  1353. color: #666;
  1354. line-height: 1.6;
  1355. display: block;
  1356. margin-bottom: 16rpx;
  1357. }
  1358. .tip-footer {
  1359. display: flex;
  1360. flex-direction: row;
  1361. justify-content: flex-end;
  1362. }
  1363. .tip-source {
  1364. font-size: 22rpx;
  1365. color: #bbb;
  1366. }
  1367. /* ===== 通用区块 ===== */
  1368. .section {
  1369. margin: 20rpx 30rpx;
  1370. }
  1371. .section-header {
  1372. margin-bottom: 20rpx;
  1373. }
  1374. .section-title {
  1375. font-size: 30rpx;
  1376. font-weight: bold;
  1377. color: #333;
  1378. }
  1379. /* ===== 推荐阅读 ===== */
  1380. .article-list {
  1381. display: flex;
  1382. flex-direction: column;
  1383. }
  1384. .article-card {
  1385. background: #fff;
  1386. border-radius: 20rpx;
  1387. padding: 28rpx 24rpx;
  1388. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1389. margin-bottom: 20rpx;
  1390. }
  1391. .article-category {
  1392. display: inline-block;
  1393. padding: 4rpx 18rpx;
  1394. border-radius: 20rpx;
  1395. margin-bottom: 14rpx;
  1396. }
  1397. .article-category-text {
  1398. font-size: 20rpx;
  1399. color: #fff;
  1400. font-weight: 500;
  1401. }
  1402. .article-title {
  1403. font-size: 28rpx;
  1404. font-weight: bold;
  1405. color: #333;
  1406. display: block;
  1407. margin-bottom: 10rpx;
  1408. }
  1409. .article-summary {
  1410. font-size: 24rpx;
  1411. color: #888;
  1412. line-height: 1.5;
  1413. display: block;
  1414. margin-bottom: 20rpx;
  1415. }
  1416. .article-meta {
  1417. display: flex;
  1418. flex-direction: row;
  1419. align-items: center;
  1420. justify-content: space-between;
  1421. }
  1422. .meta-item {
  1423. display: flex;
  1424. flex-direction: row;
  1425. align-items: center;
  1426. margin-right: 20rpx;
  1427. }
  1428. .meta-icon {
  1429. font-size: 22rpx;
  1430. margin-right: 4rpx;
  1431. }
  1432. .meta-text {
  1433. font-size: 22rpx;
  1434. color: #bbb;
  1435. }
  1436. .article-date {
  1437. font-size: 22rpx;
  1438. color: #bbb;
  1439. margin-left: auto;
  1440. }
  1441. /* ===== 功能区入口 ===== */
  1442. .func-section {
  1443. margin: 20rpx 30rpx;
  1444. }
  1445. .func-grid {
  1446. display: flex;
  1447. flex-direction: row;
  1448. justify-content: space-between;
  1449. background: #fff;
  1450. border-radius: 20rpx;
  1451. padding: 24rpx 16rpx;
  1452. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1453. }
  1454. .func-item {
  1455. display: flex;
  1456. flex-direction: column;
  1457. align-items: center;
  1458. flex: 1;
  1459. }
  1460. .func-icon-wrap {
  1461. width: 80rpx;
  1462. height: 80rpx;
  1463. border-radius: 40rpx;
  1464. background: linear-gradient(135deg, #D6EAF8, #EBF2FA);
  1465. display: flex;
  1466. align-items: center;
  1467. justify-content: center;
  1468. margin-bottom: 10rpx;
  1469. }
  1470. .func-icon {
  1471. font-size: 40rpx;
  1472. }
  1473. .func-label {
  1474. font-size: 22rpx;
  1475. color: #666;
  1476. font-weight: 500;
  1477. }
  1478. .func-item:active {
  1479. opacity: 0.7;
  1480. }
  1481. /* ===== 底部 ===== */
  1482. .bottom-spacer {
  1483. height: 120rpx;
  1484. }
  1485. /* ===== 心愿单入口 ===== */
  1486. .wishlist-card {
  1487. background: #fff;
  1488. border-radius: 20rpx;
  1489. padding: 28rpx 24rpx;
  1490. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1491. display: flex;
  1492. flex-direction: row;
  1493. align-items: center;
  1494. }
  1495. .wishlist-left {
  1496. width: 72rpx;
  1497. height: 72rpx;
  1498. background: linear-gradient(135deg, #FF6B35, #FFD700);
  1499. border-radius: 50%;
  1500. display: flex;
  1501. align-items: center;
  1502. justify-content: center;
  1503. margin-right: 20rpx;
  1504. flex-shrink: 0;
  1505. }
  1506. .wishlist-icon {
  1507. font-size: 36rpx;
  1508. }
  1509. .wishlist-body {
  1510. flex: 1;
  1511. }
  1512. .wishlist-title {
  1513. font-size: 28rpx;
  1514. font-weight: bold;
  1515. color: #333;
  1516. display: block;
  1517. margin-bottom: 4rpx;
  1518. }
  1519. .wishlist-desc {
  1520. font-size: 22rpx;
  1521. color: #999;
  1522. }
  1523. .wishlist-arrow {
  1524. font-size: 36rpx;
  1525. color: #ccc;
  1526. margin-left: 12rpx;
  1527. }
  1528. </style>