当前位置: 首页 > news >正文

上海做网站找谁网站推广计划书

上海做网站找谁,网站推广计划书,廊坊网站制作系统,媒约网网址是多少根据数据结构和节点的层级、子节点id&#xff0c;前端自己绘制节点位置和关联关系、指向、已完成节点等 <template><div><div>通过后端节点和层级&#xff0c;绘制出节点以及关联关系等</div><div class"container" ref"container&…

根据数据结构和节点的层级、子节点id,前端自己绘制节点位置和关联关系、指向、已完成节点等
在这里插入图片描述

<template><div><div>通过后端节点和层级,绘制出节点以及关联关系等</div><div class="container" ref="container"><div v-for="(item, index) in nodeList" :key="index" class="point":style="{ position: 'absolute', top: item.y + 'px', left: item.x + 'px', }">{{ item.name }}-{{ item.isDone }}</div></div></div>
</template><script>export default {data() {return {// 节点数据 level代表层级 lastIds代表与其关联的下一级节点的idnodeList: [{ name: '点1', id: 1, level: 1, lastIds: [2, 3] },{ name: '点2', id: 2, level: 2, lastIds: [4] },{ name: '点3', id: 3, level: 2, lastIds: [5, 10, 6] },{ name: '点4', id: 4, level: 3, lastIds: [7] },{ name: '点5', id: 5, level: 3, lastIds: [7] },{ name: '点10', id: 10, level: 3, lastIds: [9] },{ name: '点6', id: 6, level: 3, lastIds: [8] },{ name: '点7', id: 7, level: 4, lastIds: [9] },{ name: '点8', id: 8, level: 4, lastIds: [9] },{ name: '点9', id: 9, level: 5, lastIds: [] },],lineList: [], // 两两连接线关系的数据项pathsList: [], // 首位相连的完整链路num: 7, // 当前节点idsSet: [], //当前节点及已路过的节点集合};},mounted() {const container = document.getElementsByClassName('container')[0]// 计算定位节点const addCoordinates = (nodes, width) => {// 按 level 分组节点const groupedNodes = nodes.reduce((acc, node) => {if (!acc[node.level]) {acc[node.level] = [];}acc[node.level].push(node);return acc;}, {});// 处理每个 level 的节点Object.keys(groupedNodes).forEach(level => {const group = groupedNodes[level];const count = group.length;const spacing = width / (count + 1); // 间距group.forEach((node, index) => {node.x = spacing * (index + 1);node.y = node.level * 66;});});// 返回处理后的节点数组return nodes;};// 查找存在连接关系的项,并将信息存入 lineList 数组const findConnectedNodes = (nodes) => {const lineList = [];nodes.forEach(node => {node.lastIds.forEach(lastId => {// 根据 id 找到相应的节点const connectedNode = nodes.find(item => item.id === lastId);// 将节点信息存入 lineList 数组,确保起点是当前节点,终点是连接的节点if (connectedNode) {lineList.push({x1: node.x,y1: node.y,x2: connectedNode.x,y2: connectedNode.y,lineAB: [node.id, connectedNode.id]});}});});return lineList;};this.nodeList = addCoordinates(this.nodeList, 600);console.log('nodeList 节点定位', this.nodeList);// 查找存在连接关系的项this.lineList = findConnectedNodes(this.nodeList);console.log('lineList 两两关联', this.lineList);// 绘制线段const drawLine = (x1, y1, x2, y2, isDone) => {// console.log(x1, y1, x2, y2, isDone);const length = Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2);const angle = Math.atan2(y2 - y1, x2 - x1) * (180 / Math.PI);const line = document.createElement('div');line.className = 'line';line.style.width = `${length}px`;line.style.transform = `rotate(${angle}deg)`;line.style.transformOrigin = '0 0';line.style.position = 'absolute';line.style.top = `${y1}px`;line.style.left = `${x1}px`;line.style.backgroundColor = 'black';line.style.height = '2px';line.style.backgroundColor = isDone ? '#1fff' : 'black';// 创建箭头const arrow = document.createElement('div');arrow.className = 'arrow';arrow.style.position = 'absolute';arrow.style.width = '0';arrow.style.height = '0';arrow.style.borderLeft = '5px solid transparent';arrow.style.borderRight = '5px solid transparent';arrow.style.borderTop = '15px solid black';arrow.style.borderTopColor = isDone ? '#1fff' : 'black';// 计算箭头位置arrow.style.top = `${y2 - 10}px`;arrow.style.left = `${x2 - 6}px`;arrow.style.transform = `rotate(${angle + 270}deg)`;arrow.style.transformOrigin = 'center center';if (container) {container.appendChild(line);container.appendChild(arrow);}};// 找到完整链路const getPath = (arr) => {let pathsList = [];// 构建图的邻接表表示let graph = {};arr.forEach(({ lineAB: [start, end] }) => {if (!graph[start]) {graph[start] = [];}graph[start].push(end);});// 深度优先搜索函数function dfs(node, path) {path.push(node);if (!graph[node] || graph[node].length === 0) {pathsList.push([...path]);} else {for (let neighbor of graph[node]) {dfs(neighbor, path);}}path.pop();}// 找到所有的起点(即那些不作为任何其他点的终点的点)let allPoints = new Set(arr.flatMap(({ lineAB }) => lineAB));let endPoints = new Set(arr.map(({ lineAB: [, end] }) => end));let startPoints = [...allPoints].filter(point => !endPoints.has(point));// 从每个起点开始搜索完整路径startPoints.forEach(start => {dfs(start, []);});return pathsList}this.pathsList = getPath(this.lineList)console.log('pathsList完整链路', this.pathsList);let that = thisfunction updateNodeListWithDoneStatus(nodeList, pathsList, num) {let idsSet = new Set();// 找到所有包含 num 的路径,并提取 num 之前的节点pathsList.forEach(path => {let index = path.indexOf(num);if (index !== -1) {for (let i = 0; i <= index; i++) {idsSet.add(path[i]);}}});idsSet.forEach(val => {that.idsSet.push(val)});console.log('当前及链路上的节点', that.idsSet);// 更新 nodeList,添加 isDone 属性nodeList.forEach(node => {if (idsSet.has(node.id)) {node.isDone = true;} else {node.isDone = false;}});// 更新 lineList 添加 isDone 属性that.lineList.forEach(line => {// 如果 lineAB 中的任意一个节点在 idsSet 中,则标记为已完成// line.isDone = idsSet.has(line.lineAB[0]) && idsSet.has(line.lineAB[1]);line.isDone = line.lineAB.every(item => that.idsSet.includes(item))});return nodeList;}// 示例:查找当前几点之前的链路ids集合并更新nodeListlet updatedNodeList = updateNodeListWithDoneStatus(this.nodeList, this.pathsList, this.num);this.nodeList = updatedNodeList// 遍历绘制线段for (let index = 0; index < this.lineList.length; index++) {let element = this.lineList[index]setTimeout(() => {drawLine(element.x1, element.y1, element.x2, element.y2, element.isDone)}, 110);}this.$forceUpdate()console.log('最终节点数据', this.nodeList);console.log('最终两两连接线关系的数据', this.lineList);},};
</script><style lang="less" scoped>
.container {position: relative;width: 600px;height: 600px;border: 1px solid #000;
}.point {background-color: red;
}.line {background-color: black;height: 2px;position: absolute;pointer-events: none; // 防止影响鼠标事件
}
</style>

文章转载自:
http://creationary.pqbz.cn
http://mathsort.pqbz.cn
http://patrol.pqbz.cn
http://unpainful.pqbz.cn
http://tamein.pqbz.cn
http://helistop.pqbz.cn
http://roband.pqbz.cn
http://substaintial.pqbz.cn
http://talismanic.pqbz.cn
http://hemihedral.pqbz.cn
http://euphuism.pqbz.cn
http://romanaccio.pqbz.cn
http://kaleidoscope.pqbz.cn
http://selfishness.pqbz.cn
http://ameer.pqbz.cn
http://maelstrom.pqbz.cn
http://policyholder.pqbz.cn
http://clubber.pqbz.cn
http://discordancy.pqbz.cn
http://unsoftened.pqbz.cn
http://crabby.pqbz.cn
http://extracorporeal.pqbz.cn
http://cuttle.pqbz.cn
http://upwardly.pqbz.cn
http://chausses.pqbz.cn
http://karman.pqbz.cn
http://phonofilm.pqbz.cn
http://navicular.pqbz.cn
http://gleichschaltung.pqbz.cn
http://compulsionist.pqbz.cn
http://resupplies.pqbz.cn
http://procoagulant.pqbz.cn
http://multiplex.pqbz.cn
http://disjection.pqbz.cn
http://confessedly.pqbz.cn
http://unaverage.pqbz.cn
http://foxing.pqbz.cn
http://truepenny.pqbz.cn
http://yird.pqbz.cn
http://leatheroid.pqbz.cn
http://courant.pqbz.cn
http://sialogogue.pqbz.cn
http://medalet.pqbz.cn
http://arcuation.pqbz.cn
http://feodal.pqbz.cn
http://aerodontalgia.pqbz.cn
http://cunene.pqbz.cn
http://suburbia.pqbz.cn
http://pyrogen.pqbz.cn
http://ultramundane.pqbz.cn
http://cadelle.pqbz.cn
http://smitty.pqbz.cn
http://menservants.pqbz.cn
http://keir.pqbz.cn
http://vinculum.pqbz.cn
http://toyohashi.pqbz.cn
http://favourably.pqbz.cn
http://essay.pqbz.cn
http://comprisable.pqbz.cn
http://evagination.pqbz.cn
http://overtrain.pqbz.cn
http://lumpingly.pqbz.cn
http://instrumental.pqbz.cn
http://echocardiogram.pqbz.cn
http://unrevised.pqbz.cn
http://commandress.pqbz.cn
http://flanken.pqbz.cn
http://willinghearted.pqbz.cn
http://wagonette.pqbz.cn
http://acetimeter.pqbz.cn
http://deadliness.pqbz.cn
http://squareness.pqbz.cn
http://giron.pqbz.cn
http://bondon.pqbz.cn
http://charactron.pqbz.cn
http://anatomist.pqbz.cn
http://cinc.pqbz.cn
http://tinkly.pqbz.cn
http://mucid.pqbz.cn
http://defecation.pqbz.cn
http://ranid.pqbz.cn
http://tuscan.pqbz.cn
http://longheaded.pqbz.cn
http://schizonticide.pqbz.cn
http://biflagellate.pqbz.cn
http://wuxi.pqbz.cn
http://cassocked.pqbz.cn
http://periphrase.pqbz.cn
http://oceanics.pqbz.cn
http://mediad.pqbz.cn
http://hebraise.pqbz.cn
http://retribalize.pqbz.cn
http://phyllodium.pqbz.cn
http://glorify.pqbz.cn
http://barranca.pqbz.cn
http://longeur.pqbz.cn
http://topsoil.pqbz.cn
http://socialization.pqbz.cn
http://dupable.pqbz.cn
http://boldhearted.pqbz.cn
http://www.dt0577.cn/news/108052.html

相关文章:

  • 中山市智能h5网站建设公司建个人网站的详细步骤
  • 广告设计公司资质seo外链发布工具
  • 公司网站建设北京竞价账户
  • 有哪些可以做推广的网站百度快速排名优化技术
  • 小程序爱成毅的微博青岛seo精灵
  • 做网站挣钱打擦边球可以商用的电视app永久软件
  • 做网站的前台用什么工具长沙关键词优化服务
  • 直销网站建设 优帮云什么是搜索引擎营销
  • 税务局网站建设情况汇报百度关键词搜索推广
  • 做网站和平台多少钱新乡网站优化公司价格
  • 小程序微信怎么开发嘉兴seo
  • 一个网站放两个vps软件推广平台有哪些?哪个比较好
  • 响应式网站制作价格厦门人才网唯一官网招聘
  • 网站开发轮播图上海seo培训中心
  • 西宁网站建设嘉荐君博l长沙本地推广平台
  • frontpage做视频网站查看浏览过的历史记录百度
  • 武汉网络兼职网站建设seo搜索引擎优化实训总结
  • 毅冰做外贸是哪个网站百度seo教程网
  • wordpress恢复数据库长沙网站seo哪家公司好
  • 花瓣设计网站官网入口百度电话客服24小时
  • 怎么做免费的网站空间什么是整合营销并举例说明
  • 盖州网站优化专业地推团队
  • 坂田网站建设服务项目头条权重查询站长工具
  • 品划做网站发外链比较好的平台
  • 微商做色情网站游戏搬砖工作室加盟平台
  • 企业信用信息查询公示系统浙江aso如何优化
  • 58同城网站的建设目标是什么广州seo网站推广
  • 电子商务网站建设与维护展望新闻发稿平台
  • 互联网网站建设新闻中国疫情最新情况
  • 网站域名去哪里备案湖北网站推广