| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637 |
- <template>
- <view class="container">
- <view v-if="!isLoggedIn">
- <PageBanner theme="action" tagline="骞查 路 璁板綍 路 鎴愰暱" quote="鐭ヨ鍚堜竴锛屾瘡澶╄繘姝ヤ竴鐐圭偣" />
- <!-- 鍝佺墝瀹氫綅璇?-->
- <view class="brand-strap"><text class="brand-strap-text">鐪嬭鏀瑰彉姝e湪鍙戠敓</text></view>
- <!-- 鐞嗗康鍗?-->
- <view class="concept-card">
- <text class="concept-quote">璁板綍涓嶆槸鐩殑锛岀湅瑙佹敼鍙樻墠鏄€?/text>
- <text class="concept-desc">姣忎竴浠介ギ椋熴€佽繍鍔ㄣ€佸績鎯呯殑璁板綍锛岄兘鍦ㄤ负鎴愰暱鎻愪緵渚濇嵁銆?/text>
- </view>
- <!-- 绀轰緥妗堜緥 -->
- <view class="case-card">
- <view class="case-header">
- <text class="case-label">馃摉 鐪熷疄妗堜緥锛堣劚鏁忥級</text>
- </view>
- <view class="case-body">
- <text class="case-name">灏忔槑锛?0宀侊紝浣撴牎鐢燂級</text>
- <text class="case-change">3涓湀骞查鍓嶅悗锛?/text>
- <view class="case-metrics">
- <view class="metric-item">
- <text class="metric-up">鈫?5鍒?/text>
- <text class="metric-label">韬淮搴?/text>
- </view>
- <view class="metric-item">
- <text class="metric-up">鈫?3鍒?/text>
- <text class="metric-label">鏅虹淮搴?/text>
- </view>
- <view class="metric-item">
- <text class="metric-up">鈫?8澶?/text>
- <text class="metric-label">杩炵画鎵撳崱</text>
- </view>
- </view>
- <text class="case-note">閫氳繃楗璁板綍 + 鐫$湢鎵撳崱锛屽厤鐤姏鏄捐憲鎻愬崌</text>
- </view>
- </view>
- <!-- 鍔熻兘棰勮 -->
- <view class="guest-features">
- <view class="feat-card" @click="handleGuestFeatureTap">
- <text class="feat-icon">鉁?/text>
- <text class="feat-title">姣忔棩鎵撳崱</text>
- <text class="feat-desc">楗路杩愬姩路鐫$湢路蹇冩儏</text>
- </view>
- <view class="feat-card" @click="handleGuestFeatureTap">
- <text class="feat-icon">馃搵</text>
- <text class="feat-title">鎴愰暱璁板綍</text>
- <text class="feat-desc">姣忓懆瀹跺涵鍋ュ悍闂嵎</text>
- </view>
- <view class="feat-card" @click="handleGuestFeatureTap">
- <text class="feat-icon">馃弳</text>
- <text class="feat-title">閲岀▼纰?/text>
- <text class="feat-desc">杩炵画鎵撳崱路鎸戞垬瀹屾垚</text>
- </view>
- <view class="feat-card" @click="handleGuestFeatureTap">
- <text class="feat-icon">馃幆</text>
- <text class="feat-title">瀹跺涵鎸戞垬</text>
- <text class="feat-desc">鍏ㄥ鍙備笌鐨勪簰鍔ㄤ换鍔?/text>
- </view>
- </view>
- <!-- 浜旂淮鍋ュ悍浣撶郴 -->
- <view class="wuxing-section">
- <view class="wuxing-title">韬峰績路鏅郝疯路瀵?路 鍙墽琛岀殑鎴愰暱闂幆</view>
- <view class="wuxing-desc">浜旇鐩哥敓鐩稿厠锛屽姩璧锋潵銆佸潥鎸佸仛锛岃鎴愰暱鐪熸鍙戠敓</view>
- <view class="wuxing-relations">
- <view class="rel-group">
- <text class="rel-title">鐩哥敓 鈫?绯荤粺鍓嶈繘</text>
- <view class="rel-chain">
- <text class="rel-item">馃審 韬?/text><text class="rel-arrow">鈫?/text>
- <text class="rel-item">鈿?鏅?/text><text class="rel-arrow">鈫?/text>
- <text class="rel-item">馃挧 瀵?/text><text class="rel-arrow">鈫?/text>
- <text class="rel-item">馃尶 琛?/text><text class="rel-arrow">鈫?/text>
- <text class="rel-item">馃敟 蹇?/text><text class="rel-arrow">鈫?/text>
- <text class="rel-item">馃審 韬?/text>
- </view>
- <text class="rel-hint">韬嫟鍒欏己锛屾櫤鍕ゅ垯寮€锛屽瘜鍕ゅ垯鑱氾紝琛屽嫟鍒欏拰锛屽績鍕ゅ垯瀹?/text>
- </view>
- <view class="rel-group">
- <text class="rel-title">鐩稿厠 鈫?绯荤粺骞宠 </text>
- <view class="rel-chain">
- <text class="rel-item">馃審 韬?/text><text class="rel-op">鍏?/text><text class="rel-item">馃挧 瀵?/text><text class="rel-dot">路</text>
- <text class="rel-item">鈿?鏅?/text><text class="rel-op">鍏?/text><text class="rel-item">馃尶 琛?/text><text class="rel-dot">路</text>
- <text class="rel-item">馃挧 瀵?/text><text class="rel-op">鍏?/text><text class="rel-item">馃敟 蹇?/text><text class="rel-dot">路</text>
- <text class="rel-item">馃尶 琛?/text><text class="rel-op">鍏?/text><text class="rel-item">馃審 韬?/text><text class="rel-dot">路</text>
- <text class="rel-item">馃敟 蹇?/text><text class="rel-op">鍏?/text><text class="rel-item">鈿?鏅?/text>
- </view>
- <text class="rel-hint">涓嶆嬁韬綋鎹㈠揩閽憋紝涓嶇畻璁″叧绯诲緱澶憋紝璐㈠瘜鏈嶅姟瀹跺涵锛屽叧鐖辨湁搴︺€佷笉婧虹埍瓒婄晫</text>
- </view>
- </view>
- <view class="wuxing-cards">
- <view class="wc-card wc-body" @click="goPage('/pages/body-detail/index')">
- <text class="wc-icon">馃審</text>
- <view class="wc-info">
- <text class="wc-name">韬?路 涓诲姩鍋ュ悍</text>
- <text class="wc-text">姣忓ぉ鍔ㄤ竴鍔ㄣ€佺潯寰楅锛岃韩浣撶姸鎬佺湅寰楄鍦板彉濂?/text>
- </view>
- </view>
- <view class="wc-card wc-wisdom" @click="goPage('/pages/wisdom-detail/index')">
- <text class="wc-icon">鈿?/text>
- <view class="wc-info">
- <text class="wc-name">鏅?路 璧嬭兘鏈潵</text>
- <text class="wc-text">姣忓ぉ璇诲嚑椤点€佺粌涓€浼氫笓娉紝鏅烘収鏄粌鍑烘潵鐨?/text>
- </view>
- </view>
- <view class="wc-card wc-wealth" @click="goPage('/pages/wealth/index')">
- <text class="wc-icon">馃挧</text>
- <view class="wc-info">
- <text class="wc-name">瀵?路 鍒╀粬鍒涘瘜</text>
- <text class="wc-text">鍧氭寔鍒嗕韩涓庣Н绱紝鎶婄浜屾敹鍏ユ洸绾垮仛鍑烘潵</text>
- </view>
- </view>
- <view class="wc-card wc-action" @click="goPage('/pages/action-detail/member-action-detail')">
- <text class="wc-icon">馃尶</text>
- <view class="wc-info">
- <text class="wc-name">琛?路 浜洪檯鍜岃皭</text>
- <text class="wc-text">浠庝竴娆″€惧惉寮€濮嬶紝璁╁搴叧绯绘瘡澶╁崌娓?/text>
- </view>
- </view>
- <view class="wc-card wc-mind" @click="goPage('/pages/mind-detail/index')">
- <text class="wc-icon">馃敟</text>
- <view class="wc-info">
- <text class="wc-name">蹇?路 澶х埍鐩搁殢</text>
- <text class="wc-text">姣忓ぉ鐣?10 鍒嗛挓璇磋璇濓紝鎶婂浜虹殑蹇冧簨鎺ヤ綇</text>
- </view>
- </view>
- </view>
- </view>
- <!-- 鐧诲綍寮曞 -->
- <view class="login-guide-section">
- <LoginGuideCard
- title="瑙i攣瀹屾暣鎴愰暱妗f"
- :items="[
- '鏌ョ湅骞查杩涘害涓庤拷韪褰?,
- '瀹屾垚姣忔棩鎵撳崱绱Н杩炵画璁板綍',
- '鍙備笌瀹跺涵鎸戞垬鑾峰緱閲岀▼纰戝鍔?
- ]" />
- </view>
- </view>
- <view v-else>
- <PageBanner theme="action" tagline="骞查 路 璁板綍 路 鎴愰暱" quote="鐭ヨ鍚堜竴锛屾瘡澶╄繘姝ヤ竴鐐圭偣" />
- <!-- 閲岀▼纰?-->
- <view class="section">
- <view class="milestone-card">
- <text class="section-title-row">馃弳 閲岀▼纰?/text>
- <view class="milestone-grid">
- <view class="milestone-item">
- <text class="milestone-icon">馃敟</text>
- <text class="milestone-value">{{ streakDays }}澶?/text>
- <text class="milestone-label">杩炵画鎵撳崱</text>
- </view>
- <view class="milestone-item">
- <text class="milestone-icon">馃幆</text>
- <text class="milestone-value">{{ activeChallenges }}</text>
- <text class="milestone-label">杩涜涓寫鎴?/text>
- </view>
- <view class="milestone-item">
- <text class="milestone-icon">馃搱</text>
- <text class="milestone-value">{{ completeness }}%</text>
- <text class="milestone-label">妗f瀹屾暣搴?/text>
- </view>
- </view>
- </view>
- </view>
- <!-- 鎴愰暱璁板綍 -->
- <view class="section">
- <view class="survey-card">
- <text class="section-title-row">馃搵 鎴愰暱璁板綍</text>
- <view class="survey-pending" v-if="pendingSurvey">
- <text class="survey-alert">鈿?鏈懆杩樻湭瀹屾垚璋冪爺</text>
- <text class="survey-title-text">{{ pendingSurvey.title }}</text>
- <text class="survey-btn" @click="startSurvey">[寮€濮嬪~鍐橾</text>
- </view>
- <view class="survey-done" v-else-if="allDone"><text class="survey-done-text">鉁?鎵€鏈夎皟鐮斿凡瀹屾垚</text></view>
- <view class="survey-history-list" v-if="surveyHistory.length > 0">
- <text class="history-label">鍘嗗彶璋冪爺:</text>
- <view class="history-item" v-for="(h, hIdx) in surveyHistory" :key="getHistoryKey(h)">
- <text class="history-date">{{ h._date }}</text>
- <text class="history-content">{{ h._content }}</text>
- </view>
- <text class="survey-more" @click="viewAllHistory">鏌ョ湅鍏ㄩ儴璋冪爺 鈥?/text>
- </view>
- <view class="survey-empty" v-else-if="!pendingSurvey"><text class="survey-empty-text">鏆傛棤寰呭畬鎴愯皟鐮?/text></view>
- </view>
- </view>
- <view class="reminder-bar" v-if="hasIncomplete">
- <text class="reminder-text">鈿?浠婃棩杩樻湁 {{ incompleteCount }} 椤规湭璁板綍</text>
- <text class="reminder-close" @click="dismissReminder">鉁?/text>
- </view>
- <view class="section">
- <view class="progress-card">
- <view class="progress-header">
- <text class="progress-title">浠婃棩鎴愰暱</text> <text class="progress-date">{{ todayDate }}</text>
- </view>
- <view class="progress-item" v-for="(item, idx) in progressItems" :key="getProgressKey(item)">
- <text class="progress-icon">{{ item.icon }}</text>
- <text class="progress-label">{{ item.label }}</text>
- <text class="progress-status" :class="item.done ? 'status-done' : 'status-pending'">{{ item.done ? '鉁?宸插畬鎴? : '' }}</text>
- <text class="progress-btn" v-if="!item.done" @click="handleProgressClick(item)">{{ item.actionText || '琛ュ綍' }}</text>
- </view>
- <view class="progress-footer">
- <text class="footer-text">浠婃棩瀹屾垚 {{ doneCount }}/{{ totalCount }}</text>
- <text class="footer-streak" v-if="streakDays > 0">馃敟 杩炵画鎵撳崱 {{ streakDays }} 澶?/text>
- </view>
- </view>
- </view>
- <view class="section" v-if="cautionCount > 0">
- <view class="action-card" @click="goToCaution">
- <text class="action-icon">鈿狅笍</text>
- <view class="action-info">
- <text class="action-title">椋熸潗鎴掑鍖归厤</text>
- <text class="action-desc">{{ cautionCount }} 绉嶉鏉愰渶鍏虫敞锛岀偣鍑绘煡鐪嬫垝澶囪鎯?/text>
- </view>
- <text class="action-arrow">鈥?/text>
- </view>
- </view>
- <view class="section">
- <view class="diet-card">
- <view class="diet-card-header">
- <text class="diet-card-title">馃ガ 浠婃棩鎺ㄨ崘椋熸潗</text>
- <text class="diet-card-link" @click="goToDiet">楗涓婚〉 鈥?/text>
- </view>
- <view class="diet-card-content" v-if="ingredients.length > 0">
- <view class="diet-item" v-for="(item, index) in ingredients" :key="getIngredientKey(item, index)">
- <text class="ing-name">{{ item.name }}</text>
- <text class="ing-reason" v-if="item.reason">{{ item.reason }}</text>
- </view>
- </view>
- <view class="diet-empty" v-else>
- <text class="empty-text">{{ ingredientsLoading ? '鍔犺浇涓?..' : '鏆傛棤鎺ㄨ崘椋熸潗' }}</text>
- <text class="empty-hint" v-if="!ingredientsLoading">涓婁紶鑿岀兢鎶ュ憡鍚庣敓鎴愪釜鎬у寲鎺ㄨ崘</text>
- </view>
- </view>
- </view>
- <!-- ===== 鎺ㄨ崘鍟嗗搧 ===== -->
- <RecommendedFeed
- :products="recommendedProducts"
- :activities="[]"
- :loading="loadingProducts"
- @itemClick="onFeedItemClick"
- @more="goMoreDiscover" />
- <!-- ===== 鎺ㄨ崘闃呰 ===== -->
- <ArticleBookshelf
- :articles="indexArticles"
- :loading="articlesLoading"
- :isLoggedIn="isLoggedIn"
- @articleClick="goArticleDetail"
- @moreArticles="goMoreArticles" />
- <view class="section">
- <view class="tracking-card">
- <view class="tracking-tabs">
- <view class="tracking-tab" :class="activeTab === tab.key ? 'tab-active' : ''" v-for="tab in trackingTabs" :key="tab.key" @click="switchTab(tab.key)">
- <text class="tab-text" :class="activeTab === tab.key ? 'tab-active-text' : ''">{{ tab.label }}</text>
- </view>
- </view>
- <view class="tracking-content">
- <view class="tracking-empty" v-if="currentRecords.length === 0">
- <text class="empty-icon">馃搳</text>
- <text class="empty-text">杩樻病鏈夎褰?/text>
- <text class="empty-hint">寮€濮嬭褰晎{ activeTabLabel }}鍚?/text>
- </view>
- <view class="tracking-record" v-for="(rec, rIdx) in currentRecords" :key="getRecordKey(rec)">
- <text class="record-date">{{ rec._date || rec._text }}</text>
- <text class="record-content">{{ rec._content }}</text>
- </view>
- <view class="tracking-more" v-if="currentRecords.length > 0" @click="viewAllRecords">鏌ョ湅鍏ㄩ儴 鈥?/view>
- </view>
- </view>
- </view>
- <DimensionActivities :isLoggedIn="true" @activityClick="goActivityDetail" @moreActivities="goMoreActivities" style="margin-bottom:60rpx" />
- </view>
- </view>
- </template>
- <script>
- import PageBanner from '../../components/PageBanner.vue'
- import LoginGuideCard from '../../components/LoginGuideCard.vue'
- import DimensionActivities from '../../components/DimensionActivities.vue'
- import RecommendedFeed from '../../components/RecommendedFeed.vue'
- import ArticleBookshelf from '../../components/ArticleBookshelf.vue'
- import { healthCheckinList, getDietIngredients, getSurveyStatus, getSurveyHistory, getFoodCautionList, getExerciseList, getMindCheckinList, getSleepList, getHealthMealList, productList, getFeaturedArticles } from '../../utils/api.js'
- export default {
- components: { PageBanner, LoginGuideCard, DimensionActivities, RecommendedFeed, ArticleBookshelf },
- data() { return { memberId: '', todayDate: '', hasIncomplete: false, incompleteCount: 0, progressItems: [], trackingTabs: [{ key: 'diet', label: '楗', icon: '馃嵔锔? }, { key: 'exercise', label: '杩愬姩', icon: '馃弮' }, { key: 'sleep', label: '鐫$湢', icon: '馃槾' }, { key: 'emotion', label: '蹇冩儏', icon: '馃槉' }], trackingData: { diet: [], exercise: [], sleep: [], emotion: [] }, streakDays: 0, activeChallenges: 0, completeness: 0, cautionCount: 0,
- pendingSurvey: null, allDone: false, surveyHistory: [], isLoggedIn: false,
- ingredients: [],
- ingredientsLoading: false,
- // 鎺ㄨ崘鍟嗗搧 + 鎺ㄨ崘闃呰锛堜笌棣栭〉 parent-index 涓€鑷达級
- recommendedProducts: [],
- loadingProducts: false,
- indexArticles: [],
- articlesLoading: false,
- gradientColors: [
- 'linear-gradient(135deg, #6366F1, #818CF8)',
- 'linear-gradient(135deg, #8B5CF6, #A78BFA)',
- 'linear-gradient(135deg, #5B9BD5, #8FC5E8)',
- 'linear-gradient(135deg, #10B981, #34D399)',
- 'linear-gradient(135deg, #F97316, #FB923C)'
- ] } }, computed: {
- doneCount: function() { var c = 0; for (var i = 0; i < this.progressItems.length; i++) if (this.progressItems[i] && this.progressItems[i].done) c++; return c },
- totalCount: function() { return this.progressItems.length },
- activeTabLabel: function() { var m = { diet: '楗', exercise: '杩愬姩', sleep: '鐫$湢', emotion: '蹇冩儏' }; return m[this.activeTab] || '' },
- currentRecords: function() { return this.trackingData[this.activeTab] || [] }
- },
- onShow() {
- this.isLoggedIn = !!uni.getStorageSync('token')
- if (this.isLoggedIn) {
- this.memberId = uni.getStorageSync('currentChildId') || ''
- var now = new Date()
- this.todayDate = now.getFullYear() + '-' + this.pad(now.getMonth() + 1) + '-' + this.pad(now.getDate())
- this.loadAllData()
- }
- },
- methods: {
- pad: function(n) { return n < 10 ? '0' + n : '' + n },
- getProgressKey: function(item) { return item && item.label ? item.label : 'p-' + Math.random() },
- getRecordKey: function(rec) { return rec && (rec._id || rec.id) ? 'r' + (rec._id || rec.id) : (rec && rec._text ? rec._text + rec._content : 'r-' + Math.random()) },
- getHistoryKey: function(h) { return h && h._date ? h._date + h._content : 'h-' + Math.random() },
- dismissReminder: function() { this.hasIncomplete = false },
- switchTab: function(key) { this.activeTab = key; this.loadTrackingData(key) },
- handleProgressClick: function(item) {
- if (!item || !item.key) return
- var m = { checkin: '/pages/health/daily-checkin', diet: '/pages/health/diet-index', exercise: '/pages/health/exercise-index', sleep: '/pages/health/sleep-index', emotion: '/pages/mind/index' }
- var url = m[item.key]
- if (item.key === 'survey' && this.pendingSurvey && this.pendingSurvey.templateId) {
- url = '/pages/health/survey-questionnaire?templateId=' + this.pendingSurvey.templateId + '&templateTitle=' + encodeURIComponent(this.pendingSurvey.title) + '&templateDimension=' + (this.pendingSurvey.dimension || '')
- }
- if (url) uni.navigateTo({ url: url })
- },
- startSurvey: function() { if (this.pendingSurvey && this.pendingSurvey.templateId) uni.navigateTo({ url: '/pages/health/survey-questionnaire?templateId=' + this.pendingSurvey.templateId + '&templateTitle=' + encodeURIComponent(this.pendingSurvey.title) + '&templateDimension=' + (this.pendingSurvey.dimension || '') }) },
- viewAllRecords: function() { var m = { diet: '/pages/health/diet-index', exercise: '/pages/health/exercise-index', sleep: '/pages/health/sleep-index', emotion: '/pages/mind/index' }; if (m[this.activeTab]) uni.navigateTo({ url: m[this.activeTab] }) },
- viewAllHistory: function() { uni.navigateTo({ url: '/pages/health/survey-history?memberId=' + this.memberId }) },
- goActivityDetail: function(act) { uni.navigateTo({ url: '/pages/activity/activity-detail/activity-detail?id=' + act.id }) },
- goMoreActivities: function() { uni.navigateTo({ url: '/pages/activity/index' }) },
- handleGuestFeatureTap: function() { uni.showToast({ title: '鐧诲綍鍚庡嵆鍙綋楠岃鍔熻兘', icon: 'none' }) },
- goToCaution: function() { uni.navigateTo({ url: '/pages/growth/caution-detail' }) },
- goToDiet: function() { uni.navigateTo({ url: '/pages/diet/index' }) },
- goPage: function(url) { uni.navigateTo({ url: url }) },
- // ===== 鎺ㄨ崘鍟嗗搧 + 鎺ㄨ崘闃呰锛堜笌棣栭〉 parent-index 涓€鑷达級 =====
- onFeedItemClick: function(item) {
- if (item && item.type === 'product' && item.id) {
- uni.navigateTo({ url: '/pages/discover-detail/product-detail/product-detail?id=' + item.id })
- }
- },
- goMoreDiscover: function() {
- uni.navigateTo({ url: '/pages/shop/index/index' })
- },
- goArticleDetail: function(articleOrId) {
- var id = typeof articleOrId === 'object' ? articleOrId.id : articleOrId
- if (id) uni.navigateTo({ url: '/pages/article-center/article-detail?id=' + id })
- },
- goMoreArticles: function() {
- uni.navigateTo({ url: '/pages/article-center/index' })
- },
- async loadAllData() {
- var self = this
- self.loadProgressItems()
- self.loadSurveyData()
- self.loadRecommendedProducts()
- self.loadFeaturedArticles()
- self.loadCautionData()
- self.loadMilestones()
- self.loadDietIngredients() },
- loadRecommendedProducts: function() {
- var self = this
- self.loadingProducts = true
- productList({ page: 1, size: 6 }).then(function(res) {
- self.loadingProducts = false
- if (res && res.code === 200 && res.data) {
- var list = res.data.records || []
- self.recommendedProducts = list.map(function(p) {
- p.type = 'product'
- return p
- })
- }
- }).catch(function() {
- self.loadingProducts = false
- self.recommendedProducts = []
- })
- },
- loadFeaturedArticles: function() {
- var self = this
- self.articlesLoading = true
- getFeaturedArticles({ size: 5 }).then(function(res) {
- self.articlesLoading = false
- if (res && res.code === 200) {
- 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: self.gradientColors[index % self.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
- }
- })
- }
- }).catch(function() {
- self.articlesLoading = false
- self.indexArticles = []
- })
- },
- async loadProgressItems() {
- var self = this
- var items = []
- var dietDone = false
- try {
- var dRes = await getHealthMealList({ memberId: self.memberId })
- if (dRes.code === 200 && dRes.data && dRes.data.length > 0) {
- for (var dm = 0; dm < dRes.data.length; dm++) {
- var dRec = dRes.data[dm]
- if (!dRec) continue
- var dDate = dRec.createdAt
- if (dDate instanceof Date) dDate = dDate.toISOString().substring(0, 10)
- else if (typeof dDate === 'string') dDate = dDate.substring(0, 10)
- else continue
- if (dDate === self.todayDate) { dietDone = true; break }
- } }
- } catch(e) {}
- items.push({ key: 'diet', icon: '馃嵔锔?, label: '楗璁板綍', done: dietDone, actionText: '琛ュ綍' })
- // 杩愬姩璁板綍
- var exerciseDone = false
- try {
- var exRes = await getExerciseList({ memberId: self.memberId })
- if (exRes.code === 200 && exRes.data && exRes.data.length > 0) {
- for (var ex = 0; ex < exRes.data.length; ex++) {
- var exRec = exRes.data[ex]
- if (!exRec) continue
- var exDate = exRec.createdAt
- if (exDate instanceof Date) exDate = exDate.toISOString().substring(0, 10)
- else if (typeof exDate === 'string') exDate = exDate.substring(0, 10)
- else continue
- if (exDate === self.todayDate) { exerciseDone = true; break } }
- }
- } catch(e) {}
- items.push({ key: 'exercise', icon: '馃弮', label: '杩愬姩璁板綍', done: exerciseDone, actionText: '璁板綍' })
- var sleepDone = false
- try {
- var slRes = await getSleepList({ memberId: self.memberId })
- if (slRes.code === 200 && slRes.data && slRes.data.length > 0) {
- for (var sl = 0; sl < slRes.data.length; sl++) {
- var slRec = slRes.data[sl]
- if (!slRec) continue
- var slDate = slRec.createdAt
- if (slDate instanceof Date) slDate = slDate.toISOString().substring(0, 10)
- else if (typeof slDate === 'string') slDate = slDate.substring(0, 10)
- else continue
- if (slDate === self.todayDate) { sleepDone = true; break } }
- }
- } catch(e) {}
- items.push({ key: 'sleep', icon: '馃槾', label: '鐫$湢璁板綍', done: sleepDone, actionText: '璁板綍' })
- var emotionDone = false
- try {
- var emRes = await getMindCheckinList({ page: 1, size: 20, memberId: self.memberId })
- if (emRes.code === 200 && emRes.data && emRes.data.length > 0) {
- for (var em = 0; em < emRes.data.length; em++) {
- var emRec = emRes.data[em]
- if (!emRec) continue
- var emDate = emRec.checkinDate
- if (emDate instanceof Date) emDate = emDate.toISOString().substring(0, 10)
- else if (typeof emDate === 'string') emDate = emDate.substring(0, 10)
- else continue
- if (emDate === self.todayDate) { emotionDone = true; break }
- } }
- } catch(e) {}
- items.push({ key: 'emotion', icon: '馃槉', label: '蹇冩儏璁板綍', done: emotionDone, actionText: '璁板綍' })
- self.progressItems = items.filter(function(it) { return it && it.key })
- self.incompleteCount = 0
- for (var pi = 0; pi < items.length; pi++) if (items[pi] && !items[pi].done) self.incompleteCount++
- self.hasIncomplete = self.incompleteCount > 0
- },
- async loadSurveyData() {
- var self = this
- try {
- var statusRes = await getSurveyStatus({})
- if (statusRes.code === 200 && statusRes.data) {
- var list = statusRes.data
- self.pendingSurvey = null; self.allDone = true; var hasAny = false
- for (var si = 0; si < list.length; si++) { var s = list[si]; if (!s) continue; hasAny = true; if (s.status === 'pending') { self.pendingSurvey = { templateId: s.templateId, title: s.title || '鎴愰暱璁板綍', dimension: s.dimension || '' }; self.allDone = false } }
- if (!hasAny) { self.pendingSurvey = null; self.allDone = false }
- }
- } catch(e) {}
- try {
- var histRes = await getSurveyHistory({})
- if (histRes.code === 200 && histRes.data) {
- var hlist = histRes.data; self.surveyHistory = []
- for (var hi = 0; hi < Math.min(hlist.length, 3); hi++) { var h = hlist[hi]; self.surveyHistory.push({ _date: h && h.submittedAt ? h.submittedAt.substring(0, 10) : '', _content: '宸插畬鎴愯皟鐮? }) }
- }
- } catch(e) {}
- },
- async loadCautionData() {
- var self = this
- try {
- var res = await getFoodCautionList()
- if (res && res.code === 200) self.cautionCount = (res.data || []).length
- } catch(e) {}
- },
- async loadMilestones() {
- var self = this
- try {
- var ciRes = await healthCheckinList({})
- if (ciRes.code === 200 && ciRes.data) self.streakDays = Math.min(ciRes.data.length, 30)
- } catch(e) {}
- self.activeChallenges = 0
- self.completeness = self.streakDays > 0 ? Math.min(100, Math.round(self.streakDays * 10)) : 0
- }
- }
- }
- </script>
- <style scoped>
- .container{background:#FFF7ED;min-height:100vh;padding-bottom:calc(160rpx + env(safe-area-inset-bottom))}
- .section{margin:16rpx 24rpx}
- /* 娓稿鎬?*/
- .brand-strap{margin:0 24rpx 16rpx;background:linear-gradient(135deg,#F0FFF4,rgba(16,185,129,0.1));border-radius:16rpx;padding:20rpx 24rpx}
- .brand-strap-text{font-size:26rpx;color:#10B981;font-weight:600}
- .concept-card{margin:0 24rpx 16rpx;background:#fff;border-radius:20rpx;padding:28rpx;border-left:6rpx solid #10B981;box-shadow:0 2rpx 12rpx rgba(0,0,0,0.06)}
- .concept-quote{font-size:30rpx;font-weight:bold;color:#333;display:block;margin-bottom:8rpx}
- .concept-desc{font-size:24rpx;color:#888;display:block;line-height:1.6}
- .case-card{margin:0 24rpx 16rpx;background:#fff;border-radius:20rpx;padding:24rpx;box-shadow:0 2rpx 12rpx rgba(0,0,0,0.06)}
- .case-header{margin-bottom:12rpx}
- .case-label{font-size:24rpx;color:#10B981;font-weight:bold}
- .case-body{padding:8rpx 0}
- .case-name{font-size:26rpx;color:#333;font-weight:600;display:block;margin-bottom:6rpx}
- .case-change{font-size:24rpx;color:#666;display:block;margin-bottom:12rpx}
- .case-metrics{display:flex;gap:16rpx;margin-bottom:12rpx}
- .metric-item{display:flex;flex-direction:column;align-items:center;flex:1;background:#F0FFF4;border-radius:12rpx;padding:12rpx 8rpx}
- .metric-up{font-size:26rpx;font-weight:bold;color:#10B981}
- .metric-label{font-size:20rpx;color:#999;margin-top:4rpx}
- .case-note{font-size:22rpx;color:#888;display:block}
- .guest-features{display:flex;flex-wrap:wrap;justify-content:space-between;margin:0 24rpx 16rpx}
- .feat-card{width:calc(50% - 8rpx);box-sizing:border-box;background:#fff;border-radius:20rpx;padding:24rpx;margin-bottom:16rpx;box-shadow:0 2rpx 12rpx rgba(0,0,0,0.06)}
- .feat-icon{font-size:40rpx;display:block;margin-bottom:8rpx}
- .feat-title{font-size:26rpx;font-weight:600;color:#333;display:block;margin-bottom:4rpx}
- .feat-desc{font-size:22rpx;color:#999;display:block}
- .login-guide-section{margin:0 24rpx 24rpx}
- /* 鎴愰暱琛屽姩鍗$墖 */
- .action-card{display:flex;align-items:center;padding:24rpx 28rpx;background:#fff;border-radius:16rpx;margin:0 24rpx 16rpx;box-shadow:0 2rpx 12rpx rgba(0,0,0,0.06)}
- .action-card:active{opacity:0.85}
- .action-icon{font-size:44rpx;margin-right:20rpx}
- .action-info{flex:1}
- .action-title{font-size:28rpx;font-weight:600;color:#333;display:block}
- .action-desc{font-size:22rpx;color:#888;margin-top:4rpx;display:block}
- .action-arrow{font-size:32rpx;color:#ccc}
- /* 鐧诲綍鍚庡師鏈夋牱寮?*/
- .reminder-bar{margin:12rpx 24rpx;background:#FFF3E0;border:1rpx solid #FFB74D;border-radius:12rpx;padding:14rpx 20rpx;display:flex;align-items:center;justify-content:space-between}
- .reminder-text{font-size:24rpx;color:#E65100}
- .reminder-close{font-size:28rpx;color:#999}
- .progress-card{background:#fff;border-radius:20rpx;padding:24rpx;box-shadow:0 2rpx 12rpx rgba(0,0,0,0.06)}
- .progress-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16rpx}
- .progress-title{font-size:28rpx;font-weight:bold;color:#333}
- .progress-date{font-size:22rpx;color:#999}
- .progress-grid{display:flex}
- .progress-grid-item{flex:1;box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:center;background:#FFF7ED;border-radius:16rpx;padding:20rpx 8rpx;border:1rpx solid rgba(249,115,22,0.12)}
- .progress-grid-item:active{opacity:0.85;background:#FFEDD5}
- .progress-grid-icon{font-size:40rpx;margin-bottom:8rpx}
- .progress-grid-label{font-size:24rpx;color:#333;margin-bottom:8rpx;text-align:center}
- .progress-grid-status{font-size:20rpx;flex-shrink:0}.status-done{color:#10B981}
- .status-pending{color:#ccc}
- .progress-btn{font-size:22rpx;color:#F97316;padding:4rpx 16rpx;border:1rpx solid #F97316;border-radius:20rpx;flex-shrink:0}
- .progress-footer{display:flex;justify-content:space-between;align-items:center;margin-top:16rpx;padding-top:16rpx;border-top:1rpx solid #f5f5f5}
- .footer-text{font-size:24rpx;color:#666;font-weight:bold}
- .footer-streak{font-size:24rpx;color:#F97316;font-weight:bold}
- .tracking-card{background:#fff;border-radius:20rpx;padding:24rpx;box-shadow:0 2rpx 12rpx rgba(0,0,0,0.06)}
- .tracking-tabs{display:flex;margin-bottom:16rpx}
- .tracking-tab{flex:1;text-align:center;padding:10rpx 0;border-radius:20rpx;margin-right:8rpx;background:#FFF7ED}
- .tracking-tab:last-child{margin-right:0}
- .tab-active{background:#F97316}
- .tab-text{font-size:24rpx;color:#666}
- .tab-active-text{color:#fff;font-weight:bold}
- .tracking-content{min-height:200rpx}
- .tracking-empty{display:flex;flex-direction:column;align-items:center;padding:60rpx 0}
- .empty-icon{font-size:60rpx;margin-bottom:12rpx}
- .empty-text{font-size:26rpx;color:#999}
- .empty-hint{font-size:22rpx;color:#ccc;margin-top:8rpx}
- .tracking-record{display:flex;align-items:center;padding:10rpx 0;border-bottom:1rpx solid #f5f5f5}
- .record-date{font-size:22rpx;color:#999;width:120rpx;flex-shrink:0}
- .record-content{font-size:24rpx;color:#333;flex:1}
- .tracking-more{text-align:right;font-size:24rpx;color:#F97316;padding:12rpx 0 0 0}
- .milestone-card{background:#fff;border-radius:20rpx;padding:24rpx;box-shadow:0 2rpx 12rpx rgba(0,0,0,0.06)}
- .section-title-row{font-size:26rpx;font-weight:bold;color:#333;margin-bottom:16rpx;display:block}
- .milestone-grid{display:flex;justify-content:space-between}
- .milestone-item{display:flex;flex-direction:column;align-items:center;flex:1}
- .milestone-icon{font-size:40rpx;margin-bottom:4rpx}
- .milestone-value{font-size:28rpx;font-weight:bold;color:#F97316;margin-bottom:2rpx}
- .milestone-label{font-size:22rpx;color:#999}
- .survey-card{background:#fff;border-radius:20rpx;padding:24rpx;box-shadow:0 2rpx 12rpx rgba(0,0,0,0.06)}
- .survey-pending{background:#FFF3E0;border-radius:12rpx;padding:16rpx;margin-bottom:12rpx}
- .survey-alert{font-size:24rpx;color:#E65100;font-weight:bold;display:block;margin-bottom:4rpx}
- .survey-title-text{font-size:24rpx;color:#333;display:block;margin-bottom:8rpx}
- .survey-btn{font-size:22rpx;color:#F97316;font-weight:bold}
- .survey-done{padding:8rpx 0}
- .survey-done-text{font-size:24rpx;color:#10B981}
- .survey-history-list{border-top:1rpx solid #f5f5f5;padding-top:12rpx}
- .history-label{font-size:22rpx;color:#999;display:block;margin-bottom:6rpx}
- .history-item{display:flex;align-items:center;padding:6rpx 0}
- .history-date{font-size:22rpx;color:#999;width:120rpx;flex-shrink:0}
- .history-content{font-size:24rpx;color:#666;flex:1}
- .survey-more{text-align:right;font-size:22rpx;color:#F97316;padding-top:8rpx}
- .survey-empty{padding:12rpx 0}
- .survey-empty-text{font-size:24rpx;color:#999}
- /* ===== 浜旂淮闂幆浣撶郴鏍峰紡 ===== */
- .wuxing-section { margin: 0 24rpx 16rpx; background: #fff; border-radius: 20rpx; padding: 24rpx; box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06); }
- .wuxing-title { font-size: 30rpx; font-weight: bold; color: #333; text-align: center; margin-bottom: 6rpx; }
- .wuxing-desc { font-size: 22rpx; color: #999; text-align: center; margin-bottom: 20rpx; }
- .wuxing-diagram { position: relative; height: 320rpx; margin: 0 auto 20rpx; }
- .wuxing-relations { margin-top: 8rpx; }
- .rel-group { margin-bottom: 16rpx; }
- .rel-title { font-size: 24rpx; font-weight: bold; color: #333; margin-bottom: 8rpx; display: block; }
- .rel-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 4rpx; margin-bottom: 6rpx; }
- .rel-item { font-size: 22rpx; padding: 4rpx 10rpx; border-radius: 8rpx; background: #f7f7f7; color: #555; }
- .rel-arrow { font-size: 20rpx; color: #10B981; font-weight: bold; }
- .rel-op { font-size: 20rpx; color: #f56c6c; font-weight: bold; }
- .rel-dot { font-size: 20rpx; color: #ccc; }
- .rel-hint { font-size: 20rpx; color: #999; line-height: 1.5; display: block; }
- .wuxing-cards { display: flex; flex-direction: column; gap: 10rpx; margin-top: 16rpx; }
- .wc-card { display: flex; align-items: center; padding: 16rpx 20rpx; border-radius: 16rpx; border: 2rpx solid #f0f0f0; }
- .wc-card:active { opacity: 0.85; }
- .wc-icon { font-size: 36rpx; margin-right: 16rpx; flex-shrink: 0; }
- .wc-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
- .wc-name { font-size: 24rpx; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
- .wc-text { font-size: 20rpx; color: #999; display: block; margin-top: 4rpx; white-space: normal; }
- .wc-body { border-color: rgba(255,140,66,0.3); background: rgba(255,140,66,0.04); border-left: 8rpx solid #FF8C42; }
- .wc-body .wc-name { color: #FF8C42; }
- .wc-wisdom { border-color: rgba(99,102,241,0.3); background: rgba(99,102,241,0.04); border-left: 8rpx solid #6366F1; }
- .wc-wisdom .wc-name { color: #6366F1; }
- .wc-wealth { border-color: rgba(245,158,11,0.3); background: rgba(245,158,11,0.04); border-left: 8rpx solid #F59E0B; }
- .wc-wealth .wc-name { color: #F59E0B; }
- .wc-action { border-color: rgba(16,185,129,0.3); background: rgba(16,185,129,0.04); border-left: 8rpx solid #10B981; }
- .wc-action .wc-name { color: #10B981; }
- .wc-mind { border-color: rgba(255,107,157,0.3); background: rgba(255,107,157,0.04); border-left: 8rpx solid #FF6B9D; }
- .wc-mind .wc-name { color: #FF6B9D; }
- </style>
|