index.vue 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466
  1. <template>
  2. <view class="container" :style="{ '--font-scale': fontScale }">
  3. <!-- 登录浮层(全局组件,页面内弹出底部登录) -->
  4. <login-sheet ref="loginSheet" @success="onSheetLoginSuccess" />
  5. <!-- Tabbar 切换过渡页 -->
  6. <tab-transition v-if="showTabTransition" dimCode="action" ref="tabTransition" @close="showTabTransition = false" />
  7. <!-- 品牌头部 -->
  8. <PageBanner theme="action"
  9. tagline="人际和谐 · 关系滋养"
  10. quote="和谐关系滋养幸福家庭" />
  11. <DimensionPageSkeleton v-if="pageLoading" dim-code="action" />
  12. <!-- 品牌定位语(登录前显示) -->
  13. <view class="brand-strap" v-if="!isLoggedIn">
  14. <text class="brand-strap-text">改善全家关系与沟通能力</text>
  15. </view>
  16. <!-- 家庭成员选择条 -->
  17. <MemberSelector
  18. variant="strip"
  19. v-if="currentView === 'self' && isLoggedIn"
  20. :members="familyMembersVisible"
  21. :selectedMemberId="selectedMemberId"
  22. @select="onFamilyMemberSelect"
  23. @removed="loadFamilyMembersVisible" />
  24. <!-- 游客引导语(每月更换) -->
  25. <view class="monthly-guidance" v-if="!isLoggedIn">
  26. <text class="guidance-icon">🌿</text>
  27. <text class="guidance-text">{{ monthlyGuidance }}</text>
  28. </view>
  29. <!-- 游客价值卡(统一组件:维度色 CTA + 价值预览) -->
  30. <DimensionVisitorCard
  31. v-if="!isLoggedIn"
  32. dimCode="action"
  33. card-title="行维度 · 关系滋养"
  34. :benefits="[
  35. '家庭关系图谱与关键人分析',
  36. '章鱼图 / 珍珠图能力资产',
  37. '家庭关系质量与改善建议'
  38. ]"
  39. cta-text="登录绘制关系网络"
  40. secondary-text="了解关系维度"
  41. secondary-url="/pages/action-detail/dimension-intro"
  42. preview-text="登录后绘制你的家庭关系网络图" />
  43. <!-- 登录后:五维能量条 -->
  44. <FamilyEnergyBar
  45. v-if="isLoggedIn"
  46. dimensionCode="action"
  47. :sandboxData="sandboxData"
  48. :dualDimension="dualDimension" />
  49. <!-- 关系解读 -->
  50. <view class="section score-explain-card" :class="scoreExplainClass" v-if="isLoggedIn && currentView === 'self' && actionScore != null">
  51. <view class="explain-header">
  52. <view class="explain-icon-wrap" :class="'explain-icon-' + scoreExplainLevel">
  53. <text class="explain-icon">{{ actionScore >= 80 ? '\u2713' : actionScore >= 60 ? '\u26A0' : '\u2715' }}</text>
  54. </view>
  55. <view class="explain-info">
  56. <text class="explain-title">关系解读</text>
  57. <text class="explain-score">{{ actionScore }}<text class="explain-score-unit">分</text></text>
  58. </view>
  59. </view>
  60. <text class="explain-text">{{ actionScore >= 80 ? '家庭关系和谐,家人沟通顺畅。' : actionScore >= 60 ? '家庭关系一般,建议多花时间陪伴家人。' : '家庭关系需要改善,建议进行家庭沟通活动。' }}</text>
  61. </view>
  62. <!-- 行维度画像 - 总体说明 -->
  63. <view class="dimension-portrait-section" v-if="isLoggedIn && actionPortrait">
  64. <view class="section-header">
  65. <text class="section-title">🧭 行维度画像</text>
  66. <text class="portrait-tier">{{ actionPortrait.tierLabel }}</text>
  67. </view>
  68. <view class="portrait-summary">
  69. <text class="portrait-desc">{{ actionPortrait.summary }}</text>
  70. </view>
  71. <view class="portrait-dimensions">
  72. <view class="portrait-dim-item" v-for="dim in actionPortrait.dims" :key="dim.code">
  73. <view class="portrait-dim-header">
  74. <view class="portrait-dim-icon" :style="{ background: dim.color }">{{ dim.icon }}</view>
  75. <text class="portrait-dim-name">{{ dim.name }}</text>
  76. <text class="portrait-dim-score">{{ dim.score }}</text>
  77. </view>
  78. <view class="portrait-dim-bar-track">
  79. <view class="portrait-dim-bar-fill" :style="{ width: dim.score + '%', background: dim.color }"></view>
  80. </view>
  81. <text class="portrait-dim-desc">{{ dim.desc }}</text>
  82. </view>
  83. </view>
  84. <view class="portrait-tip" v-if="actionPortrait.tip">
  85. <text class="portrait-tip-text">💡 {{ actionPortrait.tip }}</text>
  86. </view>
  87. </view>
  88. <!-- 关系六维 -->
  89. <dimension-sub-dims
  90. v-if="isLoggedIn && actionSubDims.length > 0"
  91. title="🌲 关系六维"
  92. subtitle="家庭关系的六个方面"
  93. :accent-color="successColor"
  94. :dims="actionSubDims" />
  95. <!-- 登录后:家庭关系(行维度核心) -->
  96. <view class="section" v-if="isLoggedIn">
  97. <view class="section-header">
  98. <view class="section-title-wrap">
  99. <text class="help-icon" @tap="showHelp('家庭关系', '了解每位家人的关系质量,改善沟通方式。点击家人节点,查看关系详情。')">?</text>
  100. <view>
  101. <text class="section-title">家庭关系</text>
  102. <text class="section-sub">了解每位家人的关系质量,改善沟通方式 · 点击家人节点查看详情</text>
  103. </view>
  104. </view>
  105. </view>
  106. <FamilyRelationGraph
  107. dimensionCode="action"
  108. :selfId="selfId"
  109. :members="graphMembers"
  110. :energyMap="energyMapForGraph"
  111. :intimacyMap="intimacyMapForGraph"
  112. :interactive="true" />
  113. </view>
  114. <!-- 登录后:章鱼图(关键人拓展) -->
  115. <view class="section" v-if="isLoggedIn">
  116. <view class="section-header">
  117. <view class="section-title-wrap">
  118. <text class="help-icon" @tap="showHelp('章鱼图', '从成效出发,挖掘关键人,画出拓展路径。记录感恩时刻,建立有温度的人脉网络。')">?</text>
  119. <view>
  120. <text class="section-title">🐙 章鱼图</text>
  121. <text class="section-sub">从成效出发,挖掘关键人,画出拓展路径</text>
  122. </view>
  123. </view>
  124. <text class="section-link section-link-octopus" @tap="goOctopusEffectsList" v-if="currentView === 'self'">+ 感恩记录</text>
  125. </view>
  126. <OctopusDiagram
  127. ref="octopusDiagram"
  128. :selfId="selfId"
  129. :effects="octopusDiagramData"
  130. :expansions="currentView === 'family' ? [] : octopusExpansions"
  131. :interactive="true"
  132. :family-mode="currentView === 'family'"
  133. :member-legend="familyOctopusLegend"
  134. @effect-click="onEffectClick"
  135. @expansion-click="onExpansionClick"
  136. @add-effect="goOctopusAddEffect"
  137. @reanalyze="onReanalyze" />
  138. </view>
  139. <!-- 登录后:珍珠图(我有什么) -->
  140. <view class="section" v-if="isLoggedIn">
  141. <view class="section-header">
  142. <view class="section-title-wrap">
  143. <text class="help-icon" @tap="showHelp('珍珠图', '把可调用的资源串成珍珠项链——盘点我有什么。登记人脉、资源、信息缺口,画出一条清晰的成长珍珠链。')">?</text>
  144. <view>
  145. <text class="section-title">🫧 珍珠图</text>
  146. <text class="section-sub">把可调用的资源串成珍珠项链——盘点我有什么</text>
  147. </view>
  148. </view>
  149. <text class="section-link section-link-pearl" @tap="goPearlAddResource" v-if="currentView === 'self'">+ 登记</text>
  150. </view>
  151. <PearlDiagram
  152. ref="pearlDiagram"
  153. :selfId="selfId"
  154. :resources="pearlDiagramData"
  155. :overdue-map="currentView === 'family' ? null : overdueMap"
  156. :interactive="true"
  157. :family-mode="currentView === 'family'"
  158. :member-legend="familyPearlLegend"
  159. @add="goPearlAddResource"
  160. @delete="onDeletePearlResource" />
  161. </view>
  162. <!-- 登录后:能力图(谁会什么) -->
  163. <view class="section" v-if="isLoggedIn">
  164. <view class="section-header">
  165. <view class="section-title-wrap">
  166. <text class="help-icon" @tap="showHelp('能力图', '身边藏着什么技能——谁有能力帮到你。记录技能类帮助后,这里会画出大家的能力图谱。')">?</text>
  167. <view>
  168. <text class="section-title">💡 能力图</text>
  169. <text class="section-sub">身边藏着什么技能——谁有能力帮到你</text>
  170. </view>
  171. </view>
  172. <text class="section-link section-link-ability" @tap="goInteractionLog">+ 记录帮助</text>
  173. </view>
  174. <AbilityDiagram
  175. ref="abilityDiagram"
  176. :selfId="selfId"
  177. :abilities="abilityData"
  178. :interactive="true" />
  179. </view>
  180. <!-- 行6维关系域雷达图(登录后) -->
  181. <view class="section" v-if="isLoggedIn && currentMemberEnergies">
  182. <view class="section-header">
  183. <text class="section-title">🫂 关系质量</text>
  184. </view>
  185. <RadarChart
  186. :dimensions="actionDimensions"
  187. :scores="actionScores"
  188. :avg-scores="actionFamilyScores"
  189. :population-scores="actionPopulationScores"
  190. :fillColor="successColor"
  191. :gridColor="gridColor"
  192. :labelColor="labelColor"
  193. :width="580"
  194. :height="580" />
  195. </view>
  196. <!-- 功能入口 -->
  197. <view class="func-section" v-if="sectionVisible('func_entries')">
  198. <view class="func-grid">
  199. <view class="func-item" v-for="item in funcList" :key="item.label" @click="onFuncClick(item)">
  200. <view class="func-icon-wrap">
  201. <text class="func-icon">{{ item.icon }}</text>
  202. </view>
  203. <text class="func-label">{{ item.label }}</text>
  204. </view>
  205. </view>
  206. </view>
  207. <!-- 登录后:今日任务 -->
  208. <DimensionTasks
  209. v-if="isLoggedIn"
  210. :memberId="activeChildId"
  211. @taskClick="onTaskClick"
  212. @moreTasks="goTasks" />
  213. <!-- 登录后:活动 -->
  214. <DimensionActivities
  215. v-if="isLoggedIn"
  216. :isLoggedIn="true"
  217. @activityClick="goActivityDetail"
  218. @moreActivities="goMoreActivities" />
  219. <!-- 登录后:商品 -->
  220. <DimensionProducts
  221. v-if="isLoggedIn"
  222. :isLoggedIn="true"
  223. dimension-code="action"
  224. @productClick="goProductDetail"
  225. @moreProducts="goMoreProducts" />
  226. <!-- 行维度介绍卡片(登录后显示) -->
  227. <DimensionIntroCard dimCode="action" v-if="isLoggedIn" learn-more-url="/pages/action-detail/dimension-intro" />
  228. <!-- 底部占位 -->
  229. <view class="bottom-spacer"></view>
  230. <!-- 帮助说明弹窗 -->
  231. <view class="help-mask" v-if="helpPopup.visible" @tap="closeHelp">
  232. <view class="help-dialog" @tap.stop>
  233. <view class="help-dialog-header">
  234. <text class="help-dialog-title">{{ helpPopup.title }}</text>
  235. <text class="help-dialog-close" @tap="closeHelp">✕</text>
  236. </view>
  237. <text class="help-dialog-content">{{ helpPopup.content }}</text>
  238. </view>
  239. </view>
  240. </view>
  241. </template>
  242. <script>
  243. import { BrandColors } from '../../utils/brand-colors.js'
  244. import TabTransition from '../../components/tab-transition.vue'
  245. import PageBanner from '../../components/PageBanner.vue'
  246. import FamilyEnergyBar from '../../components/FamilyEnergyBar.vue'
  247. import FamilyRelationGraph from '../../components/FamilyRelationGraph.vue'
  248. import PearlDiagram from '@/pages/action-detail/components/PearlDiagram.vue'
  249. import AbilityDiagram from '@/pages/action-detail/components/AbilityDiagram.vue'
  250. import OctopusDiagram from '@/pages/action-detail/components/OctopusDiagram.vue'
  251. import MemberSelector from '@/components/MemberSelector.vue'
  252. import DimensionTasks from '../../components/DimensionTasks.vue'
  253. import DimensionActivities from '../../components/DimensionActivities.vue'
  254. import DimensionProducts from '../../components/DimensionProducts.vue'
  255. import DimensionIntroCard from '../../components/DimensionIntroCard.vue'
  256. import DimensionVisitorCard from '../../components/DimensionVisitorCard.vue'
  257. import RadarChart from '../../components/RadarChart.vue'
  258. import DimensionSubDims from './components/DimensionSubDims.vue'
  259. import DimensionPageSkeleton from '../../components/DimensionPageSkeleton.vue'
  260. import { getVisibleSections, getEnergyOverview, getChildren, getFamilyEnergySandbox, getEnergySandbox, getFamilyMemberList, getOctopusTentacles, getPearlResources, deletePearlResource, getAbilityMap, getRadarData, getPearlReminders, getOctopusEffects, getOctopusAnalysisSummary, getOctopusExpansionSuggest, getOctopusEffectKeyPersons, getFamilyPearlResources, getFamilyOctopusEffects } from '../../utils/api.js'
  261. import fontScaleMixin from '@/mixins/font-scale.js'
  262. export default {
  263. mixins: [fontScaleMixin],
  264. components: { TabTransition, PageBanner, FamilyEnergyBar, FamilyRelationGraph, PearlDiagram, AbilityDiagram, OctopusDiagram, MemberSelector, DimensionTasks, DimensionActivities, DimensionProducts, DimensionIntroCard, DimensionVisitorCard, RadarChart, DimensionSubDims, DimensionPageSkeleton },
  265. data() {
  266. return {
  267. gridColor: BrandColors.emerald100,
  268. labelColor: BrandColors.emerald800,
  269. successColor: BrandColors.success,
  270. pageLoading: false,
  271. isLoggedIn: false,
  272. role: null,
  273. showTabTransition: true,
  274. activeChildId: null,
  275. selectedMemberId: null,
  276. activeChildName: '',
  277. userName: '',
  278. children: [],
  279. familyMembersVisible: [],
  280. childrenChecked: false,
  281. membersChecked: false,
  282. actionSubDims: [],
  283. sandboxData: null,
  284. actionPopulationScoreMap: {},
  285. currentView: 'self', // 'self' | 'family'
  286. dualDimension: null,
  287. selfId: null,
  288. visibleSections: [],
  289. pearlData: null,
  290. abilityData: null,
  291. octopusEffects: null,
  292. octopusExpansions: [],
  293. octopusKeyPersons: {},
  294. overdueMap: null,
  295. // 家庭汇集数据
  296. familyPearlData: null,
  297. familyOctopusEffects: null,
  298. familyLoading: false,
  299. // 帮助弹窗
  300. helpPopup: { visible: false, title: '', content: '' },
  301. funcList: [
  302. { icon: '\u{1F4AC}', label: '记录互动', needLogin: true, page: '/pages/action-detail/interaction-log' },
  303. { icon: '\u{1F4DD}', label: '关系问卷', needLogin: true, page: '/pages/action-detail/relationship-questionnaire' },
  304. { icon: '\u{1F465}', label: '家庭成员', needLogin: true, page: '/pages/profile-extra/family-members' },
  305. { icon: '\u{1F4CB}', label: '任务中心', needLogin: true, page: '/pages/tasks/tasks' }
  306. ]
  307. }
  308. },
  309. computed: {
  310. /** 关系图谱:成员节点(来自沙盘数据) */
  311. graphMembers: function() {
  312. if (!this.sandboxData || !this.sandboxData.members) return []
  313. return this.sandboxData.members.map(function(m) {
  314. return {
  315. id: m.memberId || m.id,
  316. nickname: m.name || m.nickname || '成员',
  317. memberType: m.memberType || 'child'
  318. }
  319. })
  320. },
  321. /** 关系图谱:节点能量映射 */
  322. energyMapForGraph: function() {
  323. var map = {}
  324. if (this.sandboxData && this.sandboxData.members) {
  325. for (var i = 0; i < this.sandboxData.members.length; i++) {
  326. var m = this.sandboxData.members[i]
  327. map[m.memberId || m.id] = {
  328. bodyScore: m.bodyScore || 0,
  329. mindScore: m.mindScore || 0,
  330. actionScore: m.actionScore || 0
  331. }
  332. }
  333. }
  334. return map
  335. },
  336. intimacyMapForGraph: function() {
  337. return {}
  338. },
  339. /** 每月引导语 */
  340. monthlyGuidance: function() {
  341. var month = new Date().getMonth()
  342. var messages = [
  343. '一月:新年伊始,增进家庭沟通',
  344. '二月:春节团聚,珍惜亲子时光',
  345. '三月:春暖花开,多陪伴成员',
  346. '四月:清明踏青,共享家庭活动',
  347. '五月:劳动教育,培养家庭责任感',
  348. '六月:儿童节,倾听成员心声',
  349. '七月:暑期陪伴,增进亲子关系',
  350. '八月:开学准备,共同规划',
  351. '九月:新学期,建立家庭规则',
  352. '十月:国庆假期,家庭协作时光',
  353. '十一月:感恩季节,表达家庭关爱',
  354. '十二月:年终总结,回顾家庭成长'
  355. ]
  356. return messages[month] || messages[0]
  357. },
  358. /** 当前选中成员的能量数据(从 sandboxData.members 中查找) */
  359. currentMemberEnergies: function() {
  360. if (!this.sandboxData || !this.sandboxData.members) return null
  361. var members = this.sandboxData.members
  362. var targetId = this.selectedMemberId || this.activeChildId
  363. for (var i = 0; i < members.length; i++) {
  364. var m = members[i]
  365. if (m && (m.memberId === targetId)) return m
  366. }
  367. return members[0] || null
  368. },
  369. /** 行6维关系域维度定义(根据角色切换本人版/成员版) */
  370. actionDimensions: function() {
  371. var role = this.role || uni.getStorageSync('currentRole') || ''
  372. var isParent = (role === 'parent')
  373. if (isParent) {
  374. return [
  375. { key: 'actionParentChild', label: '亲子关系' },
  376. { key: 'actionMarital', label: '夫妻关系' },
  377. { key: 'actionParental', label: '父母关系' },
  378. { key: 'actionLeadership', label: '领导关系' },
  379. { key: 'actionSociality', label: '社会性' },
  380. { key: 'actionInterpersonal', label: '人际韧性' }
  381. ]
  382. } else {
  383. return [
  384. { key: 'actionChildParentChild', label: '亲子关系' },
  385. { key: 'actionSibling', label: '同胞关系' },
  386. { key: 'actionRelative', label: '亲属关系' },
  387. { key: 'actionTeacherStudent', label: '师生关系' },
  388. { key: 'actionChildSociality', label: '社会性' },
  389. { key: 'actionChildInterpersonal', label: '人际韧性' }
  390. ]
  391. }
  392. },
  393. /** 当前选中成员的行维度分数 */
  394. actionScore: function() {
  395. var member = this.currentMemberEnergies
  396. return member ? (member.actionScore || 0) : null
  397. },
  398. /** 行6维分值(从当前成员中提取,与 dimensions 顺序对应) */
  399. actionScores: function() {
  400. var member = this.currentMemberEnergies
  401. if (!member) return []
  402. var dims = this.actionDimensions
  403. var scores = []
  404. for (var i = 0; i < dims.length; i++) {
  405. scores.push(member[dims[i].key] || 0)
  406. }
  407. return scores
  408. },
  409. /** 行6维家庭平均分(从 sandboxData.members 各成员同维度均值) */
  410. actionFamilyScores: function() {
  411. if (!this.sandboxData || !this.sandboxData.members) return []
  412. var members = this.sandboxData.members
  413. var dims = this.actionDimensions
  414. var scores = []
  415. for (var i = 0; i < dims.length; i++) {
  416. var key = dims[i].key
  417. var sum = 0, count = 0
  418. for (var j = 0; j < members.length; j++) {
  419. var val = members[j][key]
  420. if (val !== undefined && val !== null && val > 0) { sum += val; count++ }
  421. }
  422. scores.push(count > 0 ? Math.round(sum / count) : 0)
  423. }
  424. return scores
  425. },
  426. /** 行6维人群位置分数(按 actionDimensions 顺序从 map 取值) */
  427. actionPopulationScores: function() {
  428. var dims = this.actionDimensions
  429. var scores = []
  430. for (var i = 0; i < dims.length; i++) {
  431. scores.push(this.actionPopulationScoreMap[dims[i].key] || 0)
  432. }
  433. return scores
  434. },
  435. /** 关系解读状态:good(≥80) | warn(≥60) | bad(<60) */
  436. scoreExplainLevel: function() {
  437. var s = this.actionScore
  438. if (s == null) return 'bad'
  439. if (s >= 80) return 'good'
  440. if (s >= 60) return 'warn'
  441. return 'bad'
  442. },
  443. /** 关系解读卡片状态类(用于 :class 绑定) */
  444. scoreExplainClass: function() {
  445. return 'score-explain-' + this.scoreExplainLevel
  446. },
  447. actionPortrait: function() {
  448. var self = this
  449. if (!this.isLoggedIn) return null
  450. var member = this.currentMemberEnergies
  451. if (!member) return null
  452. var role = this.role || uni.getStorageSync('currentRole') || ''
  453. var isParent = (role === 'parent')
  454. var parentDims = [
  455. { key: 'actionParentChild', label: '亲子关系', color: BrandColors.success, desc: '与子女的沟通与陪伴质量' },
  456. { key: 'actionMarital', label: '夫妻关系', color: BrandColors.mind, desc: '夫妻间的理解与支持' },
  457. { key: 'actionParental', label: '父母关系', color: BrandColors.wealth, desc: '与长辈的相处模式' },
  458. { key: 'actionLeadership', label: '领导关系', color: BrandColors.wisdom, desc: '职场上下级沟通能力' },
  459. { key: 'actionSociality', label: '社会性', color: BrandColors.body, desc: '社会交往与参与度' },
  460. { key: 'actionInterpersonal', label: '人际韧性', color: BrandColors.cyan500, desc: '应对人际关系挫折的能力' }
  461. ]
  462. var childDims = [
  463. { key: 'actionChildParentChild', label: '亲子关系', color: BrandColors.success, desc: '与父母的互动质量' },
  464. { key: 'actionSibling', label: '同胞关系', color: BrandColors.mind, desc: '兄弟姐妹间的关系' },
  465. { key: 'actionRelative', label: '亲属关系', color: BrandColors.wealth, desc: '与亲戚的交往频率' },
  466. { key: 'actionTeacherStudent', label: '师生关系', color: BrandColors.wisdom, desc: '与老师的沟通情况' },
  467. { key: 'actionChildSociality', label: '社会性', color: BrandColors.body, desc: '学校与社会参与度' },
  468. { key: 'actionChildInterpersonal', label: '人际韧性', color: BrandColors.cyan500, desc: '应对社交困难的能力' }
  469. ]
  470. var dims = isParent ? parentDims : childDims
  471. var result = { overall: 0, tierLabel: '', summary: '', dims: [], tip: '' }
  472. var total = 0
  473. var count = 0
  474. var dimList = []
  475. for (var i = 0; i < dims.length; i++) {
  476. var key = dims[i].key
  477. var score = member[key] || 0
  478. if (isNaN(score)) score = 0
  479. score = Math.max(0, Math.min(100, Number(score)))
  480. total += score
  481. count++
  482. dimList.push({
  483. code: key,
  484. name: dims[i].label,
  485. score: Math.round(score),
  486. color: dims[i].color,
  487. desc: dims[i].desc
  488. })
  489. }
  490. if (count === 0) return null
  491. result.overall = Math.round(total / count)
  492. result.dims = dimList
  493. var o = result.overall
  494. if (o >= 80) {
  495. result.tierLabel = '关系大师'
  496. result.summary = '您的家庭关系和谐稳定,与家人建立了深厚的信任纽带。'
  497. result.tip = '继续保持沟通习惯,也可分享经验帮助其他家庭'
  498. } else if (o >= 60) {
  499. result.tierLabel = '关系进取者'
  500. result.summary = '您的家庭关系处于良好水平,具备基本的沟通能力。'
  501. result.tip = '多倾听家人心声,主动表达关爱,持续提升关系质量'
  502. } else if (o >= 40) {
  503. result.tierLabel = '关系探索者'
  504. result.summary = '您的家庭关系正在建立基础,需要更多沟通与理解。'
  505. result.tip = '建议定期进行家庭活动,增进彼此了解与信任'
  506. } else {
  507. result.tierLabel = '关系关怀者'
  508. result.summary = '您可能面临家庭关系挑战,需要更多关注与努力。'
  509. result.tip = '建议寻求专业家庭辅导,或从简单的家庭对话开始改善'
  510. }
  511. return result
  512. },
  513. /** 当前是否处于「全家」汇集视图 */
  514. isFamilyView: function() {
  515. return this.currentView === 'family'
  516. },
  517. /** 珍珠图数据源:family 视图取家庭汇集(members 合并展开),否则取个人数据 */
  518. pearlDiagramData: function() {
  519. if (this.currentView === 'family') {
  520. return this.familyPearlDiagram
  521. }
  522. return this.pearlData
  523. },
  524. /** 章鱼图数据源:family 视图取家庭汇集(members 合并展开),否则取个人数据 */
  525. octopusDiagramData: function() {
  526. if (this.currentView === 'family') {
  527. return this.familyOctopusDiagram
  528. }
  529. return this.octopusEffects
  530. },
  531. /** 家庭珍珠图:将 members[].items 合并展开为 PearlDiagram 可消费结构,每项带成员标注 */
  532. familyPearlDiagram: function() {
  533. if (!this.familyPearlData) return null
  534. var members = this.familyPearlData.members
  535. if (!members || !Array.isArray(members)) return null
  536. var groupMap = {}
  537. var groupOrder = []
  538. for (var i = 0; i < members.length; i++) {
  539. var m = members[i]
  540. if (!m || !Array.isArray(m.items)) continue
  541. for (var j = 0; j < m.items.length; j++) {
  542. var item = m.items[j]
  543. if (!item) continue
  544. // 归属组:优先按连接类型/资源类型字段归组,缺失则归入 INFO(历史资源)
  545. var type = item.connectionType || item.type || item.groupType || 'INFO'
  546. var stamped = Object.assign({}, item, {
  547. memberId: m.memberId,
  548. memberName: m.memberName || '',
  549. memberType: m.memberType || '',
  550. colorKey: m.colorKey || ''
  551. })
  552. if (!groupMap[type]) {
  553. groupMap[type] = { type: type, typeName: item.groupTypeName || item.typeName || type, items: [] }
  554. groupOrder.push(type)
  555. }
  556. groupMap[type].items.push(stamped)
  557. }
  558. }
  559. var groups = []
  560. for (var k = 0; k < groupOrder.length; k++) {
  561. groups.push(groupMap[groupOrder[k]])
  562. }
  563. return { groups: groups, legacyGroups: [] }
  564. },
  565. /** 家庭章鱼图:将 members[].effects 合并展开为 OctopusDiagram 可消费结构,每项带成员标注 */
  566. familyOctopusDiagram: function() {
  567. if (!this.familyOctopusEffects) return null
  568. var members = this.familyOctopusEffects.members
  569. if (!members || !Array.isArray(members)) return null
  570. var list = []
  571. for (var i = 0; i < members.length; i++) {
  572. var m = members[i]
  573. if (!m || !Array.isArray(m.effects)) continue
  574. for (var j = 0; j < m.effects.length; j++) {
  575. var effect = m.effects[j]
  576. if (!effect) continue
  577. list.push(Object.assign({}, effect, {
  578. memberId: m.memberId,
  579. memberName: m.memberName || '',
  580. memberType: m.memberType || '',
  581. colorKey: m.colorKey || ''
  582. }))
  583. }
  584. }
  585. return { list: list }
  586. },
  587. /** 珍珠图成员图例(家庭视图) */
  588. familyPearlLegend: function() {
  589. if (!this.familyPearlData || !this.familyPearlData.members) return []
  590. return this.familyPearlData.members.map(function(m) {
  591. return { memberId: m.memberId, name: m.memberName || '成员', colorKey: m.colorKey || '', memberType: m.memberType || '' }
  592. })
  593. },
  594. /** 章鱼图成员图例(家庭视图) */
  595. familyOctopusLegend: function() {
  596. if (!this.familyOctopusEffects || !this.familyOctopusEffects.members) return []
  597. return this.familyOctopusEffects.members.map(function(m) {
  598. return { memberId: m.memberId, name: m.memberName || '成员', colorKey: m.colorKey || '', memberType: m.memberType || '' }
  599. })
  600. }
  601. },
  602. created() {
  603. // 首屏加载骨架:已登录用户的数据请求期间占位,稳态视觉零变化
  604. // 未登录走静态内容,不进 loading,故此处不读 isLoggedIn
  605. var token = uni.getStorageSync('token')
  606. if (token) {
  607. this.pageLoading = true
  608. var self = this
  609. setTimeout(function() { self.pageLoading = false }, 600)
  610. }
  611. },
  612. onShow() {
  613. this.showTabTransition = true
  614. var token = uni.getStorageSync('token')
  615. this.isLoggedIn = !!token
  616. if (this.isLoggedIn) {
  617. this.role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
  618. this.userName = uni.getStorageSync('nickname') || uni.getStorageSync('userName') || '本人'
  619. this.selfId = uni.getStorageSync('userId') || null
  620. }
  621. this.loadSectionConfig()
  622. if (this.isLoggedIn) {
  623. this.loadChildren()
  624. this.loadFamilyMembersVisible()
  625. this.loadPearlResources()
  626. this.loadAbilityMap()
  627. this.loadOctopusData()
  628. this.loadActionRadarPopulationData()
  629. }
  630. this._watchPageReady()
  631. },
  632. methods: {
  633. loadSectionConfig: function() {
  634. var baseSections = ['func_entries']
  635. if (!uni.getStorageSync('token')) {
  636. this.visibleSections = baseSections
  637. return
  638. }
  639. var role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
  640. var self = this
  641. getVisibleSections({ pageKey: 'action', role: role }).then(function(res) {
  642. if (res.code === 200 && res.data) {
  643. var keys = res.data.map(function(s) { return s.sectionKey })
  644. var merged = baseSections.slice()
  645. keys.forEach(function(k) { if (merged.indexOf(k) === -1) merged.push(k) })
  646. self.visibleSections = merged
  647. }
  648. }).catch(function(e) {
  649. self.visibleSections = ['func_entries']
  650. })
  651. },
  652. loadChildren: function() {
  653. var self = this
  654. getChildren().then(function(res) {
  655. if (res.code === 200 && res.data) {
  656. self.children = res.data
  657. var savedChildId = uni.getStorageSync('currentChildId')
  658. var found = false
  659. for (var i = 0; i < self.children.length; i++) {
  660. if (self.children[i].memberId === savedChildId) {
  661. self.activeChildId = savedChildId
  662. self.activeChildName = self.children[i].name || self.children[i].nickname || '成员'
  663. found = true
  664. break
  665. }
  666. }
  667. if (!found && self.children.length > 0) {
  668. self.activeChildId = self.children[0].memberId
  669. self.activeChildName = self.children[0].name || self.children[0].nickname || '成员'
  670. uni.setStorageSync('currentChildId', self.activeChildId)
  671. }
  672. if (self.activeChildId) {
  673. self.loadDashboardData()
  674. }
  675. }
  676. self.childrenChecked = true
  677. }).catch(function(e) {
  678. console.log('获取成员列表失败', e)
  679. self.childrenChecked = true
  680. })
  681. },
  682. loadDashboardData: function() {
  683. if (!this.activeChildId) return
  684. this.loadEnergyData()
  685. this.loadSandboxData()
  686. },
  687. loadSandboxData: function() {
  688. var self = this
  689. getFamilyEnergySandbox().then(function(res) {
  690. if (res && res.data) {
  691. self.sandboxData = res.data
  692. }
  693. }).catch(function(e) {
  694. console.log('获取沙盘数据失败', e)
  695. })
  696. },
  697. loadActionRadarPopulationData: function() {
  698. var self = this
  699. var memberId = this.selectedMemberId || this.activeChildId
  700. if (!memberId) return
  701. getRadarData({
  702. memberId: memberId,
  703. dimensions: ['actionParentChild','actionMarital','actionParental','actionLeadership','actionSociality','actionInterpersonal',
  704. 'actionChildParentChild','actionSibling','actionRelative','actionTeacherStudent','actionChildSociality','actionChildInterpersonal']
  705. }).then(function(res) {
  706. if (res && res.data && res.data.populationScores) {
  707. var dims = res.data.dimensions || []
  708. var scores = res.data.populationScores
  709. var map = {}
  710. for (var i = 0; i < dims.length && i < scores.length; i++) {
  711. map[dims[i]] = scores[i]
  712. }
  713. self.actionPopulationScoreMap = map
  714. }
  715. }).catch(function(e) { console.warn('[action] radar-data failed', e) })
  716. },
  717. switchView: function(view) {
  718. this.currentView = view
  719. var self = this
  720. if (view === 'family') {
  721. this.selectedMemberId = null
  722. // 全家视图:同时加载家庭汇集珍珠图/章鱼图(只读合并展示)
  723. this.loadFamilyCollectData()
  724. getEnergySandbox('family').then(function(res) {
  725. if (res && res.data && !res.data.locked) {
  726. self.sandboxData = res.data.familyData || res.data
  727. }
  728. }).catch(function(e) { console.log('获取家庭数据失败', e) })
  729. } else {
  730. // 切回自己视图:恢复个人珍珠图/章鱼图数据
  731. this.loadSandboxData()
  732. this.loadPearlResources()
  733. this.loadOctopusData()
  734. }
  735. },
  736. /** 加载家庭汇集珍珠图/章鱼图数据(Promise.all 并发,任一失败不白屏) */
  737. loadFamilyCollectData: function() {
  738. var self = this
  739. this.familyLoading = true
  740. Promise.all([getFamilyPearlResources(), getFamilyOctopusEffects()]).then(function(resArr) {
  741. var pearlRes = resArr[0]
  742. var octopusRes = resArr[1]
  743. self.familyPearlData = (pearlRes && pearlRes.code === 200 && pearlRes.data) ? pearlRes.data : null
  744. self.familyOctopusEffects = (octopusRes && octopusRes.code === 200 && octopusRes.data) ? octopusRes.data : null
  745. self.familyLoading = false
  746. }).catch(function(e) {
  747. console.log('获取家庭汇集数据失败', e)
  748. self.familyPearlData = null
  749. self.familyOctopusEffects = null
  750. self.familyLoading = false
  751. })
  752. },
  753. loadEnergyData: function() {
  754. var self = this
  755. getEnergyOverview(this.activeChildId).then(function(res) {
  756. if (res && res.data) {
  757. var dims = res.data.dimensions
  758. if (dims && dims.length > 0) {
  759. for (var i = 0; i < dims.length; i++) {
  760. if (dims[i].code === 'action') {
  761. self.dualDimension = dims[i]
  762. break
  763. }
  764. }
  765. }
  766. }
  767. }).catch(function(e) {
  768. console.log('获取能量概览失败', e)
  769. })
  770. },
  771. onFamilyMemberSelect: function(member) {
  772. this.selectedMemberId = member.id
  773. },
  774. loadFamilyMembersVisible: function() {
  775. var self = this
  776. getFamilyMemberList({ visibleOnly: true }).then(function(res) {
  777. self.familyMembersVisible = res.data || []
  778. self.membersChecked = true
  779. }).catch(function(e) {
  780. console.log('获取可见家庭成员失败', e)
  781. self.familyMembersVisible = []
  782. self.membersChecked = true
  783. })
  784. },
  785. sectionVisible: function(key) {
  786. return this.visibleSections.length === 0 || this.visibleSections.indexOf(key) !== -1
  787. },
  788. // 登录浮层成功回调:刷新行动维度数据
  789. onLoginSuccess: function() {
  790. this.loadDashboardData()
  791. },
  792. onFuncClick: function(item) {
  793. if (item.needLogin && !this.isLoggedIn) {
  794. uni.showModal({
  795. title: '提示',
  796. content: '请先登录后使用此功能',
  797. success: (res) => {
  798. if (res.confirm) this.openLoginSheet()
  799. }
  800. })
  801. return
  802. }
  803. if (item.page) uni.navigateTo({ url: item.page })
  804. },
  805. /** 加载珍珠图数据 */
  806. loadPearlResources: function() {
  807. var self = this
  808. getPearlResources().then(function(res) {
  809. self.pearlData = (res.code === 200 && res.data) ? res.data : null
  810. }).catch(function(e) {
  811. console.log('获取珍珠图数据失败', e)
  812. self.pearlData = null
  813. })
  814. // 构建逾期映射
  815. getPearlReminders().then(function(res) {
  816. var map = {}
  817. if (res.code === 200 && res.data) {
  818. for (var i = 0; i < res.data.length; i++) {
  819. map['' + res.data[i].resourceItemId] = res.data[i].daysSinceLast
  820. }
  821. }
  822. self.overdueMap = map
  823. }).catch(function(e) {
  824. self.overdueMap = null
  825. })
  826. },
  827. /** 登记珍珠图资源入口 */
  828. goPearlAddResource: function() {
  829. uni.navigateTo({ url: '/pages/action-detail/pearl-add-resource' })
  830. },
  831. /** 能力图记录帮助入口(跳转互动记录,记录技能类帮助) */
  832. goInteractionLog: function() {
  833. uni.navigateTo({ url: '/pages/action-detail/interaction-log' })
  834. },
  835. /** 删除珍珠图资源 */
  836. onDeletePearlResource: function(item) {
  837. if (!item || !item.id) return
  838. var self = this
  839. uni.showModal({
  840. title: '提示',
  841. content: '确定删除该资源吗?',
  842. success: function(res) {
  843. if (!res.confirm) return
  844. deletePearlResource({ itemId: item.id }).then(function(r) {
  845. if (r.code === 200) {
  846. uni.showToast({ title: '已删除', icon: 'success' })
  847. self.loadPearlResources()
  848. } else {
  849. uni.showToast({ title: r.message || '删除失败', icon: 'none' })
  850. }
  851. }).catch(function(e) {
  852. console.log('删除珍珠图资源失败', e)
  853. uni.showToast({ title: '删除失败', icon: 'none' })
  854. })
  855. }
  856. })
  857. },
  858. /** 加载能力图数据 */
  859. loadAbilityMap: function() {
  860. var self = this
  861. getAbilityMap().then(function(res) {
  862. self.abilityData = (res.code === 200 && Array.isArray(res.data)) ? res.data : []
  863. }).catch(function(e) {
  864. console.log('获取能力图数据失败', e)
  865. self.abilityData = []
  866. })
  867. },
  868. /** 加载章鱼图数据 */
  869. loadOctopusData: function() {
  870. var self = this
  871. getOctopusEffects().then(function(res) {
  872. self.octopusEffects = (res.code === 200 && res.data) ? res.data : null
  873. }).catch(function(e) {
  874. console.log('获取章鱼图数据失败', e)
  875. self.octopusEffects = null
  876. })
  877. getOctopusAnalysisSummary().then(function(res) {
  878. if (res.code === 200 && res.data && res.data.directions) {
  879. self.octopusExpansions = res.data.directions
  880. }
  881. }).catch(function(e) {
  882. console.log('获取拓展方向失败', e)
  883. })
  884. },
  885. /** 跳转成效录入页 */
  886. goOctopusAddEffect: function() {
  887. uni.navigateTo({ url: '/pages/action-detail/octopus-add-effect' })
  888. },
  889. /** 跳转感恩记录维护列表 */
  890. goOctopusEffectsList: function() {
  891. uni.navigateTo({ url: '/pages/action-detail/octopus-effects-list' })
  892. },
  893. /** 点击成效节点 */
  894. onEffectClick: function(effect) {
  895. var self = this
  896. if (!self.octopusKeyPersons[effect.id]) {
  897. getOctopusEffectKeyPersons({ effectId: effect.id }).then(function(res) {
  898. if (res.code === 200) self.$set(self.octopusKeyPersons, effect.id, res.data || [])
  899. }).catch(function(e) { console.log('获取关键人失败', e) })
  900. }
  901. },
  902. /** 点击拓展方向节点 */
  903. onExpansionClick: function(expansion) {
  904. var prefill = encodeURIComponent(JSON.stringify(expansion.prefill || {}))
  905. uni.navigateTo({ url: '/pages/action-detail/octopus-add-key-person?prefill=' + prefill })
  906. },
  907. /** 重新分析 */
  908. onReanalyze: function() {
  909. this.loadOctopusData()
  910. },
  911. /** 显示帮助弹窗 */
  912. showHelp: function(title, content) {
  913. this.helpPopup = { visible: true, title: title, content: content }
  914. },
  915. closeHelp: function() {
  916. this.helpPopup.visible = false
  917. },
  918. onTaskClick: function(task) {
  919. uni.navigateTo({ url: '/pages/tasks/tasks' })
  920. },
  921. goActivityDetail: function(act) {
  922. if (act && act.id) uni.navigateTo({ url: '/pages/activity/activity-detail/activity-detail?id=' + act.id })
  923. },
  924. goMoreActivities: function() {
  925. uni.navigateTo({ url: '/pages/activity/index' })
  926. },
  927. goProductDetail: function(prod) {
  928. if (prod && prod.id) uni.navigateTo({ url: '/pages/discover-detail/product-detail/product-detail?id=' + prod.id })
  929. },
  930. goMoreProducts: function() {
  931. uni.navigateTo({ url: '/pages/shop/index/index' })
  932. },
  933. goTasks: function() {
  934. uni.navigateTo({ url: '/pages/tasks/tasks' })
  935. },
  936. _watchPageReady() {
  937. var self = this
  938. var unwatch = this.$watch(function() {
  939. if (self.isLoggedIn) {
  940. return !!(self.dualDimension || self.sandboxData)
  941. }
  942. return true
  943. }, function(val) {
  944. if (val) {
  945. if (unwatch) unwatch()
  946. if (self.$refs.tabTransition) self.$refs.tabTransition.markReady()
  947. }
  948. })
  949. }
  950. }
  951. }
  952. </script>
  953. <style scoped lang="scss">
  954. // 薄荷极浅底(单页专有;vs $status-success-tint $status-success-tint 全局浅档)
  955. $c-tint-mint-wash: #E6FFF2;
  956. // 页面级局部调色板:仅本页专有色阶,跨页共性一律走 uni.scss 全局令牌
  957. // 信息蓝
  958. $c-info: $uni-info;
  959. $c-action-light: $status-success-light-3;
  960. $c-action-lighter: $status-success-light-2;
  961. // 信息蓝·亮阶
  962. $c-info-light: $status-info-light;
  963. // 危险·亮阶(渐变尾)
  964. $c-danger-light: $status-danger-light;
  965. // 次级文字
  966. $c-text-soft: $uni-text-color-secondary;
  967. // 深次级文字
  968. $c-text-deep: $facade-text-slate-deep;
  969. // 下沉底 / 分隔
  970. $c-surface-sunken: $facade-fill-slate;
  971. // 成功·亮阶(渐变尾)
  972. $c-success-light: $status-success-light;
  973. // 薄荷极浅底
  974. $c-tint-mint: $c-tint-mint-wash;
  975. .container {
  976. min-height: 100vh;
  977. background: linear-gradient(180deg, $dim-action-tint 0%, $app-bg 40%);
  978. padding-bottom: 120rpx;
  979. }
  980. /* 品牌定位语 */
  981. .brand-strap {
  982. margin: 24rpx $uni-space-lg 0;
  983. padding: 28rpx 32rpx;
  984. background: linear-gradient(135deg, $dim-action 0%, $c-action-light 50%, $c-action-lighter 100%);
  985. border-radius: 24rpx;
  986. box-shadow: 0 8rpx 24rpx rgba(16, 185, 129, 0.25);
  987. position: relative;
  988. overflow: hidden;
  989. }
  990. .brand-strap::before {
  991. content: '';
  992. position: absolute;
  993. top: -30rpx;
  994. right: -30rpx;
  995. width: 120rpx;
  996. height: 120rpx;
  997. background: rgba(255, 255, 255, 0.15);
  998. border-radius: 50%;
  999. }
  1000. .brand-strap::after {
  1001. content: '';
  1002. position: absolute;
  1003. bottom: -20rpx;
  1004. left: 20rpx;
  1005. width: 60rpx;
  1006. height: 60rpx;
  1007. background: rgba(255, 255, 255, 0.1);
  1008. border-radius: 50%;
  1009. }
  1010. .brand-strap-text {
  1011. font-size: calc(30rpx * var(--font-scale, 1));
  1012. color: $app-surface;
  1013. font-weight: 600;
  1014. text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.1);
  1015. position: relative;
  1016. z-index: 1;
  1017. }
  1018. /* 每月引导语 */
  1019. .monthly-guidance {
  1020. margin: 20rpx $uni-space-lg 0;
  1021. padding: 24rpx 28rpx;
  1022. background: linear-gradient(135deg, $app-surface 0%, $dim-action-tint 100%);
  1023. border-radius: 24rpx;
  1024. border: 1rpx solid rgba(16, 185, 129, 0.15);
  1025. box-shadow: 0 4rpx 16rpx rgba(16, 185, 129, 0.08);
  1026. display: flex;
  1027. align-items: center;
  1028. gap: 12rpx;
  1029. }
  1030. .guidance-icon { font-size: calc(36rpx * var(--font-scale, 1)); }
  1031. .guidance-text {
  1032. font-size: calc(26rpx * var(--font-scale, 1));
  1033. color: $status-success-strong;
  1034. font-weight: 500;
  1035. }
  1036. /* ===== 通用区块 ===== */
  1037. .section {
  1038. margin: 24rpx $uni-space-lg 0;
  1039. position: relative;
  1040. }
  1041. .section::before {
  1042. content: '';
  1043. position: absolute;
  1044. top: 0;
  1045. left: 24rpx;
  1046. right: 24rpx;
  1047. height: 3rpx;
  1048. border-radius: 8rpx 8rpx 0 0;
  1049. background: linear-gradient(90deg, $dim-action, $c-action-light);
  1050. opacity: 0.7;
  1051. }
  1052. .section-header {
  1053. display: flex;
  1054. flex-direction: row;
  1055. align-items: center;
  1056. justify-content: space-between;
  1057. margin-bottom: 12rpx;
  1058. }
  1059. .section-title-wrap {
  1060. display: flex;
  1061. flex-direction: row;
  1062. align-items: center;
  1063. gap: 8rpx;
  1064. border-left: 8rpx solid $dim-action;
  1065. padding-left: 16rpx;
  1066. }
  1067. .help-icon {
  1068. position: relative;
  1069. width: 36rpx;
  1070. height: 36rpx;
  1071. border-radius: 50%;
  1072. border: 2rpx solid $app-border-strong;
  1073. color: $app-text-muted;
  1074. font-size: calc(22rpx * var(--font-scale, 1));
  1075. display: flex;
  1076. align-items: center;
  1077. justify-content: center;
  1078. flex-shrink: 0;
  1079. transition: opacity 0.2s $ease-standard, transform 0.2s $ease-standard;
  1080. background: $app-surface;
  1081. }
  1082. /* 触摸目标扩展至 88rpx(微信最小可点区域):帮助图标 36x36 -> 88x88,视觉零变化 */
  1083. .help-icon::after {
  1084. content: '';
  1085. position: absolute;
  1086. left: -26rpx;
  1087. right: -26rpx;
  1088. top: -26rpx;
  1089. bottom: -26rpx;
  1090. }
  1091. .help-icon:active {
  1092. border-color: $dim-action;
  1093. color: $dim-action;
  1094. background: $dim-action-tint;
  1095. transform: scale(1.1);
  1096. }
  1097. .section-title {
  1098. font-size: calc(34rpx * var(--font-scale, 1));
  1099. font-weight: 700;
  1100. color: $app-text;
  1101. letter-spacing: 0.5rpx;
  1102. }
  1103. .section-sub {
  1104. font-size: calc(24rpx * var(--font-scale, 1));
  1105. color: $app-text-subtle;
  1106. margin-top: 4rpx;
  1107. line-height: 1.4;
  1108. }
  1109. .section-link {
  1110. display: inline-flex;
  1111. align-items: center;
  1112. padding: 12rpx 28rpx;
  1113. border-radius: 24rpx;
  1114. font-size: calc(24rpx * var(--font-scale, 1));
  1115. font-weight: 500;
  1116. white-space: nowrap;
  1117. transition: opacity 0.2s $ease-standard, transform 0.2s $ease-standard;
  1118. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
  1119. }
  1120. .section-link:active {
  1121. opacity: 0.85;
  1122. transform: scale(0.98);
  1123. }
  1124. .section-link-octopus {
  1125. background: linear-gradient(135deg, $brand-primary, $brand-primary-light);
  1126. color: $app-surface;
  1127. box-shadow: 0 4rpx 16rpx rgba(249,115,22,0.3);
  1128. }
  1129. .section-link-pearl {
  1130. background: linear-gradient(135deg, $c-info, $c-info-light);
  1131. color: $app-surface;
  1132. box-shadow: 0 4rpx 16rpx rgba(14,165,233,0.3);
  1133. }
  1134. .section-link-ability {
  1135. background: linear-gradient(135deg, $dim-action, $c-action-light);
  1136. color: $app-surface;
  1137. box-shadow: 0 4rpx 16rpx rgba(16,185,129,0.3);
  1138. }
  1139. /* 关系解读卡片 — 状态色 */
  1140. .score-explain-card {
  1141. background: linear-gradient(135deg, $app-surface 0%, $dim-action-tint 100%);
  1142. border-radius: 24rpx;
  1143. padding: 28rpx 32rpx;
  1144. border: 1rpx solid rgba(16, 185, 129, 0.12);
  1145. box-shadow: 0 4rpx 16rpx rgba(16, 185, 129, 0.08);
  1146. }
  1147. .score-explain-good {
  1148. background: linear-gradient(135deg, $app-surface 0%, $status-success-soft 100%);
  1149. border-color: rgba(16, 185, 129, 0.25);
  1150. box-shadow: 0 4rpx 20rpx rgba(16, 185, 129, 0.15);
  1151. }
  1152. .score-explain-warn {
  1153. background: linear-gradient(135deg, $app-surface 0%, $status-warning-soft 100%);
  1154. border-color: rgba(245, 158, 11, 0.25);
  1155. box-shadow: 0 4rpx 20rpx rgba(245, 158, 11, 0.12);
  1156. }
  1157. .score-explain-bad {
  1158. background: linear-gradient(135deg, $app-surface 0%, $status-danger-soft 100%);
  1159. border-color: rgba(239, 68, 68, 0.25);
  1160. box-shadow: 0 4rpx 20rpx rgba(239, 68, 68, 0.12);
  1161. }
  1162. .explain-header {
  1163. display: flex;
  1164. flex-direction: row;
  1165. align-items: center;
  1166. gap: 16rpx;
  1167. margin-bottom: 12rpx;
  1168. }
  1169. .explain-icon-wrap {
  1170. width: 56rpx;
  1171. height: 56rpx;
  1172. border-radius: 50%;
  1173. display: flex;
  1174. align-items: center;
  1175. justify-content: center;
  1176. flex-shrink: 0;
  1177. transition: transform 0.2s;
  1178. }
  1179. .explain-icon-wrap:active { transform: scale(0.95); }
  1180. .explain-icon-good { background: linear-gradient(135deg, $dim-action, $c-action-light); box-shadow: 0 4rpx 12rpx rgba(16,185,129,0.3); }
  1181. .explain-icon-warn { background: linear-gradient(135deg, $dim-wealth, $status-warning); box-shadow: 0 4rpx 12rpx rgba(245,158,11,0.3); }
  1182. .explain-icon-bad { background: linear-gradient(135deg, $status-danger, $c-danger-light); box-shadow: 0 4rpx 12rpx rgba(239,68,68,0.3); }
  1183. .explain-icon {
  1184. font-size: calc(28rpx * var(--font-scale, 1));
  1185. color: $app-surface;
  1186. font-weight: 700;
  1187. }
  1188. .explain-info {
  1189. display: flex;
  1190. flex-direction: column;
  1191. }
  1192. .explain-title {
  1193. font-size: calc(28rpx * var(--font-scale, 1));
  1194. font-weight: 600;
  1195. color: $app-text;
  1196. line-height: 1.3;
  1197. }
  1198. .explain-score {
  1199. font-size: calc(48rpx * var(--font-scale, 1));
  1200. font-weight: $uni-font-weight-extra-heavy;
  1201. line-height: 1;
  1202. letter-spacing: -2rpx;
  1203. }
  1204. .score-explain-good .explain-score { color: $dim-action; }
  1205. .score-explain-warn .explain-score { color: $status-warning-deep; }
  1206. .score-explain-bad .explain-score { color: $status-danger-deep; }
  1207. .explain-score-unit {
  1208. font-size: calc(24rpx * var(--font-scale, 1));
  1209. font-weight: 500;
  1210. color: $app-text-subtle;
  1211. margin-left: 2rpx;
  1212. letter-spacing: 0;
  1213. }
  1214. .explain-text {
  1215. font-size: calc(26rpx * var(--font-scale, 1));
  1216. color: $c-text-soft;
  1217. line-height: 1.7;
  1218. }
  1219. /* 帮助说明弹窗 */
  1220. .help-mask {
  1221. position: fixed;
  1222. top: 0;
  1223. left: 0;
  1224. right: 0;
  1225. bottom: 0;
  1226. background: rgba(0, 0, 0, 0.5);
  1227. display: flex;
  1228. align-items: center;
  1229. justify-content: center;
  1230. z-index: 999;
  1231. }
  1232. .help-dialog {
  1233. background: $app-surface;
  1234. border-radius: 24rpx;
  1235. width: 85%;
  1236. max-width: 520rpx;
  1237. max-height: 75vh;
  1238. overflow: hidden;
  1239. box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.15);
  1240. }
  1241. .help-dialog-header {
  1242. display: flex;
  1243. justify-content: space-between;
  1244. align-items: center;
  1245. padding: 28rpx 32rpx 20rpx;
  1246. border-bottom: 1rpx solid $c-surface-sunken;
  1247. background: linear-gradient(135deg, $dim-action-tint, $app-surface);
  1248. }
  1249. .help-dialog-title {
  1250. font-size: calc(32rpx * var(--font-scale, 1));
  1251. font-weight: 700;
  1252. color: $app-text;
  1253. }
  1254. .help-dialog-close {
  1255. position: relative;
  1256. font-size: calc(36rpx * var(--font-scale, 1));
  1257. color: $app-text-subtle;
  1258. cursor: pointer;
  1259. width: 48rpx;
  1260. height: 48rpx;
  1261. display: flex;
  1262. align-items: center;
  1263. justify-content: center;
  1264. border-radius: 50%;
  1265. transition: background 0.2s;
  1266. }
  1267. /* 触摸目标扩展至 88rpx(微信最小可点区域):关闭按钮 48x48 -> 88x88,视觉零变化 */
  1268. .help-dialog-close::after {
  1269. content: '';
  1270. position: absolute;
  1271. left: -20rpx;
  1272. right: -20rpx;
  1273. top: -20rpx;
  1274. bottom: -20rpx;
  1275. }
  1276. .help-dialog-close:active {
  1277. background: $c-surface-sunken;
  1278. }
  1279. .help-dialog-content {
  1280. padding: 28rpx 32rpx;
  1281. font-size: calc(28rpx * var(--font-scale, 1));
  1282. color: $c-text-soft;
  1283. line-height: 1.8;
  1284. }
  1285. /* 功能入口网格 */
  1286. .func-section {
  1287. margin: 24rpx $uni-space-lg 0;
  1288. }
  1289. .func-grid {
  1290. display: flex;
  1291. flex-direction: row;
  1292. justify-content: space-around;
  1293. background: linear-gradient(135deg, $app-surface 0%, $dim-action-tint 100%);
  1294. border-radius: 24rpx;
  1295. padding: 32rpx 16rpx;
  1296. box-shadow: 0 8rpx 24rpx rgba(16, 185, 129, 0.1);
  1297. border: 1rpx solid rgba(16, 185, 129, 0.08);
  1298. }
  1299. .func-item {
  1300. display: flex;
  1301. flex-direction: column;
  1302. align-items: center;
  1303. flex: 1;
  1304. padding: 8rpx;
  1305. }
  1306. .func-icon-wrap {
  1307. width: 96rpx;
  1308. height: 96rpx;
  1309. border-radius: 24rpx;
  1310. background: linear-gradient(135deg, $status-success-soft, $c-success-light);
  1311. display: flex;
  1312. align-items: center;
  1313. justify-content: center;
  1314. margin-bottom: 12rpx;
  1315. box-shadow: 0 4rpx 12rpx rgba(16, 185, 129, 0.15);
  1316. transition: opacity 0.2s $ease-standard, transform 0.2s $ease-standard;
  1317. }
  1318. .func-item:active .func-icon-wrap {
  1319. transform: scale(0.95);
  1320. box-shadow: 0 2rpx 8rpx rgba(16, 185, 129, 0.2);
  1321. }
  1322. .func-icon {
  1323. font-size: calc(44rpx * var(--font-scale, 1));
  1324. }
  1325. .func-label {
  1326. font-size: calc(24rpx * var(--font-scale, 1));
  1327. color: $c-text-deep;
  1328. font-weight: 500;
  1329. }
  1330. .bottom-spacer {
  1331. height: 40rpx;
  1332. }
  1333. /* 维度画像样式 */
  1334. .dimension-portrait-section {
  1335. margin: 24rpx $uni-space-lg;
  1336. background: $app-surface;
  1337. border-radius: 24rpx;
  1338. padding: 32rpx 24rpx;
  1339. box-shadow: 0 4rpx 20rpx rgba(16, 185, 129, 0.12);
  1340. border: 2rpx solid rgba(16, 185, 129, 0.1);
  1341. }
  1342. .portrait-tier {
  1343. font-size: calc(26rpx * var(--font-scale, 1));
  1344. color: $dim-action;
  1345. font-weight: bold;
  1346. margin-left: 16rpx;
  1347. }
  1348. .portrait-summary {
  1349. margin-bottom: 24rpx;
  1350. }
  1351. .portrait-desc {
  1352. font-size: calc(26rpx * var(--font-scale, 1));
  1353. color: $app-text-secondary;
  1354. line-height: 1.6;
  1355. display: block;
  1356. }
  1357. .portrait-dimensions {
  1358. margin-bottom: 20rpx;
  1359. }
  1360. .portrait-dim-item {
  1361. margin-bottom: 18rpx;
  1362. }
  1363. .portrait-dim-header {
  1364. display: flex;
  1365. align-items: center;
  1366. margin-bottom: 6rpx;
  1367. }
  1368. .portrait-dim-icon {
  1369. width: 36rpx;
  1370. height: 36rpx;
  1371. border-radius: 16rpx;
  1372. display: flex;
  1373. align-items: center;
  1374. justify-content: center;
  1375. margin-right: 10rpx;
  1376. font-size: calc(20rpx * var(--font-scale, 1));
  1377. background: linear-gradient(135deg, $status-success-soft, $c-success-light);
  1378. }
  1379. .portrait-dim-name {
  1380. font-size: calc(24rpx * var(--font-scale, 1));
  1381. color: $app-text;
  1382. flex: 1;
  1383. }
  1384. .portrait-dim-score {
  1385. font-size: calc(26rpx * var(--font-scale, 1));
  1386. font-weight: bold;
  1387. color: $dim-action;
  1388. margin-right: 12rpx;
  1389. }
  1390. .portrait-dim-bar-track {
  1391. height: 10rpx;
  1392. background: $status-success-soft;
  1393. border-radius: 8rpx;
  1394. overflow: hidden;
  1395. margin-bottom: 4rpx;
  1396. flex: 1;
  1397. }
  1398. .portrait-dim-bar-fill {
  1399. height: 100%;
  1400. border-radius: 8rpx;
  1401. transition: width 0.3s ease;
  1402. }
  1403. .portrait-dim-desc {
  1404. font-size: calc(20rpx * var(--font-scale, 1));
  1405. color: $app-text-secondary;
  1406. display: block;
  1407. }
  1408. .portrait-tip {
  1409. padding: 16rpx 20rpx;
  1410. background: linear-gradient(135deg, $dim-action-tint, $c-tint-mint);
  1411. border-radius: 16rpx;
  1412. border-left: 8rpx solid $dim-action;
  1413. margin-top: 16rpx;
  1414. }
  1415. .portrait-tip-text {
  1416. font-size: calc(22rpx * var(--font-scale, 1));
  1417. color: $status-success-strong;
  1418. line-height: 1.5;
  1419. }
  1420. </style>