member-wisdom-detail.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <template>
  2. <view class="detail-container">
  3. <!-- 顶部导航 -->
  4. <!-- 五维能量条 -->
  5. <FamilyEnergyBar
  6. dimensionCode="wisdom"
  7. :sandboxData="sandboxData"
  8. :dualDimension="dualDimension" />
  9. <!-- 成员信息卡 -->
  10. <view class="member-card" v-if="memberInfo">
  11. <view class="member-avatar wisdom-avatar">
  12. <text class="avatar-text">{{ memberInfo.name && memberInfo.name.charAt(0) || '孩' }}</text>
  13. </view>
  14. <view class="member-info">
  15. <text class="member-name">{{ memberInfo.name || '孩子' }}</text>
  16. <text class="member-role">智慧维度</text>
  17. </view>
  18. <view class="member-score" v-if="dualDimension">
  19. <text class="score-value wisdom-score">{{ dualDimension.energy || 0 }}</text>
  20. <text class="score-label">能量值</text>
  21. </view>
  22. </view>
  23. <!-- 家庭成员关系图谱(只读) -->
  24. <FamilyRelationGraph
  25. dimensionCode="wisdom"
  26. :selfId="selfId"
  27. :members="graphMembers"
  28. :energyMap="energyMapForGraph"
  29. :intimacyMap="intimacyMapForGraph"
  30. :interactive="false" />
  31. <!-- 今日任务 -->
  32. <DimensionTasks
  33. :memberId="memberId"
  34. @taskClick="onTaskClick"
  35. @moreTasks="goTasks" />
  36. <!-- 活动 -->
  37. <DimensionActivities
  38. :isLoggedIn="true"
  39. @activityClick="goActivityDetail"
  40. @moreActivities="goMoreActivities" />
  41. <!-- 商品 -->
  42. <DimensionProducts
  43. :isLoggedIn="true"
  44. @productClick="goProductDetail"
  45. @moreProducts="goMoreProducts" />
  46. <!-- 底部占位 -->
  47. <view class="bottom-spacer"></view>
  48. </view>
  49. </template>
  50. <script>
  51. import FamilyEnergyBar from '../../components/FamilyEnergyBar.vue'
  52. import FamilyRelationGraph from '../../components/FamilyRelationGraph.vue'
  53. import DimensionTasks from '../../components/DimensionTasks.vue'
  54. import DimensionActivities from '../../components/DimensionActivities.vue'
  55. import DimensionProducts from '../../components/DimensionProducts.vue'
  56. import { getEnergyOverview, getFamilyEnergySandbox, getChildren } from '../../utils/api.js'
  57. export default {
  58. components: { FamilyEnergyBar, FamilyRelationGraph, DimensionTasks, DimensionActivities, DimensionProducts },
  59. data() {
  60. return {
  61. memberId: null,
  62. selfId: null,
  63. memberInfo: null,
  64. graphMembers: [],
  65. energyMapForGraph: {},
  66. intimacyMapForGraph: {},
  67. dualDimension: null,
  68. sandboxData: null
  69. }
  70. },
  71. onLoad: function(options) {
  72. if (options && options.memberId) {
  73. this.selfId = options.memberId
  74. this.memberId = options.memberId
  75. this.loadMemberData()
  76. }
  77. },
  78. methods: {
  79. goBack: function() {
  80. uni.navigateBack()
  81. },
  82. loadMemberData: function() {
  83. var self = this
  84. var memberId = this.memberId
  85. if (!memberId) return
  86. getEnergyOverview(memberId).then(function(res) {
  87. if (res && res.data) {
  88. self.dualDimension = res.data
  89. }
  90. }).catch(function() {})
  91. getFamilyEnergySandbox(memberId).then(function(res) {
  92. if (res && res.data) {
  93. self.sandboxData = res.data.sandboxData || null
  94. self.graphMembers = res.data.members || []
  95. self.energyMapForGraph = res.data.energyMap || {}
  96. self.intimacyMapForGraph = res.data.intimacyMap || {}
  97. }
  98. }).catch(function() {})
  99. },
  100. onTaskClick: function(task) {},
  101. goTasks: function() { uni.navigateTo({ url: '/pages/tasks/tasks' }) },
  102. goActivityDetail: function(id) {},
  103. goMoreActivities: function() {
  104. uni.navigateTo({ url: '/pages/activity/index' })
  105. },
  106. goProductDetail: function(id) {
  107. var token = uni.getStorageSync('token')
  108. if (token) {
  109. uni.navigateTo({ url: '/pages/discover-detail/product-detail/product-detail?id=' + id })
  110. } else {
  111. uni.navigateTo({ url: '/pages/login/login' })
  112. }
  113. },
  114. goMoreProducts: function() {
  115. uni.navigateTo({ url: '/pages/shop/index/index' })
  116. }
  117. }
  118. }
  119. </script>
  120. <style scoped>
  121. .detail-container {
  122. min-height: 100vh;
  123. background: #f5f7fa;
  124. padding-bottom: 120rpx;
  125. }
  126. .nav-back-icon {
  127. font-size: 36rpx;
  128. color: #fff;
  129. }
  130. .member-card {
  131. display: flex;
  132. flex-direction: row;
  133. align-items: center;
  134. background: #fff;
  135. margin: 20rpx 30rpx;
  136. padding: 30rpx;
  137. border-radius: 20rpx;
  138. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  139. }
  140. .member-avatar {
  141. width: 100rpx;
  142. height: 100rpx;
  143. border-radius: 50%;
  144. display: flex;
  145. align-items: center;
  146. justify-content: center;
  147. margin-right: 24rpx;
  148. }
  149. .wisdom-avatar {
  150. background: linear-gradient(135deg, #FFD700, #FFA500);
  151. }
  152. .avatar-text {
  153. font-size: 40rpx;
  154. font-weight: bold;
  155. color: #fff;
  156. }
  157. .member-info {
  158. flex: 1;
  159. }
  160. .member-name {
  161. font-size: 32rpx;
  162. font-weight: bold;
  163. color: #333;
  164. display: block;
  165. }
  166. .member-role {
  167. font-size: 24rpx;
  168. color: #999;
  169. margin-top: 6rpx;
  170. display: block;
  171. }
  172. .member-score {
  173. text-align: center;
  174. }
  175. .score-value {
  176. font-size: 40rpx;
  177. font-weight: bold;
  178. display: block;
  179. }
  180. .wisdom-score {
  181. color: #B8860B;
  182. }
  183. .score-label {
  184. font-size: 22rpx;
  185. color: #999;
  186. display: block;
  187. }
  188. .bottom-spacer {
  189. height: 40rpx;
  190. }
  191. </style>