提交 6ad6286d authored 作者: 徐先红's avatar 徐先红

合并分支 'xxh-dev' 到 'master'

人物页面接口 查看合并请求 !65
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
<script setup> <script setup>
import { ref, onMounted, onBeforeUnmount, watch } from "vue"; import { ref, onMounted, onBeforeUnmount, watch } from "vue";
import * as echarts from "echarts"; import * as echarts from "echarts";
import {getCharacterGlobalInfo, getCharacterRelation } from "@/api/characterPage/characterPage.js";
import Center from "./assets/img1.png"; import Center from "./assets/img1.png";
import P1 from "./assets/img2.png"; import P1 from "./assets/img2.png";
import P2 from "./assets/img3.png"; import P2 from "./assets/img3.png";
...@@ -35,8 +36,10 @@ import P10 from "./assets/img11.png"; ...@@ -35,8 +36,10 @@ import P10 from "./assets/img11.png";
import P11 from "./assets/img12.png"; import P11 from "./assets/img12.png";
import PS from "./assets/img13.png"; import PS from "./assets/img13.png";
const list = ref(["圆形布局", "力导向布局", "树形布局"]); // 人物全局信息
const activeIndex = ref("圆形布局"); const characterInfo = ref({});
// 人物关系
const CharacterRelation = ref({});
const nodes = [ const nodes = [
{ {
...@@ -75,6 +78,98 @@ const nodes = [ ...@@ -75,6 +78,98 @@ const nodes = [
{ id: "n3", name: "格温・肖特韦尔", category: 1, symbolSize: 80, symbol: `image://${P3}`, r: 80 } { id: "n3", name: "格温・肖特韦尔", category: 1, symbolSize: 80, symbol: `image://${P3}`, r: 80 }
]; ];
const getCharacterGlobalInfoFn = async () => {
const params = {
personId: window.sessionStorage.getItem("personId") || "Y000064"
};
try{
const res = await getCharacterGlobalInfo(params);
if (res.code === 200) {
console.log("人物全局信息", res);
if (res.data) {
characterInfo.value = res.data;
}
}
const res1 = await getCharacterRelation(params);
if (res1.code === 200) {
console.log("人物关系", res1);
if (res1.data) {
CharacterRelation.value = res1.data;
}
}
nodes = [
{
id: "c",
name: characterInfo.value.name,
category: 0,
symbolSize: 80,
symbol: `image://${characterInfo.value.imageUrl}`,
label: {
show: true,
position: "bottom",
formatter: "{n|埃隆·马斯克}",
rich: {
n: {
color: "rgba(5,95,194,1)",
fontSize: 24,
fontWeight: 700,
fontFamily: "Microsoft YaHei",
lineHeight: 36
}
}
}
},
// 从三点钟方向顺时针排序
{ id: "n11", name: "贾斯汀・马斯克", category: 1, symbolSize: 80, symbol: `image://${P11}` },
{ id: "n7", name: "杰弗里·凯斯勒", category: 1, symbolSize: 80, symbol: `image://${P7}`, r: 80 },
{ id: "n6", name: "斯科特·贝森特", category: 1, symbolSize: 80, symbol: `image://${P6}` },
{ id: "n9", name: "道格·伯格姆", category: 1, symbolSize: 80, symbol: `image://${P9}` },
{ id: "n12", name: "史蒂夫・尤尔韦松", category: 1, symbolSize: 80, symbol: `image://${PS}` },
{ id: "n5", name: "拉里・埃里森", category: 1, symbolSize: 80, symbol: `image://${P5}`, r: 80 },
{ id: "n8", name: "马尔科·卢比奥", category: 1, symbolSize: 80, symbol: `image://${P8}` },
{ id: "n10", name: "艾拉・埃伦普里斯", category: 1, symbolSize: 80, symbol: `image://${P10}`, r: 80 },
{ id: "n2", name: "詹姆斯・默多克", category: 1, symbolSize: 80, symbol: `image://${P2}` },
{ id: "n1", name: "唐纳德・特朗普", category: 1, symbolSize: 80, symbol: `image://${P1}` },
{ id: "n4", name: "金博尔・马斯克", category: 1, symbolSize: 80, symbol: `image://${P4}` },
{ id: "n3", name: "格温・肖特韦尔", category: 1, symbolSize: 80, symbol: `image://${P3}`, r: 80 }
];
}catch(error){
}
};
const getCharacterRelationFn = async () => {
const params = {
personId: window.sessionStorage.getItem("personId") || "Y000064"
};
try{
const res = await getCharacterRelation(params);
if (res.code === 200) {
console.log("人物关系", res);
if (res.data) {
CharacterRelation.value = res.data;
}
}
}catch(error){
}
};
onMounted(() => {
getCharacterRelationFn();
getCharacterGlobalInfoFn();
});
const list = ref(["圆形布局", "力导向布局", "树形布局"]);
const activeIndex = ref("圆形布局");
const links = [ const links = [
{ source: "n11", target: "c", label: { show: true, formatter: "第一任妻子" } }, { source: "n11", target: "c", label: { show: true, formatter: "第一任妻子" } },
{ source: "n7", target: "c", label: { show: true, formatter: "风险投资家" } }, { source: "n7", target: "c", label: { show: true, formatter: "风险投资家" } },
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<!-- 主要内容 --> <!-- 主要内容 -->
<div class="main"> <div class="main">
<!-- 科技领袖 --> <!-- 科技领袖 -->
<tech-leader v-if="type == 1" /> <tech-leader v-if="type == 1"/>
<!-- 国会议员 --> <!-- 国会议员 -->
<member-of-congress v-if="type == 2" /> <member-of-congress v-if="type == 2" />
<!-- 智库研究人员 --> <!-- 智库研究人员 -->
...@@ -23,6 +23,8 @@ import ThinkTankPerson from './components/thinkTankPerson/index.vue'; ...@@ -23,6 +23,8 @@ import ThinkTankPerson from './components/thinkTankPerson/index.vue';
// 获取路由参数,1为科技领袖,2为国会议员,3为智库研究人员 // 获取路由参数,1为科技领袖,2为国会议员,3为智库研究人员
const route = useRoute(); const route = useRoute();
const type = ref(route.query.type || 1); const type = ref(route.query.type || 1);
</script> </script>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论