Compare commits
3 Commits
0dc0b98fdb
...
047cf2d4ef
| Author | SHA1 | Date | |
|---|---|---|---|
| 047cf2d4ef | |||
| 47e2bcfb59 | |||
| 52b753885d |
@ -43,10 +43,10 @@ export default defineConfig({
|
||||
})
|
||||
]
|
||||
// server: {
|
||||
// port: 8808,
|
||||
// port: 8848,
|
||||
// proxy: {
|
||||
// '/api': {
|
||||
// target: localStorage.getItem('ip') || 'http://127.0.0.1:8808',
|
||||
// target: localStorage.getItem('ip') || 'http://127.0.0.1:8848',
|
||||
// changeOrigin: true,
|
||||
// rewrite: (path) => path.replace(/^\/api/, '')
|
||||
// }
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
//@ts-nocheck
|
||||
import router from '@renderer/router'
|
||||
import axios from 'axios'
|
||||
import type {
|
||||
@ -10,16 +11,17 @@ import type {
|
||||
const pendingRequests = new Map<string, AbortController>()
|
||||
let baseURL: any
|
||||
if (window && window.process && window.process.type === 'renderer') {
|
||||
// baseURL = localStorage.getItem('ip') ||'http://192.168.110.25:8848'|| 'http://127.0.0.1:8808'
|
||||
baseURL = 'http://127.0.0.1:8848'
|
||||
baseURL = localStorage.getItem('ip') || 'http://127.0.0.1:8848'
|
||||
// baseURL = 'http://127.0.0.1:8848'
|
||||
} else {
|
||||
localStorage.setItem('ip', 'http://192.168.110.25:8848')
|
||||
baseURL = 'http://192.168.110.25:8848'
|
||||
}
|
||||
localStorage.setItem('service', baseURL)
|
||||
// localStorage.setItem('service', baseURL)
|
||||
|
||||
// 创建自定义配置的axios实例
|
||||
const service: AxiosInstance = axios.create({
|
||||
baseURL: baseURL,
|
||||
// baseURL: baseURL,
|
||||
timeout: 300000,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@ -35,6 +37,10 @@ function getRequestKey(config: AxiosRequestConfig): string {
|
||||
// 请求拦截器
|
||||
service.interceptors.request.use(
|
||||
(config: InternalAxiosRequestConfig) => {
|
||||
if (!config.url.startsWith("http://"))
|
||||
config.url = new URL(config.url,
|
||||
localStorage.getItem('ip')
|
||||
).href;
|
||||
const key = getRequestKey(config)
|
||||
|
||||
// 检查是否有相同请求正在进行
|
||||
|
||||
@ -3,7 +3,7 @@ import { renderVector } from '../views/components/tree/components/hooks/renderVe
|
||||
export const initMapData = async (type, data, cd) => {
|
||||
let entityObject
|
||||
let options
|
||||
let baseURL = localStorage.getItem('service')
|
||||
let baseURL = localStorage.getItem('ip')
|
||||
switch (type) {
|
||||
case 'groundText':
|
||||
entityObject = new YJ.Obj.GroundText(window.earth, data)
|
||||
|
||||
1
src/renderer/src/global.d.ts
vendored
1
src/renderer/src/global.d.ts
vendored
@ -6,7 +6,6 @@ interface Window {
|
||||
sendMessage: (msg: string) => void
|
||||
onReply: (callback: (msg: string) => void) => void
|
||||
}
|
||||
isStandAlone: any
|
||||
treeObj: any
|
||||
AllNodes: any
|
||||
}
|
||||
|
||||
@ -151,7 +151,7 @@ const fs = require('fs')
|
||||
const eventBus: any = inject('bus')
|
||||
var clickTreeNode: any = reactive({})
|
||||
var leftClickTreeNode: any = reactive({})
|
||||
const service = ref(localStorage.getItem('service'))
|
||||
const service = ref(localStorage.getItem('ip'))
|
||||
|
||||
interface TypeNode {
|
||||
id: string
|
||||
|
||||
@ -159,7 +159,7 @@ const fs = require('fs')
|
||||
const eventBus: any = inject('bus')
|
||||
var clickTreeNode: any = reactive({})
|
||||
var leftClickTreeNode: any = reactive({})
|
||||
const service = ref(localStorage.getItem('service'))
|
||||
const service = ref(localStorage.getItem('ip'))
|
||||
|
||||
interface TypeNode {
|
||||
id: string
|
||||
|
||||
@ -193,7 +193,7 @@ const fs = require('fs')
|
||||
const eventBus: any = inject('bus')
|
||||
const imageRef: any = ref('')
|
||||
var clickTreeNode: any = reactive({})
|
||||
const service = ref(localStorage.getItem('service'))
|
||||
const service = ref(localStorage.getItem('ip'))
|
||||
|
||||
interface TypeNode {
|
||||
id: string
|
||||
|
||||
@ -3,11 +3,8 @@
|
||||
<div class="leftSideSecondBox">
|
||||
<template v-if="obj">
|
||||
<div class="menuItem" v-for="value in obj.children" @click="handleClick(value)">
|
||||
<img
|
||||
:src="'http://localhost:' + `${availablePort}` + '/icon/' + `${value}` + '.png'"
|
||||
style="color: rgb(255, 0, 0)"
|
||||
alt=""
|
||||
/>
|
||||
<img :src="'http://localhost:' + `${availablePort}` + '/icon/' + `${value}` + '.png'"
|
||||
style="color: rgb(255, 0, 0)" alt="" />
|
||||
<!-- <svg-icon :name="value" :size="20" color="rgba(0, 255, 255, 1)"></svg-icon> -->
|
||||
<span :style="{ color: !clickChange[value] ? 'var(--color-text)' : 'rgb(255,0,0)' }">{{
|
||||
t(`${obj.key}.${value}`)
|
||||
@ -34,6 +31,7 @@ import {
|
||||
} from '@/utils/communication'
|
||||
import { ElMessage, ElLoading } from 'element-plus'
|
||||
import dayjs from 'dayjs'
|
||||
import { renderVector } from '../tree/components/hooks/renderVector'
|
||||
const { ipcRenderer } = require('electron')
|
||||
const { t } = useI18n()
|
||||
const { findParentId, findTreeIndex, cusAddNodes } = useTreeNode()
|
||||
@ -600,7 +598,7 @@ const methodMap = {
|
||||
filters: [{ name: '保存图片', extensions: ['jpg'] }]
|
||||
})
|
||||
$recvElectronChanel('selectedFileItem', (e, path) => {
|
||||
fs.writeFile(path, dataBuffer, (res) => {})
|
||||
fs.writeFile(path, dataBuffer, (res) => { })
|
||||
})
|
||||
}
|
||||
|
||||
@ -734,11 +732,11 @@ const methodMap = {
|
||||
TreeApi.addOtherSource(paramsData)
|
||||
paramsData.isShow = true
|
||||
paramsData.params = JSON.stringify(paramsData.params)
|
||||
;(window as any).pressModelMap.set(id + '_' + selectedNode.id, paramsData)
|
||||
;(window as any).pressModelEntities.set(id, flat)
|
||||
; (window as any).pressModelMap.set(id + '_' + selectedNode.id, paramsData)
|
||||
; (window as any).pressModelEntities.set(id, flat)
|
||||
cusAddNodes(window.treeObj, paramsData.parentId, [paramsData])
|
||||
// //鼠标右键点击事件
|
||||
flat.onRightClick = () => {}
|
||||
flat.onRightClick = () => { }
|
||||
// _entityMap.set(node.source_id, flat)
|
||||
} else {
|
||||
// this.$message.warning('至少三个点')
|
||||
@ -842,13 +840,20 @@ const methodMap = {
|
||||
let selectedNode = window.treeObj.getSelectedNodes()[0]
|
||||
let DbOption: any = {
|
||||
params: {
|
||||
richText: {}
|
||||
id: id,
|
||||
path: path[0],
|
||||
field: 'id',
|
||||
name: name,
|
||||
headTables: [],
|
||||
opacity: 1,
|
||||
color: 'rgba(0,255,184,0.5)',
|
||||
show: true
|
||||
},
|
||||
id,
|
||||
sourceName: name,
|
||||
sourceType: 'gdb',
|
||||
sourceType: 'vector',
|
||||
// isShow: true,
|
||||
sourcePath: path[0],
|
||||
// sourcePath: path[0],
|
||||
parentId: selectedNode
|
||||
? selectedNode.sourceType == 'directory'
|
||||
? selectedNode.id
|
||||
@ -858,7 +863,9 @@ const methodMap = {
|
||||
TreeApi.addOtherSource(DbOption)
|
||||
DbOption.isShow = true
|
||||
DbOption.params = JSON.stringify(DbOption.params)
|
||||
// cusAddNodes(window.treeObj, DbOption.parentId, [DbOption])
|
||||
cusAddNodes(window.treeObj, DbOption.parentId, [DbOption])
|
||||
let entityObject = renderVector(DbOption, true);
|
||||
(window as any)._entityMap.set(id, entityObject)
|
||||
// }
|
||||
// })
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ const isShowPup = ref(false)
|
||||
const eventBus: any = inject('bus')
|
||||
const { cusUpdateNode } = useTreeNode()
|
||||
var modelName = ref('')
|
||||
const service = ref(localStorage.getItem('service'))
|
||||
const service = ref(localStorage.getItem('ip'))
|
||||
|
||||
//tab
|
||||
interface Model {
|
||||
|
||||
@ -45,7 +45,7 @@ const eventBus: any = inject('bus')
|
||||
const viewPointHeight: any = ref(1.8)
|
||||
var rowData: any = reactive([])
|
||||
var imageData: any = ref(null)
|
||||
const service = ref(localStorage.getItem('service'))
|
||||
const service = ref(localStorage.getItem('ip'))
|
||||
// var newData: any = reactive({
|
||||
// name: ''
|
||||
// })
|
||||
|
||||
@ -122,7 +122,7 @@ const eventBus: any = inject('bus')
|
||||
var modelName = ref('')
|
||||
var clickTreeNode: any = ref('')
|
||||
|
||||
const service = ref(localStorage.getItem('service'))
|
||||
const service = ref(localStorage.getItem('ip'))
|
||||
|
||||
//tab
|
||||
interface Model {
|
||||
@ -358,7 +358,8 @@ const renderModel = async (data, model) => {
|
||||
z
|
||||
}
|
||||
}
|
||||
let Model = await new YJ.Obj.Model(window.earth, option)
|
||||
let Model = await new YJ.Obj.Model(window.earth, option);
|
||||
(window as any)._entityMap.set(id, Model)
|
||||
|
||||
let DbOption: any = {
|
||||
params: option,
|
||||
|
||||
@ -173,7 +173,7 @@ const { cusUpdateNode } = useTreeNode()
|
||||
var modelName = ref('')
|
||||
|
||||
const availablePort = ref(55110)
|
||||
const service = ref(localStorage.getItem('service'))
|
||||
const service = ref(localStorage.getItem('ip'))
|
||||
|
||||
ipcRenderer.invoke('get-available-port').then((port) => {
|
||||
availablePort.value = port
|
||||
|
||||
@ -168,7 +168,7 @@ const init = (obj, selected, hasGEMarker = true, isUrl) => {
|
||||
activeName.value = arr[0];
|
||||
}
|
||||
hasGEMarker1.value = hasGEMarker;
|
||||
url.value = localStorage.getItem('service')
|
||||
url.value = localStorage.getItem('ip')
|
||||
|
||||
for (const objKey in obj) {
|
||||
let imgList: any = [];
|
||||
|
||||
@ -101,10 +101,11 @@ export const useRightOperate = () => {
|
||||
params.isShow = true
|
||||
params.params = JSON.stringify(params.params)
|
||||
cusAddNodes(window.treeObj, params.parentId, [params])
|
||||
renderVector(params, true)
|
||||
let entityObject = renderVector(params, true);
|
||||
(window as any)._entityMap.set(id, entityObject)
|
||||
}
|
||||
else if (["geojson"].includes(sourceType)) {
|
||||
let baseURL = localStorage.getItem('service')
|
||||
let baseURL = localStorage.getItem('ip')
|
||||
await addMapSource({
|
||||
type: 'geojson',
|
||||
id: id,
|
||||
|
||||
@ -178,7 +178,7 @@ async function tankuang(id, node, info) {
|
||||
let availablePort = await ipcRenderer.invoke('get-available-port');
|
||||
window.treeObj.selectNode(node);
|
||||
console.log('BrowserWindow---------------------', electron.BrowserWindow)
|
||||
let baseURL = localStorage.getItem('service')
|
||||
let baseURL = localStorage.getItem('ip')
|
||||
// console.log("node.detail.namenode.detail.namenode.detail.name", node.detail);
|
||||
let _winMap = await ipcRenderer.invoke('get-_winMap')
|
||||
if (!_winMap.has(id)) {
|
||||
|
||||
@ -477,9 +477,9 @@ const getStatus = (time) => {
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
let baseURL = localStorage.getItem('service')
|
||||
let baseURL = localStorage.getItem('ip')
|
||||
getAuthInfo()
|
||||
await YJ.on({ host: baseURL })
|
||||
await YJ.on({ host: baseURL, token: localStorage.getItem('Authorization') })
|
||||
createEarth()
|
||||
})
|
||||
</script>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { validateURL } from '@/utils/validate'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { setIP } from '@/utils/index'
|
||||
import { setIP,getIP } from '@/utils/index'
|
||||
export const useSetUp = () => {
|
||||
const serviceDialog = ref(false) // 服务设置对话框
|
||||
const servVal = ref('单机') // 服务类型选择值
|
||||
@ -8,13 +8,32 @@ export const useSetUp = () => {
|
||||
const ip = ref('192.168.1.1')
|
||||
const port = ref('8890')
|
||||
const localip = ref('127.0.0.1')
|
||||
const localport = ref('8808')
|
||||
const localport = ref('8848')
|
||||
const gpsVal = ref('') // 服务类型选择值
|
||||
const gpsOptions: any = ref([])
|
||||
const servOptions: any = ref([{ name: '单机' }, { name: '网络' }])
|
||||
const selectedService = ref('接口服务')
|
||||
const serviceOptions: any = ref([{ name: '接口服务' }, { name: '北斗串口' }])
|
||||
|
||||
let serveUrl:any = getIP()
|
||||
let isOk = validateURL(serveUrl)
|
||||
let serverMode = localStorage.getItem('serverMode')
|
||||
if(isOk) {
|
||||
const parsedUrl = new URL(serveUrl);
|
||||
const host = parsedUrl.host;
|
||||
const ipPort = host.split(':');
|
||||
if(serverMode === 'false') {
|
||||
servVal.value = '网络'
|
||||
ip.value = ipPort[0]
|
||||
port.value = ipPort[1]
|
||||
prototype.value = parsedUrl.protocol.slice(0, -1)
|
||||
}
|
||||
else {
|
||||
localip.value = ipPort[0]
|
||||
localport.value = ipPort[1]
|
||||
}
|
||||
}
|
||||
|
||||
const submit = () => {
|
||||
switch (selectedService.value) {
|
||||
case '接口服务':
|
||||
@ -39,7 +58,7 @@ export const useSetUp = () => {
|
||||
// 验证url 合法性
|
||||
if (isOk) {
|
||||
// 网络走这里
|
||||
window.isStandAlone = false //判断走哪个服务
|
||||
localStorage.setItem('serverMode', 'false') //判断走哪个服务
|
||||
setIP(url)
|
||||
serviceDialog.value = false
|
||||
} else {
|
||||
@ -47,13 +66,15 @@ export const useSetUp = () => {
|
||||
}
|
||||
} else {
|
||||
//单机走这里
|
||||
window.isStandAlone = true
|
||||
localStorage.setItem('serverMode', 'true')
|
||||
setIP('http://127.0.0.1:' + localport.value)
|
||||
serviceDialog.value = false
|
||||
}
|
||||
}
|
||||
const initialize = () => {
|
||||
if (!window.isStandAlone) {
|
||||
if(localStorage.getItem('ip')) {}
|
||||
else {
|
||||
if (serverMode==='false') {
|
||||
setIP('http://127.0.0.1:' + localport.value)
|
||||
} else {
|
||||
let url = prototype.value + '://' + ip.value + ':' + port.value
|
||||
@ -65,6 +86,7 @@ export const useSetUp = () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
serviceDialog,
|
||||
servVal,
|
||||
|
||||
Reference in New Issue
Block a user