Explorar o código

feat: 新增家庭关系联系人组件 FamilyRelationshipSection

asus hai 2 meses
pai
achega
a26643b62e
Modificáronse 1 ficheiros con 323 adicións e 0 borrados
  1. 323 0
      cfc-frontend/components/FamilyRelationshipSection.vue

+ 323 - 0
cfc-frontend/components/FamilyRelationshipSection.vue

@@ -0,0 +1,323 @@
+<template>
+  <view class="family-relationship-wrapper">
+    <!-- ===== 重要关系维护 ===== -->
+    <view class="contact-section" v-if="isLoggedIn">
+    <view class="contact-header">
+      <text class="contact-section-title">重要关系</text>
+      <view class="contact-header-right">
+        <text class="contact-more" @click="$emit('refresh')">刷新</text>
+        <text class="contact-import-btn" @click="$emit('import')">+ 导入</text>
+        <text class="contact-manage-btn" @click="$emit('manage')">⚙️</text>
+      </view>
+    </view>
+    <scroll-view class="contact-scroll" scroll-x enable-flex>
+      <view class="contact-scroll-inner">
+        <view class="contact-card-wrap" v-for="item in contactList" :key="item.id" @click="$emit('contactClick', item)">
+          <ContactCard :contact="item" />
+        </view>
+        <view class="contact-card-wrap contact-add-card" @click="$emit('import')">
+          <view class="add-card-inner">
+            <text class="add-card-icon">+</text>
+            <text class="add-card-label">导入通讯录</text>
+          </view>
+        </view>
+      </view>
+    </scroll-view>
+    <view class="contact-empty" v-if="contactList.length === 0">
+      <text class="contact-empty-text">暂无重要联系人,点击导入添加</text>
+    </view>
+  </view>
+
+  <!-- ===== 关系健康概览 ===== -->
+  <view class="rq-section" v-if="isLoggedIn && (healthAlerts.length > 0 || milestones.length > 0)">
+    <view class="rq-header">
+      <text class="rq-title">关系健康</text>
+      <text class="rq-more" @click="$emit('questionnaire')">去做问卷</text>
+    </view>
+    <!-- 健康预警列表 -->
+    <view class="rq-alerts" v-if="healthAlerts.length > 0">
+      <view class="rq-alert-card" v-for="alert in healthAlerts" :key="alert.memberId" @click="$emit('interactionLog', alert.memberId)">
+        <view class="rq-alert-icon">
+          <text class="rq-alert-emoji">⚠️</text>
+        </view>
+        <view class="rq-alert-info">
+          <text class="rq-alert-name">{{ alert.memberName }}</text>
+          <text class="rq-alert-desc">已{{ alert.daysSinceInteraction }}天无互动</text>
+        </view>
+        <view class="rq-alert-action">
+          <text class="rq-alert-btn">去互动</text>
+        </view>
+      </view>
+    </view>
+    <!-- 里程碑列表 -->
+    <view class="rq-milestones" v-if="milestones.length > 0">
+      <view class="rq-milestone-card" v-for="m in milestones" :key="m.memberId">
+        <view class="rq-milestone-icon">
+          <text class="rq-milestone-emoji">🎂</text>
+        </view>
+        <view class="rq-milestone-info">
+          <text class="rq-milestone-name">{{ m.memberName }}</text>
+          <text class="rq-milestone-desc">{{ m.daysUntil > 0 ? m.daysUntil + '天后生日' : '今天生日' }}</text>
+        </view>
+      </view>
+    </view>
+    <!-- 快捷操作 -->
+    <view class="rq-quick-actions">
+      <view class="rq-action-btn" @click="$emit('interactionLog')">
+        <text class="rq-action-icon">📝</text>
+        <text class="rq-action-label">记录互动</text>
+      </view>
+      <view class="rq-action-btn" @click="$emit('questionnaire')">
+        <text class="rq-action-icon">🤝</text>
+        <text class="rq-action-label">做关系问卷</text>
+      </view>
+    </view>
+  </view>
+  </view>
+</template>
+
+<script>
+export default {
+  props: {
+    contactList: { type: Array, default: function() { return [] } },
+    healthAlerts: { type: Array, default: function() { return [] } },
+    milestones: { type: Array, default: function() { return [] } },
+    isLoggedIn: { type: Boolean, default: false }
+  }
+}
+</script>
+
+<style scoped>
+/* ===== 重要关系 ===== */
+.contact-section {
+  margin: 20rpx 20rpx 0;
+}
+.contact-header {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  margin-bottom: 16rpx;
+}
+.contact-section-title {
+  font-size: 30rpx;
+  font-weight: 600;
+  color: #333;
+}
+.contact-header-right {
+  display: flex;
+  gap: 16rpx;
+  align-items: center;
+}
+.contact-more {
+  font-size: 24rpx;
+  color: #999;
+}
+.contact-import-btn {
+  font-size: 24rpx;
+  color: #F97316;
+  font-weight: 500;
+}
+.contact-manage-btn {
+  font-size: 30rpx;
+  color: #999;
+  padding: 4rpx;
+}
+.contact-scroll {
+  white-space: nowrap;
+  overflow: hidden;
+}
+.contact-scroll-inner {
+  display: flex;
+  flex-direction: row;
+  gap: 16rpx;
+  padding: 8rpx 0 16rpx;
+}
+.contact-card-wrap {
+  flex-shrink: 0;
+  width: 220rpx;
+}
+.contact-card-wrap:active {
+  opacity: 0.8;
+}
+.contact-add-card {
+  width: 160rpx;
+}
+.add-card-inner {
+  width: 160rpx;
+  height: 280rpx;
+  background: #fff;
+  border-radius: 16rpx;
+  border: 2rpx dashed #ddd;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+  gap: 12rpx;
+}
+.add-card-icon {
+  font-size: 48rpx;
+  color: #ccc;
+}
+.add-card-label {
+  font-size: 22rpx;
+  color: #999;
+}
+.contact-empty {
+  padding: 40rpx 0;
+  text-align: center;
+}
+.contact-empty-text {
+  font-size: 26rpx;
+  color: #ccc;
+}
+
+/* ===== 关系健康概览 ===== */
+.rq-section {
+  margin: 20rpx 20rpx 0;
+}
+.rq-header {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  margin-bottom: 16rpx;
+}
+.rq-title {
+  font-size: 30rpx;
+  font-weight: 600;
+  color: #333;
+}
+.rq-more {
+  font-size: 24rpx;
+  color: #F97316;
+  font-weight: 500;
+}
+/* 健康预警卡片 */
+.rq-alerts {
+  display: flex;
+  flex-direction: column;
+  gap: 12rpx;
+  margin-bottom: 16rpx;
+}
+.rq-alert-card {
+  background: #FFF7ED;
+  border-radius: 16rpx;
+  padding: 20rpx;
+  display: flex;
+  align-items: center;
+  gap: 16rpx;
+  border: 1rpx solid #FED7AA;
+}
+.rq-alert-card:active {
+  opacity: 0.8;
+}
+.rq-alert-icon {
+  width: 64rpx;
+  height: 64rpx;
+  border-radius: 50%;
+  background: #fff;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  flex-shrink: 0;
+}
+.rq-alert-emoji {
+  font-size: 32rpx;
+}
+.rq-alert-info {
+  flex: 1;
+  display: flex;
+  flex-direction: column;
+  gap: 4rpx;
+}
+.rq-alert-name {
+  font-size: 28rpx;
+  font-weight: 600;
+  color: #333;
+}
+.rq-alert-desc {
+  font-size: 24rpx;
+  color: #F97316;
+}
+.rq-alert-action {
+  flex-shrink: 0;
+}
+.rq-alert-btn {
+  font-size: 24rpx;
+  color: #fff;
+  background: #F97316;
+  padding: 8rpx 20rpx;
+  border-radius: 20rpx;
+}
+/* 里程碑卡片 */
+.rq-milestones {
+  display: flex;
+  flex-direction: column;
+  gap: 12rpx;
+  margin-bottom: 16rpx;
+}
+.rq-milestone-card {
+  background: #F0F9FF;
+  border-radius: 16rpx;
+  padding: 20rpx;
+  display: flex;
+  align-items: center;
+  gap: 16rpx;
+  border: 1rpx solid #BAE6FD;
+}
+.rq-milestone-icon {
+  width: 64rpx;
+  height: 64rpx;
+  border-radius: 50%;
+  background: #fff;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  flex-shrink: 0;
+}
+.rq-milestone-emoji {
+  font-size: 32rpx;
+}
+.rq-milestone-info {
+  flex: 1;
+  display: flex;
+  flex-direction: column;
+  gap: 4rpx;
+}
+.rq-milestone-name {
+  font-size: 28rpx;
+  font-weight: 600;
+  color: #333;
+}
+.rq-milestone-desc {
+  font-size: 24rpx;
+  color: #0EA5E9;
+}
+/* 快捷操作 */
+.rq-quick-actions {
+  display: flex;
+  gap: 16rpx;
+  margin-top: 8rpx;
+}
+.rq-action-btn {
+  flex: 1;
+  background: #fff;
+  border-radius: 16rpx;
+  padding: 20rpx;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  gap: 10rpx;
+  box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
+}
+.rq-action-btn:active {
+  opacity: 0.8;
+}
+.rq-action-icon {
+  font-size: 36rpx;
+}
+.rq-action-label {
+  font-size: 26rpx;
+  color: #333;
+  font-weight: 500;
+}
+</style>