index.vue 51 KB

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