提交 672ee8d7 authored 作者: 张烨's avatar 张烨

政令概览-替换词云图组件

上级 8980f929
...@@ -269,7 +269,9 @@ ...@@ -269,7 +269,9 @@
</div> </div>
<div class="header-title">{{ "政令重点条款" }}</div> <div class="header-title">{{ "政令重点条款" }}</div>
</div> </div>
<div class="box8-main" id="wordCloudChart"></div> <div class="box8-content" v-if="wordCloudData?.length">
<WordCloudChart :data="wordCloudData" width="100%" height="100%" />
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -427,9 +429,9 @@ ...@@ -427,9 +429,9 @@
</template> </template>
<script setup> <script setup>
import NewsList from "@/components/base/NewsList/index.vue";
import { onMounted, ref, watch, nextTick } from "vue"; import { onMounted, ref, watch, nextTick } from "vue";
import router from "@/router"; import router from "@/router";
import WordCloudChart from "@/components/base/WordCloundChart/index.vue"
import { import {
getDepartmentList, getDepartmentList,
getLatestDecree, getLatestDecree,
...@@ -448,7 +450,6 @@ import DivideHeader from "@/components/DivideHeader.vue"; ...@@ -448,7 +450,6 @@ import DivideHeader from "@/components/DivideHeader.vue";
import { useContainerScroll } from "@/hooks/useScrollShow"; import { useContainerScroll } from "@/hooks/useScrollShow";
import getBarChart from "./utils/barChart"; import getBarChart from "./utils/barChart";
import getPieChart from "./utils/piechart"; import getPieChart from "./utils/piechart";
import getWordCloudChart from "./utils/wordCloudChart";
import setChart from "@/utils/setChart"; import setChart from "@/utils/setChart";
...@@ -935,38 +936,17 @@ const handleGetKeyDecree = async () => { ...@@ -935,38 +936,17 @@ const handleGetKeyDecree = async () => {
handleGetKeyDecree(); handleGetKeyDecree();
// 政令重点条款 // 政令重点条款
const wordCloudData = [ const wordCloudData = ref([]);
// { name: "与马斯克公开冲突", value: 100 },
// { name: "传统能源", value: 5 },
// { name: "共和党财政鹰派", value: 77 },
// { name: "未实现赤字控制目标", value: 35 },
// { name: "得克萨斯州", value: 88 },
// { name: "选举压力", value: 57 },
// { name: "主张财政紧缩", value: 72 },
// { name: "财政保守", value: 18 },
];
const handleGetDecreeKeyInstruction = async () => { const handleGetDecreeKeyInstruction = async () => {
try { try {
const res = await getDecreeKeyInstruction(); const res = await getDecreeKeyInstruction();
console.log("政令重点条款", res); console.log("政令重点条款", res);
wordCloudData.value = res.data.map(item => { wordCloudData.value = res.data.map(item => ({name: item.clause, value: item.count}));
return {
name: item.clause,
value: item.count
};
});
} catch (error) { } catch (error) {
console.error("政令重点条款error", error); console.error("政令重点条款error", error);
} }
}; };
const handleBox8 = async () => {
await handleGetDecreeKeyInstruction();
let chart3 = getWordCloudChart(wordCloudData.value);
setChart(chart3, "wordCloudChart");
};
// 资源库 // 资源库
const searchType = ref(""); const searchType = ref("");
const isChina = ref(false); const isChina = ref(false);
...@@ -1224,7 +1204,7 @@ onMounted(async () => { ...@@ -1224,7 +1204,7 @@ onMounted(async () => {
handleBox1(); // 最新科技政令 handleBox1(); // 最新科技政令
handleBox5(); handleBox5();
handleBox6(); handleBox6();
handleBox8(); handleGetDecreeKeyInstruction();
}); });
</script> </script>
...@@ -2999,9 +2979,11 @@ onMounted(async () => { ...@@ -2999,9 +2979,11 @@ onMounted(async () => {
border-radius: 10px; border-radius: 10px;
box-shadow: 0px 0px 15px 0px rgba(60, 87, 126, 0.2); box-shadow: 0px 0px 15px 0px rgba(60, 87, 126, 0.2);
background: rgba(255, 255, 255, 1); background: rgba(255, 255, 255, 1);
display: flex;
flex-direction: column;
.box8-header { .box8-header {
width: 792px; width: 100%;
height: 48px; height: 48px;
display: flex; display: flex;
border-bottom: 1px solid rgba(240, 242, 244, 1); border-bottom: 1px solid rgba(240, 242, 244, 1);
...@@ -3030,6 +3012,12 @@ onMounted(async () => { ...@@ -3030,6 +3012,12 @@ onMounted(async () => {
} }
} }
.box8-content {
width: 100%;
height: 20px;
flex: auto;
}
.box8-main { .box8-main {
height: 401px; height: 401px;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论