<!-- SpeechStance.vue -->
<template>
  <div class="speech-stance-container">
    <div class="speech-stance-grid">
      <div v-for="(item, index) in PersonRelation" :key="index" class="speech-stance-card">
        <div class="speech-stance-avatar-wrapper">
          <img :src="item.personImage" alt="" class="speech-stance-avatar" />
        </div>
        <div class="speech-stance-text-content">
          <div style="display: flex;      width: 683px;">
            <h3 class="speech-stance-name">{{ item.personName }}</h3>
            <p class="speech-stance-title">{{ item.positionTitle }}</p>
          </div>

          <p class="speech-stance-content">{{ item.remarks }}</p>
        </div>
       
      </div>
    </div>
  </div>
</template>

<script setup>
// 导入数据
import { onMounted, ref,defineProps,watch } from "vue";
import speechStance from '../json/speechStance.json';
import {getPersonRelation} from "@/api/technologyFigures/technologyFigures"

const props = defineProps({
  fieldSelected: {
    type: String,
    default: "全部领域"
    },
    areaId: {
      type: String,
      default: 0
    }
});

const aId = ref();
const params = ref({});

watch(() => props.fieldSelected, (val) => {
  
  aId.value = props.areaId;
  if(val !== "全部领域"){
    params.value.industryId = aId.value;
  }else{
    params.value = {};
  }
  handlegetPersonRelationFn();
})


// 获取重要人物言论及立场
const PersonRelation = ref([]); 
const handlegetPersonRelationFn = async () => {
	
	try {
		const res = await getPersonRelation(params.value);
		console.log("重要人物言论及立场", res);
		if (res.code === 200) {
			PersonRelation.value = res.data;
		}
	} catch (error) {}
};

onMounted(async () => {
	handlegetPersonRelationFn();
});

</script>

<style scoped>
.speech-stance-container {
  width: 1530px;
  /* max-width: 900px; */
  margin: 0 auto;
  margin: 5px 35px;
}

.speech-stance-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 30px 9px;
}

/* 响应式：小屏变一列 */
@media (max-width: 768px) {
  .speech-stance-grid {
    grid-template-columns: 1fr;
  }
}

.speech-stance-card {
  /* 容器 553 */
  width: 768px;
  height: 50px;
  display: flex;
}

.speech-stance-avatar-wrapper {
  flex-shrink: 0;
}

.speech-stance-avatar {
  /* 椭圆 141 */
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.speech-stance-text-content {
  width: 656px;
  flex: 1;
  margin-left: 13px;

}

.speech-stance-name {
  color: rgba(34, 41, 52, 1);
  margin: 0;
  font-family: Microsoft YaHei;
  font-size: 18px;
  font-weight: 700;
  line-height: 24px;
  letter-spacing: 0px;
  text-align: left;
}

.speech-stance-title {
  color: rgba(95, 101, 108, 1);
  margin: 0;
  margin-left: 12px;
  font-family: Microsoft YaHei;
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  letter-spacing: 0px;
  text-align: left;
}

.speech-stance-content {
  color: rgba(95, 101, 108, 1);
  margin: 0;
  font-family: Microsoft YaHei;
  font-size: 16px;
  font-weight: 400;
  line-height: 30px;
  letter-spacing: 0px;
  text-align: left;
  white-space: nowrap;
  /* 禁止换行 */
  overflow: hidden;
  /* 隐藏溢出内容 */
  text-overflow: ellipsis;
  /* 溢出部分显示省略号 */
}
</style>