index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876
  1. <template>
  2. <view class="container">
  3. <!-- Tabbar 切换过渡页 -->
  4. <tab-transition v-if="showTabTransition" dimCode="action" waitingFor="action" />
  5. <!-- 品牌头部 -->
  6. <PageBanner theme="action"
  7. tagline="知行合一 · 快乐成长"
  8. quote="千里之行,始于足下" />
  9. <!-- 游客登录引导卡 -->
  10. <template v-if="!isLoggedIn">
  11. <LoginGuideCard
  12. title="登录后查看任务和活动记录"
  13. :items="[
  14. '查看今日任务,完成打卡获取行动能量',
  15. '报名参加热门活动,记录成长足迹',
  16. '查看专属商品和活动价格'
  17. ]" />
  18. </template>
  19. <!-- 登录后:五维能量条 -->
  20. <FamilyEnergyBar
  21. v-if="isLoggedIn"
  22. dimensionCode="action"
  23. :sandboxData="sandboxData"
  24. :dualDimension="dualDimension" />
  25. <!-- 能量沙盘(登录后可见) — Canvas 五行星图 -->
  26. <WuxingSandbox
  27. v-if="isLoggedIn && sandboxData"
  28. mode="live"
  29. :scores="{
  30. body: sandboxData.bodyScore || 0,
  31. mind: sandboxData.mindScore || 0,
  32. wisdom: sandboxData.wisdomScore || 0,
  33. action: sandboxData.actionScore || 0,
  34. wealth: sandboxData.wealthScore || 0
  35. }"
  36. :overallScore="sandboxData.overallScore || 0"
  37. :members="sandboxData.members || []"
  38. showDimensionBar
  39. starHeight="480rpx" />
  40. <!-- 关系图谱(登录后可见) — 家庭关系网络 -->
  41. <FamilyRelationGraph
  42. v-if="isLoggedIn && familyMembersVisible.length > 0"
  43. dimensionCode="action"
  44. :selfId="activeChildId"
  45. :members="familyMembersVisible"
  46. :energyMap="energyMapForGraph"
  47. :intimacyMap="intimacyMapForGraph"
  48. @memberTap="goMemberDetail" />
  49. <!-- ===== 维度任务/活动/商品 ===== -->
  50. <DimensionTasks
  51. v-if="isLoggedIn"
  52. dimensionCode="action"
  53. :tasks="dimensionTasks"
  54. @taskClick="onTaskClick"
  55. @moreTasks="goTasks" />
  56. <DimensionActivities
  57. dimensionCode="action"
  58. :activities="dimensionActivities"
  59. :isLoggedIn="isLoggedIn"
  60. @activityClick="goActivityDetail"
  61. @moreActivities="goMoreActivities" />
  62. <!-- 商品推荐 -->
  63. <DimensionProductList
  64. v-if="isLoggedIn"
  65. dimensionCode="action"
  66. :familyId="activeChildId"
  67. title="为你推荐" />
  68. <!-- 推荐阅读 -->
  69. <ActionArticleRecommend
  70. :articles="actionArticles"
  71. :isLoggedIn="isLoggedIn"
  72. @articleClick="goArticleDetail"
  73. @moreArticles="goMoreArticles" />
  74. <!-- 珍珠图/圈子(登录后可见) -->
  75. <PearlDiagram
  76. v-if="isLoggedIn"
  77. :circles="myCircles"
  78. :isLoggedIn="isLoggedIn"
  79. @circleClick="onCircleClick"
  80. @discover="goDiscoverCircles" />
  81. <!-- ===== 重要关系维护 + 关系健康概览 ===== -->
  82. <FamilyRelationshipSection
  83. :contactList="contactList"
  84. :healthAlerts="healthAlerts"
  85. :milestones="milestones"
  86. :isLoggedIn="isLoggedIn"
  87. @manage="goFamilyMembers" />
  88. <!-- 功能入口(4个:活动、商品、课程) -->
  89. <view class="func-section" v-if="sectionVisible('func_entries')">
  90. <view class="func-grid">
  91. <view class="func-item" v-for="item in funcList" :key="item.label" @click="onFuncClick(item)">
  92. <view class="func-icon-wrap">
  93. <text class="func-icon">{{ item.icon }}</text>
  94. </view>
  95. <text class="func-label">{{ item.label }}</text>
  96. </view>
  97. </view>
  98. </view>
  99. <!-- 导入联系人弹窗 -->
  100. <ContactImport
  101. :visible="showImportModal"
  102. @close="onCloseImport"
  103. @success="onImportSuccess" />
  104. <!-- 圈子详情弹窗 -->
  105. <CircleDetail
  106. :visible="showCircleDetail"
  107. :circle="selectedCircle"
  108. :isMember="isCircleMember"
  109. @close="showCircleDetail = false"
  110. @join="onCircleJoin"
  111. @leave="onCircleLeave" />
  112. <!-- 底部占位 -->
  113. <view class="bottom-spacer"></view>
  114. </view>
  115. </template>
  116. <script>
  117. import TabTransition from '../../components/tab-transition.vue'
  118. import PageBanner from '../../components/PageBanner.vue'
  119. import LoginGuideCard from '../../components/LoginGuideCard.vue'
  120. import FamilyEnergyBar from '../../components/FamilyEnergyBar.vue'
  121. import DimensionTasks from '../../components/DimensionTasks.vue'
  122. import DimensionActivities from '../../components/DimensionActivities.vue'
  123. import DimensionProducts from '../../components/DimensionProducts.vue'
  124. import ActionArticleRecommend from '../../components/ActionArticleRecommend.vue'
  125. import PearlDiagram from '../../components/PearlDiagram.vue'
  126. import CircleDetail from '../../components/CircleDetail.vue'
  127. import ContactCard from '../../components/ContactCard.vue'
  128. import ContactImport from '../../components/ContactImport.vue'
  129. import FamilyRelationshipSection from '../../components/FamilyRelationshipSection.vue'
  130. import FamilyRelationGraph from '../../components/FamilyRelationGraph.vue'
  131. import WuxingSandbox from '../../components/wuxing-sandbox.vue'
  132. import { getVisibleSections, getEnergyOverview, getFamilyEnergySandbox, getTodayTasksByCategory, getActivityList, getProductsByDomain, getChildren, getContactList, getVisibleFamilyMembers, getFeaturedArticles, getHealthAlerts, getMilestones, getMyCircles, discoverCircles, joinCircle, leaveCircle } from '../../utils/api.js'
  133. export default {
  134. components: { TabTransition, PageBanner, LoginGuideCard, FamilyEnergyBar, DimensionTasks, DimensionActivities, DimensionProducts, ActionArticleRecommend, PearlDiagram, CircleDetail, ContactCard, ContactImport, FamilyRelationGraph, FamilyRelationshipSection, WuxingSandbox },
  135. data() {
  136. return {
  137. showTabTransition: true,
  138. isLoggedIn: false,
  139. role: null,
  140. currentChildId: null,
  141. activeChildId: null,
  142. currentChildName: '',
  143. userName: '',
  144. children: [],
  145. familyMembersVisible: [],
  146. sandboxData: null,
  147. dualDimension: null,
  148. visibleSections: [],
  149. dimensionTasks: [],
  150. dimensionActivities: [],
  151. dimensionProducts: [],
  152. articles: [],
  153. contactList: [],
  154. myCircles: [],
  155. showCircleDetail: false,
  156. selectedCircle: null,
  157. isCircleMember: false,
  158. showImportModal: false,
  159. healthAlerts: [],
  160. milestones: [],
  161. funcList: [
  162. { icon: '\u{1F3CB}', label: '任务', needLogin: true, page: '/pages/tasks/tasks' },
  163. { icon: '\u{1F3C0}', label: '活动', needLogin: false, page: '/pages/discover/index?type=activity' },
  164. { icon: '\u{1F6CD}', label: '商城', needLogin: false, page: '/pages/discover/index?type=product' },
  165. { icon: '\u{1F3EB}', label: '课程', needLogin: false, page: '/pages/discover/index?type=course' }
  166. ]
  167. }
  168. },
  169. computed: {
  170. energyMapForGraph: function() {
  171. var map = {}
  172. if (this.sandboxData && this.sandboxData.members) {
  173. for (var i = 0; i < this.sandboxData.members.length; i++) {
  174. var m = this.sandboxData.members[i]
  175. map[m.memberId || m.id] = {
  176. bodyScore: m.bodyScore || 0,
  177. mindScore: m.mindScore || 0,
  178. actionScore: m.actionScore || 0
  179. }
  180. }
  181. }
  182. return map
  183. },
  184. intimacyMapForGraph: function() {
  185. return {}
  186. },
  187. actionArticles: function() {
  188. if (!this.articles || this.articles.length === 0) return []
  189. var result = []
  190. for (var i = 0; i < this.articles.length; i++) {
  191. var a = this.articles[i]
  192. if (a.relatedDimensions && a.relatedDimensions.indexOf('action') !== -1) {
  193. result.push(a)
  194. }
  195. }
  196. if (result.length === 0) return this.articles.slice(0, 5)
  197. return result.slice(0, 5)
  198. }
  199. },
  200. onShow() {
  201. this.showTabTransition = true
  202. var token = uni.getStorageSync('token')
  203. this.isLoggedIn = !!token
  204. if (this.isLoggedIn) {
  205. this.role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
  206. this.currentChildId = uni.getStorageSync('currentChildId') || null
  207. this.userName = uni.getStorageSync('nickname') || uni.getStorageSync('userName') || '家长'
  208. }
  209. this.loadSectionConfig()
  210. if (this.isLoggedIn) {
  211. var self = this
  212. this.loadChildren().finally(function() {
  213. uni.setStorageSync('actionReadyTime', Date.now())
  214. })
  215. this.loadFamilyMembersVisible()
  216. this.loadRelationshipHealth()
  217. this.loadMyCircles()
  218. }
  219. // 游客也能浏览活动和商品
  220. this.loadDimensionActivities()
  221. this.loadDimensionProducts()
  222. // 游客也能浏览文章
  223. this.loadFeaturedArticles()
  224. this._watchPageReady()
  225. },
  226. methods: {
  227. loadSectionConfig: function() {
  228. var self = this
  229. var baseSections = ['func_entries']
  230. if (!uni.getStorageSync('token')) {
  231. self.visibleSections = baseSections
  232. return
  233. }
  234. var role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || null
  235. getVisibleSections({ pageKey: 'action', role: role }).then(function(res) {
  236. if (res.code === 200 && res.data) {
  237. var keys = res.data.map(function(s) { return s.sectionKey })
  238. var merged = baseSections.slice()
  239. keys.forEach(function(k) { if (merged.indexOf(k) === -1) merged.push(k) })
  240. self.visibleSections = merged
  241. }
  242. }).catch(function() {
  243. self.visibleSections = ['func_entries']
  244. })
  245. },
  246. loadChildren: function() {
  247. var self = this
  248. getChildren().then(function(res) {
  249. if (res.code === 200 && res.data) {
  250. self.children = res.data
  251. var savedChildId = uni.getStorageSync('currentChildId')
  252. var found = false
  253. for (var i = 0; i < self.children.length; i++) {
  254. if (self.children[i].childId === savedChildId) {
  255. self.currentChildId = savedChildId
  256. self.activeChildId = savedChildId
  257. self.currentChildName = self.children[i].name || self.children[i].nickname || '孩子'
  258. found = true
  259. break
  260. }
  261. }
  262. if (!found && self.children.length > 0) {
  263. self.currentChildId = self.children[0].childId
  264. self.activeChildId = self.children[0].childId
  265. self.currentChildName = self.children[0].name || self.children[0].nickname || '孩子'
  266. uni.setStorageSync('currentChildId', self.activeChildId)
  267. }
  268. if (self.currentChildId) {
  269. self.loadDimensionData()
  270. }
  271. self.loadContacts()
  272. }
  273. }).catch(function(e) {
  274. console.log('获取孩子列表失败', e)
  275. })
  276. },
  277. loadDimensionData: function() {
  278. this.loadEnergyData()
  279. this.loadSandboxData()
  280. this.loadDimensionTasks()
  281. this.loadDimensionActivities()
  282. this.loadDimensionProducts()
  283. },
  284. loadEnergyData: function() {
  285. var self = this
  286. if (!this.currentChildId) return
  287. getEnergyOverview(this.currentChildId).then(function(res) {
  288. if (res && res.data) {
  289. var dims = res.data.dimensions
  290. if (dims && dims.length > 0) {
  291. for (var i = 0; i < dims.length; i++) {
  292. if (dims[i].code === 'action') {
  293. self.dualDimension = dims[i]
  294. break
  295. }
  296. }
  297. }
  298. }
  299. }).catch(function(e) {
  300. console.log('获取能量概览失败', e)
  301. })
  302. },
  303. loadSandboxData: function() {
  304. var self = this
  305. getFamilyEnergySandbox().then(function(res) {
  306. if (res && res.data) {
  307. self.sandboxData = res.data
  308. }
  309. }).catch(function() {})
  310. },
  311. loadDimensionTasks: function() {
  312. var self = this
  313. if (!this.currentChildId) return
  314. getTodayTasksByCategory(this.currentChildId, 'action').then(function(res) {
  315. if (res && res.data) {
  316. self.dimensionTasks = Array.isArray(res.data) ? res.data.slice(0, 5) : []
  317. }
  318. }).catch(function() { self.dimensionTasks = [] })
  319. },
  320. loadDimensionActivities: function() {
  321. var self = this
  322. getActivityList({ dimensionCode: 'action', page: 1, size: 3 }).then(function(res) {
  323. if (res && res.data) {
  324. var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
  325. self.dimensionActivities = list.slice(0, 3)
  326. }
  327. }).catch(function() { self.dimensionActivities = [] })
  328. },
  329. loadDimensionProducts: function() {
  330. var self = this
  331. getProductsByDomain('action', 1, 4).then(function(res) {
  332. if (res && res.data) {
  333. var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
  334. self.dimensionProducts = list.slice(0, 4)
  335. }
  336. }).catch(function() { self.dimensionProducts = [] })
  337. },
  338. loadContacts: function() {
  339. var self = this
  340. getContactList({}).then(function(res) {
  341. if (res.code === 200 && res.data) {
  342. self.contactList = Array.isArray(res.data) ? res.data : []
  343. }
  344. }).catch(function(e) {
  345. console.log('获取联系人失败', e)
  346. })
  347. },
  348. onContactClick: function(item) {
  349. uni.navigateTo({ url: '/pages/action-detail/contact-detail?id=' + item.id })
  350. },
  351. onShowImport: function() {
  352. this.showImportModal = true
  353. },
  354. onCloseImport: function() {
  355. this.showImportModal = false
  356. },
  357. onImportSuccess: function() {
  358. this.showImportModal = false
  359. this.loadContacts()
  360. },
  361. onChildChanged: function(child) {
  362. this.currentChildId = child.childId
  363. this.currentChildName = child.name || child.nickname || '孩子'
  364. uni.setStorageSync('currentChildId', child.childId)
  365. this.loadDimensionData()
  366. },
  367. loadFamilyMembersVisible: function() {
  368. var self = this
  369. getVisibleFamilyMembers().then(function(res) {
  370. self.familyMembersVisible = res.data || []
  371. }).catch(function(e) {
  372. console.log('获取可见家庭成员失败', e)
  373. self.familyMembersVisible = []
  374. })
  375. },
  376. scrollToSection: function(section) {
  377. uni.pageScrollTo({ selector: '#' + section, duration: 300 })
  378. },
  379. sectionVisible: function(key) {
  380. return this.visibleSections.length === 0 || this.visibleSections.indexOf(key) !== -1
  381. },
  382. onTaskClick: function(task) {
  383. uni.navigateTo({ url: '/pages/tasks/tasks' })
  384. },
  385. goActivityDetail: function(act) {
  386. if (!act || !act.id) return
  387. uni.navigateTo({ url: '/pages/discover-detail/activity-detail/activity-detail?id=' + act.id })
  388. },
  389. goMoreActivities: function() {
  390. uni.navigateTo({ url: '/pages/activity/index' })
  391. },
  392. goProductDetail: function(prod) {
  393. uni.navigateTo({ url: '/pages/discover-detail/product-detail/product-detail?id=' + prod.id })
  394. },
  395. goMoreProducts: function() {
  396. uni.navigateTo({ url: '/pages/shop/index' })
  397. },
  398. onFuncClick: function(item) {
  399. if (item.needLogin && !this.isLoggedIn) {
  400. uni.showModal({
  401. title: '提示',
  402. content: '请先登录后使用此功能',
  403. success: function(res) { if (res.confirm) uni.navigateTo({ url: '/pages/login/login' }) }
  404. })
  405. return
  406. }
  407. if (item.page) {
  408. var nativeTabs = ['/pages/tasks/tasks', '/pages/index/index', '/pages/body/index', '/pages/mind/index', '/pages/action/index', '/pages/profile/profile']
  409. if (nativeTabs.indexOf(item.page) !== -1) {
  410. uni.switchTab({ url: item.page })
  411. } else {
  412. uni.navigateTo({ url: item.page })
  413. }
  414. }
  415. },
  416. goTasks: function() { uni.switchTab({ url: '/pages/tasks/tasks' }) },
  417. goMemberDetail: function(member) {
  418. if (!member || !member.memberId) return
  419. uni.navigateTo({
  420. url: '/pages/member-detail/member-detail?memberId=' + member.memberId + '&memberType=' + (member.memberType || 'child') + '&entrySource=relation-graph&dimensionCode=action'
  421. })
  422. },
  423. goLogin: function() { uni.navigateTo({ url: '/pages/login/login' }) },
  424. parseRelatedDimensions: function(val) {
  425. if (!val) return []
  426. if (Array.isArray(val)) return val
  427. if (typeof val === 'string') {
  428. try {
  429. var parsed = JSON.parse(val)
  430. return Array.isArray(parsed) ? parsed : []
  431. } catch (e) {
  432. // 逗号分隔格式 fallback: "action,mind"
  433. return val.split(',').map(function(s) { return s.trim() }).filter(function(s) { return s })
  434. }
  435. }
  436. return []
  437. },
  438. loadFeaturedArticles: function() {
  439. var self = this
  440. getFeaturedArticles({ size: 5, dimensionCode: 'action' }).then(function(res) {
  441. if (res.code === 200 && res.data) {
  442. var gradientColors = [
  443. 'linear-gradient(135deg, #10B981, #34D399)',
  444. 'linear-gradient(135deg, #5B9BD5, #8FC5E8)',
  445. 'linear-gradient(135deg, #8B5CF6, #C084FC)',
  446. 'linear-gradient(135deg, #F97316, #FB923C)',
  447. 'linear-gradient(135deg, #6366F1, #818CF8)'
  448. ]
  449. var list = Array.isArray(res.data) ? res.data : (res.data.records || [])
  450. self.articles = list.map(function(item, index) {
  451. return {
  452. id: item.id,
  453. category: item.categoryName || '行动文章',
  454. categoryColor: gradientColors[index % gradientColors.length],
  455. title: item.title || '',
  456. summary: item.summary || '',
  457. views: item.viewCount ? String(item.viewCount) : '0',
  458. likes: '0',
  459. date: item.publishedAt ? item.publishedAt.slice(0, 10) : '',
  460. relatedDimensions: self.parseRelatedDimensions(item.relatedDimensions)
  461. }
  462. })
  463. }
  464. }).catch(function() {})
  465. },
  466. goArticleDetail: function(article) {
  467. var id = article.id || article
  468. uni.navigateTo({ url: '/pages/mind-detail/article-detail?id=' + id })
  469. },
  470. goMoreArticles: function() {
  471. uni.navigateTo({ url: '/pages/article-center/index?dimension=action' })
  472. },
  473. goFamilyMembers: function() {
  474. uni.navigateTo({ url: '/pages/profile/family-members' })
  475. },
  476. loadRelationshipHealth: function() {
  477. var self = this
  478. getHealthAlerts({}).then(function(res) {
  479. if (res.code === 200 && res.data) {
  480. self.healthAlerts = Array.isArray(res.data) ? res.data : []
  481. }
  482. }).catch(function() {
  483. self.healthAlerts = []
  484. })
  485. getMilestones({}, 30).then(function(res) {
  486. if (res.code === 200 && res.data) {
  487. self.milestones = Array.isArray(res.data) ? res.data : []
  488. }
  489. }).catch(function() {
  490. self.milestones = []
  491. })
  492. },
  493. goInteractionLog: function(memberId) {
  494. if (memberId) {
  495. uni.navigateTo({ url: '/pages/action-detail/interaction-log?memberId=' + memberId })
  496. } else {
  497. uni.navigateTo({ url: '/pages/action-detail/interaction-log' })
  498. }
  499. },
  500. goRelationshipQuestionnaire: function() {
  501. uni.navigateTo({ url: '/pages/action-detail/relationship-questionnaire' })
  502. },
  503. _watchPageReady() {
  504. var self = this
  505. var unwatch = this.$watch(function() {
  506. if (self.isLoggedIn) {
  507. return !!(self.dualDimension || self.sandboxData || (self.dimensionTasks && self.dimensionTasks.length > 0))
  508. }
  509. return !!(self.dimensionActivities && self.dimensionActivities.length > 0) ||
  510. !!(self.dimensionProducts && self.dimensionProducts.length > 0)
  511. }, function(val) {
  512. if (val) {
  513. if (unwatch) unwatch()
  514. self.showTabTransition = false
  515. }
  516. })
  517. setTimeout(function() {
  518. if (unwatch) unwatch()
  519. self.showTabTransition = false
  520. }, 5000)
  521. },
  522. loadMyCircles: function() {
  523. var self = this
  524. getMyCircles({}).then(function(res) {
  525. if (res.code === 200 && res.data) {
  526. self.myCircles = res.data
  527. }
  528. }).catch(function() {
  529. self.myCircles = []
  530. })
  531. },
  532. onCircleClick: function(circle) {
  533. this.selectedCircle = circle
  534. this.isCircleMember = true
  535. this.showCircleDetail = true
  536. },
  537. goDiscoverCircles: function() {
  538. var self = this
  539. var childId = this.currentChildId || uni.getStorageSync('currentChildId')
  540. discoverCircles({ childId: childId }).then(function(res) {
  541. if (res.code === 200 && res.data && res.data.length > 0) {
  542. self.myCircles = res.data
  543. }
  544. }).catch(function() {})
  545. },
  546. onCircleJoin: function(circleId) {
  547. var self = this
  548. joinCircle({ circleId: circleId }).then(function(res) {
  549. if (res.code === 200) {
  550. uni.showToast({ title: '加入成功', icon: 'success' })
  551. self.showCircleDetail = false
  552. self.loadMyCircles()
  553. }
  554. }).catch(function() {})
  555. },
  556. onCircleLeave: function(circleId) {
  557. var self = this
  558. uni.showModal({
  559. title: '退出圈子',
  560. content: '确定退出该圈子吗?',
  561. success: function(res) {
  562. if (res.confirm) {
  563. leaveCircle({ circleId: circleId }).then(function(res2) {
  564. if (res2.code === 200) {
  565. uni.showToast({ title: '已退出', icon: 'success' })
  566. self.showCircleDetail = false
  567. self.loadMyCircles()
  568. }
  569. }).catch(function() {})
  570. }
  571. }
  572. })
  573. }
  574. }
  575. }
  576. </script>
  577. <style scoped>
  578. .container {
  579. min-height: 100vh;
  580. background: #f5f7fa;
  581. padding-bottom: 120rpx;
  582. }
  583. /* ===== 功能入口 ===== */
  584. .func-section {
  585. margin: -40rpx 20rpx 0;
  586. position: relative;
  587. z-index: 2;
  588. }
  589. .func-grid {
  590. background: #fff;
  591. border-radius: 24rpx;
  592. padding: 30rpx 16rpx;
  593. display: flex;
  594. box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.06);
  595. }
  596. .func-item {
  597. flex: 1;
  598. display: flex;
  599. flex-direction: column;
  600. align-items: center;
  601. }
  602. .func-item:active {
  603. opacity: 0.7;
  604. }
  605. .func-icon-wrap {
  606. width: 88rpx;
  607. height: 88rpx;
  608. border-radius: 50%;
  609. background: #FFF7ED;
  610. display: flex;
  611. align-items: center;
  612. justify-content: center;
  613. margin-bottom: 10rpx;
  614. }
  615. .func-icon {
  616. font-size: 40rpx;
  617. }
  618. .func-label {
  619. font-size: 24rpx;
  620. color: #333;
  621. font-weight: 500;
  622. }
  623. /* ===== 重要关系 ===== */
  624. .contact-section {
  625. margin: 20rpx 20rpx 0;
  626. }
  627. .contact-header {
  628. display: flex;
  629. justify-content: space-between;
  630. align-items: center;
  631. margin-bottom: 16rpx;
  632. }
  633. .contact-section-title {
  634. font-size: 30rpx;
  635. font-weight: 600;
  636. color: #333;
  637. }
  638. .contact-header-right {
  639. display: flex;
  640. gap: 16rpx;
  641. align-items: center;
  642. }
  643. .contact-more {
  644. font-size: 24rpx;
  645. color: #999;
  646. }
  647. .contact-import-btn {
  648. font-size: 24rpx;
  649. color: #F97316;
  650. font-weight: 500;
  651. }
  652. .contact-scroll {
  653. white-space: nowrap;
  654. overflow: hidden;
  655. }
  656. .contact-scroll-inner {
  657. display: flex;
  658. flex-direction: row;
  659. gap: 16rpx;
  660. padding: 8rpx 0 16rpx;
  661. }
  662. .contact-card-wrap {
  663. flex-shrink: 0;
  664. width: 220rpx;
  665. }
  666. .contact-card-wrap:active {
  667. opacity: 0.8;
  668. }
  669. .contact-add-card {
  670. width: 160rpx;
  671. }
  672. .add-card-inner {
  673. width: 160rpx;
  674. height: 280rpx;
  675. background: #fff;
  676. border-radius: 16rpx;
  677. border: 2rpx dashed #ddd;
  678. display: flex;
  679. flex-direction: column;
  680. align-items: center;
  681. justify-content: center;
  682. gap: 12rpx;
  683. }
  684. .add-card-icon {
  685. font-size: 48rpx;
  686. color: #ccc;
  687. }
  688. .add-card-label {
  689. font-size: 22rpx;
  690. color: #999;
  691. }
  692. .contact-empty {
  693. padding: 40rpx 0;
  694. text-align: center;
  695. }
  696. .contact-empty-text {
  697. font-size: 26rpx;
  698. color: #ccc;
  699. }
  700. /* ===== 关系健康概览 ===== */
  701. .rq-section {
  702. margin: 20rpx 20rpx 0;
  703. }
  704. .rq-header {
  705. display: flex;
  706. justify-content: space-between;
  707. align-items: center;
  708. margin-bottom: 16rpx;
  709. }
  710. .rq-title {
  711. font-size: 30rpx;
  712. font-weight: 600;
  713. color: #333;
  714. }
  715. .rq-more {
  716. font-size: 24rpx;
  717. color: #F97316;
  718. font-weight: 500;
  719. }
  720. /* 健康预警卡片 */
  721. .rq-alerts {
  722. display: flex;
  723. flex-direction: column;
  724. gap: 12rpx;
  725. margin-bottom: 16rpx;
  726. }
  727. .rq-alert-card {
  728. background: #FFF7ED;
  729. border-radius: 16rpx;
  730. padding: 20rpx;
  731. display: flex;
  732. align-items: center;
  733. gap: 16rpx;
  734. border: 1rpx solid #FED7AA;
  735. }
  736. .rq-alert-card:active {
  737. opacity: 0.8;
  738. }
  739. .rq-alert-icon {
  740. width: 64rpx;
  741. height: 64rpx;
  742. border-radius: 50%;
  743. background: #fff;
  744. display: flex;
  745. align-items: center;
  746. justify-content: center;
  747. flex-shrink: 0;
  748. }
  749. .rq-alert-emoji {
  750. font-size: 32rpx;
  751. }
  752. .rq-alert-info {
  753. flex: 1;
  754. display: flex;
  755. flex-direction: column;
  756. gap: 4rpx;
  757. }
  758. .rq-alert-name {
  759. font-size: 28rpx;
  760. font-weight: 600;
  761. color: #333;
  762. }
  763. .rq-alert-desc {
  764. font-size: 24rpx;
  765. color: #F97316;
  766. }
  767. .rq-alert-action {
  768. flex-shrink: 0;
  769. }
  770. .rq-alert-btn {
  771. font-size: 24rpx;
  772. color: #fff;
  773. background: #F97316;
  774. padding: 8rpx 20rpx;
  775. border-radius: 20rpx;
  776. }
  777. /* 里程碑卡片 */
  778. .rq-milestones {
  779. display: flex;
  780. flex-direction: column;
  781. gap: 12rpx;
  782. margin-bottom: 16rpx;
  783. }
  784. .rq-milestone-card {
  785. background: #F0F9FF;
  786. border-radius: 16rpx;
  787. padding: 20rpx;
  788. display: flex;
  789. align-items: center;
  790. gap: 16rpx;
  791. border: 1rpx solid #BAE6FD;
  792. }
  793. .rq-milestone-icon {
  794. width: 64rpx;
  795. height: 64rpx;
  796. border-radius: 50%;
  797. background: #fff;
  798. display: flex;
  799. align-items: center;
  800. justify-content: center;
  801. flex-shrink: 0;
  802. }
  803. .rq-milestone-emoji {
  804. font-size: 32rpx;
  805. }
  806. .rq-milestone-info {
  807. flex: 1;
  808. display: flex;
  809. flex-direction: column;
  810. gap: 4rpx;
  811. }
  812. .rq-milestone-name {
  813. font-size: 28rpx;
  814. font-weight: 600;
  815. color: #333;
  816. }
  817. .rq-milestone-desc {
  818. font-size: 24rpx;
  819. color: #0EA5E9;
  820. }
  821. /* 快捷操作 */
  822. .rq-quick-actions {
  823. display: flex;
  824. gap: 16rpx;
  825. margin-top: 8rpx;
  826. }
  827. .rq-action-btn {
  828. flex: 1;
  829. background: #fff;
  830. border-radius: 16rpx;
  831. padding: 20rpx;
  832. display: flex;
  833. align-items: center;
  834. justify-content: center;
  835. gap: 10rpx;
  836. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  837. }
  838. .rq-action-btn:active {
  839. opacity: 0.8;
  840. }
  841. .rq-action-icon {
  842. font-size: 36rpx;
  843. }
  844. .rq-action-label {
  845. font-size: 26rpx;
  846. color: #333;
  847. font-weight: 500;
  848. }
  849. /* ===== 底部 ===== */
  850. .bottom-spacer {
  851. height: 20rpx;
  852. }
  853. </style>