<template>
|
<div>
|
<public-box class="campus-nav-box">
|
<template slot="public-box-header">
|
<div class="title">
|
<img class="icon deblurring" :src="publicPath + 'img/icon/xndh.png'" alt />
|
<span>校区内导航</span>
|
</div>
|
<img class="close deblurring" :src="publicPath + 'img/navicon/close.png'" alt @click="closeModel" />
|
</template>
|
<template slot="public-box-content">
|
<div class="tab">
|
<ul v-if="twoOrThree == '真三维'">
|
<li @click="tabClick('步行')" :class="{ on: tabOneFlag }">
|
<i></i>
|
步行
|
</li>
|
<li @click="tabClick('驾车')" :class="{ on: tabTwoFlag }">
|
<i></i>
|
驾车
|
</li>
|
</ul>
|
<v-else>
|
<ul>
|
<li>江西科技师范大学欢迎您!</li>
|
</ul>
|
</v-else>
|
</div>
|
<div class="container">
|
<div>
|
<div id="ToNameContainer">
|
<el-input v-model="toNameText" @input="toNameChange" placeholder="起点……">
|
<template slot="prepend">
|
<i class="el-icon-location mydingwei" style="color: green"></i>
|
</template>
|
</el-input>
|
<div v-show="toNameShow" class="toname-value-box">
|
<ul>
|
<li v-for="(item, index) in toNameList" :key="index" @click="originChange(item)">{{
|
item.mechanismname
|
}}</li>
|
</ul>
|
</div>
|
</div>
|
<div id="ComeNameContainer">
|
<el-input v-model="comeNameText" @input="comeNameChange" placeholder="终点……">
|
<template slot="prepend">
|
<i class="el-icon-location mydingwei" style="color: red"></i>
|
</template>
|
</el-input>
|
<div v-show="comeNameShow" class="comename-value-box">
|
<ul>
|
<li v-for="(item, index) in comeNameList" :key="index" @click="terminusChange(item)">{{
|
item.mechanismname
|
}}</li>
|
</ul>
|
</div>
|
</div>
|
</div>
|
<div>
|
<el-button @click="startNavigation" type="primary">导航</el-button>
|
</div>
|
</div>
|
|
<div class="path-box" v-show="pathBoxShow">
|
<ul>
|
<li v-for="(item, index) in pathBoxList" :key="index">{{ item.instruction }}</li>
|
</ul>
|
</div>
|
</template>
|
</public-box>
|
|
<div id="overlay" v-show="toolTipShow">
|
{{ toolTipText }}
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import { mapGetters } from 'vuex'
|
import { getSearchList } from '@/api/pc/public/search'
|
import axios from 'axios'
|
|
import OlOverlay from "ol/Overlay"
|
|
import VectorLayer from "ol/layer/Vector"
|
import VectorSource from "ol/source/Vector"
|
import Feature from 'ol/Feature.js'
|
import LineString from 'ol/geom/LineString.js'
|
|
import Point from 'ol/geom/Point.js'
|
import { Icon, Style, Fill, Text, Stroke } from 'ol/style.js'
|
|
import { WGS84ToGCJ02 } from '@/utils/CoordTransform'
|
|
const CamPusNavLayer = {
|
campusStartLayer: null,
|
campusEndLayer: null,
|
campusRouteLayer: null
|
}
|
|
let overlayLayer
|
|
let pathUrl = [
|
{
|
key: 1,
|
url: "https://fkxt.jxstnu.edu.cn/changjing/arcgis155/rest/services/hjzlw/NAServer/%E8%B7%AF%E5%BE%84/solve",
|
},
|
{
|
key: 2,
|
url: "https://fkxt.jxstnu.edu.cn/changjing/arcgis155/rest/services/fllw/NAServer/%E8%B7%AF%E5%BE%84/solve",
|
}
|
]
|
|
export default {
|
name: 'campusNav',
|
data () {
|
return {
|
publicPath: process.env.BASE_URL,
|
map2D: this.$store.state.openlayerData.openlayers.map2D,
|
tabOneFlag: true,
|
tabTwoFlag: false,
|
navigationWay: '步行',
|
toNameText: '',
|
comeNameText: '',
|
toNameList: [],
|
comeNameList: [],
|
toNameShow: false,
|
comeNameShow: false,
|
|
overChouse: false,
|
butChouse: '',
|
|
pathBoxShow: false,
|
pathBoxList: [],
|
|
isOverRouter: false, // 是否启用了导航
|
|
toolTipShow: false,
|
toolTipTitle: '',
|
toolTipText: ''
|
}
|
},
|
|
inject: ["layoutElement"],
|
|
computed: {
|
...mapGetters([
|
'twoOrThree',
|
// 起点
|
'startingPoint',
|
// 终点
|
'terminus',
|
// 出发名称
|
'getToName',
|
// 到达名称
|
'comeName',
|
// 点信息
|
'pointPosition',
|
'campusNavFlag'
|
])
|
},
|
watch: {
|
getToName: {
|
immediate: true,
|
handler (newCode, oldCode) {
|
this.toNameText = newCode
|
}
|
},
|
comeName: {
|
immediate: true,
|
handler (newCode, oldCode) {
|
this.comeNameText = newCode
|
}
|
},
|
campusNavFlag: {
|
immediate: true,
|
handler (newCode, oldCode) {
|
if (newCode == false) {
|
this.navigationWay = '步行'
|
this.tabOneFlag = true
|
this.tabTwoFlag = false
|
}
|
}
|
}
|
},
|
created () {
|
},
|
mounted () {
|
const leftBut = document.querySelectorAll('.el-input-group__prepend')
|
leftBut[0].onclick = () => {
|
this.chouseDian('start')
|
}
|
leftBut[1].onclick = () => {
|
this.chouseDian('end')
|
}
|
},
|
methods: {
|
chouseDian (val) {
|
const that = this
|
|
that.clearLayer('campusRouteLayer', true)
|
|
// 添加标记
|
if (val == 'start') {
|
that.clearLayer('campusStartLayer')
|
|
that.toolTipTitle = '点击选择起点'
|
|
if (that.isOverRouter) {
|
that.$store.commit('SET_STARTINGPOINT', [])
|
|
CamPusNavLayer.campusStartLayer.getSource().addFeature(that.getCurItemFeature({
|
lng: this.startingPoint[0],
|
lat: this.startingPoint[1],
|
url: this.publicPath + 'img/navicon/start.png',
|
}))
|
}
|
} else if (val == 'end') {
|
that.clearLayer('campusEndLayer')
|
|
that.toolTipTitle = '点击选择终点'
|
|
if (that.isOverRouter) {
|
that.$store.commit('SET_TERMINUS', [])
|
|
CamPusNavLayer.campusRouteLayer.getSource().addFeature(that.getCurItemFeature({
|
lng: this.terminus[0],
|
lat: this.terminus[1],
|
url: this.publicPath + 'img/navicon/end.png',
|
}))
|
}
|
}
|
|
this.butChouse = val
|
// 关闭其他地图事件
|
that.$store.commit('set_closeMapClick', true)
|
|
that.overChouse = false // 开启事件
|
|
that.map2D.on('click', that.mapHandlerClick)
|
that.map2D.on('pointermove', that.mapHandlerMove)
|
},
|
|
mapHandlerClick (event) {
|
const that = this
|
const coordinate = that.map2D.getEventCoordinate(event.originalEvent)
|
|
if (that.butChouse == 'start') {
|
that.toNameText = '自定义起点'
|
// 传输坐标数据
|
that.$store.commit('SET_STARTINGPOINT', [...coordinate, 0])
|
|
CamPusNavLayer.campusStartLayer.getSource().addFeature(that.getCurItemFeature({
|
lng: Number(coordinate[0]),
|
lat: Number(coordinate[1]),
|
url: this.publicPath + 'img/navicon/start.png',
|
}))
|
} else if (that.butChouse == 'end') {
|
that.comeNameText = '自定义终点'
|
// 传输坐标数据
|
that.$store.commit('SET_TERMINUS', [...coordinate, 0])
|
|
CamPusNavLayer.campusEndLayer.getSource().addFeature(that.getCurItemFeature({
|
lng: Number(coordinate[0]),
|
lat: Number(coordinate[1]),
|
url: this.publicPath + 'img/navicon/end.png',
|
}))
|
}
|
|
this.toolTipShow = false
|
|
that.map2D.un('click', that.mapHandlerClick)
|
that.map2D.un('pointermove', that.mapHandlerMove)
|
|
setTimeout(() => {
|
that.$store.commit('set_closeMapClick', false)
|
}, 500)
|
},
|
|
mapHandlerMove (event) {
|
const that = this
|
that.moveOverlay(event.coordinate)
|
},
|
|
addOverlay (center) {
|
//此处的overlayLayer要是全局变量,其他的函数内要用到
|
overlayLayer = new OlOverlay({
|
element: document.getElementById('overlay'),
|
position: center,
|
positioning: 'center-center',
|
stopEvent: false
|
})
|
this.map2D.addOverlay(overlayLayer)
|
},
|
|
moveOverlay (coorC) {
|
if (!overlayLayer) {
|
this.addOverlay(coorC)
|
}
|
|
this.toolTipShow = true
|
this.toolTipText = this.toolTipTitle
|
|
overlayLayer.setPosition(coorC)
|
},
|
|
closeModel () {
|
if (this.$route.path.indexOf('/campusnavi') != -1) {
|
this.$store.dispatch('delVisitedViews', this.$route)
|
this.$router.push('/pcLayout/default')
|
}
|
|
this.toNameText = ''
|
this.toNameList = []
|
this.toNameShow = false
|
this.comeNameText = ''
|
this.comeNameList = []
|
this.comeNameShow = false
|
this.pathBoxList = []
|
this.pathBoxShow = false
|
|
if (CamPusNavLayer.campusStartLayer != null) {
|
CamPusNavLayer.campusStartLayer.getSource().clear()
|
}
|
|
if (CamPusNavLayer.campusEndLayer != null) {
|
CamPusNavLayer.campusEndLayer.getSource().clear()
|
}
|
|
if (CamPusNavLayer.campusRouteLayer != null) {
|
CamPusNavLayer.campusRouteLayer.getSource().clear()
|
this.isOverRouter = false
|
}
|
|
this.$store.commit('SET_COMENAME', '')
|
this.$store.commit('SET_TERMINUS', null)
|
this.$store.commit('SET_GETTONAME', '')
|
this.$store.commit('SET_STARTINGPOINT', null)
|
this.$store.commit('SET_CAMPUSNAVFLAG', false)
|
this.$store.commit('set_closeMapClick', false)
|
},
|
|
tabClick (param) {
|
this.navigationWay = param
|
this.tabOneFlag = !this.tabOneFlag
|
this.tabTwoFlag = !this.tabTwoFlag
|
},
|
|
startNavigation () {
|
const that = this
|
that.clearLayer('campusRouteLayer', true)
|
that.clearLayer('campusStartLayer')
|
that.clearLayer('campusEndLayer')
|
|
if (this.startingPoint == null) {
|
this.$message('请输入起点!!!')
|
}
|
if (this.terminus == null) {
|
this.$message('请输入终点!!!')
|
}
|
|
CamPusNavLayer.campusStartLayer.getSource().addFeature(that.getCurItemFeature({
|
lng: this.startingPoint[0],
|
lat: this.startingPoint[1],
|
url: this.publicPath + 'img/navicon/start.png',
|
}))
|
|
CamPusNavLayer.campusEndLayer.getSource().addFeature(that.getCurItemFeature({
|
lng: this.terminus[0],
|
lat: this.terminus[1],
|
url: this.publicPath + 'img/navicon/end.png',
|
}))
|
|
var routes = ''
|
|
let curPath = pathUrl.find(item => item.key == this.layoutElement.campusValue)
|
|
var startLog = Number(this.startingPoint[0]).toFixed(6)
|
var startLat = Number(this.startingPoint[1]).toFixed(6)
|
var endLog = Number(this.terminus[0]).toFixed(6)
|
var endLat = Number(this.terminus[1]).toFixed(6)
|
|
var origin = WGS84ToGCJ02(startLog, startLat)
|
var destination = WGS84ToGCJ02(endLog, endLat)
|
|
if (this.twoOrThree == '真三维') {
|
if (this.navigationWay == '步行') {
|
axios
|
.get('https://restapi.amap.com/v3/direction/walking', {
|
params: {
|
origin: `${origin[0].toFixed(6) + ',' + origin[1].toFixed(6)}`,
|
destination: `${destination[0].toFixed(6) + ',' + destination[1].toFixed(6)
|
}`,
|
key: '4b3e1db3211054ce5b466407cbb9d221',
|
output: 'json'
|
}
|
})
|
.then((res) => {
|
if (res.data.info == 'OVER_DIRECTION_RANGE') {
|
this.$message({
|
message: '超出步行范围!',
|
type: 'warning',
|
duration: 3000
|
})
|
}
|
|
this.pathBoxList = []
|
|
res.data.route.paths[0].steps.forEach((item) => {
|
this.pathBoxList.push({ instruction: item.instruction, orientation: item.orientation, action: item.action })
|
|
item.polyline = item.polyline.split(';')
|
|
var lineArr = []
|
|
item.polyline.forEach((it) => {
|
it = it.split(',')
|
lineArr.push(
|
global.DC.CoordTransform.GCJ02ToWGS84(it[0], it[1]).join(',')
|
)
|
})
|
|
lineArr = lineArr.join(';')
|
|
lineArr += ';'
|
|
routes += lineArr
|
})
|
|
this.pathBoxShow = true
|
|
routes =
|
startLog + ',' + startLat + ';' + routes + endLog + ',' + endLat
|
|
const polyline = new global.DC.Polyline(routes)
|
polyline.setStyle({
|
width: 6,
|
material: global.DC.Color.RED,
|
clampToGround: true
|
})
|
|
CamPusNavLayer.campusRouteLayer.addOverlay(polyline)
|
if (this.twoOrThree == '真三维') {
|
global.viewer.flyTo(CamPusNavLayer.campusRouteLayer)
|
} else {
|
var longitude = null
|
var latitude = null
|
startLog = Number(startLog)
|
endLog = Number(endLog)
|
if (startLog > endLog) {
|
longitude = (startLog - endLog) / 2 + endLog
|
} else {
|
longitude = (endLog - startLog) / 2 + startLog
|
}
|
startLat = Number(startLat)
|
endLat = Number(endLat)
|
if (startLat > endLat) {
|
latitude = (startLat - endLat) / 2 + endLat
|
} else {
|
latitude = (endLat - startLat) / 2 + startLat
|
}
|
that.isOverRouter = true
|
global.viewer.camera.setView({
|
// Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
|
// fromDegrees()方法,将经纬度和高程转换为世界坐标
|
destination: global.DC.Namespace.Cesium.Cartesian3.fromDegrees(
|
longitude,
|
latitude,
|
600
|
),
|
orientation: {
|
// 指向
|
heading: global.DC.Namespace.Cesium.Math.toRadians(0, 0),
|
// 视角
|
pitch: global.DC.Namespace.Cesium.Math.toRadians(-90),
|
roll: 0.0
|
}
|
})
|
}
|
})
|
} else {
|
axios
|
.get('https://restapi.amap.com/v3/direction/driving', {
|
params: {
|
origin: `${origin[0].toFixed(6) + ',' + origin[1].toFixed(6)}`,
|
destination: `${destination[0].toFixed(6) + ',' + destination[1].toFixed(6)
|
}`,
|
key: '4b3e1db3211054ce5b466407cbb9d221',
|
strategy: 2,
|
extensions: 'all',
|
output: 'json'
|
}
|
})
|
.then((res) => {
|
res.data.route.paths[0].steps.forEach((item) => {
|
item.polyline = item.polyline.split(';')
|
|
var lineArr = []
|
|
item.polyline.forEach((it) => {
|
it = it.split(',')
|
lineArr.push(
|
global.DC.CoordTransform.GCJ02ToWGS84(it[0], it[1]).join(',')
|
)
|
})
|
|
lineArr = lineArr.join(';')
|
|
lineArr += ';'
|
|
routes += lineArr
|
})
|
|
routes =
|
startLog + ',' + startLat + ';' + routes + endLog + ',' + endLat
|
|
const polyline = new global.DC.Polyline(routes)
|
polyline.setStyle({
|
width: 6,
|
material: global.DC.Color.RED,
|
clampToGround: true
|
})
|
|
CamPusNavLayer.campusRouteLayer.addOverlay(polyline)
|
|
if (this.twoOrThree == '真三维') {
|
global.viewer.flyTo(CamPusNavLayer.campusRouteLayer)
|
} else {
|
var longitude = null
|
var latitude = null
|
startLog = Number(startLog)
|
endLog = Number(endLog)
|
if (startLog > endLog) {
|
longitude = (startLog - endLog) / 2 + endLog
|
} else {
|
longitude = (endLog - startLog) / 2 + startLog
|
}
|
startLat = Number(startLat)
|
endLat = Number(endLat)
|
if (startLat > endLat) {
|
latitude = (startLat - endLat) / 2 + endLat
|
} else {
|
latitude = (endLat - startLat) / 2 + startLat
|
}
|
that.isOverRouter = true
|
global.viewer.camera.setView({
|
// Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
|
// fromDegrees()方法,将经纬度和高程转换为世界坐标
|
destination: global.DC.Namespace.Cesium.Cartesian3.fromDegrees(
|
longitude,
|
latitude,
|
600
|
),
|
orientation: {
|
// 指向
|
heading: global.DC.Namespace.Cesium.Math.toRadians(0, 0),
|
// 视角
|
pitch: global.DC.Namespace.Cesium.Math.toRadians(-90),
|
roll: 0.0
|
}
|
})
|
}
|
})
|
}
|
} else {
|
if (this.navigationWay == '步行') {
|
axios
|
.get(curPath.url, {
|
params: {
|
stops: { features: [{ geometry: { x: startLog, y: startLat } }, { geometry: { x: endLog, y: endLat } }] },
|
returnDirections: false,
|
returnRoutes: true,
|
f: 'json'
|
}
|
})
|
.then((res) => {
|
if (res.data.info == 'OVER_DIRECTION_RANGE' || 'error' in res.data) {
|
this.$message({
|
message: '超出步行范围!',
|
type: 'warning',
|
duration: 3000,
|
onClose () {
|
that.clearLayer('campusRouteLayer', true)
|
}
|
})
|
|
}
|
|
this.pathBoxList = []
|
|
let polyLineData = res.data.routes.features[0].geometry.paths[0].map(item => {
|
return [item[0], item[1]]
|
})
|
|
this.pathBoxShow = true
|
|
CamPusNavLayer.campusRouteLayer.getSource().addFeature(that.drawPolyline(polyLineData))
|
|
if (this.twoOrThree == '真三维') {
|
global.viewer.flyTo(CamPusNavLayer.campusRouteLayer)
|
} else {
|
var longitude = null
|
var latitude = null
|
startLog = Number(startLog)
|
endLog = Number(endLog)
|
if (startLog > endLog) {
|
longitude = (startLog - endLog) / 2 + endLog
|
} else {
|
longitude = (endLog - startLog) / 2 + startLog
|
}
|
startLat = Number(startLat)
|
endLat = Number(endLat)
|
if (startLat > endLat) {
|
latitude = (startLat - endLat) / 2 + endLat
|
} else {
|
latitude = (endLat - startLat) / 2 + startLat
|
}
|
that.isOverRouter = true
|
|
this.map2D.getView().setCenter([longitude, latitude])
|
}
|
})
|
} else {
|
axios
|
.get('https://dev.jxpskj.com:8023/arcgis/rest/services/jglw/NAServer/%E8%B7%AF%E5%BE%84/solve', {
|
params: {
|
// stops: {features:[{geometry:{x:116.026051,y:28.686474}},{geometry:{x:116.024876,y:28.678025}}]},
|
stops: { features: [{ geometry: { x: startLog, y: startLat } }, { geometry: { x: endLog, y: endLat } }] },
|
returnDirections: false,
|
returnRoutes: true,
|
f: 'json'
|
}
|
})
|
.then((res) => {
|
res.data.routes.features[0].geometry.paths[0].forEach((item) => {
|
routes += `${item[0]},${item[1]};`
|
})
|
|
routes =
|
startLog + ',' + startLat + ';' + routes + endLog + ',' + endLat
|
|
const polyline = new global.DC.Polyline(routes)
|
polyline.setStyle({
|
width: 6,
|
material: global.DC.Color.RED,
|
clampToGround: true
|
})
|
|
CamPusNavLayer.campusRouteLayer.addOverlay(polyline)
|
|
if (this.twoOrThree == '真三维') {
|
global.viewer.flyTo(CamPusNavLayer.campusRouteLayer)
|
} else {
|
var longitude = null
|
var latitude = null
|
startLog = Number(startLog)
|
endLog = Number(endLog)
|
if (startLog > endLog) {
|
longitude = (startLog - endLog) / 2 + endLog
|
} else {
|
longitude = (endLog - startLog) / 2 + startLog
|
}
|
startLat = Number(startLat)
|
endLat = Number(endLat)
|
if (startLat > endLat) {
|
latitude = (startLat - endLat) / 2 + endLat
|
} else {
|
latitude = (endLat - startLat) / 2 + startLat
|
}
|
that.isOverRouter = true
|
global.viewer.camera.setView({
|
// Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
|
// fromDegrees()方法,将经纬度和高程转换为世界坐标
|
destination: global.DC.Namespace.Cesium.Cartesian3.fromDegrees(
|
longitude,
|
latitude,
|
600
|
),
|
orientation: {
|
// 指向
|
heading: global.DC.Namespace.Cesium.Math.toRadians(0, 0),
|
// 视角
|
pitch: global.DC.Namespace.Cesium.Math.toRadians(-90),
|
roll: 0.0
|
}
|
})
|
}
|
})
|
}
|
}
|
},
|
|
getCurItemFeature (params) {
|
const iconFeature = new Feature({
|
geometry: new Point([Number(params.lng), Number(params.lat)]),
|
type: 'navigationPoint'
|
})
|
|
iconFeature.setStyle(new Style({
|
image: new Icon({
|
scale: 1,
|
imgSize: [48, 48],
|
src: params.url,
|
// 设置图标偏移
|
anchor: [24, 44],
|
// X方向单位:分数
|
anchorXUnits: 'pixels',
|
// Y方向单位:像素
|
anchorYUnits: 'pixels',
|
})
|
}))
|
|
return iconFeature
|
},
|
|
drawPolyline (item) {
|
let lineFeature = new Feature({
|
geometry: new LineString(item)
|
})
|
|
let style = new Style({
|
stroke: new Stroke({
|
color: 'red', // 线条颜色,根据需要设置
|
width: 6 // 线条宽度,根据需要设置
|
})
|
})
|
|
// 设置线要素的样式
|
lineFeature.setStyle(style)
|
|
return lineFeature
|
},
|
|
clearLayer (layerName, flag = false) {
|
if (flag) {
|
this.pathBoxList = []
|
this.pathBoxShow = false
|
}
|
|
if (CamPusNavLayer[layerName] == null) {
|
CamPusNavLayer[layerName] = new VectorLayer({
|
// 图标图层
|
zIndex: 33,
|
source: new VectorSource(),
|
})
|
this.map2D.addLayer(CamPusNavLayer[layerName])
|
} else {
|
CamPusNavLayer[layerName].getSource().clear()
|
}
|
},
|
|
toNameChange () {
|
if (this.toNameText == '') {
|
this.toNameList = []
|
this.toNameShow = false
|
return
|
}
|
|
getSearchList({ mechanismName: this.toNameText, campus: this.layoutElement.campusValue }).then((res) => {
|
if (res.data.data.length > 0) {
|
this.toNameList = res.data.data
|
this.toNameShow = true
|
}
|
})
|
},
|
|
comeNameChange () {
|
if (this.comeNameText == '') {
|
this.comeNameList = []
|
this.comeNameShow = false
|
return
|
}
|
|
getSearchList({ mechanismName: this.comeNameText, campus: this.layoutElement.campusValue }).then((res) => {
|
if (res.data.data.length > 0) {
|
this.comeNameList = res.data.data
|
this.comeNameShow = true
|
}
|
})
|
},
|
|
shortcutShow (event) {
|
var toBox = document.getElementById('ToNameContainer')
|
|
if (toBox) {
|
if (!toBox.contains(event.target)) {
|
// 这句是说如果我们点击到了id为myPanel以外的区域
|
this.toNameShow = false
|
}
|
}
|
|
var comeBox = document.getElementById('ComeNameContainer')
|
|
if (comeBox) {
|
if (!comeBox.contains(event.target)) {
|
// 这句是说如果我们点击到了id为myPanel以外的区域
|
this.comeNameShow = false
|
}
|
}
|
},
|
|
originChange (param) {
|
if (this.twoOrThree == '真三维') {
|
this.$store.commit('SET_POINTPOSITION', [
|
Number(param.jd),
|
Number(param.wd),
|
Number(param.gd),
|
Number(param.heading),
|
Number(param.pitch),
|
Number(param.roll)
|
])
|
} else {
|
const arr = param.x.split(',')
|
this.$store.commit('SET_POINTPOSITION', [
|
Number(arr[0]),
|
Number(arr[1]),
|
Number(param.gd),
|
Number(param.heading),
|
Number(param.pitch),
|
Number(param.roll)
|
])
|
}
|
this.$store.commit('SET_GETTONAME', param.mechanismname)
|
this.$store.commit('SET_STARTINGPOINT', this.pointPosition)
|
this.toNameShow = false
|
this.toNameList = []
|
},
|
|
terminusChange (param) {
|
if (this.twoOrThree == '真三维') {
|
this.$store.commit('SET_POINTPOSITION', [
|
Number(param.jd),
|
Number(param.wd),
|
Number(param.gd),
|
Number(param.heading),
|
Number(param.pitch),
|
Number(param.roll)
|
])
|
} else {
|
const arr = param.x.split(',')
|
this.$store.commit('SET_POINTPOSITION', [
|
Number(arr[0]),
|
Number(arr[1]),
|
Number(param.gd),
|
Number(param.heading),
|
Number(param.pitch),
|
Number(param.roll)
|
])
|
}
|
|
this.$store.commit('SET_COMENAME', param.mechanismname)
|
this.$store.commit('SET_TERMINUS', this.pointPosition)
|
this.comeNameShow = false
|
this.comeNameList = []
|
}
|
},
|
destroyed () {
|
// this.closeModel();
|
}
|
}
|
</script>
|
|
<style lang="scss" scope>
|
#overlay {
|
padding: 0 10px;
|
height: 36px;
|
line-height: 36px;
|
transform: translate(calc(50% + 16px), 0);
|
color: #fff;
|
background: #000;
|
border-radius: 8px;
|
|
&::after {
|
content: '';
|
position: absolute;
|
top: 50%;
|
left: 0;
|
width: 0;
|
height: 0;
|
border: 8px solid #000;
|
//可以通过改变边框的颜色来控制三角形的方向
|
border-color: transparent #000 transparent transparent;
|
transform: translate(-100%, -50%);
|
}
|
}
|
</style>
|