index.vue 95 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900
  1. <template>
  2. <view>
  3. <!-- 冷启动 splash overlay — 覆盖首页直到数据加载完毕(tab 切回时不显示) -->
  4. <view class="splash-overlay" :class="{'fade-out': splashOverlayFading}" v-if="splashOverlay || splashOverlayFading">
  5. <view class="splash-overlay-bg">
  6. <view class="bg-circle bg-circle-1"></view>
  7. <view class="bg-circle bg-circle-2"></view>
  8. <view class="bg-circle bg-circle-3"></view>
  9. </view>
  10. <view class="splash-overlay-body">
  11. <view class="splash-logo-wrap">
  12. <image class="splash-logo-img" src="/static/logo.png" mode="aspectFit" />
  13. </view>
  14. <text class="splash-brand-name">浠艾福</text>
  15. <text class="splash-brand-en">Care Family</text>
  16. <view class="splash-dims-row">
  17. <view class="splash-dim-item">
  18. <view class="splash-dim-circle" style="background:rgba(255,140,66,0.3);"><text class="splash-dim-icon">🌏</text></view>
  19. <text class="splash-dim-label">身</text>
  20. </view>
  21. <view class="splash-dim-item">
  22. <view class="splash-dim-circle" style="background:rgba(255,107,157,0.3);"><text class="splash-dim-icon">🔥</text></view>
  23. <text class="splash-dim-label">心</text>
  24. </view>
  25. <view class="splash-dim-item">
  26. <view class="splash-dim-circle" style="background:rgba(99,102,241,0.3);"><text class="splash-dim-icon">⚡</text></view>
  27. <text class="splash-dim-label">智</text>
  28. </view>
  29. <view class="splash-dim-item">
  30. <view class="splash-dim-circle" style="background:rgba(16,185,129,0.3);"><text class="splash-dim-icon">🌿</text></view>
  31. <text class="splash-dim-label">行</text>
  32. </view>
  33. <view class="splash-dim-item">
  34. <view class="splash-dim-circle" style="background:rgba(245,158,11,0.3);"><text class="splash-dim-icon">💧</text></view>
  35. <text class="splash-dim-label">富</text>
  36. </view>
  37. </view>
  38. <text class="splash-tagline">给全家的一站式幸福提案</text>
  39. <view class="splash-overlay-loading">
  40. <view class="splash-overlay-dot"></view>
  41. <view class="splash-overlay-dot"></view>
  42. <view class="splash-overlay-dot"></view>
  43. </view>
  44. </view>
  45. </view>
  46. <!-- 登录态 — 直接内嵌,保持底签可见 -->
  47. <view v-if="currentRole" class="logged-in-container">
  48. <!-- ⓪ 新手成长礼包进度条(新用户引导,全部领取后自动隐藏) -->
  49. <OnboardingProgressBar ref="onboardingProgress" />
  50. <!-- ① 了解区 — 自测大卡(首屏,引导"从了解开始") -->
  51. <view class="self-test-card" @click="goSelfTest">
  52. <view class="self-test-head">
  53. <text class="self-test-icon">⚡</text>
  54. <view class="self-test-info">
  55. <text class="self-test-title">{{ selfTestTitle }}</text>
  56. <text class="self-test-sub">{{ selfTestSub }}</text>
  57. <text v-if="pendingSurveys.length > 0" class="self-test-badge">有 {{ pendingSurveys.length }} 项调研待填</text>
  58. </view>
  59. <text class="self-test-arrow">›</text>
  60. </view>
  61. </view>
  62. <!-- ①.b 行动引导条 — Next Best Action(仅登录态展示,定位"现在该做的一件事") -->
  63. <view v-if="nextBestAction" class="guide-bar" :class="'guide-bar-' + nextBestAction.color" @click="onGuideTap(nextBestAction)">
  64. <view class="guide-bar-icon-wrap">
  65. <text class="guide-bar-icon">{{ nextBestAction.icon }}</text>
  66. </view>
  67. <view class="guide-bar-info">
  68. <text class="guide-bar-title">{{ nextBestAction.title }}</text>
  69. <text class="guide-bar-sub">{{ nextBestAction.sub }}</text>
  70. </view>
  71. <view class="guide-bar-btn">
  72. <text class="guide-bar-btn-text">{{ nextBestAction.btn }} ›</text>
  73. </view>
  74. </view>
  75. <!-- ② 发现区 — 能量沙盘 — Canvas 五行星图(未测评时显示引导卡) -->
  76. <GateLock v-if="sandboxLocked && sandboxLockGate" :gate="sandboxLockGate" />
  77. <WuxingSandbox
  78. v-else-if="sandboxData"
  79. mode="live"
  80. :scores="familySandboxScores"
  81. :overallScore="familySandboxOverall"
  82. :members="familySandboxMembers"
  83. :personalData="sandboxPersonalData"
  84. :dimensions="energyDimensions"
  85. :totalEnergy="totalEnergy"
  86. :totalHealthIndex="totalHealthIndex"
  87. :currentView="currentSandboxView"
  88. :familyUnlocked="familyUnlocked"
  89. :memberCount="familyMembersVisible.length"
  90. @view-change="onSandboxViewChange"
  91. showDimensionBar
  92. starHeight="480rpx" />
  93. <!-- ② 发现区 — 上传报告 -->
  94. <FamilyFeed
  95. :items="familyFeed"
  96. :notices="notices"
  97. :showHeader="true" />
  98. <!-- 能量/积分/CF值变更通知 - 从下滑动展示 -->
  99. <view v-if="showEnergyBadge || showPointsBadge || showCfBadge" class="change-notification-bar" :class="{ 'visible': isNotificationVisible }" @click="handleNotificationClick">
  100. <view v-if="showEnergyBadge" class="change-item energy" @click.stop="onEnergyClick">{{ formatEnergyNotification }}</view>
  101. <view v-if="showPointsBadge" class="change-item points" @click.stop="onPointsClick">{{ formatPointsNotification }}</view>
  102. <view v-if="showCfBadge" class="change-item cf" @click.stop="onCfClick">{{ formatCfNotification }}</view>
  103. <view class="change-dismiss" @click="dismissAll">✕</view>
  104. </view>
  105. <!-- ④ 内容区 — 推荐文章 -->
  106. <view v-if="showMemberEntry" class="member-entry" @click="goMembership">
  107. <view class="member-entry-icon-wrap">
  108. <text class="member-entry-icon">👑</text>
  109. </view>
  110. <view class="member-entry-texts">
  111. <text class="member-entry-title">{{ memberEntryTitle }}</text>
  112. <text class="member-entry-desc">{{ memberEntryDesc }}</text>
  113. </view>
  114. <view class="member-entry-btn">
  115. <text class="member-entry-btn-text">{{ memberEntryBtn }}</text>
  116. </view>
  117. </view>
  118. <!-- ④ 内容区 — 快捷功能入口(动态渲染,可在应用库自定义) -->
  119. <view class="section">
  120. <view class="section-header">
  121. <text class="section-title">⚡ 快捷功能</text>
  122. <text class="section-more" @click="goAppLibrary">应用库 ›</text>
  123. </view>
  124. <view class="quick-bar">
  125. <view class="quick-item" v-for="(app, idx) in quickApps" :key="app.key" @click="onQuickTap(app)">
  126. <view class="quick-icon" :style="getQuickIconStyle(idx)"><text>{{ app.icon }}</text></view>
  127. <text class="quick-label">{{ app.name }}</text>
  128. </view>
  129. <view class="quick-item" v-if="quickApps.length === 0" @click="goAppLibrary">
  130. <view class="quick-icon" style="background:rgba(99,102,241,0.15)"><text>+</text></view>
  131. <text class="quick-label">去添加</text>
  132. </view>
  133. </view>
  134. </view>
  135. <!-- ④ 内容区 — 家庭动态 -->
  136. <view v-if="hasPendingTasks" class="section">
  137. <view class="section-header">
  138. <text class="section-title">📝 我的任务</text>
  139. <text class="section-more" @click="navTo('/pages/tasks/tasks')">全部 ›</text>
  140. </view>
  141. <view class="task-quick-list">
  142. <view
  143. v-for="task in pendingTasks"
  144. :key="task.id"
  145. class="task-quick-item"
  146. >
  147. <view class="task-quick-info">
  148. <text class="task-quick-title line-clamp-1">{{ task.title }}</text>
  149. <text class="task-quick-meta">+{{ task.points }}分</text>
  150. </view>
  151. <button class="btn-quick-complete" @click="quickCompleteTask(task)">完成</button>
  152. </view>
  153. </view>
  154. </view>
  155. <!-- ③ 行动区 — 家庭挑战任务 -->
  156. <view class="section">
  157. <view class="section-header">
  158. <text class="section-title">🔥 家庭挑战</text>
  159. <text class="section-more" @click="goChallengeManage">管理 ›</text>
  160. </view>
  161. <FamilyChallengeCard
  162. v-for="ch in activeChallenges"
  163. :key="ch.id"
  164. :challenge="ch"
  165. :showCheckin="showCheckinBtn"
  166. @checkin="onChallengeCheckin"
  167. @respond="onChallengeRespond"
  168. @cardClick="goChallengeManage(ch.id)" />
  169. <view v-if="activeChallenges.length === 0" class="challenge-empty">
  170. <text class="challenge-empty-icon">🏆</text>
  171. <text class="challenge-empty-text">您还没有挑战,去添加吧</text>
  172. <button class="challenge-add-btn" @click="goChallengeManage">去添加</button>
  173. </view>
  174. </view>
  175. <!-- ③ 行动区 — 会员入口:非会员显示开通 / 快到期显示续费 -->
  176. <DailyTaskCard />
  177. <!-- ③ 行动区 — 我的任务(仅当有待完成时显示) -->
  178. <view class="section">
  179. <ReportUploadCard
  180. title="上传报告"
  181. desc="体检报告 · 菌群检测 · 认知测评 · 心理测评 · 情绪打卡"
  182. :tags="['体检报告', '菌群检测', '认知测评', '心理测评', '情绪打卡']"
  183. @click="goToUploadReport" />
  184. </view>
  185. <!-- ③ 行动区 — 今日任务 -->
  186. <view class="section">
  187. <view class="section-header">
  188. <text class="section-title">📖 推荐阅读</text>
  189. <text class="section-more" @click="goMoreArticles">更多 ›</text>
  190. </view>
  191. <ArticleBookshelf
  192. :articles="actionArticles"
  193. :isLoggedIn="true"
  194. @articleClick="goArticleDetail" />
  195. </view>
  196. <!-- ④ 内容区 — 推荐商品 -->
  197. <view class="section">
  198. <view class="section-header">
  199. <text class="section-title">🛍️ 推荐商品</text>
  200. <text class="section-more" @click="goMoreProducts">更多 ›</text>
  201. </view>
  202. <DimensionProducts
  203. :isLoggedIn="true"
  204. :showMore="false"
  205. @productClick="goProductDetail" />
  206. </view>
  207. <!-- 底部占位 -->
  208. <view class="bottom-spacer" style="height: 40rpx;"></view>
  209. <!-- 首次登录引导浮层(3 步产品介绍,看过一次后不再弹) -->
  210. <OnboardingGuide
  211. :role="currentRole"
  212. :show="showOnboardingGuide"
  213. position="home"
  214. @close="closeOnboardingGuide" />
  215. <!-- 配置驱动弹窗(guide_popup 表,管理端可配置) -->
  216. <ConfigurableGuide
  217. :popup="guidePopup"
  218. :show="showGuidePopup"
  219. @done="handleGuidePopupDone" />
  220. </view>
  221. <!-- 未登录态 — 发现页/引流内容,直接内嵌,不跳转 -->
  222. <view v-else class="discover-container">
  223. <!-- 品牌 Hero 区 -->
  224. <view class="hero-section">
  225. <image class="hero-logo" src="/static/logo.png" mode="aspectFit" />
  226. <text class="hero-name">浠艾福</text>
  227. <text class="hero-identity">您的专属家庭主动健康管理师</text>
  228. <text class="hero-slogan">家里每个人的状态,你真的看见了?</text>
  229. <text class="hero-powered">亿图腾科技出品</text>
  230. <view class="hero-dims">
  231. <view class="hero-dim"><text class="hero-dim-emoji">🌏</text><text class="hero-dim-label">身·根基</text></view>
  232. <view class="hero-dim"><text class="hero-dim-emoji">⚡</text><text class="hero-dim-label">智·赋能</text></view>
  233. <view class="hero-dim"><text class="hero-dim-emoji">💧</text><text class="hero-dim-label">富·创富</text></view>
  234. <view class="hero-dim"><text class="hero-dim-emoji">🌿</text><text class="hero-dim-label">行·和谐</text></view>
  235. <view class="hero-dim"><text class="hero-dim-emoji">🔥</text><text class="hero-dim-label">心·大爱</text></view>
  236. </view>
  237. <text class="hero-sub-slogan">孩子的习惯、老人的身体、自己的精力——不用等到出问题才着急。先看见,先了解,不等问题发生。</text>
  238. <button class="hero-cta-btn" @click="handleLogin">免费体验 · 登录 / 注册</button>
  239. </view>
  240. <!-- ② 平台作用·价值主张 -->
  241. <view class="value-prop-section">
  242. <text class="value-prop-title">为什么选择浠艾福?</text>
  243. <view class="value-prop-grid">
  244. <view class="value-prop-card">
  245. <text class="value-prop-icon">🧪</text>
  246. <view class="value-prop-texts">
  247. <text class="value-prop-name">免费五维测评</text>
  248. <text class="value-prop-desc">从身体到心智,20 分钟看清全家健康状况</text>
  249. </view>
  250. </view>
  251. <view class="value-prop-card">
  252. <text class="value-prop-icon">🎯</text>
  253. <view class="value-prop-texts">
  254. <text class="value-prop-name">个性化成长方案</text>
  255. <text class="value-prop-desc">基于测评数据,AI+专家定制专属行动计划</text>
  256. </view>
  257. </view>
  258. <view class="value-prop-card">
  259. <text class="value-prop-icon">👨‍👩‍👧</text>
  260. <view class="value-prop-texts">
  261. <text class="value-prop-name">全家共管</text>
  262. <text class="value-prop-desc">一个家庭一张网,三代同框、全员参与,成长看得见</text>
  263. </view>
  264. </view>
  265. <view class="value-prop-card">
  266. <text class="value-prop-icon">📈</text>
  267. <view class="value-prop-texts">
  268. <text class="value-prop-name">任务与积分激励</text>
  269. <text class="value-prop-desc">把健康管理变成每天的小行动,习惯自然养成</text>
  270. </view>
  271. </view>
  272. </view>
  273. </view>
  274. <!-- ③ 三步上手 -->
  275. <view class="how-it-works">
  276. <text class="how-it-works-title">三步开启全家健康之旅</text>
  277. <view class="step-row">
  278. <view class="step-item">
  279. <view class="step-num">1</view>
  280. <text class="step-name">登录/注册</text>
  281. <text class="step-sub">(30 秒)</text>
  282. </view>
  283. <view class="step-arrow">›</view>
  284. <view class="step-item">
  285. <view class="step-num">2</view>
  286. <text class="step-name">完成五维测评</text>
  287. <text class="step-sub">(全家各一份)</text>
  288. </view>
  289. <view class="step-arrow">›</view>
  290. <view class="step-item">
  291. <view class="step-num">3</view>
  292. <text class="step-name">获得专属方案</text>
  293. <text class="step-sub">(照着做,持续优化)</text>
  294. </view>
  295. </view>
  296. </view>
  297. <!-- 五行沙盘预览 -->
  298. <wuxing-sandbox mode="preview" badgeText="登录查看完整报告" @point-click="handleLogin" />
  299. <!-- 热门活动(无条件展示) -->
  300. <view class="section">
  301. <view class="section-header">
  302. <text class="section-title">🔥 热门活动</text>
  303. <text class="section-more" @click="goActivities">查看更多 ›</text>
  304. </view>
  305. <view v-if="dimensionActivities.length === 0" class="empty-state" style="padding: 40rpx 0;">
  306. <text class="empty-text">暂无活动</text>
  307. </view>
  308. <view class="activity-list" v-else>
  309. <view class="activity-card" v-for="act in dimensionActivities" :key="act.id" @click="goActivityDetail(act)">
  310. <image class="activity-cover" :src="getImageUrl(act.coverImage) || '/static/default-activity.png'" mode="aspectFill" />
  311. <view class="activity-info">
  312. <text class="activity-name line-clamp-1">{{ act.title }}</text>
  313. <view class="activity-meta">
  314. <text class="activity-time">{{ act.startTime }}</text>
  315. </view>
  316. <view class="activity-bottom">
  317. <text class="activity-status" :class="'status-' + (act.status || 'upcoming')">{{ act.status === 'ongoing' ? '进行中' : act.status === 'ended' ? '已结束' : '即将开始' }}</text>
  318. <text class="activity-fee" v-if="act.price && act.price > 0">¥{{ (act.price / 100).toFixed(0) }}</text>
  319. <text class="activity-fee fee-free" v-else>免费</text>
  320. </view>
  321. </view>
  322. </view>
  323. </view>
  324. </view>
  325. <!-- 推荐阅读(无条件展示) -->
  326. <view class="section">
  327. <view class="section-header">
  328. <text class="section-title">📖 推荐阅读</text>
  329. <text class="section-more" @click="goArticles">更多 ›</text>
  330. </view>
  331. <view class="article-list">
  332. <view v-if="articlesLoading" class="loading-state" style="padding: 40rpx 0;">
  333. <text class="loading-text">加载中...</text>
  334. </view>
  335. <!-- 无数据时显示占位卡片 -->
  336. <template v-else-if="indexArticles.length === 0">
  337. <view class="article-card" v-for="(item, i) in [1,2,3]" :key="i">
  338. <view class="article-category" :style="{ background: gradientColors[(i-1) % gradientColors.length] }">
  339. <text class="article-category-text">推荐文章</text>
  340. </view>
  341. <text class="article-title">暂无推荐文章</text>
  342. <text class="article-summary">精彩内容即将上线,敬请期待</text>
  343. <view class="article-meta">
  344. <view class="meta-item">
  345. <text class="meta-icon">&#x1F4D6;</text>
  346. <text class="meta-text">0</text>
  347. </view>
  348. <text class="article-date">--</text>
  349. </view>
  350. </view>
  351. </template>
  352. <!-- 有数据时显示文章卡片 -->
  353. <template v-else>
  354. <view class="article-card" v-for="article in indexArticles" :key="article.id" @click="goArticleDetail(article.id)">
  355. <view class="article-category" :style="{ background: article.categoryColor }">
  356. <text class="article-category-text">{{ article.category }}</text>
  357. </view>
  358. <text class="article-title">{{ article.title }}</text>
  359. <text class="article-summary">{{ article.summary }}</text>
  360. <view class="article-meta">
  361. <view class="meta-item">
  362. <text class="meta-icon">&#x1F4D6;</text>
  363. <text class="meta-text">{{ article.views }}</text>
  364. </view>
  365. <text class="article-date">{{ article.date }}</text>
  366. </view>
  367. </view>
  368. </template>
  369. </view>
  370. </view>
  371. <!-- 底部登录按钮 -->
  372. <view class="login-footer">
  373. <button class="login-btn" @click="handleLogin">登录 / 注册</button>
  374. </view>
  375. <!-- 底部占位 -->
  376. <view style="height: 120rpx;"></view>
  377. </view>
  378. </view>
  379. </template>
  380. <script>
  381. import store from '../../store/index.js'
  382. import WuxingSandbox from '../../components/wuxing-sandbox.vue'
  383. import GateLock from '../../components/gate-lock.vue'
  384. import FamilyFeed from '../../components/FamilyFeed.vue'
  385. import DimensionProducts from '../../components/DimensionProducts.vue'
  386. import ArticleBookshelf from '../../components/ArticleBookshelf.vue'
  387. import FamilyChallengeCard from '../../components/FamilyChallengeCard.vue'
  388. import DailyTaskCard from '../../components/daily-task-card.vue'
  389. import ReportUploadCard from '../../components/report-upload-card.vue'
  390. import OnboardingProgressBar from '../../components/OnboardingProgressBar.vue'
  391. import OnboardingGuide from '../../components/OnboardingGuide.vue'
  392. import ConfigurableGuide from '../../components/ConfigurableGuide.vue'
  393. import { acceptParentInvite, getActivityList, getFeaturedArticles, getEnergySandbox, getEnergyOverview, getFamilyMemberList, getChallengeList, getGuideConfig, getGuidePopupList, consumeGuidePopup, switchToFamilyMember, getMyMembership, updateChallengeProgress, respondChallenge, getTodayTasks, completeTask as completeTaskApi, getTodayParentTasks, completeParentTask as completeParentTaskApi, getTaskHistory, getNotices, getNotificationList, getSurveyStatus, getSelfCheckStatus, getReferralCode, extractReferralCode, getAppLibrary, reportAppEnter, getEnergyLogs, getPointsLogs, getCfList, getCfSummary } from '../../utils/api.js'
  394. import { findAppByKey, getShortcutableApps } from '../../utils/app-library.js'
  395. import nav from '../../utils/nav.js'
  396. import config from '@/config.js'
  397. import { parseDate } from '../../utils/format.js'
  398. export default {
  399. components: {
  400. WuxingSandbox,
  401. GateLock,
  402. FamilyFeed,
  403. DimensionProducts,
  404. ArticleBookshelf,
  405. FamilyChallengeCard,
  406. DailyTaskCard,
  407. ReportUploadCard,
  408. OnboardingProgressBar,
  409. OnboardingGuide,
  410. ConfigurableGuide,
  411. },
  412. data() {
  413. // 从 storage 预取登录态/角色,确保首次渲染即正确(WeChat 渲染层/逻辑层分离架构下 onLoad 执行前已渲染)
  414. var _token = uni.getStorageSync('token')
  415. var _currentRole = ''
  416. if (_token) {
  417. _currentRole = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || ''
  418. }
  419. // 冷启动标记(由 App.vue onLaunch 设置,仅在冷启动时存在)
  420. var _isFirstLaunch = (uni.getStorageSync('_showSplashOverlay') === '1')
  421. return {
  422. currentRole: _currentRole,
  423. // splash loading overlay(冷启动时展示,数据加载完关闭)
  424. splashOverlay: _isFirstLaunch,
  425. splashOverlayFading: false,
  426. _splashReady: false,
  427. _watchPageReadyDone: false,
  428. pendingSurveys: [],
  429. selfCheckScore: null,
  430. selfCheckLoading: false,
  431. showOnboardingGuide: false,
  432. _onboardingGuideAttempted: false,
  433. guidePopup: null,
  434. showGuidePopup: false,
  435. _guidePopupAttempted: false,
  436. dimensionActivities: [],
  437. indexArticles: [],
  438. articlesLoading: false,
  439. gradientColors: [
  440. 'linear-gradient(135deg, #10B981, #34D399)',
  441. 'linear-gradient(135deg, #5B9BD5, #8FC5E8)',
  442. 'linear-gradient(135deg, #8B5CF6, #C084FC)',
  443. 'linear-gradient(135deg, #F97316, #FB923C)',
  444. 'linear-gradient(135deg, #6366F1, #818CF8)'
  445. ],
  446. // 登录态数据
  447. familyMembersVisible: [],
  448. // 接口数据是否已检查(避免"暂无数据"闪烁)
  449. childrenChecked: false,
  450. membersChecked: false,
  451. selectedMemberId: null,
  452. sandboxData: null,
  453. sandboxPersonalData: null,
  454. sandboxFamilyData: null,
  455. sandboxLocked: false,
  456. sandboxLockGate: null,
  457. currentSandboxView: 'personal',
  458. familyUnlocked: false,
  459. energyDimensions: [],
  460. totalEnergy: 0,
  461. totalHealthIndex: 0,
  462. articles: [],
  463. children: [],
  464. currentChildId: null,
  465. activeChallenges: [],
  466. pendingTasks: [],
  467. familyFeed: [],
  468. notices: [],
  469. loggedInInitDone: false,
  470. // 会员状态(沙盘下方会员入口使用)
  471. isMember: false,
  472. isLifetime: false,
  473. membershipDays: 0,
  474. // 分享邀请码
  475. referralCode: '',
  476. referralCodeLoaded: false,
  477. // 首页快捷区(应用库自定义)
  478. quickApps: [],
  479. myShortcuts: [],
  480. appUsage: {},
  481. quickLoaded: false,
  482. // 能量/积分/CF值变更通知
  483. energyMessages: [],
  484. pointsMessages: [],
  485. cfMessages: [],
  486. showEnergyBadge: false,
  487. showPointsBadge: false,
  488. showCfBadge: false,
  489. // 通知栏可见性(从下往上滑入)
  490. isNotificationVisible: false
  491. }
  492. },
  493. computed: {
  494. isFamilyAdmin: function() {
  495. if (!this.familyMembersVisible || this.familyMembersVisible.length === 0) return false
  496. // isAdmin 语义为"成员本人是否为家庭创建者";自己(isSelf)是创建者即管理员
  497. var me = this.familyMembersVisible.filter(function(m) { return m.isSelf })[0]
  498. return !!(me && me.isAdmin === true)
  499. },
  500. sandboxScores: function() {
  501. var d = this.sandboxData || {}
  502. return {
  503. body: d.bodyScore || 0,
  504. mind: d.mindScore || 0,
  505. wisdom: d.wisdomScore || 0,
  506. action: d.actionScore || 0,
  507. wealth: d.wealthScore || 0
  508. }
  509. },
  510. familySandboxScores: function() {
  511. var d = this.sandboxFamilyData || {}
  512. return {
  513. body: d.bodyScore || 0,
  514. mind: d.mindScore || 0,
  515. wisdom: d.wisdomScore || 0,
  516. action: d.actionScore || 0,
  517. wealth: d.wealthScore || 0
  518. }
  519. },
  520. familySandboxOverall: function() {
  521. return this.sandboxFamilyData ? (this.sandboxFamilyData.overallScore || 0) : 0
  522. },
  523. familySandboxMembers: function() {
  524. return this.sandboxFamilyData ? (this.sandboxFamilyData.members || []) : []
  525. },
  526. hasPendingTasks: function() {
  527. return (this.pendingTasks && this.pendingTasks.length > 0)
  528. },
  529. actionArticles: function() {
  530. if (!this.articles || this.articles.length === 0) return []
  531. return this.articles.slice(0, 5)
  532. },
  533. // 会员入口显示:非会员显示开通;会员剩余≤30天显示续费
  534. showMemberEntry: function() {
  535. if (!this.isLoggedIn()) return false
  536. if (this.isLifetime) return false
  537. if (!this.isMember) return true
  538. return this.membershipDays > 0 && this.membershipDays <= 30
  539. },
  540. showCheckinBtn: function() {
  541. return (uni.getStorageSync('role') || 'parent') === 'child'
  542. },
  543. memberEntryTitle: function() {
  544. if (this.isLifetime) return '终身会员 · 永久有效'
  545. if (!this.isMember) return '开通会员,解锁全部特权'
  546. return '会员即将到期,续费恢复权益'
  547. },
  548. memberEntryDesc: function() {
  549. if (this.isLifetime) return '享全平台权益,无需续费'
  550. if (!this.isMember) return '享专属折扣 · 成长服务 · 规划指导'
  551. return '剩余 ' + this.membershipDays + ' 天,续费保持权益不中断'
  552. },
  553. memberEntryBtn: function() {
  554. if (this.isLifetime) return '已拥有'
  555. return this.isMember ? '立即续费' : '立即开通'
  556. },
  557. // 自测大卡:已有数据(沙盘解锁)显示"再次了解",否则显示引导文案
  558. selfTestTitle: function() {
  559. return this.sandboxData ? '再次了解 · 看看变化' : '先花 1 分钟,了解全家健康状况'
  560. },
  561. selfTestSub: function() {
  562. if (this.sandboxData) {
  563. if (this.selfCheckScore != null) {
  564. return '最近自检得分 ' + this.selfCheckScore + '/45 分 · 点击查看'
  565. }
  566. return '最近综合得分 ' + (this.sandboxData.overallScore || 0) + ' 分 · 点击查看'
  567. }
  568. return '15 题五维自检 · 约 20 秒'
  569. },
  570. // ===== Next Best Action 引导条(C 方案)=====
  571. // 优先级:沙盘未解锁 > 待填调研 > 待办任务 > 未读通知 > 默认引导
  572. // 只展示当前最该做的一件事,未登录态不展示
  573. nextBestAction: function() {
  574. if (!this.currentRole) return null
  575. // 1) 沙盘未解锁 — 最高优先级,引导完成自检
  576. if (this.sandboxLocked) {
  577. return {
  578. type: 'self-check',
  579. icon: '⚡',
  580. title: '先完成五维自检',
  581. sub: '15 题,约 20 秒,解锁全家能量报告',
  582. btn: '去自检',
  583. color: 'orange'
  584. }
  585. }
  586. // 2) 家庭成员为空 — 新用户关键动作,引导添加孩子/家人
  587. if (this.membersChecked && this.familyMembersVisible && this.familyMembersVisible.length <= 1) {
  588. return {
  589. type: 'add-member',
  590. icon: '👨‍👩‍👧',
  591. title: '添加家庭成员',
  592. sub: '邀请家人加入,全家一起开启健康管理',
  593. btn: '去添加',
  594. color: 'blue'
  595. }
  596. }
  597. // 3) 待填调研 — 定期调研是用户的实际行动邀请
  598. if (this.pendingSurveys && this.pendingSurveys.length > 0) {
  599. return {
  600. type: 'survey',
  601. icon: '📝',
  602. title: '有 ' + this.pendingSurveys.length + ' 项调研待填',
  603. sub: '填完解锁下一阶段内容',
  604. btn: '去填写',
  605. color: 'blue'
  606. }
  607. }
  608. // 4) 待办任务 — 用户已完成自检后的执行路径
  609. if (this.pendingTasks && this.pendingTasks.length > 0) {
  610. return {
  611. type: 'task',
  612. icon: '🎯',
  613. title: '今日有 ' + this.pendingTasks.length + ' 项待办',
  614. sub: '完成可累积成长分',
  615. btn: '去完成',
  616. color: 'green'
  617. }
  618. }
  619. // 5) 未读通知 — 私域触达优先
  620. var unreadCount = 0
  621. if (this.notices && this.notices.length) {
  622. for (var i = 0; i < this.notices.length; i++) {
  623. if (this.notices[i] && this.notices[i].unread) unreadCount++
  624. }
  625. }
  626. if (unreadCount > 0) {
  627. return {
  628. type: 'notice',
  629. icon: '📬',
  630. title: '有 ' + unreadCount + ' 条新消息',
  631. sub: '家庭动态、通知、待办提醒',
  632. btn: '查看',
  633. color: 'purple'
  634. }
  635. }
  636. // 6) 默认引导 — 已完成所有任务,指向任务中心
  637. return {
  638. type: 'default',
  639. icon: '✨',
  640. title: '今日任务已清空',
  641. sub: '去任务中心看看,保持成长节奏',
  642. btn: '逛一逛',
  643. color: 'gray'
  644. }
  645. },
  646. // ===== 能量/积分/CF值变更通知格式化(标题带具体数量) =====
  647. formatEnergyNotification: function() {
  648. var total = 0
  649. var arr = this.energyMessages || []
  650. for (var i = 0; i < arr.length; i++) {
  651. total += (arr[i].amount || 0)
  652. }
  653. var sign = total > 0 ? '+' : ''
  654. var first = arr.length > 0 ? arr[0].description : '能量变动'
  655. return '⚡ 能量 ' + sign + total + ' · ' + first
  656. },
  657. formatPointsNotification: function() {
  658. var total = 0
  659. var arr = this.pointsMessages || []
  660. for (var i = 0; i < arr.length; i++) {
  661. total += (arr[i].amount || 0)
  662. }
  663. var sign = total > 0 ? '+' : ''
  664. var first = arr.length > 0 ? arr[0].description : '积分变动'
  665. return '🪙 积分 ' + sign + total + ' · ' + first
  666. },
  667. formatCfNotification: function() {
  668. var total = 0
  669. var arr = this.cfMessages || []
  670. for (var i = 0; i < arr.length; i++) {
  671. total += (arr[i].amount || 0)
  672. }
  673. var sign = total > 0 ? '+' : ''
  674. var first = arr.length > 0 ? arr[0].description : 'CF值变动'
  675. return '💰 CF值 ' + sign + total + ' · ' + first
  676. }
  677. },
  678. onLoad(options) {
  679. this._onLoadFired = true
  680. // 兜底:分享卡直达首页(热启动直通等 App 级捕获未覆盖到的路径)时,
  681. // 新用户把推荐码写入 storage,登录注册后由 login / user-edit 消费绑定推荐人
  682. // 注意:type=parent_invite 的家庭邀请码不存推荐码 storage,避免后续误绑
  683. if (options && !uni.getStorageSync('token')) {
  684. var refCode = options.refCode || options.ref
  685. if (!refCode && options.inviteCode && options.type !== 'parent_invite') {
  686. refCode = options.inviteCode // 兼容老推荐码链接
  687. }
  688. if (refCode) {
  689. uni.setStorageSync('refCode', refCode)
  690. }
  691. }
  692. this._doInit(options)
  693. },
  694. onShow() {
  695. // splash overlay 已在 data() 中根据 storage 标记初始化,此处只需配置关闭条件
  696. if (this.splashOverlay) {
  697. uni.removeStorageSync('_showSplashOverlay')
  698. this._splashLoadCount = 0
  699. this._splashMinPassed = false
  700. var self = this
  701. // 最低展示 800ms
  702. setTimeout(function() {
  703. self._splashMinPassed = true
  704. self._tryHideSplash()
  705. }, 800)
  706. // 最多展示 5s
  707. setTimeout(function() {
  708. if (self.splashOverlay) self._hideSplashOverlay()
  709. }, 5000)
  710. }
  711. // 首次加载:onLoad 已触发 _doInit,此处跳过避免重复调用
  712. // 后续 onShow(切 Tab 返回):刷新易变数据(会员状态、今日任务、挑战列表)
  713. // 关键修复:在 onShow 中也检查 onboarding,兼容 switchTab 后未触发 onLoad 的情况
  714. if (!this.showOnboardingGuide) {
  715. this._maybeShowOnboardingGuide()
  716. }
  717. this.loadGuidePopup()
  718. if (this._onLoadFired) {
  719. this._onLoadFired = false // 清标记,后续 onShow 走刷新路径
  720. } else {
  721. this._refreshOnShow()
  722. }
  723. // 定期调研待办角标(内部自检登录态,未登录静默清空)
  724. this._loadSurveyBadge()
  725. },
  726. methods: {
  727. _checkSplashReady() {
  728. this._splashLoadCount++
  729. this._tryHideSplash()
  730. },
  731. _tryHideSplash() {
  732. if (this.splashOverlayFading) return
  733. if (!this._splashMinPassed) return
  734. if (this.isLoggedIn()) {
  735. // 登录用户:等待子组件的 ready 信号
  736. if (this._splashReady) this._hideSplashOverlay()
  737. } else {
  738. // 游客:等待 3 个 API 全部返回
  739. if (this._splashLoadCount >= 3) this._hideSplashOverlay()
  740. }
  741. },
  742. _hideSplashOverlay() {
  743. if (this.splashOverlayFading) return
  744. this.splashOverlayFading = true
  745. var self = this
  746. setTimeout(function() {
  747. self.splashOverlay = false
  748. self.splashOverlayFading = false
  749. }, 400)
  750. },
  751. // ===== 首页快捷区(应用库自定义) =====
  752. // 排序算法:锁定占位 + 频度填满剩余(最多 6 个)
  753. computeQuickApps: function(myShortcuts, usage) {
  754. var lockedApps = []
  755. var myShortcutsArr = myShortcuts || []
  756. // 1. 锁定应用按 sortOrder 升序
  757. lockedApps = myShortcutsArr.filter(function(s) { return s.locked === 1 })
  758. .sort(function(a, b) { return a.sortOrder - b.sortOrder })
  759. if (lockedApps.length >= 6) {
  760. return lockedApps.slice(0, 6)
  761. }
  762. // 2. 剩余格数:候选 = 可快捷且未被锁定的应用,按频度降序填充
  763. var remaining = 6 - lockedApps.length
  764. var lockedKeys = {}
  765. lockedApps.forEach(function(s) { lockedKeys[s.appKey] = true })
  766. var candidates = getShortcutableApps().filter(function(app) { return !lockedKeys[app.key] })
  767. candidates.sort(function(a, b) {
  768. var ca = (usage && usage[a.key]) || 0
  769. var cb = (usage && usage[b.key]) || 0
  770. return cb - ca
  771. })
  772. return lockedApps.concat(candidates.slice(0, remaining))
  773. },
  774. // 默认 6 个快捷入口(未配置自定义快捷方式时使用)
  775. getDefaultQuickApps: function() {
  776. var defaultKeys = ['task', 'interaction', 'tiandi', 'members', 'circle', 'shop']
  777. var shown = []
  778. defaultKeys.forEach(function(key) {
  779. var app = findAppByKey(key)
  780. if (app) shown.push({ key: app.key, name: app.name, icon: app.icon, route: app.route, locked: 0 })
  781. })
  782. return shown
  783. },
  784. // 后端返回 myShortcuts(含 locked/sortOrder);未配置(myShortcuts 为空)时使用默认 6 个
  785. loadQuickApps: function() {
  786. var self = this
  787. getAppLibrary().then(function(res) {
  788. if (res.code === 200 && res.data) {
  789. self.myShortcuts = res.data.myShortcuts || []
  790. self.appUsage = res.data.usage || {}
  791. var shown = []
  792. if (!self.myShortcuts || self.myShortcuts.length === 0) {
  793. // 用户未配置:使用默认 6 个(不按频度重排)
  794. shown = self.getDefaultQuickApps()
  795. } else {
  796. // 已配置:锁定占位 + 频度填充
  797. var result = self.computeQuickApps(self.myShortcuts, self.appUsage)
  798. result.forEach(function(item) {
  799. var appKey = item.appKey
  800. var app = findAppByKey(appKey)
  801. if (app) {
  802. shown.push({
  803. key: app.key,
  804. name: app.name,
  805. icon: app.icon,
  806. route: app.route,
  807. locked: item.locked
  808. })
  809. }
  810. })
  811. }
  812. self.quickApps = shown
  813. self.quickLoaded = true
  814. }
  815. }).catch(function() {
  816. // 接口失败:回退到默认 6 个
  817. self.quickApps = self.getDefaultQuickApps()
  818. self.quickLoaded = true
  819. })
  820. },
  821. onQuickTap: function(app) {
  822. if (!app || !app.route) return
  823. // 记录进入次数(静默,失败不影响跳转)
  824. if (app.key) {
  825. reportAppEnter(app.key).catch(function() {})
  826. }
  827. this.navTo(app.route)
  828. },
  829. goAppLibrary: function() {
  830. uni.navigateTo({ url: '/pages/home/app-library' })
  831. },
  832. getQuickIconStyle: function(idx) {
  833. var palette = [
  834. 'rgba(99,102,241,0.15)',
  835. 'rgba(16,185,129,0.15)',
  836. 'rgba(139,92,246,0.15)',
  837. 'rgba(245,158,11,0.15)',
  838. 'rgba(255,107,157,0.15)',
  839. 'rgba(249,115,22,0.15)'
  840. ]
  841. return { background: palette[idx % palette.length] }
  842. },
  843. // ===== 登录态数据加载 =====
  844. loadLoggedInData: function() {
  845. this.loadFamilyData()
  846. this.loadReferralCode()
  847. this.loadQuickApps()
  848. this.loadEnergyPointsCFChanges()
  849. },
  850. // 合并原 loadFamilyMembers + loadChildren:仅调用一次 getFamilyMemberList
  851. loadFamilyData: function() {
  852. var self = this
  853. getFamilyMemberList({ visibleOnly: true }).then(function(res) {
  854. if (res.code === 200 && res.data) {
  855. var arr = Array.isArray(res.data) ? res.data : (res.data.list || [])
  856. self.familyMembersVisible = arr
  857. // 过滤出孩子成员(effectiveRole 为 'child' 的成员)
  858. self.children = arr.filter(function(m) { return m.effectiveRole === 'child' })
  859. var savedChildId = uni.getStorageSync('currentChildId')
  860. if (savedChildId) {
  861. self.currentChildId = savedChildId
  862. }
  863. self.loadDimensionData()
  864. }
  865. self.childrenChecked = true
  866. self.membersChecked = true
  867. self.loadTodayTasks()
  868. self.loadFamilyFeed()
  869. self.loadNotices()
  870. self.loadNotifications()
  871. }).catch(function(e) {
  872. console.log('获取家庭成员失败', e)
  873. self.familyMembersVisible = []
  874. self.children = []
  875. self.childrenChecked = true
  876. self.membersChecked = true
  877. })
  878. },
  879. // loadChildren 已废弃:loadFamilyData 统一调用 getFamilyMemberList 一次,
  880. // 从响应中过滤出 effectiveRole==='child' 的成员赋给 this.children。
  881. // 删除了原 loadChildren 方法(调用 getChildren 会重复打 /api/family/member/list)。
  882. loadDimensionData: function() {
  883. this.loadSandboxData()
  884. this.loadEnergyOverview()
  885. this.loadActionArticles()
  886. this.loadChallenges()
  887. this.loadSelfCheckStatus()
  888. },
  889. loadEnergyOverview: function() {
  890. var memberId = this.currentChildId || uni.getStorageSync('currentMemberId')
  891. if (!memberId) return
  892. var self = this
  893. getEnergyOverview(memberId).then(function(res) {
  894. if (res && res.data) {
  895. self.energyDimensions = res.data.dimensions || []
  896. self.totalEnergy = res.data.totalEnergy || 0
  897. self.totalHealthIndex = res.data.totalHealthIndex || 0
  898. }
  899. }).catch(function(e) {
  900. console.log('获取能量概览失败', e)
  901. })
  902. },
  903. loadSandboxData: function() {
  904. var self = this
  905. var memberId = uni.getStorageSync('currentMemberId') || uni.getStorageSync('currentChildId') || null
  906. getEnergySandbox(this.currentSandboxView, memberId).then(function(res) {
  907. if (res && res.data) {
  908. var d = res.data
  909. if (d.locked) {
  910. // 未解锁:显示引导卡(GateLock 渲染自检引导按钮)
  911. self.sandboxLocked = true
  912. self.sandboxLockGate = d.gate || null
  913. self.sandboxData = null
  914. self.sandboxPersonalData = null
  915. self.sandboxFamilyData = null
  916. } else {
  917. self.sandboxLocked = false
  918. self.sandboxLockGate = null
  919. self.sandboxPersonalData = d.personalData || null
  920. self.sandboxFamilyData = d.familyData || null
  921. self.sandboxData = self.currentSandboxView === 'family' ? (d.familyData || null) : (d.personalData || null)
  922. self.familyUnlocked = d.familyUnlocked || false
  923. }
  924. self._splashReady = true
  925. self._tryHideSplash()
  926. }
  927. }).catch(function() {})
  928. },
  929. /** 切换沙盘个人/全家视角(本地切换,不重新请求) */
  930. onSandboxViewChange: function(view) {
  931. if (view === this.currentSandboxView) return
  932. this.currentSandboxView = view
  933. this.sandboxData = view === 'family' ? (this.sandboxFamilyData || null) : (this.sandboxPersonalData || null)
  934. },
  935. loadActionArticles: function() {
  936. var self = this
  937. getFeaturedArticles({ size: 5 }).then(function(res) {
  938. if (res.code === 200 && res.data) {
  939. var gradientColors = [
  940. 'linear-gradient(135deg, #10B981, #34D399)',
  941. 'linear-gradient(135deg, #5B9BD5, #8FC5E8)',
  942. 'linear-gradient(135deg, #8B5CF6, #C084FC)',
  943. 'linear-gradient(135deg, #F97316, #FB923C)',
  944. 'linear-gradient(135deg, #6366F1, #818CF8)'
  945. ]
  946. var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
  947. self.articles = list.map(function(item, index) {
  948. return {
  949. id: item.id,
  950. category: item.categoryName || '行动社交',
  951. categoryColor: gradientColors[index % gradientColors.length],
  952. title: item.title || '',
  953. summary: item.summary || '',
  954. dimensionWeights: item.dimensionWeights || null,
  955. views: item.viewCount ? String(item.viewCount) : '0',
  956. likes: '0',
  957. date: item.publishedAt ? item.publishedAt.slice(0, 10) : '',
  958. relatedDimensions: self.parseRelatedDimensions(item.relatedDimensions),
  959. coverImage: item.coverImage
  960. }
  961. })
  962. }
  963. }).catch(function() {})
  964. },
  965. loadChallenges: function() {
  966. var self = this
  967. getChallengeList({}).then(function(res) {
  968. if (res.code === 200 && Array.isArray(res.data)) {
  969. self.activeChallenges = res.data
  970. }
  971. }).catch(function() {
  972. self.activeChallenges = []
  973. })
  974. },
  975. loadTodayTasks: function() {
  976. var self = this
  977. var role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || 'parent'
  978. // 家长:家庭维度拉取(方案任务可能挂在任意成员,不只是当前孩子)
  979. if (role === 'parent') {
  980. getTodayTasks(null, { familyWide: true }).then(function(res) {
  981. if (res.code === 200 && Array.isArray(res.data)) {
  982. self.pendingTasks = res.data.filter(function(t) {
  983. return t.status === 'pending'
  984. })
  985. }
  986. }).catch(function() {
  987. self.pendingTasks = []
  988. })
  989. return
  990. }
  991. if (!self.currentChildId) {
  992. self.pendingTasks = []
  993. return
  994. }
  995. getTodayTasks(self.currentChildId).then(function(res) {
  996. if (res.code === 200 && Array.isArray(res.data)) {
  997. self.pendingTasks = res.data.filter(function(t) {
  998. return t.status === 'pending'
  999. })
  1000. }
  1001. }).catch(function() {
  1002. self.pendingTasks = []
  1003. })
  1004. },
  1005. loadFamilyFeed: function() {
  1006. var self = this
  1007. // 仅对第一个孩子拉取任务历史(避免 N 个孩子 N 次 /api/tasks/history 请求)
  1008. var children = (self.children || []).filter(function(m) { return m.effectiveRole === 'child' })
  1009. if (children.length === 0) {
  1010. self.familyFeed = []
  1011. return
  1012. }
  1013. var child = children[0]
  1014. getTaskHistory(child.id, 1, 3).then(function(res) {
  1015. var tasks = []
  1016. if (res.code === 200) {
  1017. var data = res.data
  1018. tasks = (data && data.records) ? data.records : (Array.isArray(data) ? data : [])
  1019. }
  1020. var feed = tasks.filter(function(t) { return t.status === 'completed' }).map(function(t) {
  1021. var points = t.pointsEarned || t.points || 0
  1022. var timeStr = ''
  1023. if (t.completedAt && typeof t.completedAt === 'string') {
  1024. timeStr = t.completedAt.substring(11, 16)
  1025. }
  1026. return {
  1027. text: '✅ ' + (child.nickname || '小名') + ' 完成「' + (t.title || '任务') + '」 +' + points + '分',
  1028. time: timeStr,
  1029. type: 'task'
  1030. }
  1031. })
  1032. self.familyFeed = feed.slice(0, 10)
  1033. }).catch(function() {
  1034. self.familyFeed = []
  1035. })
  1036. },
  1037. loadNotices: function() {
  1038. var self = this
  1039. getNotices().then(function(res) {
  1040. if (res.code === 200 && res.data) {
  1041. var notices = res.data.map(function(n) {
  1042. var timeStr = ''
  1043. if (n.createdAt) {
  1044. var d = parseDate(n.createdAt)
  1045. if (d) {
  1046. timeStr = (d.getMonth() + 1) + '月' + d.getDate() + '日'
  1047. }
  1048. }
  1049. return {
  1050. text: '📢 ' + n.title,
  1051. time: timeStr,
  1052. type: 'notice',
  1053. notice: n
  1054. }
  1055. })
  1056. self.notices = notices
  1057. // 合并 notices 到 familyFeed(优先显示)
  1058. self.familyFeed = notices.concat(self.familyFeed).slice(0, 10)
  1059. }
  1060. }).catch(function() {})
  1061. },
  1062. // W3: 用户通知入动态(仅显示未读,已读不计入 familyFeed 顶部)
  1063. loadNotifications: function() {
  1064. var self = this
  1065. getNotificationList().then(function(res) {
  1066. if (res.code === 200 && res.data) {
  1067. var notifications = res.data.map(function(n) {
  1068. var timeStr = ''
  1069. if (n.createdAt) {
  1070. var d = parseDate(n.createdAt)
  1071. if (d) {
  1072. timeStr = (d.getMonth() + 1) + '月' + d.getDate() + '日'
  1073. }
  1074. }
  1075. return {
  1076. text: '📬 ' + n.title,
  1077. time: timeStr,
  1078. type: 'notification',
  1079. unread: (n.isRead === 0),
  1080. notice: n
  1081. }
  1082. })
  1083. // 仅显示未读通知在 familyFeed 顶部(最多10条)
  1084. var unread = notifications.filter(function(n) { return n.unread })
  1085. self.familyFeed = unread.slice(0, 10)
  1086. }
  1087. }).catch(function() {})
  1088. },
  1089. // ===== 能量/积分/CF值变更通知 =====
  1090. loadEnergyPointsCFChanges: function() {
  1091. var self = this
  1092. var memberId = this.currentChildId || uni.getStorageSync('currentMemberId')
  1093. if (!memberId) {
  1094. self.energyMessages = []
  1095. self.pointsMessages = []
  1096. self.cfMessages = []
  1097. self.showEnergyBadge = false
  1098. self.showPointsBadge = false
  1099. self.showCfBadge = false
  1100. return
  1101. }
  1102. // 并行加载能量、积分、CF值变更
  1103. Promise.all([
  1104. this.loadEnergyChanges(),
  1105. this.loadPointsChanges(),
  1106. this.loadCfChanges()
  1107. ]).then(function(results) {
  1108. var energyRes = results[0]
  1109. var pointsRes = results[1]
  1110. var cfRes = results[2]
  1111. // 处理能量变更
  1112. if (energyRes) {
  1113. self.energyMessages = energyRes.messages
  1114. self.showEnergyBadge = energyRes.showBadge
  1115. }
  1116. // 处理积分变更
  1117. if (pointsRes) {
  1118. self.pointsMessages = pointsRes.messages
  1119. self.showPointsBadge = pointsRes.showBadge
  1120. }
  1121. // 处理CF值变更
  1122. if (cfRes) {
  1123. self.cfMessages = cfRes.messages
  1124. self.showCfBadge = cfRes.showBadge
  1125. }
  1126. // 通知栏滑入动画:数据加载完成后触发从下往上的展示
  1127. self.isNotificationVisible = true
  1128. }).catch(function() {
  1129. self.energyMessages = []
  1130. self.pointsMessages = []
  1131. self.cfMessages = []
  1132. self.showEnergyBadge = false
  1133. self.showPointsBadge = false
  1134. self.showCfBadge = false
  1135. })
  1136. },
  1137. loadEnergyChanges: function() {
  1138. var self = this
  1139. var memberId = this.currentChildId || uni.getStorageSync('currentMemberId')
  1140. if (!memberId) return
  1141. getEnergyLogs(memberId, null, 1, 10).then(function(res) {
  1142. if (res.code === 200 && res.data && res.data.records) {
  1143. var records = res.data.records
  1144. var messages = []
  1145. var totalAmount = 0
  1146. var count = 0
  1147. for (var i = 0; i < records.length; i++) {
  1148. var record = records[i]
  1149. if (record.amount && record.createdAt) {
  1150. var date = self.parseDate(record.createdAt)
  1151. if (date && self.isToday(date)) {
  1152. totalAmount += record.amount
  1153. count++
  1154. // 解析具体内容
  1155. var desc = record.description || ''
  1156. var sourceType = record.sourceType || ''
  1157. var contentText = ''
  1158. switch(sourceType) {
  1159. case 'task':
  1160. contentText = '完成了' + (desc || '任务')
  1161. break
  1162. case 'product':
  1163. contentText = '购买了' + (desc || '商品')
  1164. break
  1165. case 'medical_report':
  1166. contentText = '上传了' + (desc || '体检报告')
  1167. break
  1168. case 'daily_record':
  1169. contentText = '完成了' + (desc || '日常记录')
  1170. break
  1171. default:
  1172. contentText = desc || '能量变动'
  1173. }
  1174. messages.push({
  1175. id: 'energy-' + record.id,
  1176. type: 'energy',
  1177. title: '能量变动',
  1178. description: contentText,
  1179. amount: record.amount,
  1180. isRead: true,
  1181. createdAt: record.createdAt,
  1182. time: self.formatTime(record.createdAt)
  1183. })
  1184. }
  1185. }
  1186. }
  1187. // 存储到实例属性(供其他方法使用,或可单独暴露)
  1188. // 注意:这里的 messages 仅在该方法调用后有效,实际建议使用单独的数据存储
  1189. self.energyMessages = messages
  1190. self.energyChangeTotal = totalAmount
  1191. self.energyChangeCount = count
  1192. self.showEnergyBadge = count > 0
  1193. }
  1194. }).catch(function() {})
  1195. },
  1196. loadPointsChanges: function() {
  1197. var self = this
  1198. var memberId = this.currentChildId || uni.getStorageSync('currentMemberId')
  1199. if (!memberId) return
  1200. getPointsLogs(memberId, 1, 10).then(function(res) {
  1201. if (res.code === 200 && res.data && res.data.records) {
  1202. var records = res.data.records
  1203. var messages = []
  1204. var totalAmount = 0
  1205. var count = 0
  1206. for (var i = 0; i < records.length; i++) {
  1207. var record = records[i]
  1208. if (record.amount && record.createdAt) {
  1209. var date = self.parseDate(record.createdAt)
  1210. if (date && self.isToday(date)) {
  1211. totalAmount += record.amount
  1212. count++
  1213. // 解析具体内容
  1214. var desc = record.description || ''
  1215. var type = record.type || ''
  1216. var contentText = ''
  1217. switch(type) {
  1218. case 'task':
  1219. contentText = '完成了' + (desc || '任务')
  1220. contentText += '获得' + (record.amount >= 0 ? '+' : '') + record.amount + '积分'
  1221. break
  1222. case 'reward':
  1223. contentText = '完成了' + (desc || '心愿兑换')
  1224. contentText += '获得' + (record.amount >= 0 ? '+' : '') + record.amount + '积分'
  1225. break
  1226. case 'adjust':
  1227. contentText = '管理员调整' + (record.amount >= 0 ? '+' : '') + record.amount + '积分'
  1228. break
  1229. case 'expire':
  1230. contentText = '积分过期扣除' + Math.abs(record.amount) + '积分'
  1231. break
  1232. default:
  1233. contentText = (desc || '积分变动') + (record.amount >= 0 ? '获得' : '扣除') + Math.abs(record.amount) + '积分'
  1234. }
  1235. messages.push({
  1236. id: 'points-' + record.id,
  1237. type: 'points',
  1238. title: '积分变动',
  1239. description: contentText,
  1240. amount: record.amount,
  1241. isRead: true,
  1242. createdAt: record.createdAt,
  1243. time: self.formatTime(record.createdAt)
  1244. })
  1245. }
  1246. }
  1247. }
  1248. self.pointsMessages = messages
  1249. self.pointsChangeTotal = totalAmount
  1250. self.pointsChangeCount = count
  1251. self.showPointsBadge = count > 0
  1252. }
  1253. }).catch(function() {})
  1254. },
  1255. loadCfChanges: function() {
  1256. var self = this
  1257. getCfSummary().then(function(res) {
  1258. if (res.code === 200 && res.data) {
  1259. var todayStr = new Date().toISOString().substring(0, 10)
  1260. getCfList(1, 10).then(function(cfRes) {
  1261. if (cfRes.code === 200 && cfRes.data && cfRes.data.records) {
  1262. var records = cfRes.data.records
  1263. var messages = []
  1264. var totalAmount = 0
  1265. var count = 0
  1266. for (var i = 0; i < records.length; i++) {
  1267. var record = records[i]
  1268. if (record.amount && record.createdAt) {
  1269. var date = self.parseDate(record.createdAt)
  1270. if (date && date.toISOString().substring(0, 10) === todayStr) {
  1271. totalAmount += record.amount
  1272. count++
  1273. // 解析具体内容
  1274. var desc = record.description || ''
  1275. var action = record.action || ''
  1276. var contentText = ''
  1277. switch(action) {
  1278. case 'transfer_send':
  1279. contentText = 'CF值转出' + Math.abs(record.amount) + 'CF'
  1280. break
  1281. case 'transfer_receive':
  1282. contentText = 'CF值转入' + record.amount + 'CF'
  1283. break
  1284. case 'commission':
  1285. contentText = '获得' + record.amount + 'CF分佣'
  1286. break
  1287. default:
  1288. contentText = (desc || 'CF值变动') + (record.amount >= 0 ? '+' : '') + record.amount + 'CF'
  1289. }
  1290. messages.push({
  1291. id: 'cf-' + record.id,
  1292. type: 'cf',
  1293. title: 'CF值变动',
  1294. description: contentText,
  1295. amount: record.amount,
  1296. isRead: true,
  1297. createdAt: record.createdAt,
  1298. time: self.formatTime(record.createdAt)
  1299. })
  1300. }
  1301. }
  1302. }
  1303. self.cfMessages = messages
  1304. self.cfChangeTotal = totalAmount
  1305. self.cfChangeCount = count
  1306. self.showCfBadge = count > 0
  1307. }
  1308. }).catch(function() {})
  1309. }
  1310. }).catch(function() {})
  1311. },
  1312. // 辅助方法:解析日期
  1313. parseDate: function(dateStr) {
  1314. if (!dateStr) return null
  1315. // 统一日期格式处理
  1316. var d = new Date(dateStr)
  1317. if (isNaN(d)) return null
  1318. return d
  1319. },
  1320. isToday: function(date) {
  1321. var today = new Date()
  1322. return date.getDate() === today.getDate() &&
  1323. date.getMonth() === today.getMonth() &&
  1324. date.getFullYear() === today.getFullYear()
  1325. },
  1326. // ===== 能量/积分/CF值变更通知点击处理 =====
  1327. // 点击通知内容 → 跳转详情页 + 隐藏通知(点击后不再显示)
  1328. handleNotificationClick: function() {
  1329. // 点击空白区域:若有多个通知,跳转第一个可见的
  1330. if (this.showEnergyBadge) {
  1331. this.onEnergyClick()
  1332. } else if (this.showPointsBadge) {
  1333. this.onPointsClick()
  1334. } else if (this.showCfBadge) {
  1335. this.onCfClick()
  1336. } else {
  1337. this.dismissAll()
  1338. }
  1339. },
  1340. onEnergyClick: function() {
  1341. var memberId = this.currentChildId || uni.getStorageSync('currentMemberId') || ''
  1342. this.dismissAll()
  1343. uni.navigateTo({ url: '/pages/energy/detail?memberId=' + memberId })
  1344. },
  1345. onPointsClick: function() {
  1346. this.dismissAll()
  1347. uni.navigateTo({ url: '/pages/rewards/rewards' })
  1348. },
  1349. onCfClick: function() {
  1350. this.dismissAll()
  1351. uni.navigateTo({ url: '/pages/promotion/index' })
  1352. },
  1353. // 关闭按钮:仅隐藏,不跳转
  1354. dismissAll: function() {
  1355. this.isNotificationVisible = false
  1356. this.showEnergyBadge = false
  1357. this.showPointsBadge = false
  1358. this.showCfBadge = false
  1359. this.energyMessages = []
  1360. this.pointsMessages = []
  1361. this.cfMessages = []
  1362. },
  1363. quickCompleteTask: function(task) {
  1364. var self = this
  1365. var memberId = (task && task.familyMemberId) || self.currentChildId || uni.getStorageSync('currentMemberId')
  1366. completeTaskApi(task.id, memberId, '').then(function(res) {
  1367. if (res.code === 200) {
  1368. uni.showToast({ title: '获得 ' + (res.data && res.data.pointsEarned || 0) + ' 积分', icon: 'success' })
  1369. self.loadTodayTasks()
  1370. } else {
  1371. uni.showToast({ title: (res && res.message) || '完成失败', icon: 'none' })
  1372. }
  1373. }).catch(function() {
  1374. uni.showToast({ title: '完成失败,请重试', icon: 'none' })
  1375. })
  1376. },
  1377. onChallengeCheckin: function(payload) {
  1378. var self = this
  1379. updateChallengeProgress({ challengeId: payload.challengeId, delta: 1 }).then(function(res) {
  1380. if (res && res.code === 200) {
  1381. uni.showToast({ title: '打卡成功', icon: 'success' })
  1382. self.loadChallenges()
  1383. } else {
  1384. uni.showToast({ title: (res && res.message) || '打卡失败', icon: 'none' })
  1385. }
  1386. }).catch(function() {
  1387. uni.showToast({ title: '打卡失败,请重试', icon: 'none' })
  1388. })
  1389. },
  1390. onChallengeRespond: function(payload) {
  1391. var self = this
  1392. respondChallenge({ challengeId: payload.challengeId, action: payload.action }).then(function(res) {
  1393. if (res && res.code === 200) {
  1394. uni.showToast({ title: payload.action === 'agree' ? '已同意' : '已拒绝', icon: 'success' })
  1395. self.loadChallenges()
  1396. } else {
  1397. uni.showToast({ title: (res && res.message) || '操作失败', icon: 'none' })
  1398. self.loadChallenges()
  1399. }
  1400. }).catch(function() {
  1401. uni.showToast({ title: '操作失败,请重试', icon: 'none' })
  1402. })
  1403. },
  1404. // loadFamilyMembers 已合并到 loadFamilyData(避免重复调用 /api/family/member/list)
  1405. parseRelatedDimensions: function(val) {
  1406. if (!val) return []
  1407. if (Array.isArray(val)) return val
  1408. if (typeof val === 'string') {
  1409. try {
  1410. var parsed = JSON.parse(val)
  1411. return Array.isArray(parsed) ? parsed : []
  1412. } catch (e) {
  1413. return val.split(',').map(function(s) { return s.trim() }).filter(function(s) { return s })
  1414. }
  1415. }
  1416. return []
  1417. },
  1418. onFamilyMemberSelect: function(member) {
  1419. this.selectedMemberId = member.id
  1420. },
  1421. onFamilyMemberSwitch: function(member) {
  1422. var self = this
  1423. if (!member || !member.id) return
  1424. switchToFamilyMember(member.id, member.source || 'family_member').then(function(res) {
  1425. if (res.code === 200 && res.data) {
  1426. store.commit('switchToMember', {
  1427. memberId: res.data.memberId,
  1428. effectiveRole: res.data.effectiveRole
  1429. })
  1430. uni.showToast({ title: '已切换到' + (member.nickname || '该成员'), icon: 'success' })
  1431. setTimeout(function() {
  1432. uni.reLaunch({ url: '/pages/index-home/index' })
  1433. }, 1000)
  1434. } else {
  1435. uni.showToast({ title: res.message || '切换失败', icon: 'none' })
  1436. }
  1437. }).catch(function() {
  1438. uni.showToast({ title: '切换失败', icon: 'none' })
  1439. })
  1440. },
  1441. navTo: function(url) {
  1442. nav.goPage(url)
  1443. },
  1444. goActivityDetail: function(act) {
  1445. if (!act || !act.id) return
  1446. uni.navigateTo({ url: '/pages/activity/activity-detail/activity-detail?id=' + act.id })
  1447. },
  1448. goMoreActivities: function() {
  1449. uni.navigateTo({ url: '/pages/activity/index' })
  1450. },
  1451. goProductDetail: function(prod) {
  1452. uni.navigateTo({ url: '/pages/discover-detail/product-detail/product-detail?id=' + prod.id })
  1453. },
  1454. goMoreProducts: function() {
  1455. uni.navigateTo({ url: '/pages/shop/index/index' })
  1456. },
  1457. goArticleDetail: function(article) {
  1458. var id = article.id || article
  1459. uni.navigateTo({ url: '/pages/article-center/article-detail?id=' + id })
  1460. },
  1461. goMoreArticles: function() {
  1462. uni.navigateTo({ url: '/pages/article-center/index' })
  1463. },
  1464. goToUploadReport: function() {
  1465. var id = this.currentChildId || ''
  1466. uni.navigateTo({ url: '/pages/health/report-upload?memberId=' + id + '&from=index' })
  1467. },
  1468. // 定期调研待办角标(内部自检登录态,未登录静默清空)
  1469. _loadSurveyBadge: function() {
  1470. var self = this
  1471. if (!this.isLoggedIn()) { self.pendingSurveys = []; return }
  1472. getSurveyStatus({}).then(function(res) {
  1473. var list = (res && res.code === 200 && res.data && res.data instanceof Array) ? res.data : []
  1474. var pending = []
  1475. for (var i = 0; i < list.length; i++) {
  1476. if (list[i] && list[i].status === 'pending') pending.push(list[i])
  1477. }
  1478. self.pendingSurveys = pending
  1479. }).catch(function() { self.pendingSurveys = [] })
  1480. },
  1481. goSelfTest: function() {
  1482. var firstPending = null
  1483. for (var i = 0; i < this.pendingSurveys.length; i++) {
  1484. var s = this.pendingSurveys[i]
  1485. if (s && s.templateId) { firstPending = s; break }
  1486. }
  1487. if (firstPending) {
  1488. var url = '/pages/health/survey-questionnaire?templateId=' + firstPending.templateId +
  1489. '&templateTitle=' + encodeURIComponent(firstPending.title || '定期调研') +
  1490. '&templateDimension=' + encodeURIComponent(firstPending.dimension || '') +
  1491. '&periodStart=' + (firstPending.periodStart || '') +
  1492. '&periodEnd=' + (firstPending.periodEnd || '')
  1493. uni.navigateTo({ url: url })
  1494. } else {
  1495. // 无待填调研 → 进入五维自检中间页
  1496. uni.navigateTo({ url: '/pages/family/self-check-entry' })
  1497. }
  1498. },
  1499. // ===== Next Best Action 引导条点击 =====
  1500. onGuideTap: function(action) {
  1501. if (!action) return
  1502. switch (action.type) {
  1503. case 'self-check':
  1504. this.goSelfTest()
  1505. break
  1506. case 'survey':
  1507. // 跳转到第一个待填调研
  1508. if (this.pendingSurveys && this.pendingSurveys.length > 0) {
  1509. var s = this.pendingSurveys[0]
  1510. uni.navigateTo({
  1511. url: '/pages/health/survey-questionnaire?templateId=' + s.templateId +
  1512. '&templateTitle=' + encodeURIComponent(s.title || '定期调研') +
  1513. '&templateDimension=' + encodeURIComponent(s.dimension || '') +
  1514. '&periodStart=' + (s.periodStart || '') +
  1515. '&periodEnd=' + (s.periodEnd || '')
  1516. })
  1517. }
  1518. break
  1519. case 'add-member':
  1520. this.navTo('/pages/profile-extra/family-members')
  1521. break
  1522. case 'task':
  1523. this.navTo('/pages/tasks/tasks')
  1524. break
  1525. case 'notice':
  1526. this.navTo('/pages/profile/profile')
  1527. break
  1528. case 'default':
  1529. this.navTo('/pages/tasks/tasks')
  1530. break
  1531. }
  1532. },
  1533. loadSelfCheckStatus: function() {
  1534. var self = this
  1535. getSelfCheckStatus().then(function(res) {
  1536. if (res.code === 200 && res.data && res.data.lastResult) {
  1537. self.selfCheckScore = res.data.lastResult.totalScore
  1538. }
  1539. }).catch(function() {})
  1540. },
  1541. _doInit(options) {
  1542. options = options || {}
  1543. if (!this.isLoggedIn()) {
  1544. this.currentRole = ''
  1545. this.loadDimensionActivities()
  1546. this.loadFeaturedArticles()
  1547. return
  1548. }
  1549. this.syncRoleAndTabBar()
  1550. if (options.inviteCode && options.type === 'parent_invite') {
  1551. this.handleParentInvite(options.inviteCode)
  1552. return
  1553. }
  1554. var storedCode = uni.getStorageSync('inviteCode')
  1555. var storedType = uni.getStorageSync('inviteType')
  1556. if (storedCode && storedType === 'parent_invite') {
  1557. this.handleParentInvite(storedCode)
  1558. uni.removeStorageSync('inviteCode')
  1559. uni.removeStorageSync('inviteType')
  1560. return
  1561. }
  1562. // 登录用户:直接在 TabBar 页面内联渲染,保持底签可见
  1563. if (!this.loggedInInitDone) {
  1564. // 首次加载:全量初始化(数据 + 会员状态),onShow 不再重复
  1565. this.loggedInInitDone = true
  1566. this.loadLoggedInData()
  1567. this.checkMemberStatus()
  1568. }
  1569. this._watchPageReady()
  1570. this._maybeShowOnboardingGuide()
  1571. },
  1572. _refreshOnShow() {
  1573. // 切 Tab 返回:刷新家庭成员 + 沙盘 + 会员状态(loadFamilyData 内含任务/挑战刷新)
  1574. if (!this.isLoggedIn()) {
  1575. this.currentRole = ''
  1576. return
  1577. }
  1578. // 登录态可能在后台发生变化(如从登录页 switchTab 返回),
  1579. // 必须在此重新同步 currentRole,否则 v-if="currentRole" 无法切换到登录视图
  1580. this.syncRoleAndTabBar()
  1581. this.checkMemberStatus()
  1582. this.loadFamilyData()
  1583. },
  1584. _watchPageReady() {
  1585. if (this._watchPageReadyDone) return
  1586. this._watchPageReadyDone = true
  1587. var that = this
  1588. that.$watch('_splashReady', function(newVal) {
  1589. if (newVal) that._tryHideSplash()
  1590. })
  1591. },
  1592. // 首次登录引导浮层:异步拉取配置并按版本号判断是否展示
  1593. _maybeShowOnboardingGuide() {
  1594. if (this.showOnboardingGuide) return
  1595. if (this._onboardingGuideAttempted) return
  1596. this._onboardingGuideAttempted = true
  1597. var self = this
  1598. getGuideConfig().then(function(res) {
  1599. var cfg = (res && res.data) ? res.data : null
  1600. var cfgVersion = cfg ? (cfg.version || '1.0') : '1.0'
  1601. // 检查启用
  1602. if (cfg && cfg.enabled === false) return
  1603. // 检查位置(index-home 对应 'home' 位置)
  1604. if (cfg && cfg.positions && cfg.positions.indexOf('home') === -1) return
  1605. // 比较版本
  1606. var stored = uni.getStorageSync('_onboardingDone')
  1607. var seenVersion = '0.0'
  1608. if (stored) {
  1609. try {
  1610. var obj = typeof stored === 'string' ? JSON.parse(stored) : stored
  1611. if (obj && obj.version) seenVersion = obj.version
  1612. } catch (e) {}
  1613. }
  1614. if (self._compareVersion(seenVersion, cfgVersion) >= 0) return
  1615. setTimeout(function() {
  1616. if (!self.isLoggedIn()) return
  1617. self.showOnboardingGuide = true
  1618. }, 600)
  1619. }).catch(function() {
  1620. // 接口失败走旧逻辑
  1621. var stored = uni.getStorageSync('_onboardingDone')
  1622. if (stored) {
  1623. try {
  1624. var obj = typeof stored === 'string' ? JSON.parse(stored) : stored
  1625. if (obj && obj.version && self._compareVersion(obj.version, '1.0') >= 0) return
  1626. } catch (e) {}
  1627. }
  1628. setTimeout(function() {
  1629. if (!self.isLoggedIn()) return
  1630. self.showOnboardingGuide = true
  1631. }, 600)
  1632. })
  1633. },
  1634. closeOnboardingGuide() {
  1635. this.showOnboardingGuide = false
  1636. },
  1637. loadGuidePopup() {
  1638. var self = this
  1639. if (self._guidePopupAttempted) return
  1640. self._guidePopupAttempted = true
  1641. getGuidePopupList().then(function(res) {
  1642. var arr = (res && res.data) || []
  1643. if (arr && arr.length > 0) {
  1644. self.guidePopup = arr[0]
  1645. self.showGuidePopup = true
  1646. }
  1647. }).catch(function() {})
  1648. },
  1649. handleGuidePopupDone(payload) {
  1650. var popup = payload && payload.popup
  1651. var buttonClicked = payload && payload.buttonClicked
  1652. if (popup && popup.id) {
  1653. consumeGuidePopup(popup.id, buttonClicked)
  1654. }
  1655. this.showGuidePopup = false
  1656. if (buttonClicked && payload && payload.btnAction) {
  1657. uni.navigateTo({ url: payload.btnAction })
  1658. }
  1659. },
  1660. isLoggedIn() {
  1661. return !!uni.getStorageSync('token')
  1662. },
  1663. // 版本比较:返回 >0 表示 v1 > v2,0 相等,<0 表示 v1 < v2
  1664. _compareVersion: function(v1, v2) {
  1665. var parts1 = String(v1).split('.')
  1666. var parts2 = String(v2).split('.')
  1667. for (var i = 0; i < Math.max(parts1.length, parts2.length); i++) {
  1668. var n1 = parseInt(parts1[i] || '0', 10)
  1669. var n2 = parseInt(parts2[i] || '0', 10)
  1670. if (n1 !== n2) return n1 - n2
  1671. }
  1672. return 0
  1673. },
  1674. // ===== 会员状态(沙盘下方会员入口) =====
  1675. checkMemberStatus: function() {
  1676. var that = this
  1677. getMyMembership().then(function(res) {
  1678. var m = res.data || {}
  1679. var level = m.memberLevel || m.levelCode || ''
  1680. that.isLifetime = (level === 'LIFETIME')
  1681. that.isMember = that.isLifetime || !!(level && level !== 'FREE')
  1682. var mem = m.membership || m
  1683. if (mem.daysRemaining != null) {
  1684. that.membershipDays = mem.daysRemaining
  1685. } else if (that.isLifetime) {
  1686. // 终身会员:永久有效,不显示剩余天数
  1687. that.membershipDays = 0
  1688. }
  1689. }).catch(function() {})
  1690. },
  1691. goMembership: function() {
  1692. uni.navigateTo({ url: '/pages/membership/upgrade' })
  1693. },
  1694. normalizeCurrentRole() {
  1695. const role = uni.getStorageSync('role') || 'parent'
  1696. const currentRole = uni.getStorageSync('currentRole')
  1697. // 所有人统一以家长身份进入,不再进行角色分流
  1698. // 保留 currentRole 用于 TabBar 显示,但不再做 teacher 专用处理
  1699. if (!currentRole) {
  1700. return role
  1701. }
  1702. // 规则:所有人使用 role(家长为主),currentRole 仅作为备用
  1703. // 如果是 teacher 身份,仍然使用 role 返回 parent,因为不再有专属 TabBar
  1704. if (currentRole === 'teacher') {
  1705. // 教师角色不再有专属 TabBar 入口,返回家长 role
  1706. return role
  1707. }
  1708. // 只有家长账号允许切换到孩子视角(保留原有逻辑)
  1709. if (currentRole === 'child' && role !== 'parent') {
  1710. return role
  1711. }
  1712. return currentRole
  1713. },
  1714. syncRoleAndTabBar() {
  1715. this.currentRole = this.normalizeCurrentRole()
  1716. uni.setStorageSync('currentRole', this.currentRole)
  1717. },
  1718. // ===== 发现页 / 未登录态方法 =====
  1719. loadDimensionActivities: function() {
  1720. var self = this
  1721. getActivityList({ dimensionCode: '', page: 1, size: 3 }).then(function(res) {
  1722. if (res && res.code === 200) {
  1723. // res.data is the response wrapper, activities are in res.data.data or res.data.records
  1724. var rawData = res.data && (Array.isArray(res.data) ? res.data : (res.data.data || res.data.records || []))
  1725. self.dimensionActivities = Array.isArray(rawData) ? rawData.slice(0, 3) : []
  1726. }
  1727. self._checkSplashReady()
  1728. }).catch(function() {
  1729. self._checkSplashReady()
  1730. })
  1731. },
  1732. loadFeaturedArticles: function() {
  1733. var self = this
  1734. this.articlesLoading = true
  1735. getFeaturedArticles({ size: 5 }).then(function(res) {
  1736. self.articlesLoading = false
  1737. if (res && res.code === 200) {
  1738. var gradientColors = [
  1739. 'linear-gradient(135deg, #10B981, #34D399)',
  1740. 'linear-gradient(135deg, #5B9BD5, #8FC5E8)',
  1741. 'linear-gradient(135deg, #8B5CF6, #C084FC)',
  1742. 'linear-gradient(135deg, #F97316, #FB923C)',
  1743. 'linear-gradient(135deg, #6366F1, #818CF8)'
  1744. ]
  1745. // res.data is the response wrapper, articles are in res.data.data
  1746. var rawList = res.data && (Array.isArray(res.data) ? res.data : (res.data.data || res.data.records || []))
  1747. var list = Array.isArray(rawList) ? rawList : []
  1748. self.indexArticles = list.map(function(item, index) {
  1749. return {
  1750. id: item.id,
  1751. category: item.categoryName || item.category || '热门文章',
  1752. categoryColor: gradientColors[index % gradientColors.length],
  1753. title: item.title || '',
  1754. summary: item.summary || '',
  1755. views: item.viewCount ? String(item.viewCount) : '0',
  1756. date: item.publishedAt ? item.publishedAt.slice(0, 10) : '',
  1757. coverImage: item.coverImage
  1758. }
  1759. })
  1760. }
  1761. self._checkSplashReady()
  1762. }).catch(function() {
  1763. self.articlesLoading = false
  1764. self._checkSplashReady()
  1765. })
  1766. },
  1767. goActivities: function() {
  1768. uni.navigateTo({ url: '/pages/activity/index' })
  1769. },
  1770. goChallengeManage: function(id) {
  1771. uni.navigateTo({ url: '/pages/health/challenge-manage?id=' + id })
  1772. },
  1773. goArticles: function() {
  1774. uni.navigateTo({ url: '/pages/article-center/index' })
  1775. },
  1776. goArticleDetail: function(article) {
  1777. var id = article && article.id ? article.id : article
  1778. uni.navigateTo({ url: '/pages/article-center/article-detail?id=' + id })
  1779. },
  1780. handleLogin() {
  1781. uni.navigateTo({ url: '/pages/login/login?redirect=' + encodeURIComponent('/pages/index-home/index') })
  1782. },
  1783. async handleParentInvite(code) {
  1784. // 延迟显示,等待登录完成
  1785. setTimeout(async () => {
  1786. const hasToken = uni.getStorageSync('token')
  1787. if (!hasToken) {
  1788. // 未登录,先去登录
  1789. uni.reLaunch({
  1790. url: '/pages/login/login?inviteCode=' + code
  1791. })
  1792. return
  1793. }
  1794. // 已登录,显示确认框
  1795. uni.showModal({
  1796. title: '加入家庭',
  1797. content: '您已被邀请加入家庭,是否接受?',
  1798. success: async (res) => {
  1799. if (res.confirm) {
  1800. try {
  1801. uni.showLoading({ title: '加入中...' })
  1802. const result = await acceptParentInvite(code)
  1803. uni.hideLoading()
  1804. if (result.code === 200) {
  1805. const { role, token } = result.data
  1806. uni.setStorageSync('role', role)
  1807. uni.setStorageSync('token', token)
  1808. uni.showToast({ title: '加入成功', icon: 'success' })
  1809. // 刷新页面
  1810. setTimeout(() => {
  1811. uni.switchTab({ url: '/pages/index-home/index' })
  1812. }, 1500)
  1813. }
  1814. } catch (e) {
  1815. uni.hideLoading()
  1816. uni.showToast({ title: e.message || '加入失败', icon: 'none' })
  1817. }
  1818. }
  1819. }
  1820. })
  1821. }, 500)
  1822. },
  1823. /** 获取自己的邀请码用于分享 */
  1824. loadReferralCode: function() {
  1825. if (this.referralCodeLoaded || !this.isLoggedIn()) return
  1826. var self = this
  1827. getReferralCode().then(function(res) {
  1828. self.referralCode = extractReferralCode(res)
  1829. }).catch(function() {})
  1830. self.referralCodeLoaded = true
  1831. },
  1832. getImageUrl: function(path) {
  1833. return config.API_BASE_URL + path
  1834. },
  1835. /** 转发给朋友/群(不指定 imageUrl,微信自动截取当前页面截图作缩略图;static/share-cover.png 不存在会导致卡片空白) */
  1836. onShareAppMessage: function() {
  1837. var path = '/pages/index-home/index'
  1838. if (this.referralCode) {
  1839. path = path + '?refCode=' + this.referralCode
  1840. }
  1841. return {
  1842. title: '浠艾福 · 家庭五维幸福成长',
  1843. path: path
  1844. }
  1845. },
  1846. /** 分享到朋友圈 */
  1847. onShareTimeline: function() {
  1848. var query = ''
  1849. if (this.referralCode) {
  1850. query = 'refCode=' + this.referralCode
  1851. }
  1852. return {
  1853. title: '浠艾福 · 家庭五维幸福成长',
  1854. query: query
  1855. }
  1856. }
  1857. }
  1858. }
  1859. </script>
  1860. <style>
  1861. .discover-container {
  1862. min-height: 100vh;
  1863. background: #f5f7fa;
  1864. padding-bottom: 100rpx;
  1865. }
  1866. /* ===== 品牌 Hero 区 ===== */
  1867. .hero-section {
  1868. margin: 24rpx 30rpx 0;
  1869. padding: 40rpx 32rpx;
  1870. background: linear-gradient(160deg, #FFF7ED 0%, #FED7AA 60%, rgba(249,115,22,0.15) 100%);
  1871. border-radius: 24rpx;
  1872. text-align: center;
  1873. border: 1rpx solid rgba(249,115,22,0.12);
  1874. }
  1875. .hero-logo {
  1876. width: 100rpx;
  1877. height: 100rpx;
  1878. border-radius: 50rpx;
  1879. background: #fff;
  1880. box-shadow: 0 8rpx 24rpx rgba(249,115,22,0.18);
  1881. }
  1882. .hero-name {
  1883. display: block;
  1884. font-size: 48rpx;
  1885. font-weight: bold;
  1886. color: #7C2D12;
  1887. margin-top: 16rpx;
  1888. letter-spacing: 6rpx;
  1889. }
  1890. .hero-identity {
  1891. display: block;
  1892. font-size: 28rpx;
  1893. font-weight: 600;
  1894. color: #C2410C;
  1895. margin-top: 12rpx;
  1896. letter-spacing: 2rpx;
  1897. }
  1898. .hero-slogan {
  1899. display: block;
  1900. font-size: 26rpx;
  1901. color: #9A3412;
  1902. margin-top: 8rpx;
  1903. font-weight: 500;
  1904. }
  1905. .hero-powered {
  1906. display: block;
  1907. font-size: 20rpx;
  1908. color: rgba(124,45,18,0.45);
  1909. margin-top: 10rpx;
  1910. }
  1911. .hero-dims {
  1912. display: flex;
  1913. justify-content: center;
  1914. gap: 16rpx;
  1915. margin-top: 28rpx;
  1916. flex-wrap: wrap;
  1917. }
  1918. .hero-dim {
  1919. display: flex;
  1920. flex-direction: column;
  1921. align-items: center;
  1922. gap: 6rpx;
  1923. padding: 12rpx 16rpx;
  1924. background: rgba(255,255,255,0.7);
  1925. border-radius: 16rpx;
  1926. }
  1927. .hero-dim-emoji {
  1928. font-size: 32rpx;
  1929. }
  1930. .hero-dim-label {
  1931. font-size: 20rpx;
  1932. color: #7C2D12;
  1933. font-weight: 500;
  1934. white-space: nowrap;
  1935. }
  1936. /* ===== 未登录态 Hero 副标语 / CTA ===== */
  1937. .hero-sub-slogan {
  1938. display: block;
  1939. font-size: 22rpx;
  1940. color: #EA580C;
  1941. margin-top: 18rpx;
  1942. font-weight: 500;
  1943. }
  1944. .hero-cta-btn {
  1945. margin: 28rpx auto 0;
  1946. display: block;
  1947. width: 420rpx;
  1948. height: 80rpx;
  1949. line-height: 80rpx;
  1950. background: linear-gradient(135deg, #F97316, #FB923C);
  1951. color: #fff;
  1952. font-size: 28rpx;
  1953. font-weight: bold;
  1954. border-radius: 40rpx;
  1955. text-align: center;
  1956. border: none;
  1957. box-shadow: 0 8rpx 20rpx rgba(249,115,22,0.3);
  1958. }
  1959. .hero-cta-btn::after {
  1960. border: none;
  1961. }
  1962. /* ===== 价值主张(为什么选择浠艾福) ===== */
  1963. .value-prop-section {
  1964. margin: 24rpx 30rpx 0;
  1965. }
  1966. .value-prop-title {
  1967. display: block;
  1968. font-size: 32rpx;
  1969. font-weight: bold;
  1970. color: #333;
  1971. text-align: center;
  1972. margin-bottom: 20rpx;
  1973. }
  1974. .value-prop-grid {
  1975. display: flex;
  1976. flex-wrap: wrap;
  1977. justify-content: space-between;
  1978. }
  1979. .value-prop-card {
  1980. width: 48.5%;
  1981. box-sizing: border-box;
  1982. background: #fff;
  1983. border-radius: 20rpx;
  1984. padding: 22rpx;
  1985. margin-bottom: 16rpx;
  1986. box-shadow: 0 2rpx 10rpx rgba(0,0,0,0.05);
  1987. display: flex;
  1988. flex-direction: row;
  1989. align-items: flex-start;
  1990. }
  1991. .value-prop-icon {
  1992. font-size: 40rpx;
  1993. line-height: 1.3;
  1994. margin-right: 12rpx;
  1995. flex-shrink: 0;
  1996. }
  1997. .value-prop-texts {
  1998. display: flex;
  1999. flex-direction: column;
  2000. flex: 1;
  2001. min-width: 0;
  2002. }
  2003. .value-prop-name {
  2004. font-size: 28rpx;
  2005. font-weight: bold;
  2006. color: #333;
  2007. }
  2008. .value-prop-desc {
  2009. font-size: 22rpx;
  2010. color: #999;
  2011. margin-top: 8rpx;
  2012. line-height: 1.5;
  2013. }
  2014. /* ===== 三步上手 ===== */
  2015. .how-it-works {
  2016. margin: 32rpx 30rpx 0;
  2017. padding: 32rpx 24rpx;
  2018. background: #fff;
  2019. border-radius: 24rpx;
  2020. box-shadow: 0 2rpx 10rpx rgba(0,0,0,0.04);
  2021. }
  2022. .how-it-works-title {
  2023. display: block;
  2024. font-size: 32rpx;
  2025. font-weight: bold;
  2026. color: #333;
  2027. text-align: center;
  2028. margin-bottom: 28rpx;
  2029. }
  2030. .step-row {
  2031. display: flex;
  2032. align-items: flex-start;
  2033. justify-content: space-between;
  2034. }
  2035. .step-item {
  2036. display: flex;
  2037. flex-direction: column;
  2038. align-items: center;
  2039. flex: 1;
  2040. min-width: 0;
  2041. }
  2042. .step-num {
  2043. width: 48rpx;
  2044. height: 48rpx;
  2045. line-height: 48rpx;
  2046. border-radius: 50%;
  2047. background: linear-gradient(135deg, #F97316, #FB923C);
  2048. color: #fff;
  2049. font-size: 26rpx;
  2050. font-weight: bold;
  2051. text-align: center;
  2052. box-shadow: 0 4rpx 12rpx rgba(249,115,22,0.3);
  2053. }
  2054. .step-name {
  2055. font-size: 24rpx;
  2056. color: #333;
  2057. font-weight: 500;
  2058. margin-top: 12rpx;
  2059. text-align: center;
  2060. }
  2061. .step-sub {
  2062. font-size: 20rpx;
  2063. color: #999;
  2064. margin-top: 4rpx;
  2065. text-align: center;
  2066. }
  2067. .step-arrow {
  2068. font-size: 28rpx;
  2069. color: #F97316;
  2070. line-height: 1;
  2071. align-self: center;
  2072. padding: 0 6rpx;
  2073. }
  2074. /* ===== 品牌定位语(保留旧样式,不再使用) ===== */
  2075. .brand-strap {
  2076. margin: 16rpx 30rpx 0;
  2077. padding: 20rpx 28rpx;
  2078. background: linear-gradient(135deg, #FFF7ED, rgba(249,115,22,0.10));
  2079. border-radius: 16rpx;
  2080. border-left: 4rpx solid #F97316;
  2081. }
  2082. .brand-strap-text {
  2083. font-size: 26rpx;
  2084. color: #9A3412;
  2085. font-weight: 500;
  2086. }
  2087. /* ===== 会员入口卡(能量沙盘下方) ===== */
  2088. .member-entry {
  2089. display: flex;
  2090. align-items: center;
  2091. margin: 20rpx 30rpx 0;
  2092. background: linear-gradient(135deg, #F97316, #FB923C);
  2093. border-radius: 20rpx;
  2094. padding: 24rpx 30rpx;
  2095. }
  2096. .member-entry-icon-wrap {
  2097. width: 64rpx;
  2098. height: 64rpx;
  2099. border-radius: 50%;
  2100. background: rgba(255,255,255,0.2);
  2101. display: flex;
  2102. align-items: center;
  2103. justify-content: center;
  2104. margin-right: 16rpx;
  2105. flex-shrink: 0;
  2106. }
  2107. .member-entry-icon {
  2108. font-size: 36rpx;
  2109. }
  2110. .member-entry-texts {
  2111. flex: 1;
  2112. display: flex;
  2113. flex-direction: column;
  2114. min-width: 0;
  2115. }
  2116. .member-entry-title {
  2117. font-size: 30rpx;
  2118. font-weight: bold;
  2119. color: #fff;
  2120. }
  2121. .member-entry-desc {
  2122. font-size: 22rpx;
  2123. color: rgba(255,255,255,0.85);
  2124. margin-top: 4rpx;
  2125. overflow: hidden;
  2126. text-overflow: ellipsis;
  2127. white-space: nowrap;
  2128. }
  2129. .member-entry-btn {
  2130. margin-left: 16rpx;
  2131. padding: 10rpx 24rpx;
  2132. background: #fff;
  2133. border-radius: 30rpx;
  2134. flex-shrink: 0;
  2135. }
  2136. .member-entry-btn-text {
  2137. font-size: 24rpx;
  2138. color: #F97316;
  2139. font-weight: bold;
  2140. }
  2141. /* ===== 活动/阅读共用状态样式 ===== */
  2142. .loading-state,
  2143. .empty-state {
  2144. display: flex;
  2145. justify-content: center;
  2146. padding: 60rpx 0;
  2147. }
  2148. .loading-text,
  2149. .empty-text {
  2150. font-size: 26rpx;
  2151. color: #999;
  2152. }
  2153. /* ===== 五维全景幸福矩阵 ===== */
  2154. /* ===== 底部登录 ===== */
  2155. .login-footer {
  2156. margin: 40rpx 30rpx;
  2157. display: flex;
  2158. flex-direction: column;
  2159. align-items: center;
  2160. }
  2161. .login-btn {
  2162. width: 100%;
  2163. height: 88rpx;
  2164. line-height: 88rpx;
  2165. background: linear-gradient(135deg, #F97316, #FB923C);
  2166. color: #fff;
  2167. font-size: 32rpx;
  2168. font-weight: bold;
  2169. border-radius: 44rpx;
  2170. text-align: center;
  2171. border: none;
  2172. box-shadow: 0 8rpx 24rpx rgba(249,115,22,0.3);
  2173. }
  2174. .login-btn::after {
  2175. border: none;
  2176. }
  2177. .login-footer-text {
  2178. font-size: 22rpx;
  2179. color: #F97316;
  2180. margin-top: 16rpx;
  2181. font-weight: 500;
  2182. }
  2183. /* ===== 加载占位 ===== */
  2184. .loading-container {
  2185. display: flex;
  2186. justify-content: center;
  2187. align-items: center;
  2188. height: 100vh;
  2189. }
  2190. /* ===== 角色切换淡入淡出 ===== */
  2191. .role-switch-wrapper {
  2192. width: 100%;
  2193. min-height: 100vh;
  2194. }
  2195. .fade-enter-active,
  2196. .fade-leave-active {
  2197. transition: opacity 0.3s ease;
  2198. }
  2199. .fade-enter,
  2200. .fade-leave-to {
  2201. opacity: 0;
  2202. }
  2203. /* ===== 通用区块样式 ===== */
  2204. .section {
  2205. margin: 20rpx 30rpx;
  2206. }
  2207. .section-header {
  2208. display: flex;
  2209. justify-content: space-between;
  2210. align-items: center;
  2211. margin-bottom: 20rpx;
  2212. }
  2213. .section-title {
  2214. font-size: 30rpx;
  2215. font-weight: bold;
  2216. color: #333;
  2217. }
  2218. .section-more {
  2219. font-size: 24rpx;
  2220. color: #5B9BD5;
  2221. }
  2222. .empty-state {
  2223. display: flex;
  2224. justify-content: center;
  2225. padding: 60rpx 0;
  2226. }
  2227. .empty-text {
  2228. font-size: 26rpx;
  2229. color: #999;
  2230. }
  2231. /* ===== 活动列表 ===== */
  2232. .activity-list {
  2233. display: flex;
  2234. flex-direction: column;
  2235. gap: 16rpx;
  2236. }
  2237. .activity-card {
  2238. background: #fff;
  2239. border-radius: 16rpx;
  2240. overflow: hidden;
  2241. display: flex;
  2242. flex-direction: row;
  2243. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  2244. }
  2245. .activity-card:active {
  2246. opacity: 0.8;
  2247. }
  2248. .activity-cover {
  2249. width: 200rpx;
  2250. height: 160rpx;
  2251. flex-shrink: 0;
  2252. background: #f0f0f0;
  2253. }
  2254. .activity-info {
  2255. flex: 1;
  2256. padding: 16rpx;
  2257. display: flex;
  2258. flex-direction: column;
  2259. justify-content: space-between;
  2260. }
  2261. .activity-name {
  2262. font-size: 28rpx;
  2263. font-weight: bold;
  2264. color: #333;
  2265. margin-bottom: 8rpx;
  2266. }
  2267. .line-clamp-1 {
  2268. overflow: hidden;
  2269. text-overflow: ellipsis;
  2270. white-space: nowrap;
  2271. }
  2272. .activity-meta {
  2273. display: flex;
  2274. align-items: center;
  2275. margin-bottom: 8rpx;
  2276. }
  2277. .activity-time {
  2278. font-size: 22rpx;
  2279. color: #999;
  2280. }
  2281. .activity-bottom {
  2282. display: flex;
  2283. align-items: center;
  2284. gap: 12rpx;
  2285. }
  2286. .activity-status {
  2287. font-size: 20rpx;
  2288. padding: 2rpx 10rpx;
  2289. border-radius: 8rpx;
  2290. background: #E8F5E9;
  2291. color: #2E7D32;
  2292. }
  2293. .activity-status.status-upcoming {
  2294. background: #E3F2FD;
  2295. color: #1565C0;
  2296. }
  2297. .activity-status.status-ended {
  2298. background: #F5F5F5;
  2299. color: #999;
  2300. }
  2301. .activity-fee {
  2302. font-size: 24rpx;
  2303. color: #F97316;
  2304. font-weight: bold;
  2305. }
  2306. .activity-fee.fee-free {
  2307. color: #4CAF50;
  2308. }
  2309. /* ===== 文章列表 ===== */
  2310. .article-list {
  2311. display: flex;
  2312. flex-direction: column;
  2313. gap: 16rpx;
  2314. }
  2315. .article-card {
  2316. background: #fff;
  2317. border-radius: 16rpx;
  2318. padding: 24rpx;
  2319. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  2320. }
  2321. .article-card:active {
  2322. opacity: 0.8;
  2323. }
  2324. .article-category {
  2325. display: inline-block;
  2326. padding: 4rpx 14rpx;
  2327. border-radius: 8rpx;
  2328. margin-bottom: 10rpx;
  2329. }
  2330. .article-category-text {
  2331. font-size: 20rpx;
  2332. color: #fff;
  2333. }
  2334. .article-title {
  2335. display: block;
  2336. font-size: 28rpx;
  2337. font-weight: bold;
  2338. color: #333;
  2339. margin-bottom: 8rpx;
  2340. line-height: 1.4;
  2341. }
  2342. .article-summary {
  2343. display: block;
  2344. font-size: 24rpx;
  2345. color: #888;
  2346. line-height: 1.5;
  2347. margin-bottom: 12rpx;
  2348. overflow: hidden;
  2349. text-overflow: ellipsis;
  2350. display: -webkit-box;
  2351. -webkit-line-clamp: 2;
  2352. -webkit-box-orient: vertical;
  2353. }
  2354. .article-meta {
  2355. display: flex;
  2356. align-items: center;
  2357. gap: 16rpx;
  2358. }
  2359. .meta-item {
  2360. display: flex;
  2361. align-items: center;
  2362. gap: 4rpx;
  2363. }
  2364. .meta-icon {
  2365. font-size: 24rpx;
  2366. }
  2367. .meta-text {
  2368. font-size: 22rpx;
  2369. color: #999;
  2370. }
  2371. .article-date {
  2372. font-size: 22rpx;
  2373. color: #bbb;
  2374. }
  2375. /* ===== Splash Loading Overlay(冷启动蒙板,来自 merge splash.vue) ===== */
  2376. .splash-overlay {
  2377. position: fixed;
  2378. top: 0; left: 0; right: 0; bottom: 0;
  2379. z-index: 9999;
  2380. display: flex;
  2381. align-items: center;
  2382. justify-content: center;
  2383. background: linear-gradient(160deg, #FFF7ED 0%, #FFEDD5 50%, #FED7AA 100%);
  2384. overflow: hidden;
  2385. opacity: 1;
  2386. transition: opacity 0.4s ease;
  2387. }
  2388. .splash-overlay.fade-out {
  2389. opacity: 0;
  2390. pointer-events: none;
  2391. }
  2392. /* ---- bg circles from splash.vue ---- */
  2393. .splash-overlay-bg { position: absolute; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; }
  2394. .bg-circle {
  2395. position: absolute;
  2396. border-radius: 50%;
  2397. opacity: 0.12;
  2398. }
  2399. .bg-circle-1 {
  2400. width: 400rpx; height: 400rpx;
  2401. background: #FF8C42;
  2402. top: -100rpx; right: -80rpx;
  2403. animation: splash-float-1 4s ease-in-out infinite;
  2404. }
  2405. .bg-circle-2 {
  2406. width: 280rpx; height: 280rpx;
  2407. background: #FF6B9D;
  2408. bottom: 80rpx; left: -60rpx;
  2409. animation: splash-float-2 5s ease-in-out infinite;
  2410. }
  2411. .bg-circle-3 {
  2412. width: 180rpx; height: 180rpx;
  2413. background: #6366F1;
  2414. top: 50%; right: -40rpx;
  2415. animation: splash-float-3 6s ease-in-out infinite;
  2416. }
  2417. @keyframes splash-float-1 {
  2418. 0%, 100% { transform: translateY(0) scale(1); }
  2419. 50% { transform: translateY(-30rpx) scale(1.05); }
  2420. }
  2421. @keyframes splash-float-2 {
  2422. 0%, 100% { transform: translateY(0) scale(1); }
  2423. 50% { transform: translateY(20rpx) scale(1.08); }
  2424. }
  2425. @keyframes splash-float-3 {
  2426. 0%, 100% { transform: translateY(0) rotate(0deg); }
  2427. 50% { transform: translateY(-20rpx) rotate(10deg); }
  2428. }
  2429. /* ---- body fade-in ---- */
  2430. .splash-overlay-body {
  2431. display: flex;
  2432. flex-direction: column;
  2433. align-items: center;
  2434. animation: splash-body-in 0.8s cubic-bezier(0.16,1,0.3,1) forwards;
  2435. }
  2436. @keyframes splash-body-in {
  2437. from { opacity: 0; transform: translateY(40rpx) scale(0.96); }
  2438. to { opacity: 1; transform: translateY(0) scale(1); }
  2439. }
  2440. /* ---- logo ---- */
  2441. .splash-logo-wrap {
  2442. width: 160rpx; height: 160rpx;
  2443. border-radius: 40rpx;
  2444. background: rgba(255,255,255,0.95);
  2445. display: flex; align-items: center; justify-content: center;
  2446. margin-bottom: 16rpx;
  2447. box-shadow: 0 8rpx 32rpx rgba(249,115,22,0.25);
  2448. animation: splash-logo-pulse 2.5s ease-in-out infinite;
  2449. }
  2450. @keyframes splash-logo-pulse {
  2451. 0%, 100% { box-shadow: 0 8rpx 32rpx rgba(249,115,22,0.25); }
  2452. 50% { box-shadow: 0 8rpx 48rpx rgba(249,115,22,0.45); }
  2453. }
  2454. .splash-logo-img { width: 100rpx; height: 100rpx; }
  2455. /* ---- brand ---- */
  2456. .splash-brand-name {
  2457. font-size: 64rpx; font-weight: 800;
  2458. color: #7C2D12;
  2459. letter-spacing: 10rpx;
  2460. margin-bottom: 2rpx;
  2461. }
  2462. .splash-brand-en {
  2463. font-size: 20rpx;
  2464. color: rgba(124,45,18,0.5);
  2465. letter-spacing: 6rpx;
  2466. margin-bottom: 30rpx;
  2467. }
  2468. .splash-tagline {
  2469. font-size: 26rpx;
  2470. color: rgba(124,45,18,0.7);
  2471. letter-spacing: 4rpx;
  2472. margin-top: 24rpx;
  2473. }
  2474. /* ---- dims row from splash.vue (rounded circles) ---- */
  2475. .splash-dims-row {
  2476. display: flex; flex-direction: row;
  2477. align-items: center; justify-content: center;
  2478. gap: 28rpx;
  2479. }
  2480. .splash-dim-item {
  2481. display: flex; flex-direction: column;
  2482. align-items: center; gap: 8rpx;
  2483. }
  2484. .splash-dim-circle {
  2485. width: 80rpx; height: 80rpx;
  2486. border-radius: 50%;
  2487. display: flex; align-items: center; justify-content: center;
  2488. }
  2489. .splash-dim-icon { font-size: 36rpx; line-height: 1; }
  2490. .splash-dim-label {
  2491. font-size: 22rpx; font-weight: 500;
  2492. color: rgba(124,45,18,0.75);
  2493. line-height: 1;
  2494. }
  2495. /* ---- staggered dim entry from splash.vue ---- */
  2496. .splash-dim-item:nth-child(1) { animation: splash-dim-in 0.5s ease 0.1s both; }
  2497. .splash-dim-item:nth-child(2) { animation: splash-dim-in 0.5s ease 0.2s both; }
  2498. .splash-dim-item:nth-child(3) { animation: splash-dim-in 0.5s ease 0.3s both; }
  2499. .splash-dim-item:nth-child(4) { animation: splash-dim-in 0.5s ease 0.4s both; }
  2500. .splash-dim-item:nth-child(5) { animation: splash-dim-in 0.5s ease 0.5s both; }
  2501. @keyframes splash-dim-in {
  2502. from { opacity: 0; transform: translateY(16rpx) scale(0.8); }
  2503. to { opacity: 1; transform: translateY(0) scale(1); }
  2504. }
  2505. /* ---- loading dots ---- */
  2506. .splash-overlay-loading {
  2507. position: absolute;
  2508. bottom: 120rpx;
  2509. left: 0; right: 0;
  2510. display: flex;
  2511. justify-content: center;
  2512. align-items: center;
  2513. gap: 12rpx;
  2514. }
  2515. .splash-overlay-dot {
  2516. width: 14rpx; height: 14rpx;
  2517. border-radius: 50%;
  2518. background: rgba(249,115,22,0.6);
  2519. animation: splash-dot-bounce 1.4s ease-in-out infinite both;
  2520. }
  2521. .splash-overlay-dot:nth-child(1) { animation-delay: -0.32s; }
  2522. .splash-overlay-dot:nth-child(2) { animation-delay: -0.16s; }
  2523. .splash-overlay-dot:nth-child(3) { animation-delay: 0s; }
  2524. @keyframes splash-dot-bounce {
  2525. 0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  2526. 40% { transform: scale(1); opacity: 1; }
  2527. }
  2528. /* ---- 登录态内容布局 ---- */
  2529. .logged-in-container {
  2530. padding-bottom: 120rpx;
  2531. }
  2532. /* ===== ① 了解区 — 自测大卡(引导"从了解开始") ===== */
  2533. .self-test-card {
  2534. margin: 20rpx 30rpx 16rpx;
  2535. background: linear-gradient(135deg, #667eea, #764ba2);
  2536. border-radius: 20rpx;
  2537. padding: 24rpx 28rpx;
  2538. }
  2539. .self-test-head { display: flex; align-items: center; }
  2540. .self-test-icon { font-size: 40rpx; margin-right: 16rpx; }
  2541. .self-test-info { flex: 1; }
  2542. .self-test-title { font-size: 28rpx; font-weight: bold; color: #fff; display: block; }
  2543. .self-test-sub { font-size: 22rpx; color: rgba(255,255,255,0.8); display: block; margin-top: 4rpx; }
  2544. .self-test-arrow { font-size: 36rpx; color: rgba(255,255,255,0.7); }
  2545. /* ===== ①.b 行动引导条 — Next Best Action ===== */
  2546. .guide-bar {
  2547. margin: 0 30rpx 16rpx;
  2548. border-radius: 20rpx;
  2549. padding: 18rpx 24rpx;
  2550. display: flex;
  2551. flex-direction: row;
  2552. align-items: center;
  2553. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
  2554. }
  2555. .guide-bar-icon-wrap {
  2556. width: 72rpx;
  2557. height: 72rpx;
  2558. border-radius: 18rpx;
  2559. display: flex;
  2560. align-items: center;
  2561. justify-content: center;
  2562. margin-right: 16rpx;
  2563. flex-shrink: 0;
  2564. }
  2565. .guide-bar-icon { font-size: 34rpx; }
  2566. .guide-bar-info { flex: 1; min-width: 0; }
  2567. .guide-bar-title { font-size: 27rpx; font-weight: bold; display: block; }
  2568. .guide-bar-sub { font-size: 21rpx; margin-top: 3rpx; display: block; }
  2569. .guide-bar-btn {
  2570. flex-shrink: 0;
  2571. margin-left: 12rpx;
  2572. padding: 8rpx 20rpx;
  2573. border-radius: 999rpx;
  2574. font-size: 22rpx;
  2575. font-weight: bold;
  2576. }
  2577. .guide-bar-btn-text { }
  2578. /* 颜色主题 — 低饱和背景 + 深色文字,不抢自测卡风头 */
  2579. .guide-bar-orange { background: #FFF3E7; border: 1rpx solid rgba(249,115,22,0.18); }
  2580. .guide-bar-orange .guide-bar-icon-wrap { background: rgba(249,115,22,0.14); }
  2581. .guide-bar-orange .guide-bar-title { color: #9A3412; }
  2582. .guide-bar-orange .guide-bar-sub { color: #B45309; }
  2583. .guide-bar-orange .guide-bar-btn { background: linear-gradient(135deg, #F97316, #FB923C); color: #fff; }
  2584. .guide-bar-blue { background: #EFF4FF; border: 1rpx solid rgba(99,102,241,0.18); }
  2585. .guide-bar-blue .guide-bar-icon-wrap { background: rgba(99,102,241,0.12); }
  2586. .guide-bar-blue .guide-bar-title { color: #312E81; }
  2587. .guide-bar-blue .guide-bar-sub { color: #4338CA; }
  2588. .guide-bar-blue .guide-bar-btn { background: linear-gradient(135deg, #6366F1, #818CF8); color: #fff; }
  2589. .guide-bar-green { background: #ECFDF5; border: 1rpx solid rgba(16,185,129,0.18); }
  2590. .guide-bar-green .guide-bar-icon-wrap { background: rgba(16,185,129,0.12); }
  2591. .guide-bar-green .guide-bar-title { color: #064E3B; }
  2592. .guide-bar-green .guide-bar-sub { color: #047857; }
  2593. .guide-bar-green .guide-bar-btn { background: linear-gradient(135deg, #10B981, #34D399); color: #fff; }
  2594. .guide-bar-purple { background: #F5F3FF; border: 1rpx solid rgba(139,92,246,0.18); }
  2595. .guide-bar-purple .guide-bar-icon-wrap { background: rgba(139,92,246,0.12); }
  2596. .guide-bar-purple .guide-bar-title { color: #4C1D95; }
  2597. .guide-bar-purple .guide-bar-sub { color: #6D28D9; }
  2598. .guide-bar-purple .guide-bar-btn { background: linear-gradient(135deg, #8B5CF6, #A78BFA); color: #fff; }
  2599. .guide-bar-gray { background: #F8FAFC; border: 1rpx solid rgba(100,116,139,0.15); }
  2600. .guide-bar-gray .guide-bar-icon-wrap { background: rgba(100,116,139,0.10); }
  2601. .guide-bar-gray .guide-bar-title { color: #334155; }
  2602. .guide-bar-gray .guide-bar-sub { color: #64748B; }
  2603. .guide-bar-gray .guide-bar-btn { background: linear-gradient(135deg, #94A3B8, #CBD5E1); color: #fff; }
  2604. /* ===== 快捷功能入口(单排,6个横向排列) ===== */
  2605. .quick-bar {
  2606. display: flex;
  2607. flex-direction: row;
  2608. justify-content: space-between;
  2609. align-items: center;
  2610. background: #fff;
  2611. border-radius: 20rpx;
  2612. padding: 20rpx 10rpx;
  2613. }
  2614. .quick-item {
  2615. flex: 1;
  2616. display: flex;
  2617. flex-direction: column;
  2618. align-items: center;
  2619. gap: 8rpx;
  2620. }
  2621. .quick-icon {
  2622. width: 80rpx;
  2623. height: 80rpx;
  2624. border-radius: 20rpx;
  2625. display: flex;
  2626. align-items: center;
  2627. justify-content: center;
  2628. }
  2629. .quick-icon text {
  2630. font-size: 36rpx;
  2631. }
  2632. .quick-item .quick-label {
  2633. font-size: 26rpx;
  2634. color: #666;
  2635. }
  2636. /* ===== 我的任务快捷列表 ===== */
  2637. .task-quick-list {
  2638. display: flex;
  2639. flex-direction: column;
  2640. gap: 12rpx;
  2641. }
  2642. .task-quick-item {
  2643. display: flex;
  2644. flex-direction: row;
  2645. align-items: center;
  2646. justify-content: space-between;
  2647. background: #fff;
  2648. border-radius: 16rpx;
  2649. padding: 18rpx 24rpx;
  2650. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
  2651. }
  2652. .task-quick-info {
  2653. display: flex;
  2654. flex-direction: column;
  2655. min-width: 0;
  2656. flex: 1;
  2657. }
  2658. .task-quick-title {
  2659. font-size: 26rpx;
  2660. color: #333;
  2661. font-weight: 500;
  2662. line-height: 1.4;
  2663. }
  2664. .task-quick-meta {
  2665. font-size: 22rpx;
  2666. color: #F97316;
  2667. margin-top: 4rpx;
  2668. font-weight: bold;
  2669. }
  2670. .btn-quick-complete {
  2671. margin-left: 16rpx;
  2672. padding: 8rpx 24rpx;
  2673. background: linear-gradient(135deg, #F97316, #FB923C);
  2674. color: #fff;
  2675. font-size: 24rpx;
  2676. font-weight: bold;
  2677. border-radius: 20rpx;
  2678. border: none;
  2679. line-height: 1;
  2680. height: 44rpx;
  2681. flex-shrink: 0;
  2682. }
  2683. .btn-quick-complete::after {
  2684. border: none;
  2685. }
  2686. /* ===== 家庭挑战空态 ===== */
  2687. .challenge-empty {
  2688. display: flex;
  2689. flex-direction: column;
  2690. align-items: center;
  2691. padding: 40rpx 0 20rpx;
  2692. }
  2693. .challenge-empty-icon {
  2694. font-size: 64rpx;
  2695. margin-bottom: 12rpx;
  2696. line-height: 1;
  2697. }
  2698. .challenge-empty-text {
  2699. font-size: 26rpx;
  2700. color: #999;
  2701. margin-bottom: 20rpx;
  2702. }
  2703. .challenge-add-btn {
  2704. padding: 10rpx 32rpx;
  2705. background: linear-gradient(135deg, #F97316, #FB923C);
  2706. color: #fff;
  2707. font-size: 24rpx;
  2708. font-weight: bold;
  2709. border-radius: 24rpx;
  2710. border: none;
  2711. line-height: 1;
  2712. height: 48rpx;
  2713. }
  2714. .challenge-add-btn::after {
  2715. border: none;
  2716. }
  2717. .self-test-badge { display: inline-block; align-self: flex-start; margin-top: 8rpx; font-size: 20rpx; color: #F97316; background: rgba(249,115,22,0.1); padding: 4rpx 14rpx; border-radius: 999rpx; }
  2718. /* ===== 能量/积分/CF值变更通知条(从下滑入动画) ===== */
  2719. .change-notification-bar {
  2720. position: fixed;
  2721. bottom: -80rpx;
  2722. left: 30rpx;
  2723. right: 30rpx;
  2724. padding: 16rpx 24rpx;
  2725. background: linear-gradient(135deg, #FFF7ED, #FFEDD5);
  2726. border-radius: 16rpx;
  2727. box-shadow: 0 2rpx 8rpx rgba(249,115,22,0.12);
  2728. transition: bottom 0.3s cubic-bezier(0.16,1,0.3,1) forwards;
  2729. z-index: 100;
  2730. }
  2731. .change-notification-bar.visible {
  2732. bottom: 0;
  2733. animation: slide-up-notice 0.4s cubic-bezier(0.16,1,0.3,1) forwards;
  2734. }
  2735. @keyframes slide-up-notice {
  2736. from { opacity: 0; transform: translateY(80rpx); }
  2737. to { opacity: 1; transform: translateY(0); }
  2738. }
  2739. .change-item {
  2740. font-size: 22rpx;
  2741. font-weight: 500;
  2742. color: #333;
  2743. }
  2744. .change-item.energy { color: #F97316; }
  2745. .change-item.points { color: #10B981; }
  2746. .change-item.cf { color: #6366F1; }
  2747. .change-dismiss {
  2748. margin-left: auto;
  2749. font-size: 24rpx;
  2750. color: #999;
  2751. flex-shrink: 0;
  2752. cursor: pointer;
  2753. }
  2754. </style>