| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282 |
- <template>
- <view class="detail-container">
- <!-- 顶部导航 -->
- <view class="nav-bar">
- <view class="nav-back" @click="goBack">
- <text class="nav-back-icon">←</text>
- </view>
- <text class="nav-title">智 · 成员详情</text>
- </view>
- <view v-if="hasFamily">
- <!-- 五维能量条 -->
- <FamilyEnergyBar
- dimensionCode="wisdom"
- :sandboxData="sandboxData"
- :dualDimension="dualDimension" />
- <!-- 成员信息卡 -->
- <view class="member-card" v-if="memberInfo">
- <view class="member-avatar wisdom-avatar">
- <text class="avatar-text">{{ memberInfo.name && memberInfo.name.charAt(0) || '孩' }}</text>
- </view>
- <view class="member-info">
- <text class="member-name">{{ memberInfo.name || '孩子' }}</text>
- <text class="member-role">智慧维度</text>
- </view>
- <view class="member-score" v-if="dualDimension">
- <text class="score-value wisdom-score">{{ dualDimension.energy || 0 }}</text>
- <text class="score-label">能量值</text>
- </view>
- </view>
- <!-- 家庭成员关系图谱(只读) -->
- <FamilyRelationGraph
- dimensionCode="wisdom"
- :selfId="selfId"
- :members="graphMembers"
- :energyMap="energyMapForGraph"
- :intimacyMap="intimacyMapForGraph"
- :interactive="false" />
- <!-- 今日任务 -->
- <DimensionTasks
- dimensionCode="wisdom"
- :tasks="dimensionTasks"
- @taskClick="onTaskClick"
- @moreTasks="goTasks" />
- <!-- 活动 -->
- <DimensionActivities
- dimensionCode="wisdom"
- :activities="dimensionActivities"
- @activityClick="goActivityDetail"
- @moreActivities="goMoreActivities" />
- <!-- 商品 -->
- <DimensionProducts
- dimensionCode="wisdom"
- :products="dimensionProducts"
- @productClick="goProductDetail"
- @moreProducts="goMoreProducts" />
- </view>
- <view v-else>
- <FamilyEmptyState type="card" />
- </view>
- <!-- 底部占位 -->
- <view class="bottom-spacer"></view>
- </view>
- </template>
- <script>
- import FamilyEnergyBar from '../../components/FamilyEnergyBar.vue'
- import FamilyRelationGraph from '../../components/FamilyRelationGraph.vue'
- import DimensionTasks from '../../components/DimensionTasks.vue'
- import DimensionActivities from '../../components/DimensionActivities.vue'
- import DimensionProducts from '../../components/DimensionProducts.vue'
- import { getEnergyOverview, getFamilyEnergySandbox, getTodayTasksByCategory, getActivityList, getProductsByDomain, getChildren } from '../../utils/api.js'
- export default {
- components: { FamilyEnergyBar, FamilyRelationGraph, DimensionTasks, DimensionActivities, DimensionProducts },
- data() {
- return {
- memberId: null,
- selfId: null,
- memberInfo: null,
- graphMembers: [],
- energyMapForGraph: {},
- intimacyMapForGraph: {},
- dimensionTasks: [],
- dimensionActivities: [],
- dimensionProducts: [],
- dualDimension: null,
- sandboxData: null
- }
- },
- computed: {
- hasFamily: function() {
- return this.$store.getters.hasFamily
- }
- },
- onLoad: function(options) {
- if (options && options.memberId) {
- this.selfId = options.memberId
- this.memberId = options.memberId
- this.loadMemberData()
- }
- },
- methods: {
- goBack: function() {
- uni.navigateBack()
- },
- loadMemberData: function() {
- var self = this
- var memberId = this.memberId
- if (!memberId) return
- getEnergyOverview(memberId).then(function(res) {
- if (res && res.data) {
- self.dualDimension = res.data
- }
- }).catch(function() {})
- getFamilyEnergySandbox(memberId).then(function(res) {
- if (res && res.data) {
- self.sandboxData = res.data.sandboxData || null
- self.graphMembers = res.data.members || []
- self.energyMapForGraph = res.data.energyMap || {}
- self.intimacyMapForGraph = res.data.intimacyMap || {}
- }
- }).catch(function() {})
- getTodayTasksByCategory({ memberId: memberId, dimension: 'wisdom' }).then(function(res) {
- if (res && res.data) {
- self.dimensionTasks = res.data.slice(0, 5)
- }
- }).catch(function() {})
- getActivityList({ dimension: 'wisdom', page: 1, size: 5 }).then(function(res) {
- if (res && res.data) {
- self.dimensionActivities = res.data.records || res.data
- }
- }).catch(function() {})
- getProductsByDomain({ domain: 'wisdom', page: 1, size: 4 }).then(function(res) {
- if (res && res.data) {
- self.dimensionProducts = res.data.records || res.data
- }
- }).catch(function() {})
- },
- onTaskClick: function(task) {},
- goTasks: function() { uni.navigateTo({ url: '/pages/tasks/tasks' }) },
- goActivityDetail: function(id) {},
- goMoreActivities: function() {
- uni.navigateTo({ url: '/pages/activity/index' })
- },
- goProductDetail: function(id) {
- var token = uni.getStorageSync('token')
- if (token) {
- uni.navigateTo({ url: '/pages/discover-detail/product-detail/product-detail?id=' + id })
- } else {
- uni.navigateTo({ url: '/pages/login/login' })
- }
- },
- goMoreProducts: function() {
- uni.navigateTo({ url: '/pages/shop/index/index' })
- }
- }
- }
- </script>
- <style scoped>
- .detail-container {
- min-height: 100vh;
- background: #f5f7fa;
- padding-bottom: 120rpx;
- }
- .nav-bar {
- display: flex;
- flex-direction: row;
- align-items: center;
- padding: 80rpx 30rpx 20rpx;
- background: linear-gradient(135deg, #FFD700, #FFA500);
- }
- .nav-back {
- width: 60rpx;
- height: 60rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .nav-back-icon {
- font-size: 36rpx;
- color: #fff;
- }
- .nav-title {
- flex: 1;
- text-align: center;
- font-size: 34rpx;
- font-weight: bold;
- color: #fff;
- margin-right: 60rpx;
- }
- .member-card {
- display: flex;
- flex-direction: row;
- align-items: center;
- background: #fff;
- margin: 20rpx 30rpx;
- padding: 30rpx;
- border-radius: 20rpx;
- box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
- }
- .member-avatar {
- width: 100rpx;
- height: 100rpx;
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- margin-right: 24rpx;
- }
- .wisdom-avatar {
- background: linear-gradient(135deg, #FFD700, #FFA500);
- }
- .avatar-text {
- font-size: 40rpx;
- font-weight: bold;
- color: #fff;
- }
- .member-info {
- flex: 1;
- }
- .member-name {
- font-size: 32rpx;
- font-weight: bold;
- color: #333;
- display: block;
- }
- .member-role {
- font-size: 24rpx;
- color: #999;
- margin-top: 6rpx;
- display: block;
- }
- .member-score {
- text-align: center;
- }
- .score-value {
- font-size: 40rpx;
- font-weight: bold;
- display: block;
- }
- .wisdom-score {
- color: #B8860B;
- }
- .score-label {
- font-size: 22rpx;
- color: #999;
- display: block;
- }
- .bottom-spacer {
- height: 40rpx;
- }
- </style>
|