Browse Source

bug修复

master
menghao 2 months ago
parent
commit
6a853c53e1
  1. 2
      ruoyi-admin/src/main/resources/application-druid.yml
  2. 2
      ruoyi-ui/.env.development
  3. 48
      ruoyi-ui/src/views/cesiumMap/index.vue
  4. 2
      ruoyi-ui/vue.config.js

2
ruoyi-admin/src/main/resources/application-druid.yml

@ -8,7 +8,7 @@ spring:
master:
url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: A20040303ctw!
password: 123456
# 从库数据源
slave:
# 从数据源开关/默认关闭

2
ruoyi-ui/.env.development

@ -8,7 +8,7 @@ ENV = 'development'
VUE_APP_BASE_API = '/dev-api'
# 访问地址(绕过 /dev-api 代理,用于解决静态资源/图片访问 401 认证问题)
VUE_APP_BACKEND_URL = 'http://192.168.50.30:8080'
VUE_APP_BACKEND_URL = 'http://192.168.50.145:8080'
# 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true

48
ruoyi-ui/src/views/cesiumMap/index.vue

@ -35,7 +35,7 @@
@delete="deleteEntityFromContextMenu"
@update-property="updateEntityProperty"
/>
<!-- 定位弹窗 -->
<locate-dialog
:visible="locateDialogVisible"
@ -43,7 +43,7 @@
@confirm="handleLocateConfirm"
@cancel="handleLocateCancel"
/>
<!-- 地图右下角比例尺 + 经纬度 -->
<div class="map-info-panel">
<div class="scale-bar">
@ -358,7 +358,7 @@ export default {
const backendUrl = process.env.VUE_APP_BACKEND_URL || '';
return backendUrl + cleanPath;
},
//线style waypoint { pixelSize, color, outlineColor, outlineWidth }line { style, width, color, gapColor, dashLength }
//线
renderRouteWaypoints(waypoints, routeId = 'default', platformId, platform, style) {
if (!waypoints || waypoints.length < 1) return;
// 线
@ -367,6 +367,12 @@ export default {
if (existingLine) {
this.viewer.entities.remove(existingLine);
}
// 线
const platformBillboardId = `route-platform-${routeId}`;
const existingPlatform = this.viewer.entities.getById(platformBillboardId);
if (existingPlatform) {
this.viewer.entities.remove(existingPlatform);
}
// 线
waypoints.forEach((wp,index) => {
const waypointEntityId = `wp_${routeId}_${wp.id}`;
@ -2785,7 +2791,7 @@ export default {
handleLocate() {
this.locateDialogVisible = true
},
handleLocateConfirm(location) {
const { lng, lat } = location
if (this.viewer) {
@ -2801,29 +2807,29 @@ export default {
this.$message.success(`已定位到经度 ${lng.toFixed(4)},纬度 ${lat.toFixed(4)}`)
}
},
handleLocateCancel() {
this.$message.info('已取消定位')
},
updateSelectOptions(refName, dataList, labelField) {
const select = document.querySelector(`select[ref="${refName}"]`)
if (!select) return
const currentValue = select.value
select.innerHTML = ''
const defaultOption = document.createElement('option')
defaultOption.value = ''
defaultOption.textContent = refName === 'routeSelect' ? '请选择航线' : '请选择航点'
select.appendChild(defaultOption)
dataList.forEach(item => {
const option = document.createElement('option')
option.value = item.id
option.textContent = typeof labelField === 'function' ? labelField(item) : item[labelField]
select.appendChild(option)
})
select.value = currentValue
},
initScaleBar() {
@ -3071,25 +3077,25 @@ export default {
if (!positions || positions.length < 2) {
return -1;
}
let closestDistance = Number.MAX_VALUE;
let closestSegmentIndex = -1;
// 线
for (let i = 0; i < positions.length - 1; i++) {
const startPoint = positions[i];
const endPoint = positions[i + 1];
// 线
const distance = this.distanceToSegment(mousePosition, startPoint, endPoint);
//
if (distance < closestDistance) {
closestDistance = distance;
closestSegmentIndex = i;
}
}
//
const threshold = 10; //
return closestDistance < threshold ? closestSegmentIndex : -1;
@ -3099,30 +3105,30 @@ export default {
// 3D
const startScreen = this.viewer.scene.cartesianToCanvasCoordinates(startPoint);
const endScreen = this.viewer.scene.cartesianToCanvasCoordinates(endPoint);
if (!startScreen || !endScreen) {
return Number.MAX_VALUE;
}
// 线
const lineVec = [endScreen.x - startScreen.x, endScreen.y - startScreen.y];
// 线
const mouseVec = [mousePosition.x - startScreen.x, mousePosition.y - startScreen.y];
// 线
const lineLengthSquared = lineVec[0] * lineVec[0] + lineVec[1] * lineVec[1];
if (lineLengthSquared === 0) {
// 线0线
return Math.sqrt(mouseVec[0] * mouseVec[0] + mouseVec[1] * mouseVec[1]);
}
// 线t
const t = Math.max(0, Math.min(1, (mouseVec[0] * lineVec[0] + mouseVec[1] * lineVec[1]) / lineLengthSquared));
//
const projection = [startScreen.x + t * lineVec[0], startScreen.y + t * lineVec[1]];
//
const distanceVec = [mousePosition.x - projection[0], mousePosition.y - projection[1]];
return Math.sqrt(distanceVec[0] * distanceVec[0] + distanceVec[1] * distanceVec[1]);

2
ruoyi-ui/vue.config.js

@ -15,7 +15,7 @@ const CompressionPlugin = require('compression-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const name = process.env.VUE_APP_TITLE || '若依管理系统' // 网页标题
const baseUrl = 'http://192.168.50.30:8080' // 后端接口
const baseUrl = 'http://192.168.50.145:8080' // 后端接口
const port = process.env.port || process.env.npm_config_port || 80 // 端口
// 定义 Cesium 源码路径

Loading…
Cancel
Save