| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504 |
- <template>
- <view>
- <!-- 冷启动 splash overlay — 覆盖首页直到数据加载完毕(tab 切回时不显示) -->
- <view class="splash-overlay" :class="{'fade-out': splashOverlayFading}" v-if="splashOverlay || splashOverlayFading">
- <view class="splash-overlay-bg">
- <view class="bg-circle bg-circle-1"></view>
- <view class="bg-circle bg-circle-2"></view>
- <view class="bg-circle bg-circle-3"></view>
- </view>
- <view class="splash-overlay-body">
- <view class="splash-logo-wrap">
- <image class="splash-logo-img" src="/static/logo.png" mode="aspectFit" />
- </view>
- <text class="splash-brand-name">浠艾福</text>
- <text class="splash-brand-en">Care Family</text>
- <view class="splash-dims-row">
- <view class="splash-dim-item">
- <view class="splash-dim-circle" style="background:rgba(255,140,66,0.3);"><text class="splash-dim-icon">🌏</text></view>
- <text class="splash-dim-label">身</text>
- </view>
- <view class="splash-dim-item">
- <view class="splash-dim-circle" style="background:rgba(255,107,157,0.3);"><text class="splash-dim-icon">🔥</text></view>
- <text class="splash-dim-label">心</text>
- </view>
- <view class="splash-dim-item">
- <view class="splash-dim-circle" style="background:rgba(99,102,241,0.3);"><text class="splash-dim-icon">⚡</text></view>
- <text class="splash-dim-label">智</text>
- </view>
- <view class="splash-dim-item">
- <view class="splash-dim-circle" style="background:rgba(16,185,129,0.3);"><text class="splash-dim-icon">🌿</text></view>
- <text class="splash-dim-label">行</text>
- </view>
- <view class="splash-dim-item">
- <view class="splash-dim-circle" style="background:rgba(245,158,11,0.3);"><text class="splash-dim-icon">💧</text></view>
- <text class="splash-dim-label">富</text>
- </view>
- </view>
- <text class="splash-tagline">给全家的一站式幸福提案</text>
- <view class="splash-overlay-loading">
- <view class="splash-overlay-dot"></view>
- <view class="splash-overlay-dot"></view>
- <view class="splash-overlay-dot"></view>
- </view>
- </view>
- </view>
- <!-- 登录态 — 直接内嵌,保持底签可见 -->
- <view v-if="currentRole" class="logged-in-container">
- <!-- ⓪ 新手成长礼包进度条(新用户引导,全部领取后自动隐藏) -->
- <OnboardingProgressBar ref="onboardingProgress" />
- <!-- ① 了解区 — 自测大卡(首屏,引导"从了解开始") -->
- <view class="self-test-card" @click="goSelfTest">
- <view class="self-test-head">
- <text class="self-test-icon">⚡</text>
- <view class="self-test-info">
- <text class="self-test-title">{{ selfTestTitle }}</text>
- <text class="self-test-sub">{{ selfTestSub }}</text>
- <text v-if="pendingSurveys.length > 0" class="self-test-badge">有 {{ pendingSurveys.length }} 项调研待填</text>
- </view>
- <text class="self-test-arrow">›</text>
- </view>
- </view>
- <!-- ①.b 行动引导条 — Next Best Action(仅登录态展示,定位"现在该做的一件事") -->
- <view v-if="nextBestAction" class="guide-bar" :class="'guide-bar-' + nextBestAction.color" @click="onGuideTap(nextBestAction)">
- <view class="guide-bar-icon-wrap">
- <text class="guide-bar-icon">{{ nextBestAction.icon }}</text>
- </view>
- <view class="guide-bar-info">
- <text class="guide-bar-title">{{ nextBestAction.title }}</text>
- <text class="guide-bar-sub">{{ nextBestAction.sub }}</text>
- </view>
- <view class="guide-bar-btn">
- <text class="guide-bar-btn-text">{{ nextBestAction.btn }} ›</text>
- </view>
- </view>
- <!-- ② 发现区 — 能量沙盘 — Canvas 五行星图(未测评时显示引导卡) -->
- <GateLock v-if="sandboxLocked && sandboxLockGate" :gate="sandboxLockGate" />
- <WuxingSandbox
- v-else-if="sandboxData"
- mode="live"
- :scores="familySandboxScores"
- :overallScore="familySandboxOverall"
- :members="familySandboxMembers"
- :personalData="sandboxPersonalData"
- :dimensions="energyDimensions"
- :totalEnergy="totalEnergy"
- :totalHealthIndex="totalHealthIndex"
- :currentView="currentSandboxView"
- :familyUnlocked="familyUnlocked"
- :memberCount="familyMembersVisible.length"
- @view-change="onSandboxViewChange"
- showDimensionBar
- starHeight="480rpx" />
- <!-- ② 发现区 — 上传报告 -->
- <FamilyFeed
- :items="familyFeed"
- :notices="notices"
- :showHeader="true" />
- <!-- ④ 内容区 — 推荐文章 -->
- <view v-if="showMemberEntry" class="member-entry" @click="goMembership">
- <view class="member-entry-icon-wrap">
- <text class="member-entry-icon">👑</text>
- </view>
- <view class="member-entry-texts">
- <text class="member-entry-title">{{ memberEntryTitle }}</text>
- <text class="member-entry-desc">{{ memberEntryDesc }}</text>
- </view>
- <view class="member-entry-btn">
- <text class="member-entry-btn-text">{{ memberEntryBtn }}</text>
- </view>
- </view>
- <!-- ④ 内容区 — 快捷功能入口(动态渲染,可在应用库自定义) -->
- <view class="section">
- <view class="section-header">
- <text class="section-title">⚡ 快捷功能</text>
- <text class="section-more" @click="goAppLibrary">应用库 ›</text>
- </view>
- <view class="quick-bar">
- <view class="quick-item" v-for="(app, idx) in quickApps" :key="app.key" @click="onQuickTap(app)">
- <view class="quick-icon" :style="getQuickIconStyle(idx)"><text>{{ app.icon }}</text></view>
- <text class="quick-label">{{ app.name }}</text>
- </view>
- <view class="quick-item" v-if="quickApps.length === 0" @click="goAppLibrary">
- <view class="quick-icon" style="background:rgba(99,102,241,0.15)"><text>+</text></view>
- <text class="quick-label">去添加</text>
- </view>
- </view>
- </view>
- <!-- ④ 内容区 — 家庭动态 -->
- <view v-if="hasPendingTasks" class="section">
- <view class="section-header">
- <text class="section-title">📝 我的任务</text>
- <text class="section-more" @click="navTo('/pages/tasks/tasks')">全部 ›</text>
- </view>
- <view class="task-quick-list">
- <view
- v-for="task in pendingTasks"
- :key="task.id"
- class="task-quick-item"
- >
- <view class="task-quick-info">
- <text class="task-quick-title line-clamp-1">{{ task.title }}</text>
- <text class="task-quick-meta">+{{ task.points }}分</text>
- </view>
- <button class="btn-quick-complete" @click="quickCompleteTask(task)">完成</button>
- </view>
- </view>
- </view>
- <!-- ③ 行动区 — 家庭挑战任务 -->
- <view class="section">
- <view class="section-header">
- <text class="section-title">🔥 家庭挑战</text>
- <text class="section-more" @click="goChallengeManage">管理 ›</text>
- </view>
- <FamilyChallengeCard
- v-for="ch in activeChallenges"
- :key="ch.id"
- :challenge="ch"
- :showCheckin="showCheckinBtn"
- @checkin="onChallengeCheckin"
- @respond="onChallengeRespond" />
- <view v-if="activeChallenges.length === 0" class="challenge-empty">
- <text class="challenge-empty-icon">🏆</text>
- <text class="challenge-empty-text">您还没有挑战,去添加吧</text>
- <button class="challenge-add-btn" @click="goChallengeManage">去添加</button>
- </view>
- </view>
- <!-- ③ 行动区 — 会员入口:非会员显示开通 / 快到期显示续费 -->
- <DailyTaskCard />
- <!-- ③ 行动区 — 我的任务(仅当有待完成时显示) -->
- <view class="section">
- <ReportUploadCard
- title="上传报告"
- desc="体检报告 · 菌群检测 · 认知测评 · 心理测评 · 情绪打卡"
- :tags="['体检报告', '菌群检测', '认知测评', '心理测评', '情绪打卡']"
- @click="goToUploadReport" />
- </view>
- <!-- ③ 行动区 — 今日任务 -->
- <view class="section">
- <view class="section-header">
- <text class="section-title">📖 推荐阅读</text>
- <text class="section-more" @click="goMoreArticles">更多 ›</text>
- </view>
- <ArticleBookshelf
- :articles="actionArticles"
- :isLoggedIn="true"
- @articleClick="goArticleDetail" />
- </view>
- <!-- ④ 内容区 — 推荐商品 -->
- <view class="section">
- <view class="section-header">
- <text class="section-title">🛍️ 推荐商品</text>
- <text class="section-more" @click="goMoreProducts">更多 ›</text>
- </view>
- <DimensionProducts
- :isLoggedIn="true"
- :showMore="false"
- @productClick="goProductDetail" />
- </view>
- <!-- 底部占位 -->
- <view class="bottom-spacer" style="height: 40rpx;"></view>
- <!-- 首次登录引导浮层(3 步产品介绍,看过一次后不再弹) -->
- <OnboardingGuide
- :role="currentRole"
- :show="showOnboardingGuide"
- position="home"
- @close="closeOnboardingGuide" />
- <!-- 配置驱动弹窗(guide_popup 表,管理端可配置) -->
- <ConfigurableGuide
- :popup="guidePopup"
- :show="showGuidePopup"
- @done="handleGuidePopupDone" />
- </view>
- <!-- 未登录态 — 发现页/引流内容,直接内嵌,不跳转 -->
- <view v-else class="discover-container">
- <!-- 品牌 Hero 区 -->
- <view class="hero-section">
- <image class="hero-logo" src="/static/logo.png" mode="aspectFit" />
- <text class="hero-name">浠艾福</text>
- <text class="hero-identity">您的专属家庭主动健康管理师</text>
- <text class="hero-slogan">家里每个人的状态,你真的看见了?</text>
- <text class="hero-powered">亿图腾科技出品</text>
- <view class="hero-dims">
- <view class="hero-dim"><text class="hero-dim-emoji">🌏</text><text class="hero-dim-label">身·根基</text></view>
- <view class="hero-dim"><text class="hero-dim-emoji">⚡</text><text class="hero-dim-label">智·赋能</text></view>
- <view class="hero-dim"><text class="hero-dim-emoji">💧</text><text class="hero-dim-label">富·创富</text></view>
- <view class="hero-dim"><text class="hero-dim-emoji">🌿</text><text class="hero-dim-label">行·和谐</text></view>
- <view class="hero-dim"><text class="hero-dim-emoji">🔥</text><text class="hero-dim-label">心·大爱</text></view>
- </view>
- <text class="hero-sub-slogan">孩子的习惯、老人的身体、自己的精力——不用等到出问题才着急。先看见,先了解,不等问题发生。</text>
- <button class="hero-cta-btn" @click="handleLogin">免费体验 · 登录 / 注册</button>
- </view>
- <!-- ② 平台作用·价值主张 -->
- <view class="value-prop-section">
- <text class="value-prop-title">为什么选择浠艾福?</text>
- <view class="value-prop-grid">
- <view class="value-prop-card">
- <text class="value-prop-icon">🧪</text>
- <view class="value-prop-texts">
- <text class="value-prop-name">免费五维测评</text>
- <text class="value-prop-desc">从身体到心智,20 分钟看清全家健康状况</text>
- </view>
- </view>
- <view class="value-prop-card">
- <text class="value-prop-icon">🎯</text>
- <view class="value-prop-texts">
- <text class="value-prop-name">个性化成长方案</text>
- <text class="value-prop-desc">基于测评数据,AI+专家定制专属行动计划</text>
- </view>
- </view>
- <view class="value-prop-card">
- <text class="value-prop-icon">👨👩👧</text>
- <view class="value-prop-texts">
- <text class="value-prop-name">全家共管</text>
- <text class="value-prop-desc">一个家庭一张网,三代同框、全员参与,成长看得见</text>
- </view>
- </view>
- <view class="value-prop-card">
- <text class="value-prop-icon">📈</text>
- <view class="value-prop-texts">
- <text class="value-prop-name">任务与积分激励</text>
- <text class="value-prop-desc">把健康管理变成每天的小行动,习惯自然养成</text>
- </view>
- </view>
- </view>
- </view>
- <!-- ③ 三步上手 -->
- <view class="how-it-works">
- <text class="how-it-works-title">三步开启全家健康之旅</text>
- <view class="step-row">
- <view class="step-item">
- <view class="step-num">1</view>
- <text class="step-name">登录/注册</text>
- <text class="step-sub">(30 秒)</text>
- </view>
- <view class="step-arrow">›</view>
- <view class="step-item">
- <view class="step-num">2</view>
- <text class="step-name">完成五维测评</text>
- <text class="step-sub">(全家各一份)</text>
- </view>
- <view class="step-arrow">›</view>
- <view class="step-item">
- <view class="step-num">3</view>
- <text class="step-name">获得专属方案</text>
- <text class="step-sub">(照着做,持续优化)</text>
- </view>
- </view>
- </view>
- <!-- 五行沙盘预览 -->
- <wuxing-sandbox mode="preview" badgeText="登录查看完整报告" @point-click="handleLogin" />
- <!-- 热门活动(无条件展示) -->
- <view class="section">
- <view class="section-header">
- <text class="section-title">🔥 热门活动</text>
- <text class="section-more" @click="goActivities">查看更多 ›</text>
- </view>
- <view v-if="dimensionActivities.length === 0" class="empty-state" style="padding: 40rpx 0;">
- <text class="empty-text">暂无活动</text>
- </view>
- <view class="activity-list" v-else>
- <view class="activity-card" v-for="act in dimensionActivities" :key="act.id" @click="goActivityDetail(act)">
- <image class="activity-cover" :src="getImageUrl(act.coverImage) || '/static/default-activity.png'" mode="aspectFill" />
- <view class="activity-info">
- <text class="activity-name line-clamp-1">{{ act.title }}</text>
- <view class="activity-meta">
- <text class="activity-time">{{ act.startTime }}</text>
- </view>
- <view class="activity-bottom">
- <text class="activity-status" :class="'status-' + (act.status || 'upcoming')">{{ act.status === 'ongoing' ? '进行中' : act.status === 'ended' ? '已结束' : '即将开始' }}</text>
- <text class="activity-fee" v-if="act.price && act.price > 0">¥{{ (act.price / 100).toFixed(0) }}</text>
- <text class="activity-fee fee-free" v-else>免费</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 推荐阅读(无条件展示) -->
- <view class="section">
- <view class="section-header">
- <text class="section-title">📖 推荐阅读</text>
- <text class="section-more" @click="goArticles">更多 ›</text>
- </view>
- <view class="article-list">
- <view v-if="articlesLoading" class="loading-state" style="padding: 40rpx 0;">
- <text class="loading-text">加载中...</text>
- </view>
- <!-- 无数据时显示占位卡片 -->
- <template v-else-if="indexArticles.length === 0">
- <view class="article-card" v-for="(item, i) in [1,2,3]" :key="i">
- <view class="article-category" :style="{ background: gradientColors[(i-1) % gradientColors.length] }">
- <text class="article-category-text">推荐文章</text>
- </view>
- <text class="article-title">暂无推荐文章</text>
- <text class="article-summary">精彩内容即将上线,敬请期待</text>
- <view class="article-meta">
- <view class="meta-item">
- <text class="meta-icon">📖</text>
- <text class="meta-text">0</text>
- </view>
- <text class="article-date">--</text>
- </view>
- </view>
- </template>
- <!-- 有数据时显示文章卡片 -->
- <template v-else>
- <view class="article-card" v-for="article in indexArticles" :key="article.id" @click="goArticleDetail(article.id)">
- <view class="article-category" :style="{ background: article.categoryColor }">
- <text class="article-category-text">{{ article.category }}</text>
- </view>
- <text class="article-title">{{ article.title }}</text>
- <text class="article-summary">{{ article.summary }}</text>
- <view class="article-meta">
- <view class="meta-item">
- <text class="meta-icon">📖</text>
- <text class="meta-text">{{ article.views }}</text>
- </view>
- <text class="article-date">{{ article.date }}</text>
- </view>
- </view>
- </template>
- </view>
- </view>
- <!-- 底部登录按钮 -->
- <view class="login-footer">
- <button class="login-btn" @click="handleLogin">登录 / 注册</button>
- </view>
- <!-- 底部占位 -->
- <view style="height: 120rpx;"></view>
- </view>
- </view>
- </template>
- <script>
- import store from '../../store/index.js'
- import WuxingSandbox from '../../components/wuxing-sandbox.vue'
- import GateLock from '../../components/gate-lock.vue'
- import FamilyFeed from '../../components/FamilyFeed.vue'
- import DimensionProducts from '../../components/DimensionProducts.vue'
- import ArticleBookshelf from '../../components/ArticleBookshelf.vue'
- import FamilyChallengeCard from '../../components/FamilyChallengeCard.vue'
- import DailyTaskCard from '../../components/daily-task-card.vue'
- import ReportUploadCard from '../../components/report-upload-card.vue'
- import OnboardingProgressBar from '../../components/OnboardingProgressBar.vue'
- import OnboardingGuide from '../../components/OnboardingGuide.vue'
- import ConfigurableGuide from '../../components/ConfigurableGuide.vue'
- 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 } from '../../utils/api.js'
- import { findAppByKey, getShortcutableApps } from '../../utils/app-library.js'
- import nav from '../../utils/nav.js'
- import config from '@/config.js'
- import { parseDate } from '../../utils/format.js'
- export default {
- components: {
- WuxingSandbox,
- GateLock,
- FamilyFeed,
- DimensionProducts,
- ArticleBookshelf,
- FamilyChallengeCard,
- DailyTaskCard,
- ReportUploadCard,
- OnboardingProgressBar,
- OnboardingGuide,
- ConfigurableGuide,
- },
- data() {
- // 从 storage 预取登录态/角色,确保首次渲染即正确(WeChat 渲染层/逻辑层分离架构下 onLoad 执行前已渲染)
- var _token = uni.getStorageSync('token')
- var _currentRole = ''
- if (_token) {
- _currentRole = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || ''
- }
- // 冷启动标记(由 App.vue onLaunch 设置,仅在冷启动时存在)
- var _isFirstLaunch = (uni.getStorageSync('_showSplashOverlay') === '1')
- return {
- currentRole: _currentRole,
- // splash loading overlay(冷启动时展示,数据加载完关闭)
- splashOverlay: _isFirstLaunch,
- splashOverlayFading: false,
- _splashReady: false,
- _watchPageReadyDone: false,
- pendingSurveys: [],
- selfCheckScore: null,
- selfCheckLoading: false,
- showOnboardingGuide: false,
- _onboardingGuideAttempted: false,
- guidePopup: null,
- showGuidePopup: false,
- _guidePopupAttempted: false,
- dimensionActivities: [],
- indexArticles: [],
- articlesLoading: false,
- gradientColors: [
- 'linear-gradient(135deg, #10B981, #34D399)',
- 'linear-gradient(135deg, #5B9BD5, #8FC5E8)',
- 'linear-gradient(135deg, #8B5CF6, #C084FC)',
- 'linear-gradient(135deg, #F97316, #FB923C)',
- 'linear-gradient(135deg, #6366F1, #818CF8)'
- ],
- // 登录态数据
- familyMembersVisible: [],
- // 接口数据是否已检查(避免"暂无数据"闪烁)
- childrenChecked: false,
- membersChecked: false,
- selectedMemberId: null,
- sandboxData: null,
- sandboxPersonalData: null,
- sandboxFamilyData: null,
- sandboxLocked: false,
- sandboxLockGate: null,
- currentSandboxView: 'personal',
- familyUnlocked: false,
- energyDimensions: [],
- totalEnergy: 0,
- totalHealthIndex: 0,
- articles: [],
- children: [],
- currentChildId: null,
- activeChallenges: [],
- pendingTasks: [],
- familyFeed: [],
- notices: [],
- loggedInInitDone: false,
- // 会员状态(沙盘下方会员入口使用)
- isMember: false,
- isLifetime: false,
- membershipDays: 0,
- // 分享邀请码
- referralCode: '',
- referralCodeLoaded: false,
- // 首页快捷区(应用库自定义)
- quickApps: [],
- myShortcuts: [],
- appUsage: {},
- quickLoaded: false
- }
- },
- computed: {
- isFamilyAdmin: function() {
- if (!this.familyMembersVisible || this.familyMembersVisible.length === 0) return false
- // isAdmin 语义为"成员本人是否为家庭创建者";自己(isSelf)是创建者即管理员
- var me = this.familyMembersVisible.filter(function(m) { return m.isSelf })[0]
- return !!(me && me.isAdmin === true)
- },
- sandboxScores: function() {
- var d = this.sandboxData || {}
- return {
- body: d.bodyScore || 0,
- mind: d.mindScore || 0,
- wisdom: d.wisdomScore || 0,
- action: d.actionScore || 0,
- wealth: d.wealthScore || 0
- }
- },
- familySandboxScores: function() {
- var d = this.sandboxFamilyData || {}
- return {
- body: d.bodyScore || 0,
- mind: d.mindScore || 0,
- wisdom: d.wisdomScore || 0,
- action: d.actionScore || 0,
- wealth: d.wealthScore || 0
- }
- },
- familySandboxOverall: function() {
- return this.sandboxFamilyData ? (this.sandboxFamilyData.overallScore || 0) : 0
- },
- familySandboxMembers: function() {
- return this.sandboxFamilyData ? (this.sandboxFamilyData.members || []) : []
- },
- hasPendingTasks: function() {
- return (this.pendingTasks && this.pendingTasks.length > 0)
- },
- actionArticles: function() {
- if (!this.articles || this.articles.length === 0) return []
- return this.articles.slice(0, 5)
- },
- // 会员入口显示:非会员显示开通;会员剩余≤30天显示续费
- showMemberEntry: function() {
- if (!this.isLoggedIn()) return false
- if (this.isLifetime) return false
- if (!this.isMember) return true
- return this.membershipDays > 0 && this.membershipDays <= 30
- },
- showCheckinBtn: function() {
- return (uni.getStorageSync('role') || 'parent') === 'child'
- },
- memberEntryTitle: function() {
- if (this.isLifetime) return '终身会员 · 永久有效'
- if (!this.isMember) return '开通会员,解锁全部特权'
- return '会员即将到期,续费恢复权益'
- },
- memberEntryDesc: function() {
- if (this.isLifetime) return '享全平台权益,无需续费'
- if (!this.isMember) return '享专属折扣 · 成长服务 · 规划指导'
- return '剩余 ' + this.membershipDays + ' 天,续费保持权益不中断'
- },
- memberEntryBtn: function() {
- if (this.isLifetime) return '已拥有'
- return this.isMember ? '立即续费' : '立即开通'
- },
- // 自测大卡:已有数据(沙盘解锁)显示"再次了解",否则显示引导文案
- selfTestTitle: function() {
- return this.sandboxData ? '再次了解 · 看看变化' : '先花 1 分钟,了解全家健康状况'
- },
- selfTestSub: function() {
- if (this.sandboxData) {
- if (this.selfCheckScore != null) {
- return '最近自检得分 ' + this.selfCheckScore + '/45 分 · 点击查看'
- }
- return '最近综合得分 ' + (this.sandboxData.overallScore || 0) + ' 分 · 点击查看'
- }
- return '15 题五维自检 · 约 20 秒'
- },
- // ===== Next Best Action 引导条(C 方案)=====
- // 优先级:沙盘未解锁 > 待填调研 > 待办任务 > 未读通知 > 默认引导
- // 只展示当前最该做的一件事,未登录态不展示
- nextBestAction: function() {
- if (!this.currentRole) return null
- // 1) 沙盘未解锁 — 最高优先级,引导完成自检
- if (this.sandboxLocked) {
- return {
- type: 'self-check',
- icon: '⚡',
- title: '先完成五维自检',
- sub: '15 题,约 20 秒,解锁全家能量报告',
- btn: '去自检',
- color: 'orange'
- }
- }
- // 2) 家庭成员为空 — 新用户关键动作,引导添加孩子/家人
- if (this.membersChecked && this.familyMembersVisible && this.familyMembersVisible.length <= 1) {
- return {
- type: 'add-member',
- icon: '👨👩👧',
- title: '添加家庭成员',
- sub: '邀请家人加入,全家一起开启健康管理',
- btn: '去添加',
- color: 'blue'
- }
- }
- // 3) 待填调研 — 定期调研是用户的实际行动邀请
- if (this.pendingSurveys && this.pendingSurveys.length > 0) {
- return {
- type: 'survey',
- icon: '📝',
- title: '有 ' + this.pendingSurveys.length + ' 项调研待填',
- sub: '填完解锁下一阶段内容',
- btn: '去填写',
- color: 'blue'
- }
- }
- // 4) 待办任务 — 用户已完成自检后的执行路径
- if (this.pendingTasks && this.pendingTasks.length > 0) {
- return {
- type: 'task',
- icon: '🎯',
- title: '今日有 ' + this.pendingTasks.length + ' 项待办',
- sub: '完成可累积成长分',
- btn: '去完成',
- color: 'green'
- }
- }
- // 5) 未读通知 — 私域触达优先
- var unreadCount = 0
- if (this.notices && this.notices.length) {
- for (var i = 0; i < this.notices.length; i++) {
- if (this.notices[i] && this.notices[i].unread) unreadCount++
- }
- }
- if (unreadCount > 0) {
- return {
- type: 'notice',
- icon: '📬',
- title: '有 ' + unreadCount + ' 条新消息',
- sub: '家庭动态、通知、待办提醒',
- btn: '查看',
- color: 'purple'
- }
- }
- // 6) 默认引导 — 已完成所有任务,指向任务中心
- return {
- type: 'default',
- icon: '✨',
- title: '今日任务已清空',
- sub: '去任务中心看看,保持成长节奏',
- btn: '逛一逛',
- color: 'gray'
- }
- }
- },
- onLoad(options) {
- this._onLoadFired = true
- // 兜底:分享卡直达首页(热启动直通等 App 级捕获未覆盖到的路径)时,
- // 新用户把推荐码写入 storage,登录注册后由 login / user-edit 消费绑定推荐人
- // 注意:type=parent_invite 的家庭邀请码不存推荐码 storage,避免后续误绑
- if (options && !uni.getStorageSync('token')) {
- var refCode = options.refCode
- if (!refCode && options.inviteCode && options.type !== 'parent_invite') {
- refCode = options.inviteCode // 兼容老推荐码链接
- }
- if (refCode) {
- uni.setStorageSync('refCode', refCode)
- }
- }
- this._doInit(options)
- },
- onShow() {
- // splash overlay 已在 data() 中根据 storage 标记初始化,此处只需配置关闭条件
- if (this.splashOverlay) {
- uni.removeStorageSync('_showSplashOverlay')
- this._splashLoadCount = 0
- this._splashMinPassed = false
- var self = this
- // 最低展示 800ms
- setTimeout(function() {
- self._splashMinPassed = true
- self._tryHideSplash()
- }, 800)
- // 最多展示 5s
- setTimeout(function() {
- if (self.splashOverlay) self._hideSplashOverlay()
- }, 5000)
- }
- // 首次加载:onLoad 已触发 _doInit,此处跳过避免重复调用
- // 后续 onShow(切 Tab 返回):刷新易变数据(会员状态、今日任务、挑战列表)
- // 关键修复:在 onShow 中也检查 onboarding,兼容 switchTab 后未触发 onLoad 的情况
- if (!this.showOnboardingGuide) {
- this._maybeShowOnboardingGuide()
- }
- this.loadGuidePopup()
- if (this._onLoadFired) {
- this._onLoadFired = false // 清标记,后续 onShow 走刷新路径
- } else {
- this._refreshOnShow()
- }
- // 定期调研待办角标(内部自检登录态,未登录静默清空)
- this._loadSurveyBadge()
- },
- methods: {
- _checkSplashReady() {
- this._splashLoadCount++
- this._tryHideSplash()
- },
- _tryHideSplash() {
- if (this.splashOverlayFading) return
- if (!this._splashMinPassed) return
- if (this.isLoggedIn()) {
- // 登录用户:等待子组件的 ready 信号
- if (this._splashReady) this._hideSplashOverlay()
- } else {
- // 游客:等待 3 个 API 全部返回
- if (this._splashLoadCount >= 3) this._hideSplashOverlay()
- }
- },
- _hideSplashOverlay() {
- if (this.splashOverlayFading) return
- this.splashOverlayFading = true
- var self = this
- setTimeout(function() {
- self.splashOverlay = false
- self.splashOverlayFading = false
- }, 400)
- },
- // ===== 首页快捷区(应用库自定义) =====
- // 排序算法:锁定占位 + 频度填满剩余(最多 6 个)
- computeQuickApps: function(myShortcuts, usage) {
- var lockedApps = []
- var myShortcutsArr = myShortcuts || []
- // 1. 锁定应用按 sortOrder 升序
- lockedApps = myShortcutsArr.filter(function(s) { return s.locked === 1 })
- .sort(function(a, b) { return a.sortOrder - b.sortOrder })
- if (lockedApps.length >= 6) {
- return lockedApps.slice(0, 6)
- }
- // 2. 剩余格数:候选 = 可快捷且未被锁定的应用,按频度降序填充
- var remaining = 6 - lockedApps.length
- var lockedKeys = {}
- lockedApps.forEach(function(s) { lockedKeys[s.appKey] = true })
- var candidates = getShortcutableApps().filter(function(app) { return !lockedKeys[app.key] })
- candidates.sort(function(a, b) {
- var ca = (usage && usage[a.key]) || 0
- var cb = (usage && usage[b.key]) || 0
- return cb - ca
- })
- return lockedApps.concat(candidates.slice(0, remaining))
- },
- // 默认 6 个快捷入口(未配置自定义快捷方式时使用)
- getDefaultQuickApps: function() {
- var defaultKeys = ['task', 'interaction', 'tiandi', 'members', 'circle', 'shop']
- var shown = []
- defaultKeys.forEach(function(key) {
- var app = findAppByKey(key)
- if (app) shown.push({ key: app.key, name: app.name, icon: app.icon, route: app.route, locked: 0 })
- })
- return shown
- },
- // 后端返回 myShortcuts(含 locked/sortOrder);未配置(myShortcuts 为空)时使用默认 6 个
- loadQuickApps: function() {
- var self = this
- getAppLibrary().then(function(res) {
- if (res.code === 200 && res.data) {
- self.myShortcuts = res.data.myShortcuts || []
- self.appUsage = res.data.usage || {}
- var shown = []
- if (!self.myShortcuts || self.myShortcuts.length === 0) {
- // 用户未配置:使用默认 6 个(不按频度重排)
- shown = self.getDefaultQuickApps()
- } else {
- // 已配置:锁定占位 + 频度填充
- var result = self.computeQuickApps(self.myShortcuts, self.appUsage)
- result.forEach(function(item) {
- var appKey = item.appKey
- var app = findAppByKey(appKey)
- if (app) {
- shown.push({
- key: app.key,
- name: app.name,
- icon: app.icon,
- route: app.route,
- locked: item.locked
- })
- }
- })
- }
- self.quickApps = shown
- self.quickLoaded = true
- }
- }).catch(function() {
- // 接口失败:回退到默认 6 个
- self.quickApps = self.getDefaultQuickApps()
- self.quickLoaded = true
- })
- },
- onQuickTap: function(app) {
- if (!app || !app.route) return
- // 记录进入次数(静默,失败不影响跳转)
- if (app.key) {
- reportAppEnter(app.key).catch(function() {})
- }
- this.navTo(app.route)
- },
- goAppLibrary: function() {
- uni.navigateTo({ url: '/pages/home/app-library' })
- },
- getQuickIconStyle: function(idx) {
- var palette = [
- 'rgba(99,102,241,0.15)',
- 'rgba(16,185,129,0.15)',
- 'rgba(139,92,246,0.15)',
- 'rgba(245,158,11,0.15)',
- 'rgba(255,107,157,0.15)',
- 'rgba(249,115,22,0.15)'
- ]
- return { background: palette[idx % palette.length] }
- },
- // ===== 登录态数据加载 =====
- loadLoggedInData: function() {
- this.loadFamilyData()
- this.loadReferralCode()
- this.loadQuickApps()
- },
- // 合并原 loadFamilyMembers + loadChildren:仅调用一次 getFamilyMemberList
- loadFamilyData: function() {
- var self = this
- getFamilyMemberList({ visibleOnly: true }).then(function(res) {
- if (res.code === 200 && res.data) {
- var arr = Array.isArray(res.data) ? res.data : (res.data.list || [])
- self.familyMembersVisible = arr
- // 过滤出孩子成员(effectiveRole 为 'child' 的成员)
- self.children = arr.filter(function(m) { return m.effectiveRole === 'child' })
- var savedChildId = uni.getStorageSync('currentChildId')
- if (savedChildId) {
- self.currentChildId = savedChildId
- }
- self.loadDimensionData()
- }
- self.childrenChecked = true
- self.membersChecked = true
- self.loadTodayTasks()
- self.loadFamilyFeed()
- self.loadNotices()
- self.loadNotifications()
- }).catch(function(e) {
- console.log('获取家庭成员失败', e)
- self.familyMembersVisible = []
- self.children = []
- self.childrenChecked = true
- self.membersChecked = true
- })
- },
- // loadChildren 已废弃:loadFamilyData 统一调用 getFamilyMemberList 一次,
- // 从响应中过滤出 effectiveRole==='child' 的成员赋给 this.children。
- // 删除了原 loadChildren 方法(调用 getChildren 会重复打 /api/family/member/list)。
- loadDimensionData: function() {
- this.loadSandboxData()
- this.loadEnergyOverview()
- this.loadActionArticles()
- this.loadChallenges()
- this.loadSelfCheckStatus()
- },
- loadEnergyOverview: function() {
- var memberId = this.currentChildId || uni.getStorageSync('currentMemberId')
- if (!memberId) return
- var self = this
- getEnergyOverview(memberId).then(function(res) {
- if (res && res.data) {
- self.energyDimensions = res.data.dimensions || []
- self.totalEnergy = res.data.totalEnergy || 0
- self.totalHealthIndex = res.data.totalHealthIndex || 0
- }
- }).catch(function(e) {
- console.log('获取能量概览失败', e)
- })
- },
- loadSandboxData: function() {
- var self = this
- var memberId = uni.getStorageSync('currentMemberId') || uni.getStorageSync('currentChildId') || null
- getEnergySandbox(this.currentSandboxView, memberId).then(function(res) {
- if (res && res.data) {
- var d = res.data
- if (d.locked) {
- // 未解锁:显示引导卡(GateLock 渲染自检引导按钮)
- self.sandboxLocked = true
- self.sandboxLockGate = d.gate || null
- self.sandboxData = null
- self.sandboxPersonalData = null
- self.sandboxFamilyData = null
- } else {
- self.sandboxLocked = false
- self.sandboxLockGate = null
- self.sandboxPersonalData = d.personalData || null
- self.sandboxFamilyData = d.familyData || null
- self.sandboxData = self.currentSandboxView === 'family' ? (d.familyData || null) : (d.personalData || null)
- self.familyUnlocked = d.familyUnlocked || false
- }
- self._splashReady = true
- self._tryHideSplash()
- }
- }).catch(function() {})
- },
- /** 切换沙盘个人/全家视角(本地切换,不重新请求) */
- onSandboxViewChange: function(view) {
- if (view === this.currentSandboxView) return
- this.currentSandboxView = view
- this.sandboxData = view === 'family' ? (this.sandboxFamilyData || null) : (this.sandboxPersonalData || null)
- },
- loadActionArticles: function() {
- var self = this
- getFeaturedArticles({ size: 5 }).then(function(res) {
- if (res.code === 200 && res.data) {
- var gradientColors = [
- 'linear-gradient(135deg, #10B981, #34D399)',
- 'linear-gradient(135deg, #5B9BD5, #8FC5E8)',
- 'linear-gradient(135deg, #8B5CF6, #C084FC)',
- 'linear-gradient(135deg, #F97316, #FB923C)',
- 'linear-gradient(135deg, #6366F1, #818CF8)'
- ]
- var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
- self.articles = list.map(function(item, index) {
- return {
- id: item.id,
- category: item.categoryName || '行动社交',
- categoryColor: gradientColors[index % gradientColors.length],
- title: item.title || '',
- summary: item.summary || '',
- dimensionWeights: item.dimensionWeights || null,
- views: item.viewCount ? String(item.viewCount) : '0',
- likes: '0',
- date: item.publishedAt ? item.publishedAt.slice(0, 10) : '',
- relatedDimensions: self.parseRelatedDimensions(item.relatedDimensions),
- coverImage: item.coverImage
- }
- })
- }
- }).catch(function() {})
- },
- loadChallenges: function() {
- var self = this
- getChallengeList({}).then(function(res) {
- if (res.code === 200 && Array.isArray(res.data)) {
- self.activeChallenges = res.data
- }
- }).catch(function() {
- self.activeChallenges = []
- })
- },
- loadTodayTasks: function() {
- var self = this
- var role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || 'parent'
- // 家长:家庭维度拉取(方案任务可能挂在任意成员,不只是当前孩子)
- if (role === 'parent') {
- getTodayTasks(null, { familyWide: true }).then(function(res) {
- if (res.code === 200 && Array.isArray(res.data)) {
- self.pendingTasks = res.data.filter(function(t) {
- return t.status === 'pending'
- })
- }
- }).catch(function() {
- self.pendingTasks = []
- })
- return
- }
- if (!self.currentChildId) {
- self.pendingTasks = []
- return
- }
- getTodayTasks(self.currentChildId).then(function(res) {
- if (res.code === 200 && Array.isArray(res.data)) {
- self.pendingTasks = res.data.filter(function(t) {
- return t.status === 'pending'
- })
- }
- }).catch(function() {
- self.pendingTasks = []
- })
- },
- loadFamilyFeed: function() {
- var self = this
- // 仅对第一个孩子拉取任务历史(避免 N 个孩子 N 次 /api/tasks/history 请求)
- var children = (self.children || []).filter(function(m) { return m.effectiveRole === 'child' })
- if (children.length === 0) {
- self.familyFeed = []
- return
- }
- var child = children[0]
- getTaskHistory(child.id, 1, 3).then(function(res) {
- var tasks = []
- if (res.code === 200) {
- var data = res.data
- tasks = (data && data.records) ? data.records : (Array.isArray(data) ? data : [])
- }
- var feed = tasks.filter(function(t) { return t.status === 'completed' }).map(function(t) {
- var points = t.pointsEarned || t.points || 0
- var timeStr = ''
- if (t.completedAt && typeof t.completedAt === 'string') {
- timeStr = t.completedAt.substring(11, 16)
- }
- return {
- text: '✅ ' + (child.nickname || '小名') + ' 完成「' + (t.title || '任务') + '」 +' + points + '分',
- time: timeStr,
- type: 'task'
- }
- })
- self.familyFeed = feed.slice(0, 10)
- }).catch(function() {
- self.familyFeed = []
- })
- },
- loadNotices: function() {
- var self = this
- getNotices().then(function(res) {
- if (res.code === 200 && res.data) {
- var notices = res.data.map(function(n) {
- var timeStr = ''
- if (n.createdAt) {
- var d = parseDate(n.createdAt)
- if (d) {
- timeStr = (d.getMonth() + 1) + '月' + d.getDate() + '日'
- }
- }
- return {
- text: '📢 ' + n.title,
- time: timeStr,
- type: 'notice',
- notice: n
- }
- })
- self.notices = notices
- // 合并 notices 到 familyFeed(优先显示)
- self.familyFeed = notices.concat(self.familyFeed).slice(0, 10)
- }
- }).catch(function() {})
- },
- // W3: 用户通知入动态(未读优先显示在 familyFeed 顶部)
- loadNotifications: function() {
- var self = this
- getNotificationList().then(function(res) {
- if (res.code === 200 && res.data) {
- var notifications = res.data.map(function(n) {
- var timeStr = ''
- if (n.createdAt) {
- var d = parseDate(n.createdAt)
- if (d) {
- timeStr = (d.getMonth() + 1) + '月' + d.getDate() + '日'
- }
- }
- return {
- text: '📬 ' + n.title,
- time: timeStr,
- type: 'notification',
- unread: (n.isRead === 0),
- notice: n
- }
- })
- var unread = notifications.filter(function(n) { return n.unread })
- var read = notifications.filter(function(n) { return !n.unread })
- // 未读在前,已读在后,合并到 familyFeed 顶部
- self.familyFeed = unread.concat(read, self.familyFeed).slice(0, 10)
- }
- }).catch(function() {})
- },
- quickCompleteTask: function(task) {
- var self = this
- var memberId = (task && task.familyMemberId) || self.currentChildId || uni.getStorageSync('currentMemberId')
- completeTaskApi(task.id, memberId, '').then(function(res) {
- if (res.code === 200) {
- uni.showToast({ title: '获得 ' + (res.data && res.data.pointsEarned || 0) + ' 积分', icon: 'success' })
- self.loadTodayTasks()
- } else {
- uni.showToast({ title: (res && res.message) || '完成失败', icon: 'none' })
- }
- }).catch(function() {
- uni.showToast({ title: '完成失败,请重试', icon: 'none' })
- })
- },
- onChallengeCheckin: function(payload) {
- var self = this
- updateChallengeProgress({ challengeId: payload.challengeId, delta: 1 }).then(function(res) {
- if (res && res.code === 200) {
- uni.showToast({ title: '打卡成功', icon: 'success' })
- self.loadChallenges()
- } else {
- uni.showToast({ title: (res && res.message) || '打卡失败', icon: 'none' })
- }
- }).catch(function() {
- uni.showToast({ title: '打卡失败,请重试', icon: 'none' })
- })
- },
- onChallengeRespond: function(payload) {
- var self = this
- respondChallenge({ challengeId: payload.challengeId, action: payload.action }).then(function(res) {
- if (res && res.code === 200) {
- uni.showToast({ title: payload.action === 'agree' ? '已同意' : '已拒绝', icon: 'success' })
- self.loadChallenges()
- } else {
- uni.showToast({ title: (res && res.message) || '操作失败', icon: 'none' })
- self.loadChallenges()
- }
- }).catch(function() {
- uni.showToast({ title: '操作失败,请重试', icon: 'none' })
- })
- },
- // loadFamilyMembers 已合并到 loadFamilyData(避免重复调用 /api/family/member/list)
- parseRelatedDimensions: function(val) {
- if (!val) return []
- if (Array.isArray(val)) return val
- if (typeof val === 'string') {
- try {
- var parsed = JSON.parse(val)
- return Array.isArray(parsed) ? parsed : []
- } catch (e) {
- return val.split(',').map(function(s) { return s.trim() }).filter(function(s) { return s })
- }
- }
- return []
- },
- onFamilyMemberSelect: function(member) {
- this.selectedMemberId = member.id
- },
- onFamilyMemberSwitch: function(member) {
- var self = this
- if (!member || !member.id) return
- switchToFamilyMember(member.id, member.source || 'family_member').then(function(res) {
- if (res.code === 200 && res.data) {
- store.commit('switchToMember', {
- memberId: res.data.memberId,
- effectiveRole: res.data.effectiveRole
- })
- uni.showToast({ title: '已切换到' + (member.nickname || '该成员'), icon: 'success' })
- setTimeout(function() {
- uni.reLaunch({ url: '/pages/index-home/index' })
- }, 1000)
- } else {
- uni.showToast({ title: res.message || '切换失败', icon: 'none' })
- }
- }).catch(function() {
- uni.showToast({ title: '切换失败', icon: 'none' })
- })
- },
- navTo: function(url) {
- nav.goPage(url)
- },
- goActivityDetail: function(act) {
- if (!act || !act.id) return
- uni.navigateTo({ url: '/pages/activity/activity-detail/activity-detail?id=' + act.id })
- },
- goMoreActivities: function() {
- uni.navigateTo({ url: '/pages/activity/index' })
- },
- goProductDetail: function(prod) {
- uni.navigateTo({ url: '/pages/discover-detail/product-detail/product-detail?id=' + prod.id })
- },
- goMoreProducts: function() {
- uni.navigateTo({ url: '/pages/shop/index/index' })
- },
- goArticleDetail: function(article) {
- var id = article.id || article
- uni.navigateTo({ url: '/pages/article-center/article-detail?id=' + id })
- },
- goMoreArticles: function() {
- uni.navigateTo({ url: '/pages/article-center/index' })
- },
- goToUploadReport: function() {
- var id = this.currentChildId || ''
- uni.navigateTo({ url: '/pages/health/report-upload?memberId=' + id + '&from=index' })
- },
- // 定期调研待办角标(内部自检登录态,未登录静默清空)
- _loadSurveyBadge: function() {
- var self = this
- if (!this.isLoggedIn()) { self.pendingSurveys = []; return }
- getSurveyStatus({}).then(function(res) {
- var list = (res && res.code === 200 && res.data && res.data instanceof Array) ? res.data : []
- var pending = []
- for (var i = 0; i < list.length; i++) {
- if (list[i] && list[i].status === 'pending') pending.push(list[i])
- }
- self.pendingSurveys = pending
- }).catch(function() { self.pendingSurveys = [] })
- },
- goSelfTest: function() {
- var firstPending = null
- for (var i = 0; i < this.pendingSurveys.length; i++) {
- var s = this.pendingSurveys[i]
- if (s && s.templateId) { firstPending = s; break }
- }
- if (firstPending) {
- var url = '/pages/health/survey-questionnaire?templateId=' + firstPending.templateId +
- '&templateTitle=' + encodeURIComponent(firstPending.title || '定期调研') +
- '&templateDimension=' + encodeURIComponent(firstPending.dimension || '') +
- '&periodStart=' + (firstPending.periodStart || '') +
- '&periodEnd=' + (firstPending.periodEnd || '')
- uni.navigateTo({ url: url })
- } else {
- // 无待填调研 → 进入五维自检中间页
- uni.navigateTo({ url: '/pages/family/self-check-entry' })
- }
- },
- // ===== Next Best Action 引导条点击 =====
- onGuideTap: function(action) {
- if (!action) return
- switch (action.type) {
- case 'self-check':
- this.goSelfTest()
- break
- case 'survey':
- // 跳转到第一个待填调研
- if (this.pendingSurveys && this.pendingSurveys.length > 0) {
- var s = this.pendingSurveys[0]
- uni.navigateTo({
- url: '/pages/health/survey-questionnaire?templateId=' + s.templateId +
- '&templateTitle=' + encodeURIComponent(s.title || '定期调研') +
- '&templateDimension=' + encodeURIComponent(s.dimension || '') +
- '&periodStart=' + (s.periodStart || '') +
- '&periodEnd=' + (s.periodEnd || '')
- })
- }
- break
- case 'add-member':
- this.navTo('/pages/profile-extra/family-members')
- break
- case 'task':
- this.navTo('/pages/tasks/tasks')
- break
- case 'notice':
- this.navTo('/pages/profile/profile')
- break
- case 'default':
- this.navTo('/pages/tasks/tasks')
- break
- }
- },
- loadSelfCheckStatus: function() {
- var self = this
- getSelfCheckStatus().then(function(res) {
- if (res.code === 200 && res.data && res.data.lastResult) {
- self.selfCheckScore = res.data.lastResult.totalScore
- }
- }).catch(function() {})
- },
- _doInit(options) {
- options = options || {}
- if (!this.isLoggedIn()) {
- this.currentRole = ''
- this.loadDimensionActivities()
- this.loadFeaturedArticles()
- return
- }
- this.syncRoleAndTabBar()
- if (options.inviteCode && options.type === 'parent_invite') {
- this.handleParentInvite(options.inviteCode)
- return
- }
- var storedCode = uni.getStorageSync('inviteCode')
- var storedType = uni.getStorageSync('inviteType')
- if (storedCode && storedType === 'parent_invite') {
- this.handleParentInvite(storedCode)
- uni.removeStorageSync('inviteCode')
- uni.removeStorageSync('inviteType')
- return
- }
- // 登录用户:直接在 TabBar 页面内联渲染,保持底签可见
- if (!this.loggedInInitDone) {
- // 首次加载:全量初始化(数据 + 会员状态),onShow 不再重复
- this.loggedInInitDone = true
- this.loadLoggedInData()
- this.checkMemberStatus()
- }
- this._watchPageReady()
- this._maybeShowOnboardingGuide()
- },
- _refreshOnShow() {
- // 切 Tab 返回:刷新家庭成员 + 沙盘 + 会员状态(loadFamilyData 内含任务/挑战刷新)
- if (!this.isLoggedIn()) {
- this.currentRole = ''
- return
- }
- // 登录态可能在后台发生变化(如从登录页 switchTab 返回),
- // 必须在此重新同步 currentRole,否则 v-if="currentRole" 无法切换到登录视图
- this.syncRoleAndTabBar()
- this.checkMemberStatus()
- this.loadFamilyData()
- },
- _watchPageReady() {
- if (this._watchPageReadyDone) return
- this._watchPageReadyDone = true
- var that = this
- that.$watch('_splashReady', function(newVal) {
- if (newVal) that._tryHideSplash()
- })
- },
- // 首次登录引导浮层:异步拉取配置并按版本号判断是否展示
- _maybeShowOnboardingGuide() {
- if (this.showOnboardingGuide) return
- if (this._onboardingGuideAttempted) return
- this._onboardingGuideAttempted = true
- var self = this
- getGuideConfig().then(function(res) {
- var cfg = (res && res.data) ? res.data : null
- var cfgVersion = cfg ? (cfg.version || '1.0') : '1.0'
- // 检查启用
- if (cfg && cfg.enabled === false) return
- // 检查位置(index-home 对应 'home' 位置)
- if (cfg && cfg.positions && cfg.positions.indexOf('home') === -1) return
- // 比较版本
- var stored = uni.getStorageSync('_onboardingDone')
- var seenVersion = '0.0'
- if (stored) {
- try {
- var obj = typeof stored === 'string' ? JSON.parse(stored) : stored
- if (obj && obj.version) seenVersion = obj.version
- } catch (e) {}
- }
- if (self._compareVersion(seenVersion, cfgVersion) >= 0) return
- setTimeout(function() {
- if (!self.isLoggedIn()) return
- self.showOnboardingGuide = true
- }, 600)
- }).catch(function() {
- // 接口失败走旧逻辑
- var stored = uni.getStorageSync('_onboardingDone')
- if (stored) {
- try {
- var obj = typeof stored === 'string' ? JSON.parse(stored) : stored
- if (obj && obj.version && self._compareVersion(obj.version, '1.0') >= 0) return
- } catch (e) {}
- }
- setTimeout(function() {
- if (!self.isLoggedIn()) return
- self.showOnboardingGuide = true
- }, 600)
- })
- },
- closeOnboardingGuide() {
- this.showOnboardingGuide = false
- },
- loadGuidePopup() {
- var self = this
- if (self._guidePopupAttempted) return
- self._guidePopupAttempted = true
- getGuidePopupList().then(function(res) {
- var arr = (res && res.data) || []
- if (arr && arr.length > 0) {
- self.guidePopup = arr[0]
- self.showGuidePopup = true
- }
- }).catch(function() {})
- },
- handleGuidePopupDone(payload) {
- var popup = payload && payload.popup
- var buttonClicked = payload && payload.buttonClicked
- if (popup && popup.id) {
- consumeGuidePopup(popup.id, buttonClicked)
- }
- this.showGuidePopup = false
- if (buttonClicked && payload && payload.btnAction) {
- uni.navigateTo({ url: payload.btnAction })
- }
- },
- isLoggedIn() {
- return !!uni.getStorageSync('token')
- },
- // 版本比较:返回 >0 表示 v1 > v2,0 相等,<0 表示 v1 < v2
- _compareVersion: function(v1, v2) {
- var parts1 = String(v1).split('.')
- var parts2 = String(v2).split('.')
- for (var i = 0; i < Math.max(parts1.length, parts2.length); i++) {
- var n1 = parseInt(parts1[i] || '0', 10)
- var n2 = parseInt(parts2[i] || '0', 10)
- if (n1 !== n2) return n1 - n2
- }
- return 0
- },
- // ===== 会员状态(沙盘下方会员入口) =====
- checkMemberStatus: function() {
- var that = this
- getMyMembership().then(function(res) {
- var m = res.data || {}
- var level = m.memberLevel || m.levelCode || ''
- that.isLifetime = (level === 'LIFETIME')
- that.isMember = that.isLifetime || !!(level && level !== 'FREE')
- var mem = m.membership || m
- if (mem.daysRemaining != null) {
- that.membershipDays = mem.daysRemaining
- } else if (that.isLifetime) {
- // 终身会员:永久有效,不显示剩余天数
- that.membershipDays = 0
- }
- }).catch(function() {})
- },
- goMembership: function() {
- uni.navigateTo({ url: '/pages/membership/upgrade' })
- },
- normalizeCurrentRole() {
- const role = uni.getStorageSync('role') || 'parent'
- const currentRole = uni.getStorageSync('currentRole')
- if (!currentRole) {
- return role
- }
- // 非规划师账号不允许落到规划师首页
- if (currentRole === 'teacher' && role !== 'teacher') {
- return role
- }
- // 只有家长账号允许切换到孩子视角
- if (currentRole === 'child' && role !== 'parent') {
- return role
- }
- return currentRole
- },
- syncRoleAndTabBar() {
- this.currentRole = this.normalizeCurrentRole()
- uni.setStorageSync('currentRole', this.currentRole)
- },
- // ===== 发现页 / 未登录态方法 =====
- loadDimensionActivities: function() {
- var self = this
- getActivityList({ dimensionCode: '', page: 1, size: 3 }).then(function(res) {
- if (res && res.code === 200) {
- // res.data is the response wrapper, activities are in res.data.data or res.data.records
- var rawData = res.data && (Array.isArray(res.data) ? res.data : (res.data.data || res.data.records || []))
- self.dimensionActivities = Array.isArray(rawData) ? rawData.slice(0, 3) : []
- }
- self._checkSplashReady()
- }).catch(function() {
- self._checkSplashReady()
- })
- },
- loadFeaturedArticles: function() {
- var self = this
- this.articlesLoading = true
- getFeaturedArticles({ size: 5 }).then(function(res) {
- self.articlesLoading = false
- if (res && res.code === 200) {
- var gradientColors = [
- 'linear-gradient(135deg, #10B981, #34D399)',
- 'linear-gradient(135deg, #5B9BD5, #8FC5E8)',
- 'linear-gradient(135deg, #8B5CF6, #C084FC)',
- 'linear-gradient(135deg, #F97316, #FB923C)',
- 'linear-gradient(135deg, #6366F1, #818CF8)'
- ]
- // res.data is the response wrapper, articles are in res.data.data
- var rawList = res.data && (Array.isArray(res.data) ? res.data : (res.data.data || res.data.records || []))
- var list = Array.isArray(rawList) ? rawList : []
- self.indexArticles = list.map(function(item, index) {
- return {
- id: item.id,
- category: item.categoryName || item.category || '热门文章',
- categoryColor: gradientColors[index % gradientColors.length],
- title: item.title || '',
- summary: item.summary || '',
- views: item.viewCount ? String(item.viewCount) : '0',
- date: item.publishedAt ? item.publishedAt.slice(0, 10) : '',
- coverImage: item.coverImage
- }
- })
- }
- self._checkSplashReady()
- }).catch(function() {
- self.articlesLoading = false
- self._checkSplashReady()
- })
- },
- goActivities: function() {
- uni.navigateTo({ url: '/pages/activity/index' })
- },
- goChallengeManage: function() {
- uni.navigateTo({ url: '/pages/health/challenge-manage' })
- },
- goArticles: function() {
- uni.navigateTo({ url: '/pages/article-center/index' })
- },
- goArticleDetail: function(article) {
- var id = article && article.id ? article.id : article
- uni.navigateTo({ url: '/pages/article-center/article-detail?id=' + id })
- },
- handleLogin() {
- uni.navigateTo({ url: '/pages/login/login?redirect=' + encodeURIComponent('/pages/index-home/index') })
- },
- async handleParentInvite(code) {
- // 延迟显示,等待登录完成
- setTimeout(async () => {
- const hasToken = uni.getStorageSync('token')
- if (!hasToken) {
- // 未登录,先去登录
- uni.reLaunch({
- url: '/pages/login/login?inviteCode=' + code
- })
- return
- }
- // 已登录,显示确认框
- uni.showModal({
- title: '加入家庭',
- content: '您已被邀请加入家庭,是否接受?',
- success: async (res) => {
- if (res.confirm) {
- try {
- uni.showLoading({ title: '加入中...' })
- const result = await acceptParentInvite(code)
- uni.hideLoading()
- if (result.code === 200) {
- const { role, token } = result.data
- uni.setStorageSync('role', role)
- uni.setStorageSync('token', token)
- uni.showToast({ title: '加入成功', icon: 'success' })
- // 刷新页面
- setTimeout(() => {
- uni.switchTab({ url: '/pages/index-home/index' })
- }, 1500)
- }
- } catch (e) {
- uni.hideLoading()
- uni.showToast({ title: e.message || '加入失败', icon: 'none' })
- }
- }
- }
- })
- }, 500)
- },
- /** 获取自己的邀请码用于分享 */
- loadReferralCode: function() {
- if (this.referralCodeLoaded || !this.isLoggedIn()) return
- var self = this
- getReferralCode().then(function(res) {
- self.referralCode = extractReferralCode(res)
- }).catch(function() {})
- self.referralCodeLoaded = true
- },
- getImageUrl: function(path) {
- return config.API_BASE_URL + path
- },
- /** 转发给朋友/群(不指定 imageUrl,微信自动截取当前页面截图作缩略图;static/share-cover.png 不存在会导致卡片空白) */
- onShareAppMessage: function() {
- var path = '/pages/index-home/index'
- if (this.referralCode) {
- path = path + '?refCode=' + this.referralCode
- }
- return {
- title: '浠艾福 · 家庭五维幸福成长',
- path: path
- }
- },
- /** 分享到朋友圈 */
- onShareTimeline: function() {
- var query = ''
- if (this.referralCode) {
- query = 'refCode=' + this.referralCode
- }
- return {
- title: '浠艾福 · 家庭五维幸福成长',
- query: query
- }
- }
- }
- }
- </script>
- <style>
- .discover-container {
- min-height: 100vh;
- background: #f5f7fa;
- padding-bottom: 100rpx;
- }
- /* ===== 品牌 Hero 区 ===== */
- .hero-section {
- margin: 24rpx 30rpx 0;
- padding: 40rpx 32rpx;
- background: linear-gradient(160deg, #FFF7ED 0%, #FED7AA 60%, rgba(249,115,22,0.15) 100%);
- border-radius: 24rpx;
- text-align: center;
- border: 1rpx solid rgba(249,115,22,0.12);
- }
- .hero-logo {
- width: 100rpx;
- height: 100rpx;
- border-radius: 50rpx;
- background: #fff;
- box-shadow: 0 8rpx 24rpx rgba(249,115,22,0.18);
- }
- .hero-name {
- display: block;
- font-size: 48rpx;
- font-weight: bold;
- color: #7C2D12;
- margin-top: 16rpx;
- letter-spacing: 6rpx;
- }
- .hero-identity {
- display: block;
- font-size: 28rpx;
- font-weight: 600;
- color: #C2410C;
- margin-top: 12rpx;
- letter-spacing: 2rpx;
- }
- .hero-slogan {
- display: block;
- font-size: 26rpx;
- color: #9A3412;
- margin-top: 8rpx;
- font-weight: 500;
- }
- .hero-powered {
- display: block;
- font-size: 20rpx;
- color: rgba(124,45,18,0.45);
- margin-top: 10rpx;
- }
- .hero-dims {
- display: flex;
- justify-content: center;
- gap: 16rpx;
- margin-top: 28rpx;
- flex-wrap: wrap;
- }
- .hero-dim {
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: 6rpx;
- padding: 12rpx 16rpx;
- background: rgba(255,255,255,0.7);
- border-radius: 16rpx;
- }
- .hero-dim-emoji {
- font-size: 32rpx;
- }
- .hero-dim-label {
- font-size: 20rpx;
- color: #7C2D12;
- font-weight: 500;
- white-space: nowrap;
- }
- /* ===== 未登录态 Hero 副标语 / CTA ===== */
- .hero-sub-slogan {
- display: block;
- font-size: 22rpx;
- color: #EA580C;
- margin-top: 18rpx;
- font-weight: 500;
- }
- .hero-cta-btn {
- margin: 28rpx auto 0;
- display: block;
- width: 420rpx;
- height: 80rpx;
- line-height: 80rpx;
- background: linear-gradient(135deg, #F97316, #FB923C);
- color: #fff;
- font-size: 28rpx;
- font-weight: bold;
- border-radius: 40rpx;
- text-align: center;
- border: none;
- box-shadow: 0 8rpx 20rpx rgba(249,115,22,0.3);
- }
- .hero-cta-btn::after {
- border: none;
- }
- /* ===== 价值主张(为什么选择浠艾福) ===== */
- .value-prop-section {
- margin: 24rpx 30rpx 0;
- }
- .value-prop-title {
- display: block;
- font-size: 32rpx;
- font-weight: bold;
- color: #333;
- text-align: center;
- margin-bottom: 20rpx;
- }
- .value-prop-grid {
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- }
- .value-prop-card {
- width: 48.5%;
- box-sizing: border-box;
- background: #fff;
- border-radius: 20rpx;
- padding: 22rpx;
- margin-bottom: 16rpx;
- box-shadow: 0 2rpx 10rpx rgba(0,0,0,0.05);
- display: flex;
- flex-direction: row;
- align-items: flex-start;
- }
- .value-prop-icon {
- font-size: 40rpx;
- line-height: 1.3;
- margin-right: 12rpx;
- flex-shrink: 0;
- }
- .value-prop-texts {
- display: flex;
- flex-direction: column;
- flex: 1;
- min-width: 0;
- }
- .value-prop-name {
- font-size: 28rpx;
- font-weight: bold;
- color: #333;
- }
- .value-prop-desc {
- font-size: 22rpx;
- color: #999;
- margin-top: 8rpx;
- line-height: 1.5;
- }
- /* ===== 三步上手 ===== */
- .how-it-works {
- margin: 32rpx 30rpx 0;
- padding: 32rpx 24rpx;
- background: #fff;
- border-radius: 24rpx;
- box-shadow: 0 2rpx 10rpx rgba(0,0,0,0.04);
- }
- .how-it-works-title {
- display: block;
- font-size: 32rpx;
- font-weight: bold;
- color: #333;
- text-align: center;
- margin-bottom: 28rpx;
- }
- .step-row {
- display: flex;
- align-items: flex-start;
- justify-content: space-between;
- }
- .step-item {
- display: flex;
- flex-direction: column;
- align-items: center;
- flex: 1;
- min-width: 0;
- }
- .step-num {
- width: 48rpx;
- height: 48rpx;
- line-height: 48rpx;
- border-radius: 50%;
- background: linear-gradient(135deg, #F97316, #FB923C);
- color: #fff;
- font-size: 26rpx;
- font-weight: bold;
- text-align: center;
- box-shadow: 0 4rpx 12rpx rgba(249,115,22,0.3);
- }
- .step-name {
- font-size: 24rpx;
- color: #333;
- font-weight: 500;
- margin-top: 12rpx;
- text-align: center;
- }
- .step-sub {
- font-size: 20rpx;
- color: #999;
- margin-top: 4rpx;
- text-align: center;
- }
- .step-arrow {
- font-size: 28rpx;
- color: #F97316;
- line-height: 1;
- align-self: center;
- padding: 0 6rpx;
- }
- /* ===== 品牌定位语(保留旧样式,不再使用) ===== */
- .brand-strap {
- margin: 16rpx 30rpx 0;
- padding: 20rpx 28rpx;
- background: linear-gradient(135deg, #FFF7ED, rgba(249,115,22,0.10));
- border-radius: 16rpx;
- border-left: 4rpx solid #F97316;
- }
- .brand-strap-text {
- font-size: 26rpx;
- color: #9A3412;
- font-weight: 500;
- }
- /* ===== 会员入口卡(能量沙盘下方) ===== */
- .member-entry {
- display: flex;
- align-items: center;
- margin: 20rpx 30rpx 0;
- background: linear-gradient(135deg, #F97316, #FB923C);
- border-radius: 20rpx;
- padding: 24rpx 30rpx;
- }
- .member-entry-icon-wrap {
- width: 64rpx;
- height: 64rpx;
- border-radius: 50%;
- background: rgba(255,255,255,0.2);
- display: flex;
- align-items: center;
- justify-content: center;
- margin-right: 16rpx;
- flex-shrink: 0;
- }
- .member-entry-icon {
- font-size: 36rpx;
- }
- .member-entry-texts {
- flex: 1;
- display: flex;
- flex-direction: column;
- min-width: 0;
- }
- .member-entry-title {
- font-size: 30rpx;
- font-weight: bold;
- color: #fff;
- }
- .member-entry-desc {
- font-size: 22rpx;
- color: rgba(255,255,255,0.85);
- margin-top: 4rpx;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .member-entry-btn {
- margin-left: 16rpx;
- padding: 10rpx 24rpx;
- background: #fff;
- border-radius: 30rpx;
- flex-shrink: 0;
- }
- .member-entry-btn-text {
- font-size: 24rpx;
- color: #F97316;
- font-weight: bold;
- }
- /* ===== 活动/阅读共用状态样式 ===== */
- .loading-state,
- .empty-state {
- display: flex;
- justify-content: center;
- padding: 60rpx 0;
- }
- .loading-text,
- .empty-text {
- font-size: 26rpx;
- color: #999;
- }
- /* ===== 五维全景幸福矩阵 ===== */
- /* ===== 底部登录 ===== */
- .login-footer {
- margin: 40rpx 30rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- }
- .login-btn {
- width: 100%;
- height: 88rpx;
- line-height: 88rpx;
- background: linear-gradient(135deg, #F97316, #FB923C);
- color: #fff;
- font-size: 32rpx;
- font-weight: bold;
- border-radius: 44rpx;
- text-align: center;
- border: none;
- box-shadow: 0 8rpx 24rpx rgba(249,115,22,0.3);
- }
- .login-btn::after {
- border: none;
- }
- .login-footer-text {
- font-size: 22rpx;
- color: #F97316;
- margin-top: 16rpx;
- font-weight: 500;
- }
- /* ===== 加载占位 ===== */
- .loading-container {
- display: flex;
- justify-content: center;
- align-items: center;
- height: 100vh;
- }
- /* ===== 角色切换淡入淡出 ===== */
- .role-switch-wrapper {
- width: 100%;
- min-height: 100vh;
- }
- .fade-enter-active,
- .fade-leave-active {
- transition: opacity 0.3s ease;
- }
- .fade-enter,
- .fade-leave-to {
- opacity: 0;
- }
- /* ===== 通用区块样式 ===== */
- .section {
- margin: 20rpx 30rpx;
- }
- .section-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 20rpx;
- }
- .section-title {
- font-size: 30rpx;
- font-weight: bold;
- color: #333;
- }
- .section-more {
- font-size: 24rpx;
- color: #5B9BD5;
- }
- .empty-state {
- display: flex;
- justify-content: center;
- padding: 60rpx 0;
- }
- .empty-text {
- font-size: 26rpx;
- color: #999;
- }
- /* ===== 活动列表 ===== */
- .activity-list {
- display: flex;
- flex-direction: column;
- gap: 16rpx;
- }
- .activity-card {
- background: #fff;
- border-radius: 16rpx;
- overflow: hidden;
- display: flex;
- flex-direction: row;
- box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
- }
- .activity-card:active {
- opacity: 0.8;
- }
- .activity-cover {
- width: 200rpx;
- height: 160rpx;
- flex-shrink: 0;
- background: #f0f0f0;
- }
- .activity-info {
- flex: 1;
- padding: 16rpx;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- }
- .activity-name {
- font-size: 28rpx;
- font-weight: bold;
- color: #333;
- margin-bottom: 8rpx;
- }
- .line-clamp-1 {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .activity-meta {
- display: flex;
- align-items: center;
- margin-bottom: 8rpx;
- }
- .activity-time {
- font-size: 22rpx;
- color: #999;
- }
- .activity-bottom {
- display: flex;
- align-items: center;
- gap: 12rpx;
- }
- .activity-status {
- font-size: 20rpx;
- padding: 2rpx 10rpx;
- border-radius: 8rpx;
- background: #E8F5E9;
- color: #2E7D32;
- }
- .activity-status.status-upcoming {
- background: #E3F2FD;
- color: #1565C0;
- }
- .activity-status.status-ended {
- background: #F5F5F5;
- color: #999;
- }
- .activity-fee {
- font-size: 24rpx;
- color: #F97316;
- font-weight: bold;
- }
- .activity-fee.fee-free {
- color: #4CAF50;
- }
- /* ===== 文章列表 ===== */
- .article-list {
- display: flex;
- flex-direction: column;
- gap: 16rpx;
- }
- .article-card {
- background: #fff;
- border-radius: 16rpx;
- padding: 24rpx;
- box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
- }
- .article-card:active {
- opacity: 0.8;
- }
- .article-category {
- display: inline-block;
- padding: 4rpx 14rpx;
- border-radius: 8rpx;
- margin-bottom: 10rpx;
- }
- .article-category-text {
- font-size: 20rpx;
- color: #fff;
- }
- .article-title {
- display: block;
- font-size: 28rpx;
- font-weight: bold;
- color: #333;
- margin-bottom: 8rpx;
- line-height: 1.4;
- }
- .article-summary {
- display: block;
- font-size: 24rpx;
- color: #888;
- line-height: 1.5;
- margin-bottom: 12rpx;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- }
- .article-meta {
- display: flex;
- align-items: center;
- gap: 16rpx;
- }
- .meta-item {
- display: flex;
- align-items: center;
- gap: 4rpx;
- }
- .meta-icon {
- font-size: 24rpx;
- }
- .meta-text {
- font-size: 22rpx;
- color: #999;
- }
- .article-date {
- font-size: 22rpx;
- color: #bbb;
- }
- /* ===== Splash Loading Overlay(冷启动蒙板,来自 merge splash.vue) ===== */
- .splash-overlay {
- position: fixed;
- top: 0; left: 0; right: 0; bottom: 0;
- z-index: 9999;
- display: flex;
- align-items: center;
- justify-content: center;
- background: linear-gradient(160deg, #FFF7ED 0%, #FFEDD5 50%, #FED7AA 100%);
- overflow: hidden;
- opacity: 1;
- transition: opacity 0.4s ease;
- }
- .splash-overlay.fade-out {
- opacity: 0;
- pointer-events: none;
- }
- /* ---- bg circles from splash.vue ---- */
- .splash-overlay-bg { position: absolute; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; }
- .bg-circle {
- position: absolute;
- border-radius: 50%;
- opacity: 0.12;
- }
- .bg-circle-1 {
- width: 400rpx; height: 400rpx;
- background: #FF8C42;
- top: -100rpx; right: -80rpx;
- animation: splash-float-1 4s ease-in-out infinite;
- }
- .bg-circle-2 {
- width: 280rpx; height: 280rpx;
- background: #FF6B9D;
- bottom: 80rpx; left: -60rpx;
- animation: splash-float-2 5s ease-in-out infinite;
- }
- .bg-circle-3 {
- width: 180rpx; height: 180rpx;
- background: #6366F1;
- top: 50%; right: -40rpx;
- animation: splash-float-3 6s ease-in-out infinite;
- }
- @keyframes splash-float-1 {
- 0%, 100% { transform: translateY(0) scale(1); }
- 50% { transform: translateY(-30rpx) scale(1.05); }
- }
- @keyframes splash-float-2 {
- 0%, 100% { transform: translateY(0) scale(1); }
- 50% { transform: translateY(20rpx) scale(1.08); }
- }
- @keyframes splash-float-3 {
- 0%, 100% { transform: translateY(0) rotate(0deg); }
- 50% { transform: translateY(-20rpx) rotate(10deg); }
- }
- /* ---- body fade-in ---- */
- .splash-overlay-body {
- display: flex;
- flex-direction: column;
- align-items: center;
- animation: splash-body-in 0.8s cubic-bezier(0.16,1,0.3,1) forwards;
- }
- @keyframes splash-body-in {
- from { opacity: 0; transform: translateY(40rpx) scale(0.96); }
- to { opacity: 1; transform: translateY(0) scale(1); }
- }
- /* ---- logo ---- */
- .splash-logo-wrap {
- width: 160rpx; height: 160rpx;
- border-radius: 40rpx;
- background: rgba(255,255,255,0.95);
- display: flex; align-items: center; justify-content: center;
- margin-bottom: 16rpx;
- box-shadow: 0 8rpx 32rpx rgba(249,115,22,0.25);
- animation: splash-logo-pulse 2.5s ease-in-out infinite;
- }
- @keyframes splash-logo-pulse {
- 0%, 100% { box-shadow: 0 8rpx 32rpx rgba(249,115,22,0.25); }
- 50% { box-shadow: 0 8rpx 48rpx rgba(249,115,22,0.45); }
- }
- .splash-logo-img { width: 100rpx; height: 100rpx; }
- /* ---- brand ---- */
- .splash-brand-name {
- font-size: 64rpx; font-weight: 800;
- color: #7C2D12;
- letter-spacing: 10rpx;
- margin-bottom: 2rpx;
- }
- .splash-brand-en {
- font-size: 20rpx;
- color: rgba(124,45,18,0.5);
- letter-spacing: 6rpx;
- margin-bottom: 30rpx;
- }
- .splash-tagline {
- font-size: 26rpx;
- color: rgba(124,45,18,0.7);
- letter-spacing: 4rpx;
- margin-top: 24rpx;
- }
- /* ---- dims row from splash.vue (rounded circles) ---- */
- .splash-dims-row {
- display: flex; flex-direction: row;
- align-items: center; justify-content: center;
- gap: 28rpx;
- }
- .splash-dim-item {
- display: flex; flex-direction: column;
- align-items: center; gap: 8rpx;
- }
- .splash-dim-circle {
- width: 80rpx; height: 80rpx;
- border-radius: 50%;
- display: flex; align-items: center; justify-content: center;
- }
- .splash-dim-icon { font-size: 36rpx; line-height: 1; }
- .splash-dim-label {
- font-size: 22rpx; font-weight: 500;
- color: rgba(124,45,18,0.75);
- line-height: 1;
- }
- /* ---- staggered dim entry from splash.vue ---- */
- .splash-dim-item:nth-child(1) { animation: splash-dim-in 0.5s ease 0.1s both; }
- .splash-dim-item:nth-child(2) { animation: splash-dim-in 0.5s ease 0.2s both; }
- .splash-dim-item:nth-child(3) { animation: splash-dim-in 0.5s ease 0.3s both; }
- .splash-dim-item:nth-child(4) { animation: splash-dim-in 0.5s ease 0.4s both; }
- .splash-dim-item:nth-child(5) { animation: splash-dim-in 0.5s ease 0.5s both; }
- @keyframes splash-dim-in {
- from { opacity: 0; transform: translateY(16rpx) scale(0.8); }
- to { opacity: 1; transform: translateY(0) scale(1); }
- }
- /* ---- loading dots ---- */
- .splash-overlay-loading {
- position: absolute;
- bottom: 120rpx;
- left: 0; right: 0;
- display: flex;
- justify-content: center;
- align-items: center;
- gap: 12rpx;
- }
- .splash-overlay-dot {
- width: 14rpx; height: 14rpx;
- border-radius: 50%;
- background: rgba(249,115,22,0.6);
- animation: splash-dot-bounce 1.4s ease-in-out infinite both;
- }
- .splash-overlay-dot:nth-child(1) { animation-delay: -0.32s; }
- .splash-overlay-dot:nth-child(2) { animation-delay: -0.16s; }
- .splash-overlay-dot:nth-child(3) { animation-delay: 0s; }
- @keyframes splash-dot-bounce {
- 0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
- 40% { transform: scale(1); opacity: 1; }
- }
- /* ---- 登录态内容布局 ---- */
- .logged-in-container {
- padding-bottom: 120rpx;
- }
- /* ===== ① 了解区 — 自测大卡(引导"从了解开始") ===== */
- .self-test-card {
- margin: 20rpx 30rpx 16rpx;
- background: linear-gradient(135deg, #667eea, #764ba2);
- border-radius: 20rpx;
- padding: 24rpx 28rpx;
- }
- .self-test-head { display: flex; align-items: center; }
- .self-test-icon { font-size: 40rpx; margin-right: 16rpx; }
- .self-test-info { flex: 1; }
- .self-test-title { font-size: 28rpx; font-weight: bold; color: #fff; display: block; }
- .self-test-sub { font-size: 22rpx; color: rgba(255,255,255,0.8); display: block; margin-top: 4rpx; }
- .self-test-arrow { font-size: 36rpx; color: rgba(255,255,255,0.7); }
- /* ===== ①.b 行动引导条 — Next Best Action ===== */
- .guide-bar {
- margin: 0 30rpx 16rpx;
- border-radius: 20rpx;
- padding: 18rpx 24rpx;
- display: flex;
- flex-direction: row;
- align-items: center;
- box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
- }
- .guide-bar-icon-wrap {
- width: 72rpx;
- height: 72rpx;
- border-radius: 18rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- margin-right: 16rpx;
- flex-shrink: 0;
- }
- .guide-bar-icon { font-size: 34rpx; }
- .guide-bar-info { flex: 1; min-width: 0; }
- .guide-bar-title { font-size: 27rpx; font-weight: bold; display: block; }
- .guide-bar-sub { font-size: 21rpx; margin-top: 3rpx; display: block; }
- .guide-bar-btn {
- flex-shrink: 0;
- margin-left: 12rpx;
- padding: 8rpx 20rpx;
- border-radius: 999rpx;
- font-size: 22rpx;
- font-weight: bold;
- }
- .guide-bar-btn-text { }
- /* 颜色主题 — 低饱和背景 + 深色文字,不抢自测卡风头 */
- .guide-bar-orange { background: #FFF3E7; border: 1rpx solid rgba(249,115,22,0.18); }
- .guide-bar-orange .guide-bar-icon-wrap { background: rgba(249,115,22,0.14); }
- .guide-bar-orange .guide-bar-title { color: #9A3412; }
- .guide-bar-orange .guide-bar-sub { color: #B45309; }
- .guide-bar-orange .guide-bar-btn { background: linear-gradient(135deg, #F97316, #FB923C); color: #fff; }
- .guide-bar-blue { background: #EFF4FF; border: 1rpx solid rgba(99,102,241,0.18); }
- .guide-bar-blue .guide-bar-icon-wrap { background: rgba(99,102,241,0.12); }
- .guide-bar-blue .guide-bar-title { color: #312E81; }
- .guide-bar-blue .guide-bar-sub { color: #4338CA; }
- .guide-bar-blue .guide-bar-btn { background: linear-gradient(135deg, #6366F1, #818CF8); color: #fff; }
- .guide-bar-green { background: #ECFDF5; border: 1rpx solid rgba(16,185,129,0.18); }
- .guide-bar-green .guide-bar-icon-wrap { background: rgba(16,185,129,0.12); }
- .guide-bar-green .guide-bar-title { color: #064E3B; }
- .guide-bar-green .guide-bar-sub { color: #047857; }
- .guide-bar-green .guide-bar-btn { background: linear-gradient(135deg, #10B981, #34D399); color: #fff; }
- .guide-bar-purple { background: #F5F3FF; border: 1rpx solid rgba(139,92,246,0.18); }
- .guide-bar-purple .guide-bar-icon-wrap { background: rgba(139,92,246,0.12); }
- .guide-bar-purple .guide-bar-title { color: #4C1D95; }
- .guide-bar-purple .guide-bar-sub { color: #6D28D9; }
- .guide-bar-purple .guide-bar-btn { background: linear-gradient(135deg, #8B5CF6, #A78BFA); color: #fff; }
- .guide-bar-gray { background: #F8FAFC; border: 1rpx solid rgba(100,116,139,0.15); }
- .guide-bar-gray .guide-bar-icon-wrap { background: rgba(100,116,139,0.10); }
- .guide-bar-gray .guide-bar-title { color: #334155; }
- .guide-bar-gray .guide-bar-sub { color: #64748B; }
- .guide-bar-gray .guide-bar-btn { background: linear-gradient(135deg, #94A3B8, #CBD5E1); color: #fff; }
- /* ===== 快捷功能入口(单排,6个横向排列) ===== */
- .quick-bar {
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- background: #fff;
- border-radius: 20rpx;
- padding: 20rpx 10rpx;
- }
- .quick-item {
- flex: 1;
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: 8rpx;
- }
- .quick-icon {
- width: 80rpx;
- height: 80rpx;
- border-radius: 20rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .quick-icon text {
- font-size: 36rpx;
- }
- .quick-item .quick-label {
- font-size: 26rpx;
- color: #666;
- }
- /* ===== 我的任务快捷列表 ===== */
- .task-quick-list {
- display: flex;
- flex-direction: column;
- gap: 12rpx;
- }
- .task-quick-item {
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: space-between;
- background: #fff;
- border-radius: 16rpx;
- padding: 18rpx 24rpx;
- box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
- }
- .task-quick-info {
- display: flex;
- flex-direction: column;
- min-width: 0;
- flex: 1;
- }
- .task-quick-title {
- font-size: 26rpx;
- color: #333;
- font-weight: 500;
- line-height: 1.4;
- }
- .task-quick-meta {
- font-size: 22rpx;
- color: #F97316;
- margin-top: 4rpx;
- font-weight: bold;
- }
- .btn-quick-complete {
- margin-left: 16rpx;
- padding: 8rpx 24rpx;
- background: linear-gradient(135deg, #F97316, #FB923C);
- color: #fff;
- font-size: 24rpx;
- font-weight: bold;
- border-radius: 20rpx;
- border: none;
- line-height: 1;
- height: 44rpx;
- flex-shrink: 0;
- }
- .btn-quick-complete::after {
- border: none;
- }
- /* ===== 家庭挑战空态 ===== */
- .challenge-empty {
- display: flex;
- flex-direction: column;
- align-items: center;
- padding: 40rpx 0 20rpx;
- }
- .challenge-empty-icon {
- font-size: 64rpx;
- margin-bottom: 12rpx;
- line-height: 1;
- }
- .challenge-empty-text {
- font-size: 26rpx;
- color: #999;
- margin-bottom: 20rpx;
- }
- .challenge-add-btn {
- padding: 10rpx 32rpx;
- background: linear-gradient(135deg, #F97316, #FB923C);
- color: #fff;
- font-size: 24rpx;
- font-weight: bold;
- border-radius: 24rpx;
- border: none;
- line-height: 1;
- height: 48rpx;
- }
- .challenge-add-btn::after {
- border: none;
- }
- .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; }
- </style>
|