FamilyRelationshipSection.vue 7.2 KB

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