修改
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
server:
|
server:
|
||||||
host: 127.0.0.1
|
host: 127.0.0.1
|
||||||
port: 8848
|
port: 8848
|
||||||
path: C:\Users\takeshita\AppData\Roaming\dzsp_shijingjun_offline_Y_save
|
path: C:\Users\Administrator\AppData\Roaming\dzsp_shijingjun_offline_Y_save
|
||||||
poi:
|
poi:
|
||||||
global:
|
global:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { app, shell, BrowserWindow, ipcMain, globalShortcut, dialog } from 'electron'
|
import { app, shell, BrowserWindow, ipcMain, globalShortcut, dialog, session } from 'electron'
|
||||||
import path, { join } from 'path'
|
import path, { join } from 'path'
|
||||||
import { electronApp, optimizer, is } from '@electron-toolkit/utils'
|
import { electronApp, optimizer, is } from '@electron-toolkit/utils'
|
||||||
import icon from '../../resources/earth.png?asset'
|
import icon from '../../resources/earth.png?asset'
|
||||||
@ -376,21 +376,90 @@ function createWindow(): void {
|
|||||||
|
|
||||||
let _winMap = new Map();
|
let _winMap = new Map();
|
||||||
// 监听渲染进程创建新窗口的请求
|
// 监听渲染进程创建新窗口的请求
|
||||||
|
function createTempSession() {
|
||||||
|
// 生成唯一会话名称(避免冲突)
|
||||||
|
const sessionName = `temp-session-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
||||||
|
// 创建独立会话(基于默认分区,但命名唯一)
|
||||||
|
const tempSession = session.fromPartition(sessionName, {
|
||||||
|
cache: true, // 允许缓存,但会话独立
|
||||||
|
persistent: false // 非持久化,关闭后自动清理
|
||||||
|
});
|
||||||
|
|
||||||
|
// 清空会话初始缓存(确保无残留)
|
||||||
|
tempSession.clearStorageData({
|
||||||
|
storages: [
|
||||||
|
'appcache', 'cookies', 'localstorage', 'sessionstorage',
|
||||||
|
'indexdb', 'cachestorage', 'websql'
|
||||||
|
]
|
||||||
|
}).catch(err => console.error('清空临时会话缓存失败:', err));
|
||||||
|
|
||||||
|
return tempSession;
|
||||||
|
}
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
ipcMain.handle('create-new-window', async (event, params, url, option, id) => {
|
ipcMain.handle('create-new-window', async (event, params, url, option, id) => {
|
||||||
|
// try {
|
||||||
|
// console.log('create-new-window', params, url, option, id)
|
||||||
|
// const newWindow = await new BrowserWindow(params)
|
||||||
|
// if (url) {
|
||||||
|
// await newWindow.loadURL(url)
|
||||||
|
// await newWindow.webContents.send("data", option)
|
||||||
|
// newWindow.on('closed', () => {
|
||||||
|
// _winMap.delete(id);
|
||||||
|
// // a.delete(newWindow.id)
|
||||||
|
// // closeCB(newWindow.id)
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// _winMap.set(id, newWindow.id);
|
||||||
|
// return _winMap
|
||||||
|
// } catch (error) {
|
||||||
|
// console.error('创建窗口失败:', error);
|
||||||
|
// throw error; // 抛出错误以便渲染进程捕获
|
||||||
|
// }
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const newWindow = await new BrowserWindow(params)
|
|
||||||
if (url) {
|
// 1. 创建独立临时会话
|
||||||
await newWindow.loadURL(url)
|
const tempSession = createTempSession();
|
||||||
await newWindow.webContents.send("data", option)
|
|
||||||
newWindow.on('closed', () => {
|
// 2. 合并窗口配置:注入独立会话
|
||||||
_winMap.delete(id);
|
const windowConfig = {
|
||||||
// a.delete(newWindow.id)
|
...params,
|
||||||
// closeCB(newWindow.id)
|
webPreferences: {
|
||||||
});
|
...params.webPreferences,
|
||||||
|
session: tempSession, // 关键:使用独立会话
|
||||||
|
nodeIntegration: true,
|
||||||
|
contextIsolation: false,
|
||||||
|
devTools: true,
|
||||||
|
webSecurity: false,
|
||||||
|
allowRunningInsecureContent: true
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 3. 创建新窗口
|
||||||
|
const newWindow = new BrowserWindow(windowConfig);
|
||||||
|
|
||||||
|
// 4. 加载URL并发送初始化数据
|
||||||
|
if (url) {
|
||||||
|
await newWindow.loadURL(url);
|
||||||
|
await newWindow.webContents.send("data", option);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. 窗口关闭时清理会话和映射
|
||||||
|
newWindow.on('closed', async () => {
|
||||||
|
_winMap.delete(id);
|
||||||
|
// 清空会话缓存并销毁
|
||||||
|
await tempSession.clearStorageData({
|
||||||
|
storages: ['all'] // 清空所有存储
|
||||||
|
});
|
||||||
|
// 解除会话引用(触发GC)
|
||||||
|
tempSession.clearCache();
|
||||||
|
session.removePartition(tempSession.getPartition());
|
||||||
|
});
|
||||||
|
|
||||||
|
// 6. 记录窗口映射
|
||||||
_winMap.set(id, newWindow.id);
|
_winMap.set(id, newWindow.id);
|
||||||
return _winMap
|
|
||||||
|
return _winMap;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('创建窗口失败:', error);
|
console.error('创建窗口失败:', error);
|
||||||
throw error; // 抛出错误以便渲染进程捕获
|
throw error; // 抛出错误以便渲染进程捕获
|
||||||
|
|||||||
@ -79,7 +79,7 @@
|
|||||||
<template #icon>
|
<template #icon>
|
||||||
<svg-icon name="POI" />
|
<svg-icon name="POI" />
|
||||||
</template>
|
</template>
|
||||||
<span>POI导入</span>
|
<span>POIL导入</span>
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="fileList" v-if="poiList.length">
|
<div class="fileList" v-if="poiList.length">
|
||||||
|
|||||||
@ -2,17 +2,6 @@
|
|||||||
<div class="model-management-container">
|
<div class="model-management-container">
|
||||||
<div class="equipment_title" style="margin-bottom: 10px">
|
<div class="equipment_title" style="margin-bottom: 10px">
|
||||||
<div>
|
<div>
|
||||||
<el-button
|
|
||||||
color="#004b4b"
|
|
||||||
style="border: 1px solid rgba(var(--color-base1), 0.5)"
|
|
||||||
@click="importModelDB"
|
|
||||||
>
|
|
||||||
<template #icon>
|
|
||||||
<svg-icon name="select" />
|
|
||||||
</template>
|
|
||||||
<span>选择军标库</span>
|
|
||||||
</el-button>
|
|
||||||
|
|
||||||
<el-button
|
<el-button
|
||||||
color="#004b4b"
|
color="#004b4b"
|
||||||
style="border: 1px solid rgba(var(--color-base1), 0.5)"
|
style="border: 1px solid rgba(var(--color-base1), 0.5)"
|
||||||
@ -23,6 +12,16 @@
|
|||||||
</template>
|
</template>
|
||||||
<span>创建军标库</span>
|
<span>创建军标库</span>
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
color="#004b4b"
|
||||||
|
style="border: 1px solid rgba(var(--color-base1), 0.5)"
|
||||||
|
@click="importModelDB"
|
||||||
|
>
|
||||||
|
<template #icon>
|
||||||
|
<svg-icon name="select" />
|
||||||
|
</template>
|
||||||
|
<span>选择军标库</span>
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-input
|
<el-input
|
||||||
|
|||||||
@ -2,17 +2,6 @@
|
|||||||
<div class="model-management-container">
|
<div class="model-management-container">
|
||||||
<div class="equipment_title" style="margin-bottom: 10px">
|
<div class="equipment_title" style="margin-bottom: 10px">
|
||||||
<div>
|
<div>
|
||||||
<el-button
|
|
||||||
color="#004b4b"
|
|
||||||
style="border: 1px solid rgba(var(--color-base1), 0.5)"
|
|
||||||
@click="importModelDB"
|
|
||||||
>
|
|
||||||
<template #icon>
|
|
||||||
<svg-icon name="select" />
|
|
||||||
</template>
|
|
||||||
<span>选择图标库</span>
|
|
||||||
</el-button>
|
|
||||||
|
|
||||||
<el-button
|
<el-button
|
||||||
color="#004b4b"
|
color="#004b4b"
|
||||||
style="border: 1px solid rgba(var(--color-base1), 0.5)"
|
style="border: 1px solid rgba(var(--color-base1), 0.5)"
|
||||||
@ -23,6 +12,16 @@
|
|||||||
</template>
|
</template>
|
||||||
<span>创建图标库</span>
|
<span>创建图标库</span>
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
color="#004b4b"
|
||||||
|
style="border: 1px solid rgba(var(--color-base1), 0.5)"
|
||||||
|
@click="importModelDB"
|
||||||
|
>
|
||||||
|
<template #icon>
|
||||||
|
<svg-icon name="select" />
|
||||||
|
</template>
|
||||||
|
<span>选择图标库</span>
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-input
|
<el-input
|
||||||
v-model="photoName"
|
v-model="photoName"
|
||||||
|
|||||||
@ -658,7 +658,7 @@ const intoBack = async () => {
|
|||||||
let _winMap = await ipcRenderer.invoke('get-_winMap')
|
let _winMap = await ipcRenderer.invoke('get-_winMap')
|
||||||
if (!_winMap.has(id)) {
|
if (!_winMap.has(id)) {
|
||||||
try {
|
try {
|
||||||
const windowId = await ipcRenderer.invoke(
|
let windowId = await ipcRenderer.invoke(
|
||||||
'create-new-window',
|
'create-new-window',
|
||||||
{
|
{
|
||||||
title: '后台管理',
|
title: '后台管理',
|
||||||
@ -683,10 +683,11 @@ const intoBack = async () => {
|
|||||||
devTools: true
|
devTools: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
`http://localhost:${availablePort}/backManage/index.html#/login`,
|
`http://localhost:${availablePort}/backManage/index.html#/login?timestamp=${Date.now()}`,
|
||||||
{},
|
{},
|
||||||
id
|
id
|
||||||
)
|
)
|
||||||
|
console.log('windowId', windowId, id)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('创建窗口失败:', error)
|
console.error('创建窗口失败:', error)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,6 +63,7 @@
|
|||||||
:min="0"
|
:min="0"
|
||||||
:max="maxNum"
|
:max="maxNum"
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
|
style="max-width: 100%"
|
||||||
@change="precisionInput"
|
@change="precisionInput"
|
||||||
:show-tooltip="false"
|
:show-tooltip="false"
|
||||||
popper-class="custom-tooltip"
|
popper-class="custom-tooltip"
|
||||||
@ -156,6 +157,7 @@ const precisionInput = () => {
|
|||||||
// precision.value = dom.max * 1
|
// precision.value = dom.max * 1
|
||||||
// }
|
// }
|
||||||
visibility.precisions = precision.value
|
visibility.precisions = precision.value
|
||||||
|
console.log('precision.value', visibility.precisions, precision.value)
|
||||||
}
|
}
|
||||||
const precisionChange = () => {}
|
const precisionChange = () => {}
|
||||||
const draw = (e) => {
|
const draw = (e) => {
|
||||||
@ -167,6 +169,7 @@ const draw = (e) => {
|
|||||||
|
|
||||||
//滑块
|
//滑块
|
||||||
var maxNum: any = ref(100)
|
var maxNum: any = ref(100)
|
||||||
|
var maxNumBar: any = ref(100)
|
||||||
const updateDataAttr = async () => {
|
const updateDataAttr = async () => {
|
||||||
await nextTick()
|
await nextTick()
|
||||||
const sliderButton = document.querySelector('.el-slider__button-wrapper')
|
const sliderButton = document.querySelector('.el-slider__button-wrapper')
|
||||||
@ -176,6 +179,7 @@ const updateDataAttr = async () => {
|
|||||||
}
|
}
|
||||||
const precisionMaxInput = () => {
|
const precisionMaxInput = () => {
|
||||||
let dom: any = document.getElementById('precision')
|
let dom: any = document.getElementById('precision')
|
||||||
|
console.log('maxNum.value', maxNum.value, dom.min, dom.max)
|
||||||
if (maxNum.value < dom.min * 1) {
|
if (maxNum.value < dom.min * 1) {
|
||||||
maxNum.value = dom.min * 1
|
maxNum.value = dom.min * 1
|
||||||
} else if (maxNum.value > dom.max * 1) {
|
} else if (maxNum.value > dom.max * 1) {
|
||||||
@ -183,7 +187,19 @@ const precisionMaxInput = () => {
|
|||||||
}
|
}
|
||||||
// cutFill.heights = maxNum.value
|
// cutFill.heights = maxNum.value
|
||||||
}
|
}
|
||||||
|
watch(
|
||||||
|
() => maxNum.value,
|
||||||
|
(x, j) => {
|
||||||
|
console.log('maxNum.value11111', 'x:' + x, 'y:' + j)
|
||||||
|
if (!x) {
|
||||||
|
maxNum.value = 1
|
||||||
|
}
|
||||||
|
// if (precision.value != x) {
|
||||||
|
// visibility.precisions = x
|
||||||
|
// precision.value = x
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
)
|
||||||
defineExpose({
|
defineExpose({
|
||||||
open
|
open
|
||||||
})
|
})
|
||||||
|
|||||||
@ -191,6 +191,14 @@ const precisionMaxInput = () => {
|
|||||||
}
|
}
|
||||||
// cutFill.heights = height.value
|
// cutFill.heights = height.value
|
||||||
}
|
}
|
||||||
|
watch(
|
||||||
|
() => maxNum.value,
|
||||||
|
(x, j) => {
|
||||||
|
if (!x) {
|
||||||
|
maxNum.value = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
const precisionInput = () => {
|
const precisionInput = () => {
|
||||||
// let dom = document.getElementById('precision')
|
// let dom = document.getElementById('precision')
|
||||||
// if (precision.value < dom.min * 1) {
|
// if (precision.value < dom.min * 1) {
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
<el-input
|
<el-input
|
||||||
v-model="modelName"
|
v-model="modelName"
|
||||||
class="w-50 m-2"
|
class="w-50 m-2"
|
||||||
placeholder="请输入图标类型进行搜索"
|
placeholder="请输入图标名称进行搜索"
|
||||||
:suffix-icon="Search"
|
:suffix-icon="Search"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -205,9 +205,11 @@ let observer: IntersectionObserver | null = null
|
|||||||
|
|
||||||
const treeRef: any = ref('')
|
const treeRef: any = ref('')
|
||||||
watch(modelName, (val) => {
|
watch(modelName, (val) => {
|
||||||
if (treeRef.value && treeRef.value !== '') {
|
// if (treeRef.value && treeRef.value !== '') {
|
||||||
treeRef.value?.filter(val)
|
// treeRef.value?.filter(val)
|
||||||
}
|
// }
|
||||||
|
getModelList()
|
||||||
|
// categories.value = []
|
||||||
})
|
})
|
||||||
watch(isShowPup, (val) => {
|
watch(isShowPup, (val) => {
|
||||||
if (!val) {
|
if (!val) {
|
||||||
@ -349,7 +351,6 @@ let typeArr = {
|
|||||||
const modelClick = (index, row) => {
|
const modelClick = (index, row) => {
|
||||||
activeIndex.value = index
|
activeIndex.value = index
|
||||||
isShowPup.value = false
|
isShowPup.value = false
|
||||||
console.log(index, row)
|
|
||||||
let selectedImg
|
let selectedImg
|
||||||
if (selectCallback) {
|
if (selectCallback) {
|
||||||
if (butActiveIndex.value === 0) {
|
if (butActiveIndex.value === 0) {
|
||||||
@ -369,12 +370,21 @@ const modelClick = (index, row) => {
|
|||||||
|
|
||||||
const getModelListByType = (id) => {
|
const getModelListByType = (id) => {
|
||||||
if (butActiveIndex.value === 0) {
|
if (butActiveIndex.value === 0) {
|
||||||
categories.value = [...threePhoto]
|
let arr = threePhoto.filter((item) => {
|
||||||
|
return item.iconName.indexOf(modelName.value) > -1
|
||||||
|
})
|
||||||
|
// categories.value = [...threePhoto]
|
||||||
|
categories.value = arr
|
||||||
} else if (butActiveIndex.value === 1) {
|
} else if (butActiveIndex.value === 1) {
|
||||||
categories.value = [...ordinaryPhoto]
|
let arr = ordinaryPhoto.filter((item) => {
|
||||||
|
return item.iconName.indexOf(modelName.value) > -1
|
||||||
|
})
|
||||||
|
// categories.value = [...ordinaryPhoto]
|
||||||
|
categories.value = arr
|
||||||
} else {
|
} else {
|
||||||
let formData = new FormData()
|
let formData = new FormData()
|
||||||
formData.append('iconTypeId', id)
|
formData.append('iconTypeId', id)
|
||||||
|
formData.append('name', modelName.value)
|
||||||
PhotoApi.showModelByType(formData).then((res) => {
|
PhotoApi.showModelByType(formData).then((res) => {
|
||||||
categories.value = res.data
|
categories.value = res.data
|
||||||
})
|
})
|
||||||
@ -391,13 +401,23 @@ const getModelList = async () => {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
if (butActiveIndex.value == 0) {
|
if (butActiveIndex.value == 0) {
|
||||||
categories.value = [...threePhoto]
|
let arr = threePhoto.filter((item) => {
|
||||||
|
return item.iconName.indexOf(modelName.value) > -1
|
||||||
|
})
|
||||||
|
// categories.value = [...threePhoto]
|
||||||
|
categories.value = arr
|
||||||
}
|
}
|
||||||
if (butActiveIndex.value == 1) {
|
if (butActiveIndex.value == 1) {
|
||||||
categories.value = [...ordinaryPhoto]
|
let arr = ordinaryPhoto.filter((item) => {
|
||||||
|
return item.iconName.indexOf(modelName.value) > -1
|
||||||
|
})
|
||||||
|
// categories.value = [...ordinaryPhoto]
|
||||||
|
categories.value = arr
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const res: any = await PhotoApi.modelTypeList()
|
const params = new URLSearchParams()
|
||||||
|
params.append('iconName', modelName.value)
|
||||||
|
const res: any = await PhotoApi.modelTypeList(params)
|
||||||
if (res.code == 0 || res.code == 200) {
|
if (res.code == 0 || res.code == 200) {
|
||||||
let data = transformNestedJson(res.data, 'name', 'label')
|
let data = transformNestedJson(res.data, 'name', 'label')
|
||||||
typeTreeData.value = data
|
typeTreeData.value = data
|
||||||
@ -503,8 +523,11 @@ defineExpose({
|
|||||||
// height: 50vh;
|
// height: 50vh;
|
||||||
|
|
||||||
:deep(.el-dialog) {
|
:deep(.el-dialog) {
|
||||||
background:
|
background: linear-gradient(
|
||||||
linear-gradient(180deg, rgba(var(--color-base1), 0.2) 0%, rgba(var(--color-base1), 0) 100%),
|
180deg,
|
||||||
|
rgba(var(--color-base1), 0.2) 0%,
|
||||||
|
rgba(var(--color-base1), 0) 100%
|
||||||
|
),
|
||||||
rgba(0, 0, 0, 0.6);
|
rgba(0, 0, 0, 0.6);
|
||||||
border: 1px solid var(--color-border1);
|
border: 1px solid var(--color-border1);
|
||||||
padding-left: 0 !important;
|
padding-left: 0 !important;
|
||||||
@ -915,10 +938,7 @@ defineExpose({
|
|||||||
width: 90px;
|
width: 90px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
border-radius:
|
border-radius: 0px 4px, 4px, 0px;
|
||||||
0px 4px,
|
|
||||||
4px,
|
|
||||||
0px;
|
|
||||||
background: rgba(var(--color-base1), 0.2);
|
background: rgba(var(--color-base1), 0.2);
|
||||||
border: 1px solid rgba(var(--color-base1), 0.1);
|
border: 1px solid rgba(var(--color-base1), 0.1);
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
Reference in New Issue
Block a user