FamilyRelationshipSection.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <template>
  2. <view class="family-relationship-wrapper">
  3. <!-- ===== 重要关系维护 ===== -->
  4. <view class="contact-section" v-if="isLoggedIn">
  5. <view class="contact-header">
  6. <text class="contact-section-title">重要关系</text>
  7. <view class="contact-header-right">
  8. <text class="contact-more" @click="$emit('refresh')">刷新</text>
  9. <text class="contact-import-btn" @click="$emit('import')">+ 导入</text>
  10. <text class="contact-manage-btn" @click="$emit('manage')">⚙️</text>
  11. </view>
  12. </view>
  13. <scroll-view class="contact-scroll" scroll-x enable-flex>
  14. <view class="contact-scroll-inner">
  15. <view class="contact-card-wrap" v-for="item in contactList" :key="item.id" @click="$emit('contactClick', item)">
  16. <ContactCard :contact="item" />
  17. </view>
  18. <view class="contact-card-wrap contact-add-card" @click="$emit('import')">
  19. <view class="add-card-inner">
  20. <text class="add-card-icon">+</text>
  21. <text class="add-card-label">导入通讯录</text>
  22. </view>
  23. </view>
  24. </view>
  25. </scroll-view>
  26. <view class="contact-empty" v-if="contactList.length === 0">
  27. <text class="contact-empty-text">暂无重要联系人,点击导入添加</text>
  28. </view>
  29. </view>
  30. <!-- ===== 关系健康概览 ===== -->
  31. <view class="rq-section" v-if="isLoggedIn && (healthAlerts.length > 0 || milestones.length > 0)">
  32. <view class="rq-header">
  33. <text class="rq-title">关系健康</text>
  34. <text class="rq-more" @click="$emit('questionnaire')">去做问卷</text>
  35. </view>
  36. <!-- 健康预警列表 -->
  37. <view class="rq-alerts" v-if="healthAlerts.length > 0">
  38. <view class="rq-alert-card" v-for="alert in healthAlerts" :key="alert.memberId" @click="$emit('interactionLog', alert.memberId)">
  39. <view class="rq-alert-icon">
  40. <text class="rq-alert-emoji">⚠️</text>
  41. </view>
  42. <view class="rq-alert-info">
  43. <text class="rq-alert-name">{{ alert.memberName }}</text>
  44. <text class="rq-alert-desc">已{{ alert.daysSinceInteraction }}天无互动</text>
  45. </view>
  46. <view class="rq-alert-action">
  47. <text class="rq-alert-btn">去互动</text>
  48. </view>
  49. </view>
  50. </view>
  51. <!-- 里程碑列表 -->
  52. <view class="rq-milestones" v-if="milestones.length > 0">
  53. <view class="rq-milestone-card" v-for="m in milestones" :key="m.memberId">
  54. <view class="rq-milestone-icon">
  55. <text class="rq-milestone-emoji">🎂</text>
  56. </view>
  57. <view class="rq-milestone-info">
  58. <text class="rq-milestone-name">{{ m.memberName }}</text>
  59. <text class="rq-milestone-desc">{{ m.daysUntil > 0 ? m.daysUntil + '天后生日' : '今天生日' }}</text>
  60. </view>
  61. </view>
  62. </view>
  63. <!-- 快捷操作 -->
  64. <view class="rq-quick-actions">
  65. <view class="rq-action-btn" @click="$emit('interactionLog')">
  66. <text class="rq-action-icon">📝</text>
  67. <text class="rq-action-label">记录互动</text>
  68. </view>
  69. <view class="rq-action-btn" @click="$emit('questionnaire')">
  70. <text class="rq-action-icon">🤝</text>
  71. <text class="rq-action-label">做关系问卷</text>
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. </template>
  77. <script>
  78. export default {
  79. props: {
  80. contactList: { type: Array, default: function() { return [] } },
  81. healthAlerts: { type: Array, default: function() { return [] } },
  82. milestones: { type: Array, default: function() { return [] } },
  83. isLoggedIn: { type: Boolean, default: false }
  84. }
  85. }
  86. </script>
  87. <style scoped>
  88. /* ===== 重要关系 ===== */
  89. .contact-section {
  90. margin: 20rpx 20rpx 0;
  91. }
  92. .contact-header {
  93. display: flex;
  94. justify-content: space-between;
  95. align-items: center;
  96. margin-bottom: 16rpx;
  97. }
  98. .contact-section-title {
  99. font-size: 30rpx;
  100. font-weight: 600;
  101. color: #333;
  102. }
  103. .contact-header-right {
  104. display: flex;
  105. gap: 16rpx;
  106. align-items: center;
  107. }
  108. .contact-more {
  109. font-size: 24rpx;
  110. color: #999;
  111. }
  112. .contact-import-btn {
  113. font-size: 24rpx;
  114. color: #F97316;
  115. font-weight: 500;
  116. }
  117. .contact-manage-btn {
  118. font-size: 30rpx;
  119. color: #999;
  120. padding: 4rpx;
  121. }
  122. .contact-scroll {
  123. white-space: nowrap;
  124. overflow: hidden;
  125. }
  126. .contact-scroll-inner {
  127. display: flex;
  128. flex-direction: row;
  129. gap: 16rpx;
  130. padding: 8rpx 0 16rpx;
  131. }
  132. .contact-card-wrap {
  133. flex-shrink: 0;
  134. width: 220rpx;
  135. }
  136. .contact-card-wrap:active {
  137. opacity: 0.8;
  138. }
  139. .contact-add-card {
  140. width: 160rpx;
  141. }
  142. .add-card-inner {
  143. width: 160rpx;
  144. height: 280rpx;
  145. background: #fff;
  146. border-radius: 16rpx;
  147. border: 2rpx dashed #ddd;
  148. display: flex;
  149. flex-direction: column;
  150. align-items: center;
  151. justify-content: center;
  152. gap: 12rpx;
  153. }
  154. .add-card-icon {
  155. font-size: 48rpx;
  156. color: #ccc;
  157. }
  158. .add-card-label {
  159. font-size: 22rpx;
  160. color: #999;
  161. }
  162. .contact-empty {
  163. padding: 40rpx 0;
  164. text-align: center;
  165. }
  166. .contact-empty-text {
  167. font-size: 26rpx;
  168. color: #ccc;
  169. }
  170. /* ===== 关系健康概览 ===== */
  171. .rq-section {
  172. margin: 20rpx 20rpx 0;
  173. }
  174. .rq-header {
  175. display: flex;
  176. justify-content: space-between;
  177. align-items: center;
  178. margin-bottom: 16rpx;
  179. }
  180. .rq-title {
  181. font-size: 30rpx;
  182. font-weight: 600;
  183. color: #333;
  184. }
  185. .rq-more {
  186. font-size: 24rpx;
  187. color: #F97316;
  188. font-weight: 500;
  189. }
  190. /* 健康预警卡片 */
  191. .rq-alerts {
  192. display: flex;
  193. flex-direction: column;
  194. gap: 12rpx;
  195. margin-bottom: 16rpx;
  196. }
  197. .rq-alert-card {
  198. background: #FFF7ED;
  199. border-radius: 16rpx;
  200. padding: 20rpx;
  201. display: flex;
  202. align-items: center;
  203. gap: 16rpx;
  204. border: 1rpx solid #FED7AA;
  205. }
  206. .rq-alert-card:active {
  207. opacity: 0.8;
  208. }
  209. .rq-alert-icon {
  210. width: 64rpx;
  211. height: 64rpx;
  212. border-radius: 50%;
  213. background: #fff;
  214. display: flex;
  215. align-items: center;
  216. justify-content: center;
  217. flex-shrink: 0;
  218. }
  219. .rq-alert-emoji {
  220. font-size: 32rpx;
  221. }
  222. .rq-alert-info {
  223. flex: 1;
  224. display: flex;
  225. flex-direction: column;
  226. gap: 4rpx;
  227. }
  228. .rq-alert-name {
  229. font-size: 28rpx;
  230. font-weight: 600;
  231. color: #333;
  232. }
  233. .rq-alert-desc {
  234. font-size: 24rpx;
  235. color: #F97316;
  236. }
  237. .rq-alert-action {
  238. flex-shrink: 0;
  239. }
  240. .rq-alert-btn {
  241. font-size: 24rpx;
  242. color: #fff;
  243. background: #F97316;
  244. padding: 8rpx 20rpx;
  245. border-radius: 20rpx;
  246. }
  247. /* 里程碑卡片 */
  248. .rq-milestones {
  249. display: flex;
  250. flex-direction: column;
  251. gap: 12rpx;
  252. margin-bottom: 16rpx;
  253. }
  254. .rq-milestone-card {
  255. background: #F0F9FF;
  256. border-radius: 16rpx;
  257. padding: 20rpx;
  258. display: flex;
  259. align-items: center;
  260. gap: 16rpx;
  261. border: 1rpx solid #BAE6FD;
  262. }
  263. .rq-milestone-icon {
  264. width: 64rpx;
  265. height: 64rpx;
  266. border-radius: 50%;
  267. background: #fff;
  268. display: flex;
  269. align-items: center;
  270. justify-content: center;
  271. flex-shrink: 0;
  272. }
  273. .rq-milestone-emoji {
  274. font-size: 32rpx;
  275. }
  276. .rq-milestone-info {
  277. flex: 1;
  278. display: flex;
  279. flex-direction: column;
  280. gap: 4rpx;
  281. }
  282. .rq-milestone-name {
  283. font-size: 28rpx;
  284. font-weight: 600;
  285. color: #333;
  286. }
  287. .rq-milestone-desc {
  288. font-size: 24rpx;
  289. color: #0EA5E9;
  290. }
  291. /* 快捷操作 */
  292. .rq-quick-actions {
  293. display: flex;
  294. gap: 16rpx;
  295. margin-top: 8rpx;
  296. }
  297. .rq-action-btn {
  298. flex: 1;
  299. background: #fff;
  300. border-radius: 16rpx;
  301. padding: 20rpx;
  302. display: flex;
  303. align-items: center;
  304. justify-content: center;
  305. gap: 10rpx;
  306. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  307. }
  308. .rq-action-btn:active {
  309. opacity: 0.8;
  310. }
  311. .rq-action-icon {
  312. font-size: 36rpx;
  313. }
  314. .rq-action-label {
  315. font-size: 26rpx;
  316. color: #333;
  317. font-weight: 500;
  318. }
  319. </style>