| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906 |
- <template>
- <view class="container">
- <!-- Tabbar 切换过渡页 -->
- <tab-transition v-if="showTabTransition" dimCode="action" ref="tabTransition" @close="showTabTransition = false" />
- <!-- 品牌头部 -->
- <PageBanner theme="action"
- tagline="人际和谐 · 关系滋养"
- quote="和谐关系滋养幸福家庭" />
- <!-- 品牌定位语(登录前显示) -->
- <view class="brand-strap" v-if="!isLoggedIn">
- <text class="brand-strap-text">改善全家关系与沟通能力</text>
- </view>
- <!-- 家庭成员选择条 -->
- <FamilyMemberStrip
- v-if="currentView === 'self' && isLoggedIn"
- :members="familyMembersVisible"
- :selectedMemberId="selectedMemberId"
- @select="onFamilyMemberSelect"
- @removed="loadFamilyMembersVisible" />
- <!-- 游客引导语(每月更换) -->
- <view class="monthly-guidance" v-if="!isLoggedIn">
- <text class="guidance-icon">🌿</text>
- <text class="guidance-text">{{ monthlyGuidance }}</text>
- </view>
- <!-- 登录后:五维能量条 -->
- <FamilyEnergyBar
- v-if="isLoggedIn"
- dimensionCode="action"
- :sandboxData="sandboxData"
- :dualDimension="dualDimension" />
- <!-- 关系解读 -->
- <view class="section score-explain-card" v-if="isLoggedIn && currentView === 'self' && actionScore != null">
- <view class="explain-header">
- <text class="explain-icon">{{ actionScore >= 80 ? '✅' : actionScore >= 60 ? '⚠️' : '❗' }}</text>
- <text class="explain-title">关系解读</text>
- </view>
- <text class="explain-text">{{ actionScore >= 80 ? '家庭关系和谐,家人沟通顺畅。' : actionScore >= 60 ? '家庭关系一般,建议多花时间陪伴家人。' : '家庭关系需要改善,建议进行家庭沟通活动。' }}</text>
- </view>
- <!-- 关系六维 -->
- <dimension-sub-dims
- v-if="isLoggedIn && actionSubDims.length > 0"
- title="🌲 关系六维"
- subtitle="家庭关系的六个方面"
- accent-color="#10B981"
- :dims="actionSubDims" />
- <!-- 登录后:家庭关系(行维度核心) -->
- <view class="section" v-if="isLoggedIn">
- <view class="section-header">
- <view class="section-title-wrap">
- <text class="help-icon" @tap="showHelp('家庭关系', '了解每位家人的关系质量,改善沟通方式。点击家人节点,查看关系详情。')">?</text>
- <text class="section-title">家庭关系</text>
- </view>
- <text class="section-sub">了解每位家人的关系质量,改善沟通方式</text>
- <text class="section-sub">点击家人节点,查看关系详情</text>
- </view>
- <FamilyRelationGraph
- dimensionCode="action"
- :selfId="selfId"
- :members="graphMembers"
- :energyMap="energyMapForGraph"
- :intimacyMap="intimacyMapForGraph"
- :interactive="true" />
- </view>
- <!-- 登录后:章鱼图(关键人拓展) -->
- <view class="section" v-if="isLoggedIn">
- <view class="section-header">
- <view class="section-title-wrap">
- <text class="help-icon" @tap="showHelp('章鱼图', '从成效出发,挖掘关键人,画出拓展路径。记录感恩时刻,建立有温度的人脉网络。')">?</text>
- <view>
- <text class="section-title">🐙 章鱼图</text>
- <text class="section-sub">从成效出发,挖掘关键人,画出拓展路径</text>
- </view>
- </view>
- <text class="section-link section-link-octopus" @tap="goOctopusEffectsList">+ 感恩记录</text>
- </view>
- <OctopusDiagram
- ref="octopusDiagram"
- :selfId="selfId"
- :effects="octopusEffects"
- :expansions="octopusExpansions"
- :interactive="true"
- @effect-click="onEffectClick"
- @expansion-click="onExpansionClick"
- @add-effect="goOctopusAddEffect"
- @reanalyze="onReanalyze" />
- </view>
- <!-- 登录后:珍珠图(我有什么) -->
- <view class="section" v-if="isLoggedIn">
- <view class="section-header">
- <view class="section-title-wrap">
- <text class="help-icon" @tap="showHelp('珍珠图', '把可调用的资源串成珍珠项链——盘点我有什么。登记人脉、资源、信息缺口,画出一条清晰的成长珍珠链。')">?</text>
- <view>
- <text class="section-title">🫧 珍珠图</text>
- <text class="section-sub">把可调用的资源串成珍珠项链——盘点我有什么</text>
- </view>
- </view>
- <text class="section-link section-link-pearl" @tap="goPearlAddResource">+ 登记</text>
- </view>
- <PearlDiagram
- ref="pearlDiagram"
- :selfId="selfId"
- :resources="pearlData"
- :overdue-map="overdueMap"
- :interactive="true"
- @add="goPearlAddResource"
- @delete="onDeletePearlResource" />
- </view>
- <!-- 登录后:能力图(谁会什么) -->
- <view class="section" v-if="isLoggedIn">
- <view class="section-header">
- <view class="section-title-wrap">
- <text class="help-icon" @tap="showHelp('能力图', '身边藏着什么技能——谁有能力帮到你。记录技能类帮助后,这里会画出大家的能力图谱。')">?</text>
- <view>
- <text class="section-title">💡 能力图</text>
- <text class="section-sub">身边藏着什么技能——谁有能力帮到你</text>
- </view>
- </view>
- <text class="section-link section-link-ability" @tap="goInteractionLog">+ 记录帮助</text>
- </view>
- <AbilityDiagram
- ref="abilityDiagram"
- :selfId="selfId"
- :abilities="abilityData"
- :interactive="true" />
- </view>
- <!-- 行6维关系域雷达图(登录后) -->
- <view class="section" v-if="isLoggedIn && currentMemberEnergies">
- <view class="section-header">
- <text class="section-title">🫂 关系质量</text>
- </view>
- <RadarChart
- :dimensions="actionDimensions"
- :scores="actionScores"
- :avg-scores="actionFamilyScores"
- :population-scores="actionPopulationScores"
- fillColor="#10B981"
- gridColor="#D1FAE5"
- labelColor="#065F46"
- :width="580"
- :height="580" />
- </view>
- <!-- 功能入口 -->
- <view class="func-section" v-if="sectionVisible('func_entries')">
- <view class="func-grid">
- <view class="func-item" v-for="item in funcList" :key="item.label" @click="onFuncClick(item)">
- <view class="func-icon-wrap">
- <text class="func-icon">{{ item.icon }}</text>
- </view>
- <text class="func-label">{{ item.label }}</text>
- </view>
- </view>
- </view>
- <!-- 登录后:今日任务 -->
- <DimensionTasks
- v-if="isLoggedIn"
- :memberId="activeChildId"
- @taskClick="onTaskClick"
- @moreTasks="goTasks" />
- <!-- 登录后:活动 -->
- <DimensionActivities
- v-if="isLoggedIn"
- :isLoggedIn="true"
- @activityClick="goActivityDetail"
- @moreActivities="goMoreActivities" />
- <!-- 登录后:商品 -->
- <DimensionProducts
- v-if="isLoggedIn"
- :isLoggedIn="true"
- @productClick="goProductDetail"
- @moreProducts="goMoreProducts" />
- <!-- 行维度介绍卡片(登录后显示) -->
- <DimensionIntroCard dimCode="action" v-if="isLoggedIn" learn-more-url="/pages/action-detail/dimension-intro" />
- <!-- 底部占位 -->
- <view class="bottom-spacer"></view>
- <FloatingAvatar />
- <!-- 帮助说明弹窗 -->
- <view class="help-mask" v-if="helpPopup.visible" @tap="closeHelp">
- <view class="help-dialog" @tap.stop>
- <view class="help-dialog-header">
- <text class="help-dialog-title">{{ helpPopup.title }}</text>
- <text class="help-dialog-close" @tap="closeHelp">✕</text>
- </view>
- <text class="help-dialog-content">{{ helpPopup.content }}</text>
- </view>
- </view>
- </view>
- </template>
- <script>
- import TabTransition from '../../components/tab-transition.vue'
- import PageBanner from '../../components/PageBanner.vue'
- import FamilyEnergyBar from '../../components/FamilyEnergyBar.vue'
- import FamilyRelationGraph from '../../components/FamilyRelationGraph.vue'
- import PearlDiagram from '../../components/PearlDiagram.vue'
- import AbilityDiagram from '../../components/AbilityDiagram.vue'
- import OctopusDiagram from '../../components/OctopusDiagram.vue'
- import FamilyMemberStrip from '../../components/FamilyMemberStrip.vue'
- import DimensionTasks from '../../components/DimensionTasks.vue'
- import DimensionActivities from '../../components/DimensionActivities.vue'
- import DimensionProducts from '../../components/DimensionProducts.vue'
- import DimensionIntroCard from '../../components/DimensionIntroCard.vue'
- import FloatingAvatar from '../../components/AIFloatingAvatar.vue'
- import RadarChart from '../../components/RadarChart.vue'
- import DimensionSubDims from '../../components/DimensionSubDims.vue'
- import { getVisibleSections, getEnergyOverview, getChildren, getFamilyEnergySandbox, getEnergySandbox, getFamilyMemberList, getOctopusTentacles, getPearlResources, deletePearlResource, getAbilityMap, getRadarData, getPearlReminders, getOctopusEffects, getOctopusAnalysisSummary, getOctopusExpansionSuggest, getOctopusEffectKeyPersons } from '../../utils/api.js'
- export default {
- components: { TabTransition, PageBanner, FamilyEnergyBar, FamilyRelationGraph, PearlDiagram, AbilityDiagram, OctopusDiagram, FamilyMemberStrip, DimensionTasks, DimensionActivities, DimensionProducts, DimensionIntroCard, FloatingAvatar, RadarChart, DimensionSubDims },
- data() {
- return {
- isLoggedIn: false,
- role: null,
- showTabTransition: true,
- activeChildId: null,
- selectedMemberId: null,
- activeChildName: '',
- userName: '',
- children: [],
- familyMembersVisible: [],
- childrenChecked: false,
- membersChecked: false,
- actionSubDims: [],
- sandboxData: null,
- actionPopulationScoreMap: {},
- currentView: 'self', // 'self' | 'family'
- dualDimension: null,
- selfId: null,
- visibleSections: [],
- pearlData: null,
- abilityData: null,
- octopusEffects: null,
- octopusExpansions: [],
- octopusKeyPersons: {},
- overdueMap: null,
- // 帮助弹窗
- helpPopup: { visible: false, title: '', content: '' },
- funcList: [
- { icon: '\u{1F4AC}', label: '记录互动', needLogin: true, page: '/pages/action-detail/interaction-log' },
- { icon: '\u{1F4DD}', label: '关系问卷', needLogin: true, page: '/pages/action-detail/relationship-questionnaire' },
- { icon: '\u{1F465}', label: '家庭成员', needLogin: true, page: '/pages/profile-extra/family-members' },
- { icon: '\u{1F4CB}', label: '任务中心', needLogin: true, page: '/pages/tasks/tasks' }
- ]
- }
- },
- computed: {
- /** 关系图谱:成员节点(来自沙盘数据) */
- graphMembers: function() {
- if (!this.sandboxData || !this.sandboxData.members) return []
- return this.sandboxData.members.map(function(m) {
- return {
- id: m.memberId || m.id,
- nickname: m.name || m.nickname || '成员',
- memberType: m.memberType || 'child'
- }
- })
- },
- /** 关系图谱:节点能量映射 */
- energyMapForGraph: function() {
- var map = {}
- if (this.sandboxData && this.sandboxData.members) {
- for (var i = 0; i < this.sandboxData.members.length; i++) {
- var m = this.sandboxData.members[i]
- map[m.memberId || m.id] = {
- bodyScore: m.bodyScore || 0,
- mindScore: m.mindScore || 0,
- actionScore: m.actionScore || 0
- }
- }
- }
- return map
- },
- intimacyMapForGraph: function() {
- return {}
- },
- /** 每月引导语 */
- monthlyGuidance: function() {
- var month = new Date().getMonth()
- var messages = [
- '一月:新年伊始,增进家庭沟通',
- '二月:春节团聚,珍惜亲子时光',
- '三月:春暖花开,多陪伴孩子',
- '四月:清明踏青,共享家庭活动',
- '五月:劳动教育,培养家庭责任感',
- '六月:儿童节,倾听孩子心声',
- '七月:暑期陪伴,增进亲子关系',
- '八月:开学准备,共同规划',
- '九月:新学期,建立家庭规则',
- '十月:国庆假期,家庭协作时光',
- '十一月:感恩季节,表达家庭关爱',
- '十二月:年终总结,回顾家庭成长'
- ]
- return messages[month] || messages[0]
- },
- /** 当前选中成员的能量数据(从 sandboxData.members 中查找) */
- currentMemberEnergies: function() {
- if (!this.sandboxData || !this.sandboxData.members) return null
- var members = this.sandboxData.members
- var targetId = this.selectedMemberId || this.activeChildId
- for (var i = 0; i < members.length; i++) {
- var m = members[i]
- if (m && (m.memberId === targetId)) return m
- }
- return members[0] || null
- },
- /** 行6维关系域维度定义(根据角色切换家长版/孩子版) */
- actionDimensions: function() {
- var role = this.role || uni.getStorageSync('currentRole') || ''
- var isParent = (role === 'parent')
- if (isParent) {
- return [
- { key: 'actionParentChild', label: '亲子关系' },
- { key: 'actionMarital', label: '夫妻关系' },
- { key: 'actionParental', label: '父母关系' },
- { key: 'actionLeadership', label: '领导关系' },
- { key: 'actionSociality', label: '社会性' },
- { key: 'actionInterpersonal', label: '人际韧性' }
- ]
- } else {
- return [
- { key: 'actionChildParentChild', label: '亲子关系' },
- { key: 'actionSibling', label: '同胞关系' },
- { key: 'actionRelative', label: '亲属关系' },
- { key: 'actionTeacherStudent', label: '师生关系' },
- { key: 'actionChildSociality', label: '社会性' },
- { key: 'actionChildInterpersonal', label: '人际韧性' }
- ]
- }
- },
- /** 当前选中成员的行维度分数 */
- actionScore: function() {
- var member = this.currentMemberEnergies
- return member ? (member.actionScore || 0) : null
- },
- /** 行6维分值(从当前成员中提取,与 dimensions 顺序对应) */
- actionScores: function() {
- var member = this.currentMemberEnergies
- if (!member) return []
- var dims = this.actionDimensions
- var scores = []
- for (var i = 0; i < dims.length; i++) {
- scores.push(member[dims[i].key] || 0)
- }
- return scores
- },
- /** 行6维家庭平均分(从 sandboxData.members 各成员同维度均值) */
- actionFamilyScores: function() {
- if (!this.sandboxData || !this.sandboxData.members) return []
- var members = this.sandboxData.members
- var dims = this.actionDimensions
- var scores = []
- for (var i = 0; i < dims.length; i++) {
- var key = dims[i].key
- var sum = 0, count = 0
- for (var j = 0; j < members.length; j++) {
- var val = members[j][key]
- if (val !== undefined && val !== null && val > 0) { sum += val; count++ }
- }
- scores.push(count > 0 ? Math.round(sum / count) : 0)
- }
- return scores
- },
- /** 行6维人群位置分数(按 actionDimensions 顺序从 map 取值) */
- actionPopulationScores: function() {
- var dims = this.actionDimensions
- var scores = []
- for (var i = 0; i < dims.length; i++) {
- scores.push(this.actionPopulationScoreMap[dims[i].key] || 0)
- }
- return scores
- }
- },
- onShow() {
- this.showTabTransition = true
- var token = uni.getStorageSync('token')
- this.isLoggedIn = !!token
- if (this.isLoggedIn) {
- this.role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
- this.userName = uni.getStorageSync('nickname') || uni.getStorageSync('userName') || '家长'
- this.selfId = uni.getStorageSync('userId') || null
- }
- this.loadSectionConfig()
- if (this.isLoggedIn) {
- this.loadChildren()
- this.loadFamilyMembersVisible()
- this.loadPearlResources()
- this.loadAbilityMap()
- this.loadOctopusData()
- this.loadActionRadarPopulationData()
- }
- this._watchPageReady()
- },
- methods: {
- loadSectionConfig: function() {
- var baseSections = ['func_entries']
- if (!uni.getStorageSync('token')) {
- this.visibleSections = baseSections
- return
- }
- var role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
- var self = this
- getVisibleSections({ pageKey: 'action', role: role }).then(function(res) {
- if (res.code === 200 && res.data) {
- var keys = res.data.map(function(s) { return s.sectionKey })
- var merged = baseSections.slice()
- keys.forEach(function(k) { if (merged.indexOf(k) === -1) merged.push(k) })
- self.visibleSections = merged
- }
- }).catch(function(e) {
- self.visibleSections = ['func_entries']
- })
- },
- loadChildren: function() {
- var self = this
- getChildren().then(function(res) {
- if (res.code === 200 && res.data) {
- self.children = res.data
- var savedChildId = uni.getStorageSync('currentChildId')
- var found = false
- for (var i = 0; i < self.children.length; i++) {
- if (self.children[i].memberId === savedChildId) {
- self.activeChildId = savedChildId
- self.activeChildName = self.children[i].name || self.children[i].nickname || '孩子'
- found = true
- break
- }
- }
- if (!found && self.children.length > 0) {
- self.activeChildId = self.children[0].memberId
- self.activeChildName = self.children[0].name || self.children[0].nickname || '孩子'
- uni.setStorageSync('currentChildId', self.activeChildId)
- }
- if (self.activeChildId) {
- self.loadDashboardData()
- }
- }
- self.childrenChecked = true
- }).catch(function(e) {
- console.log('获取孩子列表失败', e)
- self.childrenChecked = true
- })
- },
- loadDashboardData: function() {
- if (!this.activeChildId) return
- this.loadEnergyData()
- this.loadSandboxData()
- },
- loadSandboxData: function() {
- var self = this
- getFamilyEnergySandbox().then(function(res) {
- if (res && res.data) {
- self.sandboxData = res.data
- }
- }).catch(function(e) {
- console.log('获取沙盘数据失败', e)
- })
- },
- loadActionRadarPopulationData: function() {
- var self = this
- var memberId = this.selectedMemberId || this.activeChildId
- if (!memberId) return
- getRadarData({
- memberId: memberId,
- dimensions: ['actionParentChild','actionMarital','actionParental','actionLeadership','actionSociality','actionInterpersonal',
- 'actionChildParentChild','actionSibling','actionRelative','actionTeacherStudent','actionChildSociality','actionChildInterpersonal']
- }).then(function(res) {
- if (res && res.data && res.data.populationScores) {
- var dims = res.data.dimensions || []
- var scores = res.data.populationScores
- var map = {}
- for (var i = 0; i < dims.length && i < scores.length; i++) {
- map[dims[i]] = scores[i]
- }
- self.actionPopulationScoreMap = map
- }
- }).catch(function(e) { console.warn('[action] radar-data failed', e) })
- },
- switchView: function(view) {
- this.currentView = view
- if (view === 'family') {
- this.selectedMemberId = null
- var self = this
- getEnergySandbox('family').then(function(res) {
- if (res && res.data && !res.data.locked) {
- self.sandboxData = res.data.familyData || res.data
- }
- }).catch(function(e) { console.log('获取家庭数据失败', e) })
- } else {
- this.loadSandboxData()
- }
- },
- loadEnergyData: function() {
- var self = this
- getEnergyOverview(this.activeChildId).then(function(res) {
- if (res && res.data) {
- var dims = res.data.dimensions
- if (dims && dims.length > 0) {
- for (var i = 0; i < dims.length; i++) {
- if (dims[i].code === 'action') {
- self.dualDimension = dims[i]
- break
- }
- }
- }
- }
- }).catch(function(e) {
- console.log('获取能量概览失败', e)
- })
- },
- onFamilyMemberSelect: function(member) {
- this.selectedMemberId = member.id
- },
- loadFamilyMembersVisible: function() {
- var self = this
- getFamilyMemberList({ visibleOnly: true }).then(function(res) {
- self.familyMembersVisible = res.data || []
- self.membersChecked = true
- }).catch(function(e) {
- console.log('获取可见家庭成员失败', e)
- self.familyMembersVisible = []
- self.membersChecked = true
- })
- },
- sectionVisible: function(key) {
- return this.visibleSections.length === 0 || this.visibleSections.indexOf(key) !== -1
- },
- onFuncClick: function(item) {
- if (item.needLogin && !this.isLoggedIn) {
- uni.showModal({
- title: '提示',
- content: '请先登录后使用此功能',
- success: function(res) {
- if (res.confirm) uni.navigateTo({ url: '/pages/login/login' })
- }
- })
- return
- }
- if (item.page) uni.navigateTo({ url: item.page })
- },
- /** 加载珍珠图数据 */
- loadPearlResources: function() {
- var self = this
- getPearlResources().then(function(res) {
- self.pearlData = (res.code === 200 && res.data) ? res.data : null
- }).catch(function(e) {
- console.log('获取珍珠图数据失败', e)
- self.pearlData = null
- })
- // 构建逾期映射
- getPearlReminders().then(function(res) {
- var map = {}
- if (res.code === 200 && res.data) {
- for (var i = 0; i < res.data.length; i++) {
- map['' + res.data[i].resourceItemId] = res.data[i].daysSinceLast
- }
- }
- self.overdueMap = map
- }).catch(function(e) {
- self.overdueMap = null
- })
- },
- /** 登记珍珠图资源入口 */
- goPearlAddResource: function() {
- uni.navigateTo({ url: '/pages/action-detail/pearl-add-resource' })
- },
- /** 能力图记录帮助入口(跳转互动记录,记录技能类帮助) */
- goInteractionLog: function() {
- uni.navigateTo({ url: '/pages/action-detail/interaction-log' })
- },
- /** 删除珍珠图资源 */
- onDeletePearlResource: function(item) {
- if (!item || !item.id) return
- var self = this
- uni.showModal({
- title: '提示',
- content: '确定删除该资源吗?',
- success: function(res) {
- if (!res.confirm) return
- deletePearlResource({ itemId: item.id }).then(function(r) {
- if (r.code === 200) {
- uni.showToast({ title: '已删除', icon: 'success' })
- self.loadPearlResources()
- } else {
- uni.showToast({ title: r.message || '删除失败', icon: 'none' })
- }
- }).catch(function(e) {
- console.log('删除珍珠图资源失败', e)
- uni.showToast({ title: '删除失败', icon: 'none' })
- })
- }
- })
- },
- /** 加载能力图数据 */
- loadAbilityMap: function() {
- var self = this
- getAbilityMap().then(function(res) {
- self.abilityData = (res.code === 200 && Array.isArray(res.data)) ? res.data : []
- }).catch(function(e) {
- console.log('获取能力图数据失败', e)
- self.abilityData = []
- })
- },
- /** 加载章鱼图数据 */
- loadOctopusData: function() {
- var self = this
- getOctopusEffects().then(function(res) {
- self.octopusEffects = (res.code === 200 && res.data) ? res.data : null
- }).catch(function(e) {
- console.log('获取章鱼图数据失败', e)
- self.octopusEffects = null
- })
- getOctopusAnalysisSummary().then(function(res) {
- if (res.code === 200 && res.data && res.data.directions) {
- self.octopusExpansions = res.data.directions
- }
- }).catch(function(e) {
- console.log('获取拓展方向失败', e)
- })
- },
- /** 跳转成效录入页 */
- goOctopusAddEffect: function() {
- uni.navigateTo({ url: '/pages/action-detail/octopus-add-effect' })
- },
- /** 跳转感恩记录维护列表 */
- goOctopusEffectsList: function() {
- uni.navigateTo({ url: '/pages/action-detail/octopus-effects-list' })
- },
- /** 点击成效节点 */
- onEffectClick: function(effect) {
- var self = this
- if (!self.octopusKeyPersons[effect.id]) {
- getOctopusEffectKeyPersons({ effectId: effect.id }).then(function(res) {
- if (res.code === 200) self.$set(self.octopusKeyPersons, effect.id, res.data || [])
- }).catch(function(e) { console.log('获取关键人失败', e) })
- }
- },
- /** 点击拓展方向节点 */
- onExpansionClick: function(expansion) {
- var prefill = encodeURIComponent(JSON.stringify(expansion.prefill || {}))
- uni.navigateTo({ url: '/pages/action-detail/octopus-add-key-person?prefill=' + prefill })
- },
- /** 重新分析 */
- onReanalyze: function() {
- this.loadOctopusData()
- },
- /** 显示帮助弹窗 */
- showHelp: function(title, content) {
- this.helpPopup = { visible: true, title: title, content: content }
- },
- closeHelp: function() {
- this.helpPopup.visible = false
- },
- onTaskClick: function(task) {
- uni.navigateTo({ url: '/pages/tasks/tasks' })
- },
- goActivityDetail: function(act) {
- if (act && act.id) uni.navigateTo({ url: '/pages/activity/activity-detail/activity-detail?id=' + act.id })
- },
- goMoreActivities: function() {
- uni.navigateTo({ url: '/pages/activity/index' })
- },
- goProductDetail: function(prod) {
- if (prod && prod.id) uni.navigateTo({ url: '/pages/discover-detail/product-detail/product-detail?id=' + prod.id })
- },
- goMoreProducts: function() {
- uni.navigateTo({ url: '/pages/shop/index/index' })
- },
- goTasks: function() {
- uni.navigateTo({ url: '/pages/tasks/tasks' })
- },
- _watchPageReady() {
- var self = this
- var unwatch = this.$watch(function() {
- if (self.isLoggedIn) {
- return !!(self.dualDimension || self.sandboxData)
- }
- return true
- }, function(val) {
- if (val) {
- if (unwatch) unwatch()
- if (self.$refs.tabTransition) self.$refs.tabTransition.markReady()
- }
- })
- }
- }
- }
- </script>
- <style scoped>
- .container {
- min-height: 100vh;
- background: #f5f7fa;
- padding-bottom: 120rpx;
- }
- /* 品牌定位语 */
- .brand-strap {
- margin: 16rpx 30rpx 0;
- padding: 20rpx 28rpx;
- background: linear-gradient(135deg, #F0FFF4, rgba(16,185,129,0.12));
- border-radius: 16rpx;
- border-left: 4rpx solid #10B981;
- }
- .brand-strap-text {
- font-size: 26rpx;
- color: #065F46;
- font-weight: 500;
- }
- /* 每月引导语 */
- .monthly-guidance {
- margin: 16rpx 30rpx 0;
- padding: 20rpx 28rpx;
- background: linear-gradient(135deg, #F0FFF4, rgba(16,185,129,0.08));
- border-radius: 16rpx;
- border-left: 4rpx solid #10B981;
- display: flex;
- align-items: center;
- gap: 12rpx;
- }
- .guidance-icon { font-size: 32rpx; }
- .guidance-text {
- font-size: 26rpx;
- color: #065F46;
- font-weight: 500;
- }
- /* ===== 通用区块 ===== */
- .section {
- margin: 20rpx 30rpx 0;
- }
- .section-header {
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: space-between;
- margin-bottom: 16rpx;
- }
- .section-title-wrap {
- display: flex;
- flex-direction: row;
- align-items: center;
- gap: 8rpx;
- }
- .help-icon {
- width: 36rpx;
- height: 36rpx;
- border-radius: 50%;
- border: 2rpx solid #CBD5E1;
- color: #94A3B8;
- font-size: 22rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- flex-shrink: 0;
- transition: all 0.2s;
- }
- .help-icon:active {
- border-color: #F97316;
- color: #F97316;
- background: #FFF7ED;
- }
- .section-title {
- font-size: 32rpx;
- font-weight: bold;
- color: #333;
- }
- .section-sub {
- font-size: 22rpx;
- color: #999;
- }
- .section-link {
- display: inline-flex;
- align-items: center;
- padding: 10rpx 28rpx;
- border-radius: 40rpx;
- font-size: 24rpx;
- font-weight: 500;
- white-space: nowrap;
- transition: opacity 0.2s;
- }
- .section-link:active {
- opacity: 0.7;
- }
- .section-link-octopus {
- background: linear-gradient(135deg, #F97316, #FB923C);
- color: #fff;
- box-shadow: 0 4rpx 16rpx rgba(249,115,22,0.25);
- }
- .section-link-pearl {
- background: linear-gradient(135deg, #0EA5E9, #38BDF8);
- color: #fff;
- box-shadow: 0 4rpx 16rpx rgba(14,165,233,0.25);
- }
- .section-link-ability {
- background: linear-gradient(135deg, #10B981, #34D399);
- color: #fff;
- box-shadow: 0 4rpx 16rpx rgba(16,185,129,0.25);
- }
- /* 帮助说明弹窗 */
- .help-mask {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background: rgba(0, 0, 0, 0.4);
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .help-dialog {
- background: #fff;
- border-radius: 20rpx;
- width: 90%;
- max-width: 500rpx;
- max-height: 80vh;
- overflow: hidden;
- }
- .help-dialog-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 20rpx 24rpx;
- border-bottom: 1rpx solid #E5E7EB;
- }
- .help-dialog-title {
- font-size: 32rpx;
- font-weight: bold;
- color: #333;
- }
- .help-dialog-close {
- font-size: 32rpx;
- color: #94A3B8;
- cursor: pointer;
- }
- .help-dialog-content {
- padding: 24rpx;
- font-size: 26rpx;
- color: #666;
- line-height: 1.6;
- }
- .func-section {
- margin: 20rpx 30rpx 0;
- }
- .func-grid {
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- background: #fff;
- border-radius: 20rpx;
- padding: 24rpx 16rpx;
- box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
- }
- .func-item {
- display: flex;
- flex-direction: column;
- align-items: center;
- flex: 1;
- }
- .func-icon-wrap {
- width: 80rpx;
- height: 80rpx;
- border-radius: 40rpx;
- background: linear-gradient(135deg, #D1FAE5, #ECFDF5);
- display: flex;
- align-items: center;
- justify-content: center;
- margin-bottom: 10rpx;
- }
- .func-icon {
- font-size: 40rpx;
- }
- .func-label {
- font-size: 22rpx;
- color: #666;
- font-weight: 500;
- }
- .bottom-spacer {
- height: 40rpx;
- }
- </style>
|