From adf2627fec84e5ba85c55964eab2fcb7c2d3e76d Mon Sep 17 00:00:00 2001 From: zyy <1787816799@qq.com> Date: Wed, 6 May 2020 13:11:37 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=A5=BF=E5=AE=89=E4=BA=8C?= =?UTF-8?q?=E5=8F=B7=E7=BA=BF=E9=BC=A0=E6=A0=87=E7=A7=BB=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/config/skinCode/bejing_01.js | 5 ++- src/jmapNew/config/skinCode/xian_02.js | 8 ++++ src/jmapNew/shape/Section/EMouse.js | 57 ++++++++++++++++++++++-- src/jmapNew/shape/Section/index.js | 2 +- src/utils/baseUrl.js | 4 +- 5 files changed, 69 insertions(+), 7 deletions(-) diff --git a/src/jmapNew/config/skinCode/bejing_01.js b/src/jmapNew/config/skinCode/bejing_01.js index 663af9e08..7b58a90c4 100644 --- a/src/jmapNew/config/skinCode/bejing_01.js +++ b/src/jmapNew/config/skinCode/bejing_01.js @@ -80,7 +80,10 @@ class SkinCode extends defaultStyle { mouseOverStyle: { borderColor: '#fff', borderBackgroundColor: '#22DFDF', - textShadowColor: '#22DFDF' + textShadowColor: '#22DFDF', + nameShow: true, + lineDash: [3, 3], + lineWidthMore: 0 }, line: { width: 5, // 区段宽度 diff --git a/src/jmapNew/config/skinCode/xian_02.js b/src/jmapNew/config/skinCode/xian_02.js index 423135776..72b92bea2 100644 --- a/src/jmapNew/config/skinCode/xian_02.js +++ b/src/jmapNew/config/skinCode/xian_02.js @@ -75,6 +75,14 @@ class SkinCode extends defaultStyle { textPosition: 'inside', // 文字位置 textVerticalAlign: 'middle' // 文字垂直对齐方式 }, + mouseOverStyle: { + borderColor: '#fff', + borderBackgroundColor: '#22DFDF', + textShadowColor: '#22DFDF', + nameShow: false, + lineDash: null, + lineWidthMore: 6 + }, line: { width: 4, // 区段宽度 beyondWidth: 0, // 区段宽超出宽度 diff --git a/src/jmapNew/shape/Section/EMouse.js b/src/jmapNew/shape/Section/EMouse.js index c3f8c6ae7..4bee49938 100644 --- a/src/jmapNew/shape/Section/EMouse.js +++ b/src/jmapNew/shape/Section/EMouse.js @@ -1,7 +1,9 @@ import Group from 'zrender/src/container/Group'; import Text from 'zrender/src/graphic/Text'; import Rect from 'zrender/src/graphic/shape/Rect'; +// import Polygon from 'zrender/src/graphic/shape/Polygon'; import store from '@/store/index_APP_TARGET'; +// import JTriangle from '../../utils/JTriangle'; class EMouse extends Group { constructor(device, code) { super(); @@ -11,7 +13,7 @@ class EMouse extends Group { } create() { // 名称的包围框 - if (this.device.name) { + if (this.device.name && this.device.style.Section.mouseOverStyle.nameShow) { const rect = this.device.name.getBoundingRect(); if (!this.device.isSwitchSection) { this.sectionTextBorder = new Rect({ @@ -69,16 +71,65 @@ class EMouse extends Group { // 区段包围框 if (this.device.section) { const rect = this.device.section.getBoundingRect(); + rect.height = rect.height + this.device.style.Section.mouseOverStyle.lineWidthMore; + const shape = { + x: rect.x, + y: rect.y - this.device.style.Section.mouseOverStyle.lineWidthMore / 2, + width: rect.width, + height: rect.height + }; this.lineBorder = new Rect({ zlevel: this.device.zlevel, z: this.device.z - 1, - shape: rect, + shape: shape, style: { - lineDash: [3, 3], + lineDash: this.device.style.Section.mouseOverStyle.lineDash, stroke: this.device.style.Section.mouseOverStyle.borderColor, fill: this.device.style.transparentColor } }); + // const model = this.device.model; + // const arr = JSON.parse(JSON.stringify(model.points)); + // arr.reverse(); + // const points = []; + // model.points.forEach((ele, index) => { + // if (index == model.points.length - 1) { + // this.triangle = new JTriangle(model.points[index - 1], ele); + // } else { + // console.log(ele, model.points[index + 1]); + // this.triangle = new JTriangle(ele, model.points[index + 1]); + // } + // const directx = this.triangle.drictx; + // const directy = this.triangle.dricty; + // const x = 5 * this.triangle.getSinRate(); + // console.log(this.triangle.getCosRate(), this.triangle.getSinRate()); + // const y = 5; + // points.push([ele.x - (directx * x), ele.y - (directy * y)]); + // }); + // arr.forEach((ele, index) => { + // if (index == arr.length - 1) { + // this.triangle = new JTriangle(arr[index - 1], ele); + // } else { + // this.triangle = new JTriangle(ele, arr[index + 1]); + // } + // const directx = this.triangle.drictx; + // const directy = this.triangle.dricty; + // const x = 5 * this.triangle.getSinRate(); + // const y = 5; + // points.push([ele.x + (directx * x), ele.y + (directy * y)]); + // }); + // this.lineBorder = new Polygon({ + // zlevel: this.device.zlevel, + // z: this.device.z - 1, + // shape: { + // points: points + // }, + // style: { + // lineDash: this.device.style.Section.mouseOverStyle.lineDash, + // stroke: this.device.style.Section.mouseOverStyle.borderColor, + // fill: this.device.style.transparentColor + // } + // }); this.add(this.lineBorder); this.lineBorder.hide(); diff --git a/src/jmapNew/shape/Section/index.js b/src/jmapNew/shape/Section/index.js index 32dc480e3..341c6869e 100644 --- a/src/jmapNew/shape/Section/index.js +++ b/src/jmapNew/shape/Section/index.js @@ -771,7 +771,7 @@ export default class Section extends Group { } createMouseEvent() { // 鼠标事件 - if (this.style.Section.mouseOverStyle) { // 只有北京线路才会有鼠标事件 + if (this.style.Section.mouseOverStyle) { this.mouseEvent = new EMouse(this, this.model.relSwitchCode); this.add(this.mouseEvent); this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); diff --git a/src/utils/baseUrl.js b/src/utils/baseUrl.js index 7cedc6817..e9046878d 100644 --- a/src/utils/baseUrl.js +++ b/src/utils/baseUrl.js @@ -2,9 +2,9 @@ export function getBaseUrl() { let BASE_API; if (process.env.NODE_ENV === 'development') { // BASE_API = 'https://joylink.club/jlcloud'; - // BASE_API = 'https://test.joylink.club/jlcloud'; + BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'http://192.168.3.5:9000'; // 袁琪 - BASE_API = 'http://192.168.3.6:9000'; // 旭强 + // BASE_API = 'http://192.168.3.6:9000'; // 旭强 // BASE_API = 'http://192.168.3.41:9000'; // 张赛 // BASE_API = 'http://192.168.3.82:9000'; // 杜康 // BASE_API = 'http://192.168.3.41:9000'; // 张赛