| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331 |
- <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="quick-bar">
- <view class="quick-item" @click="navTo('/pages/tasks/tasks')">
- <view class="quick-icon" style="background:rgba(99,102,241,0.15)"><text>📋</text></view>
- <text class="quick-label">任务</text>
- </view>
- <view class="quick-item" @click="navTo('/pages/action-detail/interaction-log')">
- <view class="quick-icon" style="background:rgba(16,185,129,0.15)"><text>💬</text></view>
- <text class="quick-label">互动</text>
- </view>
- <view class="quick-item" @click="navTo('/pages/mind-detail/family-dashboard')">
- <view class="quick-icon" style="background:rgba(139,92,246,0.15)"><text>🏠</text></view>
- <text class="quick-label">天盘</text>
- </view>
- <view class="quick-item" @click="navTo('/pages/profile-extra/family-members')">
- <view class="quick-icon" style="background:rgba(245,158,11,0.15)"><text>👨👩👧👦</text></view>
- <text class="quick-label">成员</text>
- </view>
- <view class="quick-item" @click="navTo('/pages/discover/circles')">
- <view class="quick-icon" style="background:rgba(255,107,157,0.15)"><text>🤝</text></view>
- <text class="quick-label">圈子</text>
- </view>
- <view class="quick-item" @click="navTo('/pages/shop/index/index')">
- <view class="quick-icon" style="background:rgba(249,115,22,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"
- @close="closeOnboardingGuide" />
- </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 { acceptParentInvite, getActivityList, getFeaturedArticles, getEnergySandbox, getEnergyOverview, getFamilyMemberList, getChallengeList, switchToFamilyMember, getMyMembership, updateChallengeProgress, respondChallenge, getTodayTasks, completeTask as completeTaskApi, getTodayParentTasks, completeParentTask as completeParentTaskApi, getTaskHistory, getNotices, getNotificationList, getSurveyStatus, getSelfCheckStatus, getReferralCode, extractReferralCode } from '../../utils/api.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,
-
- },
- 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,
- 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
- }
- },
- computed: {
- isFamilyAdmin: function() {
- if (!this.familyMembersVisible || this.familyMembersVisible.length === 0) return false
- return this.familyMembersVisible[0].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 返回):刷新易变数据(会员状态、今日任务、挑战列表)
- 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)
- },
- // ===== 登录态数据加载 =====
- loadLoggedInData: function() {
- this.loadFamilyData()
- this.loadReferralCode()
- },
- // 合并原 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.goMoreArticles()
- 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()
- })
- },
- // 首次登录引导浮层:仅当从未看过(无 _onboardingDone 标记)时展示一次
- _maybeShowOnboardingGuide() {
- if (this.showOnboardingGuide) return
- if (uni.getStorageSync('_onboardingDone')) return
- // 延迟到 splash 蒙板关闭后再弹,避免层级冲突
- var self = this
- setTimeout(function() {
- if (!self.isLoggedIn()) return
- self.showOnboardingGuide = true
- }, 600)
- },
- closeOnboardingGuide() {
- this.showOnboardingGuide = false
- },
- isLoggedIn() {
- return !!uni.getStorageSync('token')
- },
- // ===== 会员状态(沙盘下方会员入口) =====
- 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>
|