门户zstp更新

develoop
aaaa 5 months ago
parent 1a620e19de
commit d5a38a9a4c
  1. 2
      .env.development
  2. BIN
      src/assets/images/100.png
  3. BIN
      src/assets/images/101.jpg
  4. BIN
      src/assets/images/102.jpg
  5. BIN
      src/assets/images/103.jpg
  6. BIN
      src/assets/images/104.jpg
  7. BIN
      src/assets/images/105.jpg
  8. BIN
      src/assets/images/106.jpg
  9. BIN
      src/assets/images/107.jpg
  10. BIN
      src/assets/images/108.jpg
  11. BIN
      src/assets/images/109.jpg
  12. BIN
      src/assets/images/110.jpg
  13. BIN
      src/assets/images/141.png
  14. BIN
      src/assets/images/142.png
  15. BIN
      src/assets/images/4c.jpeg
  16. BIN
      src/assets/images/R-C.png
  17. BIN
      src/assets/images/a.png
  18. BIN
      src/assets/images/o.jpg
  19. BIN
      src/assets/images/screen (1).png
  20. BIN
      src/assets/images/screen.png
  21. BIN
      src/assets/images/yt.png
  22. BIN
      src/assets/images/zstp.jpg
  23. 10
      src/router/routers.ts
  24. 430
      src/views/course/largeScreen.vue
  25. 408
      src/views/portal/LearningPathRecommendations.vue

@ -1,4 +1,4 @@
# 变量必须以 VITE_ 为前缀才能暴露给外部读取 # 变量必须以 VITE_ 为前缀才能暴露给外部读取
NODE_ENV = 'development' NODE_ENV = 'development'
VITE_APP_TITLE = '无糖运营平台' VITE_APP_TITLE = '无糖运营平台'
VITE_APP_BASE_API = 'http://127.0.0.1:8080' VITE_APP_BASE_API = 'http://127.0.0.1:8008'

Binary file not shown.

After

Width:  |  Height:  |  Size: 640 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 609 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 557 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

@ -299,4 +299,14 @@ export const constantRoute: any = [
}, },
], ],
}, },
{
path: '/curriculumCenter/largeScreen',
component: () => import('@/views/course/largeScreen.vue'),
name: 'LargeScreen', // name 要与权限一致
meta: {
title: '课程图谱',
hidden: true,
icon: 'Notebook',
},
}
] ]

@ -0,0 +1,430 @@
<template>
<div>
<div class="container">
<div class="goto" @click="goBack">
<p>返回</p>
</div>
</div>
</div>
</template>
<script lang="ts" >
import * as d3 from 'd3';
import { useRouter } from 'vue-router'
// import portal from './portal/LearningPathRecommendations.vue'
// import { onMounted } from 'vue';
export default {
name: 'courseHomepage',
data() {
return {
svgArea: null,
links: [],
nodes: [],
nodesName: [],
linksName: [],
simulation: null,
scale: 1,
width: 800,
height: 635,
colorList: ['#91CC75', '#5470C6', '#FAC858', '#EE6666', '#73C0DE', '#EA7CCC', '#5577FF', '#5577FF', '#9DBFFF', '#78A7FF'],
// colorList: ['#E5A1D6', '#A893F5', '#D0A4FB', '#C3ACF6', '#FBBABB', '#8B81F7', '#A893F5', '#D0A4FB', '#C3ACF6', '#FBBABB'],
testGraph: {
"nodes": [],
"links": []
// "nodes": [
// { "id": "Myriel", "group": 8 },
// { "id": "Napoleon", "group": 2 },
// { "id": "Mlle.Baptistine", "group": 3 },
// { "id": "Mme.Magloire", "group": 1 },
// { "id": "CountessdeLo", "group": 5 },
// { "id": "Geborand", "group": 5 },
// { "id": "Champtercier", "group": 6 },
// { "id": "Cravatte", "group": 7 },
// { "id": "Count", "group": 8 },
// { "id": "OldMan", "group": 9 },
// { "id": "Labarre", "group": 5 },
// { "id": "Valjean", "group": 1 },
// { "id": "Marguerite", "group": 3 },
// { "id": "Mme.deR", "group": 2 },
// { "id": "Isabeau", "group": 5 },
// { "id": "Gervais", "group": 9 },
// { "id": "Tholomyes", "group": 8 },
// { "id": "Listolier", "group": 7 },
// { "id": "Fameuil", "group": 6 },
// { "id": "Blacheville", "group": 5 },
// { "id": "Favourite", "group": 4 },
// { "id": "Dahlia", "group": 3 },
// { "id": "Zephine", "group": 9 },
// { "id": "Fantine", "group": 3 },
// { "id": "Mme.Thenardier", "group": 4 },
// { "id": "Thenardier", "group": 4 },
// { "id": "Cosette", "group": 5 },
// { "id": "Javert", "group": 4 },
// { "id": "Fauchelevent", "group": 0 },
// { "id": "Bamatabois", "group": 2 },
// // { "id": "Mme.Hucheloup", "group": 8 }
// ],
// "links": [
// { "source": "Napoleon", "target": "Myriel", "value": 7 },
// { "source": "Mlle.Baptistine", "target": "Myriel", "value": 7 },
// { "source": "Mme.Magloire", "target": "Myriel", "value": 7 },
// { "source": "Mme.Magloire", "target": "Mlle.Baptistine", "value": 7 },
// { "source": "CountessdeLo", "target": "Myriel", "value": 7 },
// { "source": "Geborand", "target": "Myriel", "value": 7 },
// { "source": "Champtercier", "target": "Myriel", "value": 7 },
// { "source": "Cravatte", "target": "Myriel", "value": 7 },
// { "source": "Count", "target": "Myriel", "value": 7 },
// { "source": "OldMan", "target": "Myriel", "value": 7 },
// { "source": "Valjean", "target": "Labarre", "value": 7 },
// { "source": "Valjean", "target": "Mme.Magloire", "value": 7 },
// { "source": "Valjean", "target": "Mlle.Baptistine", "value": 3 },
// { "source": "Valjean", "target": "Myriel", "value": 5 },
// { "source": "Marguerite", "target": "Valjean", "value": 1 },
// { "source": "Mme.deR", "target": "Valjean", "value": 1 },
// { "source": "Isabeau", "target": "Valjean", "value": 1 },
// { "source": "Gervais", "target": "Valjean", "value": 1 },
// { "source": "Listolier", "target": "Tholomyes", "value": 4 },
// { "source": "Fameuil", "target": "Tholomyes", "value": 4 },
// { "source": "Fameuil", "target": "Listolier", "value": 4 },
// { "source": "Blacheville", "target": "Tholomyes", "value": 4 },
// { "source": "Blacheville", "target": "Listolier", "value": 4 },
// { "source": "Blacheville", "target": "Fameuil", "value": 4 },
// { "source": "Favourite", "target": "Tholomyes", "value": 3 },
// { "source": "Favourite", "target": "Listolier", "value": 3 },
// { "source": "Favourite", "target": "Fameuil", "value": 3 },
// { "source": "Favourite", "target": "Blacheville", "value": 4 },
// { "source": "Dahlia", "target": "Tholomyes", "value": 3 },
// { "source": "Dahlia", "target": "Listolier", "value": 3 },
// { "source": "Dahlia", "target": "Fameuil", "value": 3 },
// { "source": "Dahlia", "target": "Blacheville", "value": 3 },
// { "source": "Dahlia", "target": "Favourite", "value": 5 },
// { "source": "Zephine", "target": "Tholomyes", "value": 3 },
// { "source": "Zephine", "target": "Listolier", "value": 3 },
// { "source": "Zephine", "target": "Fameuil", "value": 3 },
// // { "source": "Mme.Hucheloup", "target": "Enjolras", "value": 1 }
// ]
// "links":[]
}
}
},
created() {
this.getGraphData()
},
// mounted() {
// this.initGraph(this.testGraph);
// },
methods: {
getGraphData(){
var _this = this
this.axios.get("person/"+'Rob Reiner')
// this.axios.get("person/all")
.then(function (response: { data: any; }) {
console.log(response)
_this.testGraph["nodes"] = [response.data]
_this.initGraph(_this.testGraph)
})
.catch(function (error: any) {
console.log(error)
})
},
initGraph(data: {
nodes: { id: string; group: number; }[]; links: { // import { onMounted } from 'vue';
source: string; target: string; value: number;
}[];
}) {
const _this = this;
const links = data.links;
const nodes = data.nodes;
const simulation = d3.forceSimulation(nodes)
.force("link", d3.forceLink(links).id((d: { id: any; }) => d.id))
.force("collide", d3.forceCollide().radius(() => 40))
.force("charge", d3.forceManyBody().strength(30))
.force("center", d3.forceCenter(_this.width / 2, _this.height / 2));
const svg = d3.select(".container")
.append("svg")
.attr("viewBox", `0 0 ${_this.width} ${_this.height}`)
// 线
const defs = svg.append("defs");
// initGraph 线
for (let i = 0; i < links.length; i++) {
const linearGradient = defs.append("linearGradient")
.attr("id", `line-gradient-${i}`)
.attr("x1", "0%")
.attr("y1", "0%")
.attr("x2", "100%")
.attr("y2", "100%");
linearGradient.append("stop")
.attr("offset", "0%")
.attr("stop-color", "#6C9DFC");
linearGradient.append("stop")
.attr("offset", "50%")
.attr("stop-color", "#9BAAFA");
linearGradient.append("stop")
.attr("offset", "100%")
.attr("stop-color", "#F3B1BC");
}
const g = svg.append("g")
// 线
const link = g.append("g")
.attr("stroke-opacity", 0.6)
.selectAll("line")
.data(links)
.join("line")
.style("stroke", (_d: any, i: any) => `url(#line-gradient-${i})`) // 使线
.style("stroke-width", (d: { value: number; }) => Math.sqrt(d.value))
.attr("class", "link")
.attr("marker-end", "url(#arrow)");
// //
// const marker = defs.append("marker")
// .attr("id", "arrow")
// .attr("viewBox", "0 -5 10 10")
// .attr("refX", 31)
// .attr("refY", 0)
// .attr("markerWidth", 6)
// .attr("markerHeight", 6)
// .attr("orient", "auto")
// .append("path")
// .attr("d", "M0,-5L10,0L0,5")
// .attr("fill", "#E0AAED");
svg.call(d3.zoom().on("zoom", function () {
g.attr("transform", d3.event.transform)
}))
//
const linkForce = d3.forceLink(links)
.id((d: { id: any; }) => d.id)
.distance(100); //
simulation.force("link", linkForce);
//
const node = g.append("g")
.selectAll("circle")
.data(nodes)
.join("circle")
.attr("r", 15)
.attr("class", "node")
.attr("fill", (d: { id: any; }) => {
return `url(#node-gradient-${d.id})`;
})
// .attr("fill", _this.color)
.on("click", _this.queryTest)
.call(_this.drag(simulation));
// initGraph 线
for (let i = 0; i < nodes.length; i++) {
const linearGradient = defs.append("linearGradient")
.attr("id", `node-gradient-${nodes[i].id}`)
.attr("x1", "0%")
.attr("y1", "0%")
.attr("x2", "0%")
.attr("y2", "100%");
linearGradient.append("stop")
.attr("offset", "0%")
.attr("stop-color", _this.colorList[nodes[i].group]);
linearGradient.append("stop")
.attr("offset", "100%")
.attr("stop-color", "#9BBCFC");
}
node.append("title")
.text((d: { id: any; }) => d.id);
const nodeNameText = g.append("g")
.selectAll("text")
.data(nodes)
.join("text")
.text(function (d: { id: any; }) {
return d.id
})
.attr("fill", "white")
// .attr("dx", function () {
// return this.getBoundingClientRect().width / 2 * (-1)
// })
.attr('x', (d: { x: any; }) => d.x)
.attr("y", 50)
.attr('text-anchor', 'middle')
.attr('alignment-baseline', 'middle')
.attr("class", "node-name")
.style('pointer-events', 'none')
.style('font-size', '15px')
.style('font-family', 'Arial')
.style('text-shadow', '1px 1px 1px #0052FF')
node.on("mouseover", function (_d: any, _i: any) {
d3.select(this)
.attr("stroke", "white") //
.attr("stroke-width", 5); //
})
.on("mouseout", function (_d: any, _i: any) {
d3.select(this)
.attr("stroke", "none"); //
});
simulation.on("tick", () => {
link
.attr("x1", (d: { source: { x: any; }; }) => d.source.x)
.attr("y1", (d: { source: { y: any; }; }) => d.source.y)
.attr("x2", (d: { target: { x: any; }; }) => d.target.x)
.attr("y2", (d: { target: { y: any; }; }) => d.target.y);
node
.attr("cx", (d: { x: any; }) => d.x)
.attr("cy", (d: { y: any; }) => d.y);
nodeNameText
.attr("x", (d: { x: any; }) => d.x)
.attr("y", (d: { y: any; }) => d.y);
});
},
updateGraph(data: { links: any[]; }) {
// var _this = this
const links = data.links.map((d: object | null) => Object.create(d));
const nodes = data.nodes.map((d: object | null) => Object.create(d));
},
color(d: { group: string | number; }) {
return this.colorList[d.group]
// const scale = d3.scaleOrdinal(d3.schemeCategory10);
// return (d: { group: any; }) => scale(d.group);
},
drag(simulation: { alphaTarget: (arg0: number) => { (): any; new(): any; restart: { (): void; new(): any; }; }; }) {
function dragstarted(event: { active: any; }) {
if (!event.active) simulation.alphaTarget(0.3).restart();
d3.event.subject.fx = d3.event.x;
d3.event.subject.fy = d3.event.y;
}
function dragged(_event: any) {
d3.event.subject.fx = d3.event.x;
d3.event.subject.fy = d3.event.y;
}
function dragended(event: { active: any; }) {
if (!event.active) simulation.alphaTarget(0);
d3.event.subject.fx = null;
d3.event.subject.fy = null;
}
return d3.drag()
.on("start", dragstarted)
.on("drag", dragged)
.on("end", dragended);
},
queryTest(d: { id: any; }) {
// var _this = this
console.log(d.id)
}
},
setup() {
const router = useRouter();
const goBack = () => {
router.go(-1);
};
return {
goBack
};
}
}
</script>
<style lang="scss" scoped>
// d3
.container {
// width: 1000px;
// height: 950px;
// border: 1px solid #2c3e50;
// border-radius: 8px;
// margin-top: 40px;
// margin-left: auto;
// border-radius: 90%;
// margin-right: auto;
border: 1px solid #CFD9EA;
background: linear-gradient(#d5e1f6, #a9c6ff, #d5e1f6);
background-image: url('/src/assets/images/106.jpg');
// background-size: 100% 80%;
background-size: 100% ;
background-attachment: fixed;
// border-radius: 50%; //
// background-color: rgba(0, 0, 0, 0); /* 50% */
}
.goto {
width: 4.5%;
height: 3.4%;
background-color: rgb(255, 255, 255,0.5);
// background-image: url('/src/assets/images/screen (1).png');
// background-size: 100% 100%;
border-radius: 8px;
position: absolute;
top: 5%;
margin-left: 94%;
z-index: 5;
cursor: pointer;
}
.goto p{
text-align: center;
color: #ffffff;
line-height: 30px;
font-size: 14px;
}
// .goto :hover{
// background-color: #a2abbb;
// border-radius: 8px;
// width: 4.5%;
// height: 3.4%;
// }
</style>

@ -35,15 +35,33 @@
<div class="subnav"> <div class="subnav">
<h1>xxx课程</h1> <h1>xxx课程</h1>
</div> </div>
<!-- <div class="tushi"> -->
<el-steps :active="3" align-center style="margin: auto;margin-top: 3%; width:60%;">
<el-step title="课程进度0%" description=""></el-step>
<el-step title="课程进度50%" description=""></el-step>
<el-step title="课程进度100%" description=""></el-step>
</el-steps>
<!-- </div> -->
<div class="tushi2">
<!-- <a href="/curriculumCenter/largeScreen">
</a> -->
<img @click="goToLargScreen" src="/src/assets/images/screen (1).png" width="100%" height="100%">
</div>
<!-- <div class="con1"></div> -->
<div class="container"></div> <div class="container"></div>
</div> </div>
<!-- 底部 --> <!-- 底部 -->
<div class="footer"> <div class="footer">
<h3>软件工程专业</h3> <h3>软件工程专业</h3>
<h1>教学一体化平台</h1> <h1>教学一体化平台</h1>
<p>关于我们&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp; &nbsp;联系我们&nbsp; &nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp; 服务协议 <p>关于我们&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp; &nbsp;联系我们&nbsp; &nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;
服务协议
</p> </p>
<p style="font-size: 13px;margin-top: 70px">黄淮学院版权所有@2023 湘豫CP备 19005950-1<br> <p style="font-size: 13px;margin-top: 70px">黄淮学院版权所有@2023 湘豫CP备 19005950-1<br>
违法和不良信息举报 举报电话0xxx-8xxxxxxx 举报邮箱xxxxxxxxx@qq.com</p> 违法和不良信息举报 举报电话0xxx-8xxxxxxx 举报邮箱xxxxxxxxx@qq.com</p>
@ -69,41 +87,42 @@ export default {
simulation: null, simulation: null,
scale: 1, scale: 1,
width: 800, width: 800,
height:560, height: 635,
colorList:['#FD7623','#3388B1','#D82952','#F3D737','#409071','#D64E52'], colorList: ['#91CC75', '#5470C6', '#FAC858', '#EE6666', '#73C0DE', '#EA7CCC', '#5577FF', '#5577FF', '#9DBFFF', '#78A7FF'],
// colorList: ['#E5A1D6', '#A893F5', '#D0A4FB', '#C3ACF6', '#FBBABB', '#8B81F7', '#A893F5', '#D0A4FB', '#C3ACF6', '#FBBABB'],
testGraph: { testGraph: {
"nodes": [ "nodes": [
{ "id": "Myriel", "group": 1 }, { "id": "Myriel", "group": 8 },
{ "id": "Napoleon", "group": 1 }, { "id": "Napoleon", "group": 2 },
{ "id": "Mlle.Baptistine", "group": 1 }, { "id": "Mlle.Baptistine", "group": 3 },
{ "id": "Mme.Magloire", "group": 1 }, { "id": "Mme.Magloire", "group": 1 },
{ "id": "CountessdeLo", "group": 1 }, { "id": "CountessdeLo", "group": 5 },
{ "id": "Geborand", "group": 1 }, { "id": "Geborand", "group": 5 },
{ "id": "Champtercier", "group": 1 }, { "id": "Champtercier", "group": 6 },
{ "id": "Cravatte", "group": 1 }, { "id": "Cravatte", "group": 7 },
{ "id": "Count", "group": 1 }, { "id": "Count", "group": 8 },
{ "id": "OldMan", "group": 1 }, { "id": "OldMan", "group": 9 },
{ "id": "Labarre", "group": 2 }, { "id": "Labarre", "group": 5 },
{ "id": "Valjean", "group": 2 }, { "id": "Valjean", "group": 1 },
// { "id": "Marguerite", "group": 3 }, { "id": "Marguerite", "group": 3 },
// { "id": "Mme.deR", "group": 2 }, { "id": "Mme.deR", "group": 2 },
// { "id": "Isabeau", "group": 2 }, { "id": "Isabeau", "group": 5 },
// { "id": "Gervais", "group": 2 }, { "id": "Gervais", "group": 9 },
// { "id": "Tholomyes", "group": 3 }, { "id": "Tholomyes", "group": 8 },
// { "id": "Listolier", "group": 3 }, { "id": "Listolier", "group": 7 },
// { "id": "Fameuil", "group": 3 }, { "id": "Fameuil", "group": 6 },
// { "id": "Blacheville", "group": 3 }, { "id": "Blacheville", "group": 5 },
// { "id": "Favourite", "group": 3 }, { "id": "Favourite", "group": 4 },
// { "id": "Dahlia", "group": 3 }, { "id": "Dahlia", "group": 3 },
// { "id": "Zephine", "group": 3 }, { "id": "Zephine", "group": 9 },
// { "id": "Fantine", "group": 3 }, { "id": "Fantine", "group": 3 },
// { "id": "Mme.Thenardier", "group": 4 }, { "id": "Mme.Thenardier", "group": 4 },
// { "id": "Thenardier", "group": 4 }, { "id": "Thenardier", "group": 4 },
// { "id": "Cosette", "group": 5 }, { "id": "Cosette", "group": 5 },
// { "id": "Javert", "group": 4 }, { "id": "Javert", "group": 4 },
// { "id": "Fauchelevent", "group": 0 }, { "id": "Fauchelevent", "group": 0 },
// { "id": "Bamatabois", "group": 2 }, { "id": "Bamatabois", "group": 2 },
// { "id": "Perpetue", "group": 3 }, { "id": "Perpetue", "group": 3 },
// { "id": "Simplice", "group": 2 }, // { "id": "Simplice", "group": 2 },
// { "id": "Scaufflaire", "group": 2 }, // { "id": "Scaufflaire", "group": 2 },
// { "id": "Woman1", "group": 2 }, // { "id": "Woman1", "group": 2 },
@ -152,42 +171,42 @@ export default {
// { "id": "Mme.Hucheloup", "group": 8 } // { "id": "Mme.Hucheloup", "group": 8 }
], ],
"links": [ "links": [
{ "source": "Napoleon", "target": "Myriel", "value": 1 }, { "source": "Napoleon", "target": "Myriel", "value": 7 },
// { "source": "Mlle.Baptistine", "target": "Myriel", "value": 8 }, { "source": "Mlle.Baptistine", "target": "Myriel", "value": 7 },
// { "source": "Mme.Magloire", "target": "Myriel", "value": 10 }, { "source": "Mme.Magloire", "target": "Myriel", "value": 7 },
// { "source": "Mme.Magloire", "target": "Mlle.Baptistine", "value": 6 }, { "source": "Mme.Magloire", "target": "Mlle.Baptistine", "value": 7 },
// { "source": "CountessdeLo", "target": "Myriel", "value": 1 }, { "source": "CountessdeLo", "target": "Myriel", "value": 7 },
// { "source": "Geborand", "target": "Myriel", "value": 1 }, { "source": "Geborand", "target": "Myriel", "value": 7 },
// { "source": "Champtercier", "target": "Myriel", "value": 1 }, { "source": "Champtercier", "target": "Myriel", "value": 7 },
// { "source": "Cravatte", "target": "Myriel", "value": 1 }, { "source": "Cravatte", "target": "Myriel", "value": 7 },
// { "source": "Count", "target": "Myriel", "value": 2 }, { "source": "Count", "target": "Myriel", "value": 7 },
// { "source": "OldMan", "target": "Myriel", "value": 1 }, { "source": "OldMan", "target": "Myriel", "value": 7 },
// { "source": "Valjean", "target": "Labarre", "value": 1 }, { "source": "Valjean", "target": "Labarre", "value": 7 },
// { "source": "Valjean", "target": "Mme.Magloire", "value": 3 }, { "source": "Valjean", "target": "Mme.Magloire", "value": 7 },
// { "source": "Valjean", "target": "Mlle.Baptistine", "value": 3 }, { "source": "Valjean", "target": "Mlle.Baptistine", "value": 3 },
// { "source": "Valjean", "target": "Myriel", "value": 5 }, { "source": "Valjean", "target": "Myriel", "value": 5 },
// { "source": "Marguerite", "target": "Valjean", "value": 1 }, { "source": "Marguerite", "target": "Valjean", "value": 1 },
// { "source": "Mme.deR", "target": "Valjean", "value": 1 }, { "source": "Mme.deR", "target": "Valjean", "value": 1 },
// { "source": "Isabeau", "target": "Valjean", "value": 1 }, { "source": "Isabeau", "target": "Valjean", "value": 1 },
// { "source": "Gervais", "target": "Valjean", "value": 1 }, { "source": "Gervais", "target": "Valjean", "value": 1 },
// { "source": "Listolier", "target": "Tholomyes", "value": 4 }, { "source": "Listolier", "target": "Tholomyes", "value": 4 },
// { "source": "Fameuil", "target": "Tholomyes", "value": 4 }, { "source": "Fameuil", "target": "Tholomyes", "value": 4 },
// { "source": "Fameuil", "target": "Listolier", "value": 4 }, { "source": "Fameuil", "target": "Listolier", "value": 4 },
// { "source": "Blacheville", "target": "Tholomyes", "value": 4 }, { "source": "Blacheville", "target": "Tholomyes", "value": 4 },
// { "source": "Blacheville", "target": "Listolier", "value": 4 }, { "source": "Blacheville", "target": "Listolier", "value": 4 },
// { "source": "Blacheville", "target": "Fameuil", "value": 4 }, { "source": "Blacheville", "target": "Fameuil", "value": 4 },
// { "source": "Favourite", "target": "Tholomyes", "value": 3 }, { "source": "Favourite", "target": "Tholomyes", "value": 3 },
// { "source": "Favourite", "target": "Listolier", "value": 3 }, { "source": "Favourite", "target": "Listolier", "value": 3 },
// { "source": "Favourite", "target": "Fameuil", "value": 3 }, { "source": "Favourite", "target": "Fameuil", "value": 3 },
// { "source": "Favourite", "target": "Blacheville", "value": 4 }, { "source": "Favourite", "target": "Blacheville", "value": 4 },
// { "source": "Dahlia", "target": "Tholomyes", "value": 3 }, { "source": "Dahlia", "target": "Tholomyes", "value": 3 },
// { "source": "Dahlia", "target": "Listolier", "value": 3 }, { "source": "Dahlia", "target": "Listolier", "value": 3 },
// { "source": "Dahlia", "target": "Fameuil", "value": 3 }, { "source": "Dahlia", "target": "Fameuil", "value": 3 },
// { "source": "Dahlia", "target": "Blacheville", "value": 3 }, { "source": "Dahlia", "target": "Blacheville", "value": 3 },
// { "source": "Dahlia", "target": "Favourite", "value": 5 }, { "source": "Dahlia", "target": "Favourite", "value": 5 },
// { "source": "Zephine", "target": "Tholomyes", "value": 3 }, { "source": "Zephine", "target": "Tholomyes", "value": 3 },
// { "source": "Zephine", "target": "Listolier", "value": 3 }, { "source": "Zephine", "target": "Listolier", "value": 3 },
// { "source": "Zephine", "target": "Fameuil", "value": 3 }, { "source": "Zephine", "target": "Fameuil", "value": 3 },
// { "source": "Zephine", "target": "Blacheville", "value": 3 }, // { "source": "Zephine", "target": "Blacheville", "value": 3 },
// { "source": "Zephine", "target": "Favourite", "value": 4 }, // { "source": "Zephine", "target": "Favourite", "value": 4 },
// { "source": "Zephine", "target": "Dahlia", "value": 4 }, // { "source": "Zephine", "target": "Dahlia", "value": 4 },
@ -430,6 +449,8 @@ export default {
}[]; }[];
}) { }) {
const _this = this; const _this = this;
// const defs = svg.append("defs");//线
const links = data.links; const links = data.links;
const nodes = data.nodes; const nodes = data.nodes;
// const links = data.links.map((d: object | null) => Object.create(d)); // const links = data.links.map((d: object | null) => Object.create(d));
@ -437,38 +458,122 @@ export default {
const simulation = d3.forceSimulation(nodes) const simulation = d3.forceSimulation(nodes)
.force("link", d3.forceLink(links).id((d: { id: any; }) => d.id)) .force("link", d3.forceLink(links).id((d: { id: any; }) => d.id))
.force("collide",d3.forceCollide().radius(()=> 30) ) // .force("link", d3.forceLink(links).distance(-30)) //
.force("charge", d3.forceManyBody().strength(-30)) .force("collide", d3.forceCollide().radius(() => 60))
.force("charge", d3.forceManyBody().strength(30))
.force("center", d3.forceCenter(_this.width / 2, _this.height / 2)); .force("center", d3.forceCenter(_this.width / 2, _this.height / 2));
// .scale(1.5); //
const svg = d3.select(".container") const svg = d3.select(".container")
.append("svg") .append("svg")
.attr("viewBox", `0 0 ${_this.width} ${_this.height}`); .attr("viewBox", `0 0 ${_this.width} ${_this.height}`)
svg.call(d3.zoom().on("zoom",function(){ .style("width", "1300px")// SVG
g.attr("transform",d3.event.transform) .style("height", "748px")// SVG
})) // .style("border-radius", "50%")// SVG
// .style("z-index", "9")// SVG
const g = svg.append("g")
// 线
const defs = svg.append("defs");
// initGraph 线
for (let i = 0; i < links.length; i++) {
const linearGradient = defs.append("linearGradient")
.attr("id", `line-gradient-${i}`)
.attr("x1", "0%")
.attr("y1", "0%")
.attr("x2", "100%")
.attr("y2", "100%");
linearGradient.append("stop")
.attr("offset", "0%")
.attr("stop-color", "#6C9DFC");
linearGradient.append("stop")
.attr("offset", "50%")
.attr("stop-color", "#9BAAFA");
linearGradient.append("stop")
.attr("offset", "100%")
.attr("stop-color", "#F3B1BC");
}
const g = svg.append("g")
// 线
const link = g.append("g") const link = g.append("g")
.attr("stroke", "#999")
.attr("stroke-opacity", 0.6) .attr("stroke-opacity", 0.6)
.selectAll("line") .selectAll("line")
.data(links) .data(links)
.join("line") .join("line")
.attr("stroke-width", (d: { value: number; }) => Math.sqrt(d.value)) .style("stroke", (_d: any, i: any) => `url(#line-gradient-${i})`) // 使线
.attr("class", "link"); .style("stroke-width", (d: { value: number; }) => Math.sqrt(d.value))
.attr("class", "link")
.attr("marker-end", "url(#arrow)");
// //
// const marker = defs.append("marker")
// .attr("id", "arrow")
// .attr("viewBox", "0 -5 10 10")
// .attr("refX", 31)
// .attr("refY", 0)
// .attr("markerWidth", 6)
// .attr("markerHeight", 6)
// .attr("orient", "auto")
// .append("path")
// .attr("d", "M0,-5L10,0L0,5")
// .attr("fill", "#E0AAED");
svg.call(d3.zoom().on("zoom", function () {
g.attr("transform", d3.event.transform)
}))
//
const linkForce = d3.forceLink(links)
.id((d: { id: any; }) => d.id)
.distance(100); //
simulation.force("link", linkForce);
//
const node = g.append("g") const node = g.append("g")
.selectAll("circle") .selectAll("circle")
.data(nodes) .data(nodes)
.join("circle") .join("circle")
.attr("r", 40) .attr("r", 23)
.attr("class", "node") .attr("class", "node")
.attr("fill", _this.color) .attr("fill", (d: { id: any; }) => {
return `url(#node-gradient-${d.id})`;
})
// .attr("fill", _this.color)
.on("click", _this.queryTest) .on("click", _this.queryTest)
.call(_this.drag(simulation)); .call(_this.drag(simulation));
// initGraph 线
for (let i = 0; i < nodes.length; i++) {
const linearGradient = defs.append("linearGradient")
.attr("id", `node-gradient-${nodes[i].id}`)
.attr("x1", "0%")
.attr("y1", "0%")
.attr("x2", "0%")
.attr("y2", "100%");
linearGradient.append("stop")
.attr("offset", "0%")
.attr("stop-color", _this.colorList[nodes[i].group]);
linearGradient.append("stop")
.attr("offset", "100%")
.attr("stop-color", "#9BBCFC");
}
node.append("title") node.append("title")
.text((d: { id: any; }) => d.id); .text((d: { id: any; }) => d.id);
@ -480,18 +585,27 @@ export default {
return d.id return d.id
}) })
.attr("fill", "white") .attr("fill", "white")
.attr("dx",function () { // .attr("dx", function () {
return this.getBoundingClientRect().width/2*(-1) // return this.getBoundingClientRect().width / 2 * (-1)
}) // })
.attr("dy",50) .attr('x', (d: { x: any; }) => d.x)
.attr("y", 50)
.attr('text-anchor', 'middle')
.attr('alignment-baseline', 'middle')
.attr("class", "node-name") .attr("class", "node-name")
.style('pointer-events', 'none')
.style('font-size', '15px')
.style('font-family', 'Arial')
.style('text-shadow', '1px 1px 1px #0052FF')
node.on("mouseover", function (d, i) {
node.on("mouseover", function (_d: any, _i: any) {
d3.select(this) d3.select(this)
.attr("stroke", "white") // .attr("stroke", "white") //
.attr("stroke-width", 5); // .attr("stroke-width", 5); //
}) })
.on("mouseout", function (d, i) { .on("mouseout", function (_d: any, _i: any) {
d3.select(this) d3.select(this)
.attr("stroke", "none"); // .attr("stroke", "none"); //
}); });
@ -511,6 +625,7 @@ export default {
nodeNameText nodeNameText
.attr("x", (d: { x: any; }) => d.x) .attr("x", (d: { x: any; }) => d.x)
.attr("y", (d: { y: any; }) => d.y); .attr("y", (d: { y: any; }) => d.y);
}); });
}, },
updateGraph(data: { links: any[]; }) { updateGraph(data: { links: any[]; }) {
@ -530,7 +645,7 @@ export default {
d3.event.subject.fy = d3.event.y; d3.event.subject.fy = d3.event.y;
} }
function dragged(event: any) { function dragged(_event: any) {
d3.event.subject.fx = d3.event.x; d3.event.subject.fx = d3.event.x;
d3.event.subject.fy = d3.event.y; d3.event.subject.fy = d3.event.y;
} }
@ -549,11 +664,16 @@ export default {
queryTest(d: { id: any; }) { queryTest(d: { id: any; }) {
// var _this = this // var _this = this
console.log(d.id) console.log(d.id)
},
goToLargScreen() {
this.$router.push('/curriculumCenter/largeScreen')
} }
} }
} }
</script> </script>
@ -683,13 +803,16 @@ img {
float: left; float: left;
margin-left: 80px; margin-left: 80px;
} }
// //
.content { .content {
margin-top: 10; margin-top: 10;
width: 100%; width: 100%;
position: relative;
height: 900px; height: 900px;
background-color: #7F9EED; // background-color: #7F9EED;
} }
.subnav { .subnav {
width: 100%; width: 100%;
margin: auto; margin: auto;
@ -699,49 +822,116 @@ img {
} }
.subnav h1 { .subnav h1 {
border-bottom: 4px solid #0052FF; border-bottom: 4px solid #3E79F6;
font-size: 20px; font-size: 20px;
width: 10%; width: 10%;
height: 35px; height: 35px;
margin: auto; margin: auto;
font-weight: bolder; font-weight: bolder;
color: #0052FF; color: #3E79F6;
text-align: center; text-align: center;
} }
// d3 // d3
// .con{
// width: 95%;
// height: 900px;
// margin: auto;
// // background-color: #3E79F6;
// background-image: url('/src/assets/images/142.png');
// background-size: 100% 100%;
// top: 353px;
// left: 4%;
// // position: absolute;
// // background-color: #409effff;
// // border-left: 1px solid #3E79F6;
// }
// .con1{
// width: 0.1%;
// height: 500px;
// // margin: auto;
// // background-color: #3E79F6;
// top: 353px;
// right: 4%;
// position: absolute;
// background-color: #409effff;
// // border-left: 1px solid #3E79F6;
// }
.container { .container {
width: 1000px; width: 1300px;
height: 700px; height: 750px;
// border: 1px solid #2c3e50; // border: 1px solid #2c3e50;
border-radius: 8px; border-radius: 8px;
margin-top: 40px; margin-top: 2.5%;
margin-left: auto; margin-left: auto;
// border-radius: 50%; // border-radius: 90%;
margin-right: auto; margin-right: auto;
border: #79c4f3;
background-color: #79c4f3 ; border: 1px solid #CFD9EA;
// background: #79c4f3 repeating-linear-gradient(30deg, background: linear-gradient(#d5e1f6, #a9c6ff, #d5e1f6);
// hsla(0, 0%, 100%, .1), hsla(0, 0%, 100%, .1) 15px, background-image: url('/src/assets/images/106.jpg');
// transparent 0, transparent 30px); background-size: 100% 100%;
} // border-radius: 10px 10% 10% 10%; //
.node{ // background-color: rgba(0, 0, 0, 0); /* 50% */
stroke:#fff;
stroke-width:1;
cursor: pointer;
} }
.node:hover{ // .tushi {
stroke-width:5; // width: 100%;
// height: 10%;
// // background-color: #F0F4FA;
// position: absolute;
// padding-top: 10%;
// z-index: 5;
// }
// .tushi1 {
// width: 100%;
// height: 15%;
// // background-color: #F0F4FA;
// position: absolute;
// top: 105%;
// z-index: 5;
// }
.tushi2 {
width: 1.8%;
height: 3%;
// background-color: #304564;
// background-image: url('/src/assets/images/screen (1).png');
// background-size: 100% 100%;
position: absolute;
top: 25%;
margin-left: 87%;
z-index: 5;
} }
.nodeName{ .tushi2:hover {
fill:white; transform: scale(1.05);
} }
// .node{
// stroke:#fff;
// stroke-width:1;
// cursor: pointer;
// }
// .node:hover{
// stroke-width:5;
// }
// .nodeName{
// fill:white;
// }
// //
.footer { .footer {
margin-top: 100px; margin-top: 100px;
// padding-bottom: 0%; // padding-bottom: 0%;
margin-top: 15%;
width: 100%; width: 100%;
height: 250px; height: 250px;
// position: absolute; // position: absolute;

Loading…
Cancel
Save