profile.vue 65 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777
  1. <template>
  2. <view class="container" :style="{ '--font-scale': fontScale }">
  3. <!-- 登录浮层(全局组件,页面内弹出底部登录) -->
  4. <login-sheet ref="loginSheet" @success="onSheetLoginSuccess" />
  5. <!-- 未登录 -->
  6. <view v-if="!isLoggedIn">
  7. <view class="gp-page">
  8. <!-- 登录大卡 -->
  9. <view class="gp-login">
  10. <view class="gp-logo"><view class="gp-logo-heart"></view></view>
  11. <text class="gp-login-title">登录浠艾福</text>
  12. <text class="gp-login-desc">登录后查看个人资料、管理积分与家庭。</text>
  13. <view class="gp-login-btn" @click="goLogin">
  14. <view class="gp-login-btn-ic"></view>
  15. <text class="gp-login-btn-text">登录 / 注册</text>
  16. </view>
  17. <view class="gp-ghost-btn" @click="goSkip">
  18. <text class="gp-ghost-btn-text">暂不登录,先逛逛</text>
  19. <view class="gp-ghost-chev"></view>
  20. </view>
  21. </view>
  22. <!-- 登录后开启 -->
  23. <view class="gp-block">
  24. <view class="gp-tag-row">
  25. <text class="gp-tag">登录后开启</text>
  26. </view>
  27. <view class="gp-rows">
  28. <view class="gp-row">
  29. <view class="gp-ic gp-ic-body"></view>
  30. <view class="gp-row-info">
  31. <text class="gp-row-name">个人身份档案</text>
  32. <text class="gp-row-sub">资料、角色标签与会员状态</text>
  33. </view>
  34. <view class="gp-lock"></view>
  35. </view>
  36. <view class="gp-row">
  37. <view class="gp-ic gp-ic-wisdom"></view>
  38. <view class="gp-row-info">
  39. <text class="gp-row-name">我的家庭</text>
  40. <text class="gp-row-sub">成员档案、家庭报告与关系管理</text>
  41. </view>
  42. <view class="gp-lock"></view>
  43. </view>
  44. <view class="gp-row">
  45. <view class="gp-ic gp-ic-wealth"></view>
  46. <view class="gp-row-info">
  47. <text class="gp-row-name">积分与能量</text>
  48. <text class="gp-row-sub">积分记录、能量数据与健康资产</text>
  49. </view>
  50. <view class="gp-lock"></view>
  51. </view>
  52. </view>
  53. </view>
  54. <!-- 理念卡 -->
  55. <view class="gp-philosophy">
  56. <view class="gp-philosophy-ic"></view>
  57. <view class="gp-philosophy-body">
  58. <text class="gp-philosophy-title">照顾家庭,从照顾好自己开始</text>
  59. <text class="gp-philosophy-desc">你的状态,就是家的状态。先安顿好自己,才有余力温暖家人。</text>
  60. </view>
  61. </view>
  62. <!-- 登录引导(模板内联:本页未注册 LoginGuideCard,等价结构本地实现) -->
  63. <view class="gp-guide">
  64. <view class="gp-guide-head">
  65. <view class="gp-guide-ic"></view>
  66. <text class="gp-guide-title">登录后,和家庭一起开始</text>
  67. </view>
  68. <view class="gp-guide-list">
  69. <view class="gp-guide-item">
  70. <view class="gp-guide-check"></view>
  71. <text class="gp-guide-text">查看家庭报告与成员档案</text>
  72. </view>
  73. <view class="gp-guide-item">
  74. <view class="gp-guide-check"></view>
  75. <text class="gp-guide-text">管理积分与能量数据</text>
  76. </view>
  77. <view class="gp-guide-item">
  78. <view class="gp-guide-check"></view>
  79. <text class="gp-guide-text">参与家庭挑战与里程碑</text>
  80. </view>
  81. </view>
  82. <view class="gp-guide-btn" @click="goLogin">
  83. <text class="gp-guide-btn-text">手机号快捷登录</text>
  84. </view>
  85. </view>
  86. </view>
  87. </view>
  88. <!-- 已登录 -->
  89. <template v-else>
  90. <!-- 退出切换 -->
  91. <view class="exit-switch" v-if="isSwitchedChild" @click="onExitSwitch">
  92. <text>🔄 退出切换</text>
  93. </view>
  94. <!-- 身份卡 -->
  95. <view class="user-card">
  96. <view class="user-card-left">
  97. <view class="avatar-wrap" @click="goToEditInfo">
  98. <image v-if="userInfo.avatar" class="avatar-img" :src="userInfo.avatar" mode="aspectFill" />
  99. <text v-else class="avatar-text">{{ nickname.charAt(0) || '👤' }}</text>
  100. </view>
  101. <view class="user-meta">
  102. <view class="user-name-row">
  103. <text class="nickname">{{ nickname || '未设置昵称' }}</text>
  104. <text v-if="roleLabel" class="role-tag">{{ roleLabel }}</text>
  105. </view>
  106. <view class="user-sub" v-if="memberLevel">
  107. <view class="level-badge" :class="'level-' + memberLevel">{{ memberLevelText }}</view>
  108. <text v-if="isLifetime" class="days-left">永久有效</text>
  109. <text v-else-if="membershipDays > 0 && membershipDays <= 30" class="days-left">剩余 {{ membershipDays }} 天</text>
  110. <view v-if="hasUpgradeSpace" class="upgrade-btn" @click="goUpgrade">
  111. <text class="upgrade-btn-text">{{ upgradeBtnText }}</text>
  112. </view>
  113. </view>
  114. <view class="user-sub" v-else>
  115. <text class="days-left">开通会员解锁更多权益</text>
  116. <view class="upgrade-btn" @click="goUpgrade">
  117. <text class="upgrade-btn-text">立即开通</text>
  118. </view>
  119. </view>
  120. </view>
  121. </view>
  122. <view class="user-card-right" @click="goToPoints">
  123. <text class="points-num">{{ totalPoints }}</text>
  124. <text class="points-label">积分</text>
  125. </view>
  126. </view>
  127. <!-- 团队邀请浮动按钮(纯 CSS 二维码图标):点按直接调起微信转发,不再生成海报。
  128. 用透明 <button open-type="share"> 覆盖原入口,保留既有视觉与布局,仅由原生按钮接管点击。
  129. 分享 path 由页面 onShareAppMessage 返回,直达服务角色申请表并携带本人 refCode。 -->
  130. <view class="share-qr-float">
  131. <view class="qr-glyph">
  132. <view class="qr-eye qr-eye-tl"></view>
  133. <view class="qr-eye qr-eye-tr"></view>
  134. <view class="qr-eye qr-eye-bl"></view>
  135. <view class="qr-mid"></view>
  136. <view class="qr-cluster">
  137. <view class="qr-pip"></view>
  138. <view class="qr-pip"></view>
  139. <view class="qr-pip"></view>
  140. <view class="qr-pip"></view>
  141. </view>
  142. </view>
  143. <button class="share-overlay-btn" open-type="share" @tap="ensureShareCode"></button>
  144. </view>
  145. <!-- 家族成员速览 -->
  146. <view class="family-strip" v-if="familyMembers.length > 0">
  147. <view class="family-strip-header">
  148. <text class="family-strip-title">我的家庭</text>
  149. <text class="family-strip-count">{{ familyMembers.length }} 位成员</text>
  150. </view>
  151. <view class="family-avatars">
  152. <view
  153. v-for="member in familyMembers"
  154. :key="member.id"
  155. class="family-avatar-item"
  156. @click="goMemberDetail(member)"
  157. >
  158. <view class="family-avatar-wrap">
  159. <image v-if="member.avatar" class="family-avatar-img" :src="member.avatar" mode="aspectFill" />
  160. <text v-else class="family-avatar-text">{{ member.nickname ? member.nickname.charAt(0) : '?' }}</text>
  161. <view class="family-avatar-tag" :class="'tag-' + (member.effectiveRole || member.source || 'member')">{{ member.roleLabel || memberRoleLabel(member.effectiveRole) }}</view>
  162. </view>
  163. <text class="family-avatar-name">{{ member.nickname || member.realName || '成员' }}</text>
  164. </view>
  165. <view class="family-avatar-item" @click="goToFamily">
  166. <view class="family-avatar-wrap family-avatar-add">
  167. <text class="family-avatar-plus">+</text>
  168. </view>
  169. <text class="family-avatar-name">添加</text>
  170. </view>
  171. </view>
  172. </view>
  173. <!-- 我的成就(纯成就指标) -->
  174. <view class="achievement-section">
  175. <view class="section-header-row">
  176. <text class="section-title">🏆 我的成就</text>
  177. <text class="section-sub">持续成长,看见改变</text>
  178. </view>
  179. <view class="achievement-grid cols-5">
  180. <view class="ach-item" @click="goToStreak">
  181. <view class="ach-icon-wrap" style="background:rgba(255,140,66,0.12)">
  182. <text class="ach-icon">🔥</text>
  183. </view>
  184. <text class="ach-num">{{ streakDays }}</text>
  185. <text class="ach-label">连续打卡</text>
  186. </view>
  187. <view class="ach-item" @click="goToTaskHistory">
  188. <view class="ach-icon-wrap" style="background:rgba(99,102,241,0.12)">
  189. <text class="ach-icon">✅</text>
  190. </view>
  191. <text class="ach-num">{{ completedTasks }}</text>
  192. <text class="ach-label">完成任务</text>
  193. </view>
  194. <view class="ach-item" @click="goToBadges">
  195. <view class="ach-icon-wrap" style="background:rgba(236,72,153,0.12)">
  196. <text class="ach-icon">🏅</text>
  197. </view>
  198. <text class="ach-num">{{ badgesCollected }}</text>
  199. <text class="ach-label">收集勋章</text>
  200. </view>
  201. <view class="ach-item" @click="goToGrowth">
  202. <view class="ach-icon-wrap" style="background:rgba(16,185,129,0.12)">
  203. <text class="ach-icon">📈</text>
  204. </view>
  205. <text class="ach-num">{{ growthRecords }}</text>
  206. <text class="ach-label">成长记录</text>
  207. </view>
  208. <view class="ach-item" @click="goToChallenges">
  209. <view class="ach-icon-wrap" style="background:rgba(255,107,157,0.12)">
  210. <text class="ach-icon">🎯</text>
  211. </view>
  212. <text class="ach-num">{{ challengesJoined }}</text>
  213. <text class="ach-label">参加挑战</text>
  214. </view>
  215. </view>
  216. </view>
  217. <!-- 我的团队(团队管理 + 推广收益 + 邀请成员) -->
  218. <view class="achievement-section">
  219. <view class="section-header-row">
  220. <text class="section-title">👥 我的团队</text>
  221. <text class="section-sub">团队网络与推广收益</text>
  222. </view>
  223. <view class="achievement-grid team-grid">
  224. <view class="ach-item" @click="goTeamTree">
  225. <view class="ach-icon-wrap" style="background:rgba(16,185,129,0.12)">
  226. <text class="ach-icon">🌳</text>
  227. </view>
  228. <text class="ach-num">{{ teamMembers }}</text>
  229. <text class="ach-label">我的团队</text>
  230. </view>
  231. <view class="ach-item" @click="goToWealthCenter">
  232. <view class="ach-icon-wrap" style="background:rgba(245,158,11,0.12)">
  233. <text class="ach-icon">💰</text>
  234. </view>
  235. <text class="ach-num">{{ referralEarnings }}</text>
  236. <text class="ach-label">推广收益</text>
  237. </view>
  238. <view class="ach-item ach-item-share">
  239. <view class="ach-icon-wrap" style="background:rgba(99,102,241,0.12)">
  240. <text class="ach-icon">🤝</text>
  241. </view>
  242. <text class="ach-num">+</text>
  243. <text class="ach-label">邀请成员</text>
  244. <!-- 团队邀请:透明原生分享按钮覆盖网格项,点按直接调起微信转发(不再生成海报) -->
  245. <button class="share-overlay-btn" open-type="share" @tap="ensureShareCode"></button>
  246. </view>
  247. </view>
  248. </view>
  249. <!-- 我的订单(电商风格) -->
  250. <view class="order-section">
  251. <view class="order-section-header">
  252. <text class="section-title">🛒 我的订单</text>
  253. <text class="order-all-link" @click="goToOrders">全部订单 ›</text>
  254. </view>
  255. <view class="order-card">
  256. <view class="order-grid">
  257. <view class="order-grid-item" @click="goToOrderStatus('pending')">
  258. <view class="order-icon-wrap">
  259. <text class="order-icon">💳</text>
  260. <text class="order-badge" v-if="orderPending > 0">{{ orderPending }}</text>
  261. </view>
  262. <text class="order-grid-text">待付款</text>
  263. </view>
  264. <view class="order-grid-item" @click="goToOrderStatus('paid')">
  265. <view class="order-icon-wrap">
  266. <text class="order-icon">📦</text>
  267. <text class="order-badge" v-if="orderUnpaid > 0">{{ orderUnpaid }}</text>
  268. </view>
  269. <text class="order-grid-text">待发货</text>
  270. </view>
  271. <view class="order-grid-item" @click="goToOrderStatus('shipped')">
  272. <view class="order-icon-wrap">
  273. <text class="order-icon">🚚</text>
  274. <text class="order-badge" v-if="orderShipped > 0">{{ orderShipped }}</text>
  275. </view>
  276. <text class="order-grid-text">待收货</text>
  277. </view>
  278. <view class="order-grid-item" @click="goToOrderStatus('refunding')">
  279. <view class="order-icon-wrap">
  280. <text class="order-icon">🔧</text>
  281. <text class="order-badge" v-if="orderAfterSale > 0">{{ orderAfterSale }}</text>
  282. </view>
  283. <text class="order-grid-text">售后</text>
  284. </view>
  285. <view class="order-grid-item" @click="goToOrders">
  286. <view class="order-icon-wrap">
  287. <text class="order-icon">📋</text>
  288. </view>
  289. <text class="order-grid-text">全部</text>
  290. </view>
  291. </view>
  292. <view class="order-extra-row">
  293. <view class="order-extra-item" @click="goToCart">
  294. <text class="order-extra-icon">🛒</text>
  295. <text class="order-extra-text">购物车</text>
  296. <text class="order-extra-badge" v-if="cartCount > 0">{{ cartCount > 99 ? '99+' : cartCount }}</text>
  297. </view>
  298. <view class="order-extra-divider"></view>
  299. <view class="order-extra-item" @click="goToAddress">
  300. <text class="order-extra-icon">📍</text>
  301. <text class="order-extra-text">收货地址</text>
  302. </view>
  303. </view>
  304. </view>
  305. </view>
  306. <!-- 卡券中心(我的优惠券 + 获得奖励) -->
  307. <view class="achievement-section">
  308. <view class="section-header-row">
  309. <text class="section-title">🎫 卡券中心</text>
  310. <text class="section-sub">优惠券与权益</text>
  311. </view>
  312. <view class="achievement-grid">
  313. <view class="ach-item" @click="goToCoupons">
  314. <view class="ach-icon-wrap" style="background:rgba(245,158,11,0.12)">
  315. <text class="ach-icon">🎟️</text>
  316. </view>
  317. <text class="ach-num">{{ couponCount }}</text>
  318. <text class="ach-label">我的优惠券</text>
  319. </view>
  320. <view class="ach-item" @click="goToWishes">
  321. <view class="ach-icon-wrap" style="background:rgba(245,158,11,0.12)">
  322. <text class="ach-icon">🎁</text>
  323. </view>
  324. <text class="ach-num">{{ rewardsEarned }}</text>
  325. <text class="ach-label">获得奖励</text>
  326. </view>
  327. </view>
  328. </view>
  329. <!-- 健康档案(上传报告) -->
  330. <view class="menu-row" @click="goToHealthReports">
  331. <text class="menu-row-icon">📋</text>
  332. <text class="menu-row-text">我的健康报告</text>
  333. <text class="menu-row-sub">{{ healthReports }} 份</text>
  334. <text class="menu-row-arrow">›</text>
  335. </view>
  336. <!-- 规划师服务中心入口(仅规划师可见) -->
  337. <view class="service-center-section" v-if="isTeacherUser && teacherStatus === 'approved'">
  338. <view class="service-center-card" @click="goToServiceCenter">
  339. <view class="service-center-icon">👨‍🏫</view>
  340. <view class="service-center-info">
  341. <text class="service-center-title">服务中心</text>
  342. <text class="service-center-desc">待处理任务:{{ pendingTasks }} 条 · 消息:{{ unreadMessages }} 条</text>
  343. </view>
  344. <text class="service-center-arrow">›</text>
  345. </view>
  346. </view>
  347. <!-- 规划师待审核提示 -->
  348. <view class="service-center-section" v-if="isTeacherUser && teacherStatus !== 'approved'">
  349. <view class="service-center-card disabled-card">
  350. <view class="service-center-icon">👨‍🏫</view>
  351. <view class="service-center-info">
  352. <text class="service-center-title">服务中心</text>
  353. <text class="service-center-desc">{{ teacherStatus === 'pending' ? '申请审核中,暂未开放' : teacherStatus === 'rejected' ? '申请未通过,请联系管理员' : '规划师服务' }}</text>
  354. </view>
  355. </view>
  356. </view>
  357. <!-- 设置 + 退出 -->
  358. <view class="bottom-menu-section">
  359. <view class="menu-row" v-if="memberActive" @click="goToMessageHistory">
  360. <text class="menu-row-icon">📨</text>
  361. <text class="menu-row-text">历史消息</text>
  362. <text class="menu-row-arrow">›</text>
  363. </view>
  364. <view class="menu-row" @click="goToSettings">
  365. <text class="menu-row-icon">⚙️</text>
  366. <text class="menu-row-text">设置</text>
  367. <text class="menu-row-arrow">›</text>
  368. </view>
  369. <view class="logout-btn" @click="logout">
  370. <text class="logout-text">退出登录</text>
  371. </view>
  372. </view>
  373. </template>
  374. <!-- 我的分享海报:复用文章/活动/商品同一套 ContentSharePoster 组件(canvas 绘制 + 保存到相册) -->
  375. <ContentSharePoster
  376. :show="showSharePoster"
  377. :title="shareHeadline"
  378. :energyData="posterEnergyData"
  379. :brandFallback="true"
  380. :qrCodeBase64="posterQrCode || ''"
  381. typeLabel="邀友加入"
  382. :summary="posterSummary"
  383. ctaText="长按识别二维码 · 加入浠艾福"
  384. :inviteText="posterInviteText"
  385. @close="closeSharePoster"
  386. />
  387. </view>
  388. </template>
  389. <script>
  390. import ContentSharePoster from '../../components/ContentSharePoster.vue'
  391. import {
  392. getChildren, getFamilyMemberList,
  393. getTodayTasksByCategory, getChallengeList, getMyMembership,
  394. verifyPassword, getPointsBalance, getUserInfo,
  395. cartCount, getOrderCounts, getCfSummary,
  396. getProfileStats, getMyReferrer, getVendorTeamList, getVendorHierarchyInfo, getMyCoupons,
  397. getTeacherInfo, getTeacherPendingTasks, getTeacherUnreadCount, getUserRoles,
  398. getReferralCode, extractReferralCode, getShareQrCode, getEnergySandbox,
  399. vendorStatus
  400. } from '../../utils/api.js'
  401. import { BrandColors } from '../../utils/brand-colors.js'
  402. import { isApprovedActivityProvider } from '../../utils/activity-role.js'
  403. import fontScaleMixin from '@/mixins/font-scale.js'
  404. import { isActiveMember } from '@/utils/membershipGate.js'
  405. import shareMixin from '../../components/share-mixin.js'
  406. // 团队邀请:本人推广码本地缓存 key(模块级常量,供同步分享钩子使用,不依赖组件 this)。
  407. // 与用户级 storage.refCode(被邀请人码)、记录级 storage.serviceRoleApplyRefCode 均不同,互不覆盖。
  408. var TEAM_INVITE_SHARE_CODE_KEY = 'myReferralCode'
  409. export default {
  410. mixins: [fontScaleMixin, shareMixin],
  411. components: { ContentSharePoster },
  412. data() {
  413. return {
  414. nickname: '',
  415. role: 'parent',
  416. isSwitchedChild: false,
  417. userRoles: [],
  418. isTeacherUser: false,
  419. userInfo: {},
  420. memberLevel: null,
  421. membershipDays: 0,
  422. // 会员有效态(isActive):控制「历史消息」等入口可见性,默认 false(fail-closed)
  423. memberActive: false,
  424. totalPoints: 0,
  425. referralEarnings: 0,
  426. teamMembers: 0,
  427. // 个人成就
  428. completedTasks: 0,
  429. streakDays: 0,
  430. rewardsEarned: 0,
  431. badgesCollected: 0,
  432. growthRecords: 0,
  433. challengesJoined: 0,
  434. healthReports: 0,
  435. // 家庭
  436. familyMembers: [],
  437. // 商城
  438. orderPending: 0,
  439. orderUnpaid: 0,
  440. orderShipped: 0,
  441. orderAfterSale: 0,
  442. cartCount: 0,
  443. couponCount: 0,
  444. // 待办
  445. pendingTasks: 0,
  446. unreadMessages: 0,
  447. teacherStatus: 'pending',
  448. isVendor: false,
  449. profileProgress: 0,
  450. myReferrer: null,
  451. // 分享推广码
  452. showSharePoster: false,
  453. referralCode: '',
  454. posterQrCode: '',
  455. posterEnergyData: null,
  456. referralCodeLoaded: false,
  457. // 登录态:响应式字段(非 computed)。computed 依赖非响应式的 Storage 读取,
  458. // 登录成功写入 token 后不会触发重算,导致页面仍显示登录前状态。
  459. // 改为 data 字段并在 onShow / 登录成功回调中重新赋值,登录后页面即时刷新。
  460. isLoggedIn: !!uni.getStorageSync('token'),
  461. }
  462. },
  463. computed: {
  464. roleLabel() {
  465. var map = { parent: '', child: '成员', teacher: '规划师' }
  466. return map[this.role] || '用户'
  467. },
  468. memberLevelText() {
  469. var map = { FREE: '免费用户', BASIC: '体验会员', FAMILY: '家庭会员', PREMIUM: '高级会员', LIFETIME: '终身会员' }
  470. return map[this.memberLevel] || this.memberLevel || ''
  471. },
  472. isLifetime() {
  473. return this.memberLevel === 'LIFETIME'
  474. },
  475. hasUpgradeSpace() {
  476. return this.memberLevel === 'FREE' || this.memberLevel === 'FAMILY'
  477. },
  478. upgradeBtnText() {
  479. return this.hasUpgradeSpace ? '升级' : '立即开通'
  480. },
  481. // 分享海报标题:XXX邀请你关注家庭健康(昵称过长自动截断)
  482. shareHeadline() {
  483. var name = (this.nickname || '').trim()
  484. if (!name) return '邀请你关注家庭健康'
  485. if (name.length > 8) name = name.substring(0, 8) + '…'
  486. return name + '邀请你关注家庭健康'
  487. },
  488. posterSummary() {
  489. return '身体 · 心理 · 智慧 · 行动 · 财富,一家专注全家健康的成长平台'
  490. },
  491. posterInviteText() {
  492. var name = (this.nickname || '').trim()
  493. if (!name) return '扫码加入浠艾福,一起照顾好这个家'
  494. if (name.length > 8) name = name.substring(0, 8) + '…'
  495. return '「' + name + '」邀请你加入浠艾福'
  496. }
  497. },
  498. /**
  499. * 团队邀请:页面级微信转发配置(覆盖 share-mixin.js 的同名 hook 返回值)。
  500. * 已核实 mp.runtime 的 __call_hook 按 mixin→页面顺序调用并返回最后一个 ret,
  501. * 故这里的返回值生效,mixin 的默认首页分享不再覆盖本页邀请 path。
  502. * 分享 path 直达服务角色申请表,携带本人推广码作为 refCode(用户级/记录级两级共用此码)。
  503. */
  504. onShareAppMessage() {
  505. // 同步钩子:data 未就绪时读本地缓存兜底,确保 refCode 不为空(否则推荐人丢失)
  506. var code = (this.referralCode || '') || uni.getStorageSync(TEAM_INVITE_SHARE_CODE_KEY) || ''
  507. return {
  508. title: '邀请你加入浠艾福服务团队',
  509. path: '/pages/profile/service-role-apply' + (code ? '?refCode=' + code : ''),
  510. imageUrl: '/static/logo.png'
  511. }
  512. },
  513. onShow() {
  514. // 重新读取登录态(登录浮层成功后 mixin 会触发 onShow),驱动页面切换到已登录视图
  515. this.isLoggedIn = !!uni.getStorageSync('token')
  516. if (!this.isLoggedIn) {
  517. return
  518. }
  519. // 团队邀请:进入即预热本人推广码,保证任意时刻点分享时 refCode 已就绪;
  520. // 已缓存则 loadReferralCode 内部直接复用,不重复请求。
  521. this.loadReferralCode()
  522. // 每次进入刷新会员有效态(覆盖从升级/续费页返回)
  523. this.refreshMemberActive()
  524. var role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || 'parent'
  525. this.role = role
  526. this.isSwitchedChild = uni.getStorageSync('isSwitchedChild') || false
  527. this.nickname = (uni.getStorageSync('userInfo') || {}).nickname || ''
  528. // 服务商身份判断(成就区「我的团队」入口按此分发)
  529. this.checkVendorStatus()
  530. // 规划师身份探测(主角色 teacher 或 roles 含 teacher 均生效),并加载其待办/消息数据
  531. this.loadTeacherIdentity()
  532. // 主角色为 parent 时加载本人/家庭数据;教师主角色保持原逻辑(不加载家庭区块)
  533. if (role !== 'teacher') {
  534. this.loadAllData()
  535. this.loadMyReferrer()
  536. }
  537. },
  538. methods: {
  539. // 会员有效态刷新:唯一判据 /api/ai/gate 的 data.isActive(不随运营开关,fail-closed)
  540. refreshMemberActive: function() {
  541. var self = this
  542. isActiveMember().then(function(active) {
  543. self.memberActive = active
  544. })
  545. },
  546. // 服务商身份:兼容两条申请/审核链路(vendor 入驻 / 服务角色申请)
  547. // 用 isApprovedActivityProvider 统一判定,避免只认 vendorStatus 漏掉服务角色申请链路
  548. checkVendorStatus() {
  549. var self = this
  550. vendorStatus().then(function(res) {
  551. self.isVendor = isApprovedActivityProvider((res && res.data) || {})
  552. }).catch(function() {
  553. self.isVendor = false
  554. })
  555. },
  556. loadTeacherStatus() {
  557. var self = this
  558. getTeacherInfo().then(function(res) {
  559. if (res && res.code === 200 && res.data) {
  560. self.teacherStatus = res.data.verificationStatus || res.data.status || 'pending'
  561. }
  562. }).catch(function() {})
  563. },
  564. loadTeacherIdentity() {
  565. var self = this
  566. var rolesP = (typeof getUserRoles === 'function' ? getUserRoles() : Promise.resolve({ data: [] }))
  567. .catch(function() { return { data: [] } })
  568. rolesP.then(function(res) {
  569. var rolesData = (res && res.data) || []
  570. self.userRoles = Array.isArray(rolesData) ? rolesData : []
  571. uni.setStorageSync('userRoles', self.userRoles)
  572. self.isTeacherUser = self.role === 'teacher' || self.userRoles.indexOf('teacher') > -1
  573. // 仅对规划师拉取认证状态与待办/消息,避免普通家长额外请求
  574. if (self.isTeacherUser) {
  575. var teacherP = (typeof getTeacherInfo === 'function' ? getTeacherInfo() : Promise.resolve({}))
  576. .catch(function() { return {} })
  577. teacherP.then(function(tres) {
  578. var t = (tres && tres.data) || {}
  579. self.teacherStatus = t.verificationStatus || t.status || 'pending'
  580. uni.setStorageSync('teacherStatus', self.teacherStatus)
  581. if (self.teacherStatus === 'approved') {
  582. self.loadTeacherData()
  583. }
  584. })
  585. }
  586. })
  587. },
  588. loadTeacherData() {
  589. var self = this
  590. // 并行加载待处理任务和未读消息
  591. getTeacherPendingTasks().then(function(res) {
  592. if (res && res.data && Array.isArray(res.data)) {
  593. self.pendingTasks = res.data.length
  594. } else if (res && res.data && res.data.pendingCount != null) {
  595. self.pendingTasks = res.data.pendingCount
  596. } else if (res && res.data && res.data.pendingReviewTasks != null) {
  597. self.pendingTasks = res.data.pendingReviewTasks
  598. }
  599. }).catch(function() {})
  600. getTeacherUnreadCount().then(function(res) {
  601. if (res && res.data != null) {
  602. self.unreadMessages = res.data
  603. }
  604. }).catch(function() {})
  605. },
  606. loadAllData() {
  607. this.loadUserInfo()
  608. this.loadMembership()
  609. this.loadPoints()
  610. this.loadFamily()
  611. this.loadTasks()
  612. this.loadChallenges()
  613. this.loadOrderCounts()
  614. this.loadCartCount()
  615. this.loadProfileStats()
  616. this.loadReferralEarnings()
  617. this.loadTeamInfo()
  618. this.loadCoupons()
  619. },
  620. loadUserInfo() {
  621. var self = this
  622. getUserInfo().then(function(res) {
  623. if (res && res.code === 200 && res.data) {
  624. self.userInfo = res.data
  625. if (!self.nickname) self.nickname = res.data.nickname || ''
  626. }
  627. }).catch(function() {})
  628. },
  629. loadMembership() {
  630. var self = this
  631. getMyMembership().then(function(res) {
  632. if (res && res.data) {
  633. self.memberLevel = res.data.memberLevel || res.data.levelCode || null
  634. self.membershipDays = res.data.membershipDays || res.data.daysRemaining || 0
  635. }
  636. }).catch(function() {})
  637. },
  638. loadPoints() {
  639. // 累计积分由 loadProfileStats 汇总家庭成员积分,此处不再单独覆盖
  640. },
  641. loadFamily() {
  642. var self = this
  643. getFamilyMemberList({ visibleOnly: true }).then(function(res) {
  644. var data = res && res.data ? res.data : []
  645. self.familyMembers = Array.isArray(data) ? data : []
  646. }).catch(function() {
  647. self.familyMembers = []
  648. })
  649. },
  650. loadTasks() {
  651. var self = this
  652. var memberId = uni.getStorageSync('currentChildId') || uni.getStorageSync('userId')
  653. if (!memberId) return
  654. getTodayTasksByCategory(memberId, 'action').then(function(res) {
  655. if (res && res.data) {
  656. self.pendingTasks = Array.isArray(res.data) ? res.data.length : 0
  657. }
  658. }).catch(function() {})
  659. // fallback to storage
  660. if (!self.pendingTasks) {
  661. self.pendingTasks = parseInt(uni.getStorageSync('pendingTaskCount') || 0)
  662. }
  663. },
  664. loadChallenges() {
  665. var self = this
  666. getChallengeList({}).then(function(res) {
  667. if (res && res.data) {
  668. // 不在此处使用,仅确保请求
  669. }
  670. }).catch(function() {})
  671. },
  672. loadOrderCounts() {
  673. var self = this
  674. getOrderCounts().then(function(res) {
  675. if (res && res.data) {
  676. self.orderPending = res.data.pending || 0
  677. self.orderUnpaid = res.data.paid || 0
  678. self.orderShipped = res.data.shipped || 0
  679. self.orderAfterSale = res.data.refunding || 0
  680. }
  681. }).catch(function() {})
  682. },
  683. loadCartCount() {
  684. var self = this
  685. cartCount().then(function(res) {
  686. if (res && res.data != null) {
  687. self.cartCount = res.data || 0
  688. }
  689. }).catch(function() {})
  690. },
  691. loadProfileStats() {
  692. var self = this
  693. getProfileStats().then(function(res) {
  694. if (res && res.code === 200 && res.data) {
  695. var d = res.data
  696. if (d.totalPoints != null) self.totalPoints = d.totalPoints
  697. if (d.streakDays != null) self.streakDays = d.streakDays
  698. if (d.completedTasks != null) self.completedTasks = d.completedTasks
  699. if (d.rewardsEarned != null) self.rewardsEarned = d.rewardsEarned
  700. if (d.badgesCollected != null) self.badgesCollected = d.badgesCollected
  701. if (d.growthRecords != null) self.growthRecords = d.growthRecords
  702. if (d.challengesJoined != null) self.challengesJoined = d.challengesJoined
  703. if (d.healthReports != null) self.healthReports = d.healthReports
  704. }
  705. }).catch(function() {})
  706. },
  707. loadReferralEarnings() {
  708. var self = this
  709. // CF 总览口径:与推广中心 promotion/index.vue 收益总览("累计获取CF")保持一致。
  710. // promotion 用 cfVal(summary.totalEarned) 直接展示原始值(cfVal 不做分→元换算),
  711. // 因此这里也不除 100,保证"我的团队"推广收益 = 推广中心"累计获取CF"数字一致。
  712. getCfSummary().then(function(res) {
  713. if (res && res.code === 200 && res.data) {
  714. self.referralEarnings = res.data.totalEarned || 0
  715. }
  716. }).catch(function() {})
  717. },
  718. loadTeamInfo() {
  719. var self = this
  720. getVendorTeamList().then(function(res) {
  721. var teams = (res && res.data) || []
  722. if (!teams.length) {
  723. self.teamMembers = 0
  724. return
  725. }
  726. var reqs = teams.map(function(t) {
  727. return getVendorHierarchyInfo(t.id).then(function(h) {
  728. return (h && h.data && h.data.totalChildren) || 0
  729. }).catch(function() {
  730. return 0
  731. })
  732. })
  733. Promise.all(reqs).then(function(counts) {
  734. self.teamMembers = counts.reduce(function(a, b) { return a + b }, 0)
  735. }).catch(function() {
  736. self.teamMembers = 0
  737. })
  738. }).catch(function() {
  739. self.teamMembers = 0
  740. })
  741. },
  742. loadCoupons() {
  743. var self = this
  744. getMyCoupons().then(function(res) {
  745. if (res && res.code === 200 && res.data) {
  746. var list = Array.isArray(res.data) ? res.data : (res.data.list || [])
  747. self.couponCount = list.length
  748. }
  749. }).catch(function() {})
  750. },
  751. async loadMyReferrer() {
  752. try {
  753. var memberId = uni.getStorageSync('currentMemberId') || uni.getStorageSync('currentChildId') || 0
  754. var res = await getMyReferrer(memberId)
  755. if (res && res.code === 200 && res.data && res.data.hasReferrer) {
  756. this.myReferrer = res.data
  757. }
  758. } catch (e) {
  759. console.error('获取推荐人失败', e)
  760. }
  761. },
  762. // ===== 分享海报(复用 ContentSharePoster,与文章/活动/商品同一套生成逻辑)=====
  763. async showShareQr() {
  764. uni.showLoading({ title: '生成海报中...' })
  765. try {
  766. if (!this.referralCodeLoaded) {
  767. await this.loadReferralCode()
  768. }
  769. var scene = 'ref=' + (this.referralCode || '')
  770. if (scene.length > 32) {
  771. scene = scene.substring(0, 32)
  772. }
  773. // 首页路径,扫码后进入首页并绑定推荐人
  774. // 注意:微信 getwxacodeunlimit 的 page 不能带前导斜杠,否则报 errcode 41030 invalid page rid
  775. var res = await getShareQrCode('pages/index-home/index', scene)
  776. if (res && res.code === 200 && res.data && res.data.qrCodeBase64) {
  777. this.posterQrCode = res.data.qrCodeBase64
  778. // 必须在 showSharePoster=true 之前取到数据:组件 watch 到 show 后 300ms 即开始绘制
  779. await this.loadPosterEnergy()
  780. this.showSharePoster = true
  781. } else {
  782. uni.showToast({ title: '生成失败,请重试', icon: 'none' })
  783. }
  784. } catch (e) {
  785. console.error('生成分享海报失败', e)
  786. uni.showToast({ title: '生成失败,请重试', icon: 'none' })
  787. } finally {
  788. uni.hideLoading()
  789. }
  790. },
  791. closeSharePoster() {
  792. this.showSharePoster = false
  793. },
  794. // 五维能量数据卡数据(方案C):家庭聚合视角;未解锁全景/取数失败时置空,海报降级为品牌卡
  795. loadPosterEnergy() {
  796. var self = this
  797. return getEnergySandbox('family').then(function(res) {
  798. self.posterEnergyData = self.mapPosterEnergy(res)
  799. }).catch(function(e) {
  800. console.error('获取五维能量失败,海报降级为品牌卡', e)
  801. self.posterEnergyData = null
  802. })
  803. },
  804. mapPosterEnergy(res) {
  805. if (!res || res.code !== 200 || !res.data) return null
  806. // locked=true 表示用户未解锁全景,此时不展示任何数据,改为品牌卡
  807. if (res.data.locked) return null
  808. // 只认家庭聚合视角;仅当接口返回的是裸 DTO(无 personalData/familyData 包装)时才直接取 res.data
  809. var d = res.data.familyData || null
  810. if (!d) {
  811. if (res.data.personalData) return null
  812. d = res.data
  813. }
  814. if (!d || typeof d !== 'object') return null
  815. var defs = [
  816. { key: 'body', label: '身', color: BrandColors.body },
  817. { key: 'mind', label: '心', color: BrandColors.mind },
  818. { key: 'wisdom', label: '智', color: BrandColors.wisdom },
  819. { key: 'action', label: '行', color: BrandColors.action },
  820. { key: 'wealth', label: '富', color: BrandColors.wealth }
  821. ]
  822. var dims = []
  823. var sum = 0
  824. for (var i = 0; i < defs.length; i++) {
  825. var raw = d[defs[i].key + 'Score']
  826. if (raw === null || raw === undefined || raw === '' || isNaN(raw)) continue
  827. var n = Number(raw)
  828. if (n < 0) n = 0
  829. if (n > 100) n = 100
  830. sum += n
  831. dims.push({ key: defs[i].key, label: defs[i].label, score: n, color: defs[i].color })
  832. }
  833. if (dims.length === 0) return null
  834. var overall = d.overallScore
  835. if (overall === null || overall === undefined || overall === '' || isNaN(overall)) {
  836. overall = Math.round(sum / dims.length)
  837. }
  838. return { label: '我们家的能量', overall: Number(overall), dims: dims }
  839. },
  840. async loadReferralCode() {
  841. if (this.referralCodeLoaded) return
  842. var self = this
  843. try {
  844. var res = await getReferralCode()
  845. self.referralCode = extractReferralCode(res) || ''
  846. // 团队邀请:写本地缓存,供同步 onShareAppMessage 在 data 尚未就绪时兜底读,保证 refCode 非空
  847. if (self.referralCode) {
  848. uni.setStorageSync(TEAM_INVITE_SHARE_CODE_KEY, self.referralCode)
  849. }
  850. } catch (e) {
  851. console.error('获取推广码失败', e)
  852. } finally {
  853. self.referralCodeLoaded = true
  854. }
  855. },
  856. // 团队邀请:分享按钮点按时的前置兜底。onShow 已预热缓存,这里再确保一次:
  857. // 若本地无码且 data 也为空(如冷启动首帧即点),因 onShareAppMessage 是同步钩子无法 await,
  858. // 只能提示用户「请稍候重试」——但正常路径 onShow 预热已完成,此分支仅为极端时序保险。
  859. ensureShareCode() {
  860. var code = (this.referralCode || '') || uni.getStorageSync(TEAM_INVITE_SHARE_CODE_KEY) || ''
  861. if (!code) {
  862. uni.showToast({ title: '邀请码准备中,请稍候重试', icon: 'none' })
  863. this.loadReferralCode()
  864. }
  865. },
  866. goToServiceCenter() {
  867. uni.navigateTo({ url: '/pages/service-center/index' })
  868. },
  869. goTeamTree() {
  870. // 服务商 → 服务商团队;非服务商 → 引导申请
  871. if (this.isVendor) {
  872. uni.navigateTo({ url: '/pages/vendor/team-system/team-system' })
  873. return
  874. }
  875. uni.showModal({
  876. title: '提示',
  877. content: '您尚未申请任何服务角色,是否立即申请?',
  878. confirmText: '去申请',
  879. cancelText: '取消',
  880. success: function(res) {
  881. if (res.confirm) {
  882. uni.navigateTo({ url: '/pages/profile/service-role-apply' })
  883. }
  884. }
  885. })
  886. },
  887. goLogin: function() {
  888. this.openLoginSheet()
  889. },
  890. // 登录浮层成功回调:立即切换到已登录视图并刷新个人资料与登录后数据
  891. onLoginSuccess: function() {
  892. this.isLoggedIn = true
  893. if (this.loadUserInfo) this.loadUserInfo()
  894. },
  895. goSkip: function() {
  896. uni.switchTab({ url: '/pages/index-home/index' })
  897. },
  898. goToEditInfo: function() {
  899. uni.navigateTo({ url: '/pages/user-edit/user-edit' })
  900. },
  901. goToPoints: function() {
  902. uni.navigateTo({ url: '/pages/points/points' })
  903. },
  904. goToStreak: function() {
  905. var memberId = uni.getStorageSync('currentMemberId') || uni.getStorageSync('currentChildId')
  906. var url = '/pages/stats/completion-rate'
  907. if (memberId) {
  908. url += '?memberId=' + memberId
  909. } else {
  910. url += '?familyView=1'
  911. }
  912. uni.navigateTo({ url: url })
  913. },
  914. goToTasks: function() {
  915. uni.navigateTo({ url: '/pages/tasks/tasks' })
  916. },
  917. goToTaskHistory: function() {
  918. uni.navigateTo({ url: '/pages/tasks/history' })
  919. },
  920. goToWishes: function() {
  921. uni.navigateTo({ url: '/pages/wishes/index' })
  922. },
  923. goToBadges: function() {
  924. uni.navigateTo({ url: '/pages/rewards/badge' })
  925. },
  926. goToGrowth: function() {
  927. uni.navigateTo({ url: '/pages/growth/history' })
  928. },
  929. goToChallenges: function() {
  930. uni.navigateTo({ url: '/pages/health/challenge-manage' })
  931. },
  932. goToHealthReports: function() {
  933. uni.navigateTo({ url: '/pages/health/report-list' })
  934. },
  935. goToWealthCenter: function() {
  936. uni.navigateTo({ url: '/pages/promotion/index' })
  937. },
  938. goToCoupons: function() {
  939. uni.navigateTo({ url: '/pages/profile-extra/coupons' })
  940. },
  941. goUpgrade: function() {
  942. uni.navigateTo({ url: '/pages/membership/upgrade' })
  943. },
  944. goToFamily: function() {
  945. uni.navigateTo({ url: '/pages/profile-extra/family-members' })
  946. },
  947. goMemberDetail: function(member) {
  948. uni.navigateTo({ url: '/pages/home-pages/member-home-detail?memberId=' + member.id })
  949. },
  950. goToAppointments: function() {
  951. uni.navigateTo({ url: '/pages/parent/appointments' })
  952. },
  953. goToOrders: function() {
  954. uni.navigateTo({ url: '/pages/shop/order-list/order-list' })
  955. },
  956. goToOrderStatus: function(status) {
  957. uni.navigateTo({ url: '/pages/shop/order-list/order-list?status=' + status })
  958. },
  959. goToCart: function() {
  960. uni.navigateTo({ url: '/pages/shop/cart/cart' })
  961. },
  962. goToAddress: function() {
  963. uni.navigateTo({ url: '/pages/shop/address/address' })
  964. },
  965. goToMessageHistory: function() {
  966. uni.navigateTo({ url: '/pages/profile/message-history' })
  967. },
  968. goToSettings: function() {
  969. uni.showActionSheet({
  970. itemList: ['完善信息', '家庭成员', '隐私政策', '用户协议', '我的画像', '提醒设置'],
  971. success: function(res) {
  972. var urls = {
  973. 0: '/pages/user-edit/user-edit',
  974. 1: '/pages/profile-extra/family-members',
  975. 2: '/pages/policy/privacy',
  976. 3: '/pages/policy/agreement',
  977. 4: '/pages/profile/portrait-edit',
  978. 5: '/pages/reminder-config/index'
  979. }
  980. if (urls[res.tapIndex]) {
  981. uni.navigateTo({ url: urls[res.tapIndex] })
  982. }
  983. }
  984. })
  985. },
  986. memberRoleLabel: function(role) {
  987. var map = { parent: '本人', child: '成员', teacher: '规划师' }
  988. return map[role] || '成员'
  989. },
  990. onExitSwitch: function() {
  991. var self = this
  992. uni.showModal({
  993. title: '退出切换',
  994. content: '请输入家庭主账号密码以确认退出',
  995. editable: true,
  996. success: function(res) {
  997. if (res.confirm && res.content) {
  998. verifyPassword(res.content).then(function(result) {
  999. if (result.code === 200) {
  1000. self.$store.commit('switchBackToParent')
  1001. self.isSwitchedChild = false
  1002. self.role = 'parent'
  1003. uni.showToast({ title: '已退出切换', icon: 'success' })
  1004. uni.reLaunch({ url: '/pages/index-home/index' })
  1005. } else {
  1006. uni.showToast({ title: '密码错误', icon: 'none' })
  1007. }
  1008. }).catch(function() {
  1009. uni.showToast({ title: '验证失败', icon: 'none' })
  1010. })
  1011. }
  1012. }
  1013. })
  1014. },
  1015. logout: function() {
  1016. uni.showModal({
  1017. title: '确认退出',
  1018. content: '确定要退出登录吗?',
  1019. success: function(res) {
  1020. if (res.confirm) {
  1021. this.$store.commit('logout')
  1022. uni.reLaunch({ url: '/pages/index-home/index' })
  1023. }
  1024. }.bind(this)
  1025. })
  1026. }
  1027. }
  1028. }
  1029. </script>
  1030. <style scoped lang="scss">
  1031. // ===== 页面级局部调色板(单页专有色阶;同值才映射全局令牌,约定见 uni.scss §14) =====
  1032. $c-text-gray-400: $facade-text-gray-400;
  1033. $c-fill-2b: #F2F2F2;
  1034. .container {
  1035. min-height: 100vh;
  1036. background: $facade-fill-warm-gray;
  1037. padding-bottom: calc(160rpx + env(safe-area-inset-bottom));
  1038. }
  1039. /* ===== 访客态(设计稿 page-profile 落地 · 令牌化) ===== */
  1040. // 页面级局部色令牌:仅声明 uni.scss 未收录、本页专属的值;其余全部走共享令牌
  1041. $gp-cta-from: #D1440B; // 深橙·亮端(白字 4.62:1)
  1042. $gp-cta-to: $brand-primary; // 深橙·暗端(#C2410C 白字 5.18:1)
  1043. $gp-cta-hover-from: #B93D0B;
  1044. $gp-cta-hover-to: #A9330A;
  1045. $gp-cta-press-from: #A9330A;
  1046. $gp-cta-press-to: #962D08;
  1047. $gp-logo-from: #FFE9D6; // logo 渐变亮端
  1048. $gp-logo-to: #FFD6AE; // logo 渐变暗端
  1049. $gp-tint-soft: $tint-warm-soft; // 暖白浅底 #FFF1E6
  1050. $gp-guide-bg-from: #FFF8F2; // 引导卡顶(暖白偏橙)
  1051. $gp-guide-bg-to: #FFFDFB; // 引导卡底
  1052. $gp-guide-ic-bg: $dim-body-deep;
  1053. // data-URI SVG icon 构造(mp-weixin 模板内禁写 <svg>,与 login-sheet 落地同款方案)
  1054. @function gp-icon($color, $inner) {
  1055. @return url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23#{$color}' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E#{$inner}%3C/svg%3E");
  1056. }
  1057. $gp-white-bg: str-slice('#{$app-surface}', 2);
  1058. $gp-ghost-bg: str-slice('#{$facade-text-slate}', 2);
  1059. $gp-brand-bg: str-slice('#{$brand-primary}', 2);
  1060. $gp-body-bg: str-slice('#{$dim-body-deep}', 2);
  1061. $gp-wisdom-bg: str-slice('#{$dim-wisdom-deep}', 2);
  1062. $gp-wealth-bg: str-slice('#{$dim-wealth-deep}', 2);
  1063. $gp-guide-ic-b: str-slice('#{$gp-guide-ic-bg}', 2);
  1064. $gp-success-bg: str-slice('#{$status-success-strong}', 2);
  1065. $gp-ghost-hex: '#{$facade-text-ghost}';
  1066. $gp-ghost: str-slice($gp-ghost-hex, 2);
  1067. .gp-page { background: $app-bg; min-height: 100vh; padding: 28rpx 0 40rpx; }
  1068. /* 登录大卡 */
  1069. .gp-login { margin: 0 32rpx 24rpx; background: linear-gradient(165deg, $gp-guide-bg-to 0%, $app-bg 100%); border: 1rpx solid $app-border-subtle; border-radius: 32rpx; padding: 48rpx 36rpx 40rpx; display: flex; flex-direction: column; }
  1070. .gp-logo { width: 112rpx; height: 112rpx; border-radius: 28rpx; background: linear-gradient(135deg, $gp-logo-from 0%, $gp-logo-to 100%); display: flex; flex-direction: row; align-items: center; justify-content: center; }
  1071. .gp-logo-heart {
  1072. width: 56rpx; height: 56rpx;
  1073. background-repeat: no-repeat;
  1074. background-position: center;
  1075. background-size: 56rpx 56rpx;
  1076. background-image: gp-icon($gp-brand-bg, '%3Cpath d=%22M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z%22/%3E');
  1077. }
  1078. .gp-login-title { font-size: calc(44rpx * var(--font-scale, 1)); font-weight: 800; color: $facade-text-strong; margin-top: 24rpx; letter-spacing: 1rpx; }
  1079. .gp-login-desc { font-size: calc(26rpx * var(--font-scale, 1)); color: $facade-text-body; line-height: 1.65; margin-top: 14rpx; }
  1080. .gp-login-btn { margin-top: 32rpx; width: 100%; display: flex; flex-direction: row; align-items: center; justify-content: center; padding: 28rpx 0; border-radius: 24rpx; background: linear-gradient(135deg, $gp-cta-from 0%, $gp-cta-to 100%); box-shadow: 0 10rpx 24rpx rgba($brand-primary, 0.2); }
  1081. .gp-login-btn:active { opacity: 0.9; }
  1082. .gp-login-btn-ic {
  1083. width: 36rpx; height: 36rpx; flex-shrink: 0;
  1084. background-repeat: no-repeat;
  1085. background-position: center;
  1086. background-size: 36rpx 36rpx;
  1087. background-image: gp-icon($gp-white-bg, '%3Cpath d=%22M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2%22/%3E%3Ccircle cx=%2212%22 cy=%227%22 r=%224%22/%3E');
  1088. }
  1089. .gp-login-btn-text { font-size: calc(30rpx * var(--font-scale, 1)); font-weight: 700; color: $app-surface; margin-left: 12rpx; }
  1090. .gp-ghost-btn { margin-top: 10rpx; width: 100%; display: flex; flex-direction: row; align-items: center; justify-content: center; padding: 24rpx 0; border-radius: 24rpx; background: $app-surface; border: 1rpx solid $app-border-subtle; }
  1091. .gp-ghost-btn:active { opacity: 0.85; }
  1092. .gp-ghost-btn-text { font-size: calc(28rpx * var(--font-scale, 1)); font-weight: 600; color: $facade-text-slate; }
  1093. .gp-ghost-chev {
  1094. width: 30rpx; height: 30rpx; margin-left: 10rpx; flex-shrink: 0;
  1095. background-repeat: no-repeat;
  1096. background-position: center;
  1097. background-size: 30rpx 30rpx;
  1098. background-image: gp-icon($gp-ghost-bg, '%3Cpolyline points=%229 18 15 12 9 6%22/%3E');
  1099. }
  1100. /* 登录后开启 */
  1101. .gp-block { margin: 0 32rpx 24rpx; background: $app-surface; border-radius: 24rpx; padding: 24rpx; border: 1rpx solid $app-border-subtle; }
  1102. .gp-tag-row { display: flex; flex-direction: row; align-items: baseline; justify-content: space-between; }
  1103. .gp-tag { font-size: calc(24rpx * var(--font-scale, 1)); font-weight: 700; color: $brand-primary; letter-spacing: 1rpx; }
  1104. .gp-rows { margin-top: 8rpx; display: flex; flex-direction: column; }
  1105. .gp-row { display: flex; flex-direction: row; align-items: center; padding: 20rpx 12rpx; border: 1rpx solid $app-border-subtle; border-radius: 20rpx; background: $app-surface; }
  1106. .gp-row + .gp-row { margin-top: 12rpx; }
  1107. .gp-ic { width: 68rpx; height: 68rpx; border-radius: 18rpx; flex-shrink: 0; }
  1108. .gp-ic-body {
  1109. background-color: $dim-body-tint;
  1110. background-repeat: no-repeat; background-position: center; background-size: 38rpx 38rpx;
  1111. background-image: gp-icon($gp-body-bg, '%3Cpath d=%22M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2%22/%3E%3Ccircle cx=%2212%22 cy=%227%22 r=%224%22/%3E');
  1112. }
  1113. .gp-ic-wisdom {
  1114. background-color: $dim-wisdom-tint;
  1115. background-repeat: no-repeat; background-position: center; background-size: 38rpx 38rpx;
  1116. background-image: gp-icon($gp-wisdom-bg, '%3Cpath d=%22M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2%22/%3E%3Ccircle cx=%229%22 cy=%227%22 r=%224%22/%3E%3Cpath d=%22M23 21v-2a4 4 0 0 0-3-3.87%22/%3E%3Cpath d=%22M16 3.13a4 4 0 0 1 0 7.75%22/%3E');
  1117. }
  1118. .gp-ic-wealth {
  1119. background-color: $dim-wealth-tint;
  1120. background-repeat: no-repeat; background-position: center; background-size: 38rpx 38rpx;
  1121. background-image: gp-icon($gp-wealth-bg, '%3Cline x1=%2218%22 y1=%2220%22 x2=%2218%22 y2=%2210%22/%3E%3Cline x1=%2212%22 y1=%2220%22 x2=%2212%22 y2=%224%22/%3E%3Cline x1=%226%22 y1=%2220%22 x2=%226%22 y2=%2214%22/%3E');
  1122. }
  1123. .gp-row-info { flex: 1; min-width: 0; margin-left: 20rpx; display: flex; flex-direction: column; }
  1124. .gp-row-name { font-size: calc(28rpx * var(--font-scale, 1)); font-weight: 600; color: $facade-text-strong; }
  1125. .gp-row-sub { font-size: calc(22rpx * var(--font-scale, 1)); color: $facade-text-body; margin-top: 6rpx; }
  1126. .gp-lock {
  1127. width: 32rpx; height: 32rpx; flex-shrink: 0; margin-left: 12rpx;
  1128. background-repeat: no-repeat;
  1129. background-position: center;
  1130. background-size: 32rpx 32rpx;
  1131. background-image: gp-icon($gp-ghost, '%3Crect x=%223%22 y=%2211%22 width=%2218%22 height=%2211%22 rx=%222%22/%3E%3Cpath d=%22M7 11V7a5 5 0 0 1 10 0v4%22/%3E');
  1132. }
  1133. /* 理念卡 */
  1134. .gp-philosophy { margin: 0 32rpx 24rpx; display: flex; flex-direction: row; align-items: flex-start; background: $app-surface; border-radius: 24rpx; padding: 28rpx 24rpx; border: 1rpx solid $app-border-subtle; }
  1135. .gp-philosophy-ic {
  1136. width: 68rpx; height: 68rpx; flex-shrink: 0; border-radius: 18rpx;
  1137. background-color: $dim-action-tint;
  1138. background-repeat: no-repeat; background-position: center; background-size: 38rpx 38rpx;
  1139. background-image: gp-icon($gp-guide-ic-b, '%3Cpath d=%22M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z%22/%3E');
  1140. }
  1141. .gp-philosophy-body { flex: 1; min-width: 0; margin-left: 20rpx; display: flex; flex-direction: column; }
  1142. .gp-philosophy-title { font-size: calc(28rpx * var(--font-scale, 1)); font-weight: 700; color: $facade-text-strong; line-height: 1.45; }
  1143. .gp-philosophy-desc { font-size: calc(24rpx * var(--font-scale, 1)); color: $facade-text-body; line-height: 1.7; margin-top: 12rpx; }
  1144. /* 登录引导(模板内联:本页未注册 LoginGuideCard) */
  1145. .gp-guide { margin: 0 32rpx 8rpx; display: flex; flex-direction: column; background: linear-gradient(150deg, $gp-guide-bg-from 0%, $gp-guide-bg-to 100%); border-radius: 24rpx; padding: 32rpx 28rpx; border: 1rpx solid $app-border-subtle; }
  1146. .gp-guide-head { display: flex; flex-direction: row; align-items: center; }
  1147. .gp-guide-ic {
  1148. width: 36rpx; height: 36rpx; flex-shrink: 0;
  1149. background-repeat: no-repeat; background-position: center; background-size: 36rpx 36rpx;
  1150. background-image: gp-icon($gp-brand-bg, '%3Crect x=%223%22 y=%2211%22 width=%2218%22 height=%2211%22 rx=%222%22/%3E%3Cpath d=%22M7 11V7a5 5 0 0 1 10 0v4%22/%3E');
  1151. }
  1152. .gp-guide-title { flex: 1; min-width: 0; margin-left: 14rpx; font-size: calc(30rpx * var(--font-scale, 1)); font-weight: 800; color: $facade-text-strong; line-height: 1.4; }
  1153. .gp-guide-list { margin-top: 20rpx; display: flex; flex-direction: column; }
  1154. .gp-guide-item { display: flex; flex-direction: row; align-items: flex-start; margin-top: 14rpx; }
  1155. .gp-guide-item:first-child { margin-top: 0; }
  1156. .gp-guide-check {
  1157. width: 28rpx; height: 28rpx; flex-shrink: 0; margin-top: 6rpx;
  1158. background-repeat: no-repeat; background-position: center; background-size: 28rpx 28rpx;
  1159. background-image: gp-icon($gp-success-bg, '%3Cpolyline points=%2220 6 9 17 4 12%22/%3E');
  1160. }
  1161. .gp-guide-text { flex: 1; min-width: 0; margin-left: 12rpx; font-size: calc(24rpx * var(--font-scale, 1)); color: $facade-text-body; line-height: 1.6; }
  1162. .gp-guide-btn { margin-top: 28rpx; padding: 24rpx 0; border-radius: 999rpx; background: linear-gradient(135deg, $gp-cta-from 0%, $gp-cta-to 100%); display: flex; flex-direction: row; align-items: center; justify-content: center; box-shadow: 0 10rpx 24rpx rgba($brand-primary, 0.18); }
  1163. .gp-guide-btn:active { opacity: 0.9; }
  1164. .gp-guide-btn-text { font-size: calc(28rpx * var(--font-scale, 1)); font-weight: 600; color: $app-surface; }
  1165. /* 退出切换 */
  1166. .exit-switch {
  1167. margin: 0 $uni-space-lg 16rpx;
  1168. background: linear-gradient(135deg, $brand-primary, $brand-primary-light);
  1169. color: $app-surface;
  1170. padding: 16rpx;
  1171. border-radius: 16rpx;
  1172. text-align: center;
  1173. font-size: calc(26rpx * var(--font-scale, 1));
  1174. }
  1175. /* 身份卡 */
  1176. .user-card {
  1177. margin: 24rpx $uni-space-lg 20rpx;
  1178. background: linear-gradient(135deg, $brand-primary 0%, $brand-primary-light 100%);
  1179. border-radius: 24rpx;
  1180. padding: 32rpx 32rpx;
  1181. display: flex;
  1182. justify-content: space-between;
  1183. align-items: center;
  1184. box-shadow: 0 8rpx 32rpx rgba($accent-indigo, 0.3);
  1185. }
  1186. .user-card-left {
  1187. display: flex;
  1188. align-items: center;
  1189. flex: 1;
  1190. }
  1191. .avatar-wrap {
  1192. width: 100rpx;
  1193. height: 100rpx;
  1194. border-radius: 50%;
  1195. background: rgba($app-surface, 0.2);
  1196. display: flex;
  1197. align-items: center;
  1198. justify-content: center;
  1199. margin-right: 20rpx;
  1200. overflow: hidden;
  1201. border: 3rpx solid rgba($app-surface, 0.3);
  1202. }
  1203. .avatar-img {
  1204. width: 100rpx;
  1205. height: 100rpx;
  1206. border-radius: 50%;
  1207. }
  1208. .avatar-text {
  1209. font-size: calc(44rpx * var(--font-scale, 1));
  1210. color: $app-surface;
  1211. }
  1212. .user-meta { flex: 1; }
  1213. .user-name-row {
  1214. display: flex;
  1215. align-items: center;
  1216. gap: 12rpx;
  1217. margin-bottom: 8rpx;
  1218. }
  1219. .nickname {
  1220. font-size: calc(34rpx * var(--font-scale, 1));
  1221. font-weight: bold;
  1222. color: $app-surface;
  1223. }
  1224. .role-tag {
  1225. font-size: calc(20rpx * var(--font-scale, 1));
  1226. background: rgba($app-surface, 0.2);
  1227. color: $app-surface;
  1228. padding: 4rpx 14rpx;
  1229. border-radius: 24rpx;
  1230. }
  1231. .referrer-line {
  1232. font-size: calc(24rpx * var(--font-scale, 1));
  1233. color: rgba($app-surface, 0.7);
  1234. margin-bottom: 6rpx;
  1235. }
  1236. .user-sub {
  1237. display: flex;
  1238. align-items: center;
  1239. gap: 12rpx;
  1240. }
  1241. .level-badge {
  1242. font-size: calc(22rpx * var(--font-scale, 1));
  1243. padding: 6rpx 20rpx;
  1244. border-radius: 24rpx;
  1245. font-weight: bold;
  1246. border: 2rpx solid rgba($app-surface, 0.35);
  1247. display: flex;
  1248. align-items: center;
  1249. gap: 6rpx;
  1250. box-sizing: border-box;
  1251. height: 40rpx;
  1252. }
  1253. .level-badge::before {
  1254. content: '👑';
  1255. font-size: calc(18rpx * var(--font-scale, 1));
  1256. }
  1257. .level-FREE { background: linear-gradient(135deg, $c-text-gray-400, $facade-text-slate); color: $app-surface; }
  1258. .level-FREE::before { content: ''; }
  1259. .level-FAMILY { background: linear-gradient(135deg, $dim-wealth, $status-warning-deep); color: $app-surface; }
  1260. .level-PREMIUM { background: linear-gradient(135deg, $dim-wisdom, $dim-wisdom-deep); color: $app-surface; }
  1261. .level-LIFETIME {
  1262. background: linear-gradient(135deg, $accent-pink, $accent-pink-deep);
  1263. color: $app-surface;
  1264. box-shadow: 0 4rpx 16rpx rgba($accent-pink, 0.45);
  1265. border-color: rgba($app-surface, 0.55);
  1266. }
  1267. .days-left {
  1268. font-size: calc(20rpx * var(--font-scale, 1));
  1269. color: rgba($app-surface, 0.85);
  1270. }
  1271. .upgrade-btn {
  1272. background: rgba($app-surface, 0.22);
  1273. border: 2rpx solid rgba($app-surface, 0.6);
  1274. border-radius: 24rpx;
  1275. padding: 6rpx 20rpx;
  1276. flex-shrink: 0;
  1277. box-sizing: border-box;
  1278. height: 40rpx;
  1279. display: flex;
  1280. align-items: center;
  1281. }
  1282. .upgrade-btn-text {
  1283. font-size: calc(20rpx * var(--font-scale, 1));
  1284. font-weight: bold;
  1285. color: $app-surface;
  1286. line-height: 1;
  1287. }
  1288. .user-card-right {
  1289. display: flex;
  1290. flex-direction: column;
  1291. align-items: center;
  1292. gap: 6rpx;
  1293. background: rgba($app-surface, 0.15);
  1294. padding: 12rpx 24rpx;
  1295. border-radius: 16rpx;
  1296. }
  1297. .points-num {
  1298. font-size: calc(36rpx * var(--font-scale, 1));
  1299. font-weight: bold;
  1300. color: $app-surface;
  1301. }
  1302. .points-label {
  1303. font-size: calc(20rpx * var(--font-scale, 1));
  1304. color: rgba($app-surface, 0.7);
  1305. }
  1306. /* 家庭成员速览 */
  1307. .family-strip {
  1308. margin: 0 $uni-space-lg 20rpx;
  1309. background: $app-surface;
  1310. border-radius: 24rpx;
  1311. padding: 20rpx 24rpx 16rpx;
  1312. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1313. }
  1314. .family-strip-header {
  1315. display: flex;
  1316. justify-content: space-between;
  1317. align-items: center;
  1318. margin-bottom: 14rpx;
  1319. }
  1320. .family-strip-title {
  1321. font-size: calc(26rpx * var(--font-scale, 1));
  1322. font-weight: bold;
  1323. color: $facade-text-strong;
  1324. }
  1325. .family-strip-count {
  1326. font-size: calc(22rpx * var(--font-scale, 1));
  1327. color: $facade-text-muted;
  1328. }
  1329. .family-avatars {
  1330. display: flex;
  1331. flex-direction: row;
  1332. align-items: center;
  1333. gap: 16rpx;
  1334. overflow-x: auto;
  1335. padding-bottom: 4rpx;
  1336. }
  1337. .family-avatar-item {
  1338. display: flex;
  1339. flex-direction: column;
  1340. align-items: center;
  1341. gap: 6rpx;
  1342. flex-shrink: 0;
  1343. }
  1344. .family-avatar-wrap {
  1345. width: 72rpx;
  1346. height: 72rpx;
  1347. border-radius: 50%;
  1348. background: $facade-fill;
  1349. display: flex;
  1350. align-items: center;
  1351. justify-content: center;
  1352. overflow: hidden;
  1353. position: relative;
  1354. }
  1355. .family-avatar-img {
  1356. width: 72rpx;
  1357. height: 72rpx;
  1358. border-radius: 50%;
  1359. }
  1360. .family-avatar-text {
  1361. font-size: calc(28rpx * var(--font-scale, 1));
  1362. color: $facade-text-body;
  1363. }
  1364. .family-avatar-wrap.family-avatar-add {
  1365. background: $facade-fill-warm-gray;
  1366. border: 2rpx dashed $facade-text-ghost;
  1367. }
  1368. .family-avatar-plus {
  1369. font-size: calc(36rpx * var(--font-scale, 1));
  1370. color: $facade-text-muted;
  1371. }
  1372. .family-avatar-tag {
  1373. position: absolute;
  1374. bottom: -4rpx;
  1375. right: -4rpx;
  1376. font-size: calc(14rpx * var(--font-scale, 1));
  1377. padding: 2rpx 6rpx;
  1378. border-radius: 8rpx;
  1379. color: $app-surface;
  1380. }
  1381. .family-avatar-tag.tag-parent { background: $dim-wisdom; }
  1382. .family-avatar-tag.tag-child { background: $brand-primary; }
  1383. .family-avatar-tag.tag-teacher { background: $dim-action; }
  1384. .family-avatar-tag.tag-member { background: $c-text-gray-400; }
  1385. .family-avatar-name {
  1386. font-size: calc(20rpx * var(--font-scale, 1));
  1387. color: $facade-text-body;
  1388. white-space: nowrap;
  1389. }
  1390. /* 个人成就 */
  1391. .achievement-section {
  1392. margin: 0 $uni-space-lg 20rpx;
  1393. background: $app-surface;
  1394. border-radius: 24rpx;
  1395. padding: 24rpx;
  1396. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1397. }
  1398. .section-header-row {
  1399. display: flex;
  1400. justify-content: space-between;
  1401. align-items: baseline;
  1402. margin-bottom: 16rpx;
  1403. }
  1404. .section-title {
  1405. font-size: calc(28rpx * var(--font-scale, 1));
  1406. font-weight: bold;
  1407. color: $facade-text-strong;
  1408. }
  1409. .section-sub {
  1410. font-size: calc(22rpx * var(--font-scale, 1));
  1411. color: $facade-text-muted;
  1412. }
  1413. .achievement-grid {
  1414. display: flex;
  1415. flex-wrap: wrap;
  1416. gap: 0;
  1417. }
  1418. .ach-item {
  1419. width: 25%;
  1420. display: flex;
  1421. flex-direction: column;
  1422. align-items: center;
  1423. gap: 6rpx;
  1424. padding: 10rpx 0;
  1425. }
  1426. .ach-icon-wrap {
  1427. width: 64rpx;
  1428. height: 64rpx;
  1429. border-radius: 50%;
  1430. display: flex;
  1431. align-items: center;
  1432. justify-content: center;
  1433. margin-bottom: 4rpx;
  1434. }
  1435. .ach-icon {
  1436. font-size: calc(32rpx * var(--font-scale, 1));
  1437. line-height: 1;
  1438. }
  1439. .ach-num {
  1440. font-size: calc(28rpx * var(--font-scale, 1));
  1441. font-weight: bold;
  1442. color: $facade-text-strong;
  1443. line-height: 1;
  1444. }
  1445. .ach-label {
  1446. font-size: calc(20rpx * var(--font-scale, 1));
  1447. color: $facade-text-muted;
  1448. line-height: 1;
  1449. }
  1450. /* 我的团队网格:3 列(我的团队 / 推广收益 / 邀请成员)等宽,保持既有视觉协调 */
  1451. .achievement-grid.team-grid .ach-item {
  1452. width: 33.33%;
  1453. }
  1454. /* 我的成就网格:5 列固定等分(连续打卡/完成任务/收集勋章/成长记录/参加挑战) */
  1455. .achievement-grid.cols-5 .ach-item {
  1456. width: 20%;
  1457. }
  1458. /* 我的订单(电商风格) */
  1459. .order-section {
  1460. margin: 0 $uni-space-lg 20rpx;
  1461. }
  1462. .order-section-header {
  1463. display: flex;
  1464. align-items: center;
  1465. justify-content: space-between;
  1466. margin-bottom: 14rpx;
  1467. }
  1468. .order-all-link {
  1469. font-size: calc(24rpx * var(--font-scale, 1));
  1470. color: $facade-text-muted;
  1471. }
  1472. .order-card {
  1473. background: $app-surface;
  1474. border-radius: 24rpx;
  1475. padding: 24rpx 12rpx;
  1476. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  1477. }
  1478. .order-grid {
  1479. display: flex;
  1480. flex-wrap: wrap;
  1481. }
  1482. .order-grid-item {
  1483. width: 20%;
  1484. display: flex;
  1485. flex-direction: column;
  1486. align-items: center;
  1487. gap: 10rpx;
  1488. padding: 8rpx 0;
  1489. }
  1490. .order-icon-wrap {
  1491. position: relative;
  1492. width: 64rpx;
  1493. height: 64rpx;
  1494. display: flex;
  1495. align-items: center;
  1496. justify-content: center;
  1497. }
  1498. .order-icon {
  1499. font-size: calc(40rpx * var(--font-scale, 1));
  1500. line-height: 1;
  1501. }
  1502. .order-badge {
  1503. position: absolute;
  1504. top: -8rpx;
  1505. right: -14rpx;
  1506. min-width: 30rpx;
  1507. height: 30rpx;
  1508. line-height: 30rpx;
  1509. border-radius: 16rpx;
  1510. background: $status-danger-2;
  1511. color: $app-surface;
  1512. font-size: calc(18rpx * var(--font-scale, 1));
  1513. text-align: center;
  1514. padding: 0 6rpx;
  1515. }
  1516. .order-grid-text {
  1517. font-size: calc(22rpx * var(--font-scale, 1));
  1518. color: $facade-text-body;
  1519. line-height: 1;
  1520. }
  1521. .order-extra-row {
  1522. display: flex;
  1523. align-items: center;
  1524. margin-top: 20rpx;
  1525. padding-top: 20rpx;
  1526. border-top: 1rpx solid $c-fill-2b;
  1527. }
  1528. .order-extra-item {
  1529. flex: 1;
  1530. display: flex;
  1531. align-items: center;
  1532. justify-content: center;
  1533. gap: 8rpx;
  1534. }
  1535. .order-extra-icon {
  1536. font-size: calc(28rpx * var(--font-scale, 1));
  1537. }
  1538. .order-extra-text {
  1539. font-size: calc(24rpx * var(--font-scale, 1));
  1540. color: $facade-text-strong;
  1541. }
  1542. .order-extra-badge {
  1543. min-width: 30rpx;
  1544. height: 30rpx;
  1545. line-height: 30rpx;
  1546. border-radius: 16rpx;
  1547. background: $brand-primary;
  1548. color: $app-surface;
  1549. font-size: calc(18rpx * var(--font-scale, 1));
  1550. text-align: center;
  1551. padding: 0 6rpx;
  1552. }
  1553. .order-extra-divider {
  1554. width: 1rpx;
  1555. height: 30rpx;
  1556. background: $c-fill-2b;
  1557. }
  1558. /* 规划师服务中心入口 */
  1559. .service-center-section {
  1560. margin: 0 $uni-space-lg 20rpx;
  1561. }
  1562. .service-center-card {
  1563. background: linear-gradient(135deg, $brand-primary 0%, $brand-primary-light 100%);
  1564. border-radius: 24rpx;
  1565. padding: 24rpx;
  1566. display: flex;
  1567. align-items: center;
  1568. gap: 20rpx;
  1569. box-shadow: 0 4rpx 16rpx rgba($brand-primary, 0.25);
  1570. }
  1571. .service-center-card.disabled-card {
  1572. background: linear-gradient(135deg, $uni-border-color-light, $app-text-subtle);
  1573. box-shadow: none;
  1574. opacity: 0.8;
  1575. }
  1576. .service-center-icon {
  1577. font-size: calc(48rpx * var(--font-scale, 1));
  1578. }
  1579. .service-center-info {
  1580. flex: 1;
  1581. }
  1582. .service-center-title {
  1583. font-size: calc(30rpx * var(--font-scale, 1));
  1584. font-weight: bold;
  1585. color: $app-surface;
  1586. display: block;
  1587. }
  1588. .service-center-desc {
  1589. font-size: calc(22rpx * var(--font-scale, 1));
  1590. color: rgba($app-surface, 0.8);
  1591. margin-top: 6rpx;
  1592. display: block;
  1593. }
  1594. .service-center-card.disabled-card .service-center-title {
  1595. color: $app-surface;
  1596. }
  1597. .service-center-card.disabled-card .service-center-desc {
  1598. color: rgba($app-surface, 0.9);
  1599. }
  1600. .service-center-arrow {
  1601. font-size: calc(40rpx * var(--font-scale, 1));
  1602. color: $app-surface;
  1603. }
  1604. /* 设置 + 退出 */
  1605. .bottom-menu-section {
  1606. margin: 0 $uni-space-lg;
  1607. padding-bottom: 20rpx;
  1608. }
  1609. .menu-row {
  1610. width: 100%;
  1611. background: $app-surface;
  1612. border-radius: 16rpx;
  1613. padding: 24rpx;
  1614. display: flex;
  1615. align-items: center;
  1616. gap: 14rpx;
  1617. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
  1618. margin-bottom: 20rpx;
  1619. }
  1620. .menu-row-icon {
  1621. font-size: calc(30rpx * var(--font-scale, 1));
  1622. }
  1623. .menu-row-text {
  1624. flex: 1;
  1625. font-size: calc(26rpx * var(--font-scale, 1));
  1626. color: $facade-text-strong;
  1627. }
  1628. .menu-row-sub {
  1629. font-size: calc(24rpx * var(--font-scale, 1));
  1630. color: $facade-text-muted;
  1631. margin-right: 8rpx;
  1632. }
  1633. .menu-row-arrow {
  1634. font-size: calc(28rpx * var(--font-scale, 1));
  1635. color: $facade-text-ghost;
  1636. }
  1637. .logout-btn {
  1638. width: 100%;
  1639. background: $app-surface;
  1640. border-radius: 16rpx;
  1641. padding: 24rpx;
  1642. text-align: center;
  1643. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
  1644. }
  1645. .logout-text {
  1646. font-size: calc(26rpx * var(--font-scale, 1));
  1647. color: $status-danger-2;
  1648. font-weight: 500;
  1649. }
  1650. /* 团队邀请:透明原生分享按钮,绝对定位铺满父入口,仅由微信接管点击、不改变任何视觉。
  1651. 彻底重置 uni-app <button> 默认样式(margin/padding/line-height/border/背景),
  1652. 用 opacity:0 而非 display:none(后者会使按钮不可点击)。父入口需为定位上下文。 */
  1653. .share-overlay-btn {
  1654. position: absolute;
  1655. left: 0;
  1656. top: 0;
  1657. width: 100%;
  1658. height: 100%;
  1659. margin: 0;
  1660. padding: 0;
  1661. border: none;
  1662. border-radius: inherit;
  1663. background: transparent;
  1664. line-height: 1;
  1665. font-size: 0;
  1666. opacity: 0;
  1667. z-index: 2;
  1668. }
  1669. .share-overlay-btn::after {
  1670. border: none;
  1671. }
  1672. /* 网格「邀请成员」项作为透明分享按钮的定位上下文;项本身已是 flex 布局,仅补定位 */
  1673. .ach-item-share {
  1674. position: relative;
  1675. overflow: hidden;
  1676. }
  1677. /* 分享推广码浮动按钮 */
  1678. .share-qr-float {
  1679. position: fixed;
  1680. top: 180rpx;
  1681. right: 30rpx;
  1682. width: 80rpx;
  1683. height: 80rpx;
  1684. border-radius: 50%;
  1685. background: $app-surface;
  1686. box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.15);
  1687. display: flex;
  1688. align-items: center;
  1689. justify-content: center;
  1690. z-index: 99;
  1691. }
  1692. /* 二维码图标(纯 CSS 绘制,不依赖 emoji 字体) */
  1693. .qr-glyph {
  1694. position: relative;
  1695. width: 46rpx;
  1696. height: 46rpx;
  1697. }
  1698. .qr-eye {
  1699. position: absolute;
  1700. width: 16rpx;
  1701. height: 16rpx;
  1702. border: 4rpx solid $uni-text-color;
  1703. border-radius: 8rpx;
  1704. box-sizing: border-box;
  1705. }
  1706. .qr-eye-tl { left: 0; top: 0; }
  1707. .qr-eye-tr { right: 0; top: 0; }
  1708. .qr-eye-bl { left: 0; bottom: 0; }
  1709. .qr-mid {
  1710. position: absolute;
  1711. left: 20rpx;
  1712. top: 20rpx;
  1713. width: 7rpx;
  1714. height: 7rpx;
  1715. background: $uni-text-color;
  1716. border-radius: 8rpx;
  1717. }
  1718. .qr-cluster {
  1719. position: absolute;
  1720. right: 0;
  1721. bottom: 0;
  1722. width: 18rpx;
  1723. display: flex;
  1724. flex-wrap: wrap;
  1725. }
  1726. .qr-pip {
  1727. width: 7rpx;
  1728. height: 7rpx;
  1729. margin: 1rpx;
  1730. background: $uni-text-color;
  1731. border-radius: 8rpx;
  1732. }
  1733. </style>