FamilyRelationshipSection.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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. </template>
  75. <script>
  76. export default {
  77. props: {
  78. contactList: { type: Array, default: function() { return [] } },
  79. healthAlerts: { type: Array, default: function() { return [] } },
  80. milestones: { type: Array, default: function() { return [] } },
  81. isLoggedIn: { type: Boolean, default: false }
  82. }
  83. }
  84. </script>
  85. <style scoped>
  86. /* ===== 重要关系 ===== */
  87. .contact-section {
  88. margin: 20rpx 20rpx 0;
  89. }
  90. .contact-header {
  91. display: flex;
  92. justify-content: space-between;
  93. align-items: center;
  94. margin-bottom: 16rpx;
  95. }
  96. .contact-section-title {
  97. font-size: 30rpx;
  98. font-weight: 600;
  99. color: #333;
  100. }
  101. .contact-header-right {
  102. display: flex;
  103. gap: 16rpx;
  104. align-items: center;
  105. }
  106. .contact-more {
  107. font-size: 24rpx;
  108. color: #999;
  109. }
  110. .contact-import-btn {
  111. font-size: 24rpx;
  112. color: #F97316;
  113. font-weight: 500;
  114. }
  115. .contact-scroll {
  116. white-space: nowrap;
  117. overflow: hidden;
  118. }
  119. .contact-scroll-inner {
  120. display: flex;
  121. flex-direction: row;
  122. gap: 16rpx;
  123. padding: 8rpx 0 16rpx;
  124. }
  125. .contact-card-wrap {
  126. flex-shrink: 0;
  127. width: 220rpx;
  128. }
  129. .contact-card-wrap:active {
  130. opacity: 0.8;
  131. }
  132. .contact-add-card {
  133. width: 160rpx;
  134. }
  135. .add-card-inner {
  136. width: 160rpx;
  137. height: 280rpx;
  138. background: #fff;
  139. border-radius: 16rpx;
  140. border: 2rpx dashed #ddd;
  141. display: flex;
  142. flex-direction: column;
  143. align-items: center;
  144. justify-content: center;
  145. gap: 12rpx;
  146. }
  147. .add-card-icon {
  148. font-size: 48rpx;
  149. color: #ccc;
  150. }
  151. .add-card-label {
  152. font-size: 22rpx;
  153. color: #999;
  154. }
  155. .contact-empty {
  156. padding: 40rpx 0;
  157. text-align: center;
  158. }
  159. .contact-empty-text {
  160. font-size: 26rpx;
  161. color: #ccc;
  162. }
  163. /* ===== 关系健康概览 ===== */
  164. .rq-section {
  165. margin: 20rpx 20rpx 0;
  166. }
  167. .rq-header {
  168. display: flex;
  169. justify-content: space-between;
  170. align-items: center;
  171. margin-bottom: 16rpx;
  172. }
  173. .rq-title {
  174. font-size: 30rpx;
  175. font-weight: 600;
  176. color: #333;
  177. }
  178. .rq-more {
  179. font-size: 24rpx;
  180. color: #F97316;
  181. font-weight: 500;
  182. }
  183. /* 健康预警卡片 */
  184. .rq-alerts {
  185. display: flex;
  186. flex-direction: column;
  187. gap: 12rpx;
  188. margin-bottom: 16rpx;
  189. }
  190. .rq-alert-card {
  191. background: #FFF7ED;
  192. border-radius: 16rpx;
  193. padding: 20rpx;
  194. display: flex;
  195. align-items: center;
  196. gap: 16rpx;
  197. border: 1rpx solid #FED7AA;
  198. }
  199. .rq-alert-card:active {
  200. opacity: 0.8;
  201. }
  202. .rq-alert-icon {
  203. width: 64rpx;
  204. height: 64rpx;
  205. border-radius: 50%;
  206. background: #fff;
  207. display: flex;
  208. align-items: center;
  209. justify-content: center;
  210. flex-shrink: 0;
  211. }
  212. .rq-alert-emoji {
  213. font-size: 32rpx;
  214. }
  215. .rq-alert-info {
  216. flex: 1;
  217. display: flex;
  218. flex-direction: column;
  219. gap: 4rpx;
  220. }
  221. .rq-alert-name {
  222. font-size: 28rpx;
  223. font-weight: 600;
  224. color: #333;
  225. }
  226. .rq-alert-desc {
  227. font-size: 24rpx;
  228. color: #F97316;
  229. }
  230. .rq-alert-action {
  231. flex-shrink: 0;
  232. }
  233. .rq-alert-btn {
  234. font-size: 24rpx;
  235. color: #fff;
  236. background: #F97316;
  237. padding: 8rpx 20rpx;
  238. border-radius: 20rpx;
  239. }
  240. /* 里程碑卡片 */
  241. .rq-milestones {
  242. display: flex;
  243. flex-direction: column;
  244. gap: 12rpx;
  245. margin-bottom: 16rpx;
  246. }
  247. .rq-milestone-card {
  248. background: #F0F9FF;
  249. border-radius: 16rpx;
  250. padding: 20rpx;
  251. display: flex;
  252. align-items: center;
  253. gap: 16rpx;
  254. border: 1rpx solid #BAE6FD;
  255. }
  256. .rq-milestone-icon {
  257. width: 64rpx;
  258. height: 64rpx;
  259. border-radius: 50%;
  260. background: #fff;
  261. display: flex;
  262. align-items: center;
  263. justify-content: center;
  264. flex-shrink: 0;
  265. }
  266. .rq-milestone-emoji {
  267. font-size: 32rpx;
  268. }
  269. .rq-milestone-info {
  270. flex: 1;
  271. display: flex;
  272. flex-direction: column;
  273. gap: 4rpx;
  274. }
  275. .rq-milestone-name {
  276. font-size: 28rpx;
  277. font-weight: 600;
  278. color: #333;
  279. }
  280. .rq-milestone-desc {
  281. font-size: 24rpx;
  282. color: #0EA5E9;
  283. }
  284. /* 快捷操作 */
  285. .rq-quick-actions {
  286. display: flex;
  287. gap: 16rpx;
  288. margin-top: 8rpx;
  289. }
  290. .rq-action-btn {
  291. flex: 1;
  292. background: #fff;
  293. border-radius: 16rpx;
  294. padding: 20rpx;
  295. display: flex;
  296. align-items: center;
  297. justify-content: center;
  298. gap: 10rpx;
  299. box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
  300. }
  301. .rq-action-btn:active {
  302. opacity: 0.8;
  303. }
  304. .rq-action-icon {
  305. font-size: 36rpx;
  306. }
  307. .rq-action-label {
  308. font-size: 26rpx;
  309. color: #333;
  310. font-weight: 500;
  311. }
  312. </style>