member-wisdom-detail.vue 6.8 KB

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