diff --git a/src/main/index.ts b/src/main/index.ts
index 38cabf9..b783ee0 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -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 { electronApp, optimizer, is } from '@electron-toolkit/utils'
import icon from '../../resources/earth.png?asset'
@@ -390,19 +390,87 @@ function createWindow(): void {
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
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 {
- const newWindow = await new BrowserWindow(params)
+
+ // 1. 创建独立临时会话
+ const tempSession = createTempSession();
+
+ // 2. 合并窗口配置:注入独立会话
+ const windowConfig = {
+ ...params,
+ 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)
- newWindow.on('closed', () => {
- _winMap.delete(id);
- // a.delete(newWindow.id)
- // closeCB(newWindow.id)
- });
+ 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. 记录窗口映射
newWindow.webContents.on('before-input-event', (event, input) => {
// 条件:仅按了 Alt 键(无其他键组合、不是组合键、不是重复按键)
if (
@@ -417,7 +485,8 @@ function createWindow(): void {
}
});
_winMap.set(id, newWindow.id);
- return _winMap
+
+ return _winMap;
} catch (error) {
console.error('创建窗口失败:', error);
throw error; // 抛出错误以便渲染进程捕获
diff --git a/src/renderer/src/views/components/headers/components/setPup/components/engineering.vue b/src/renderer/src/views/components/headers/components/setPup/components/engineering.vue
index 4e9717f..21e741e 100644
--- a/src/renderer/src/views/components/headers/components/setPup/components/engineering.vue
+++ b/src/renderer/src/views/components/headers/components/setPup/components/engineering.vue
@@ -79,7 +79,7 @@
- POI导入
+ POIL导入
diff --git a/src/renderer/src/views/components/headers/components/setPup/components/graphLabelManage.vue b/src/renderer/src/views/components/headers/components/setPup/components/graphLabelManage.vue
index 0ae39a5..83df4ba 100644
--- a/src/renderer/src/views/components/headers/components/setPup/components/graphLabelManage.vue
+++ b/src/renderer/src/views/components/headers/components/setPup/components/graphLabelManage.vue
@@ -2,17 +2,6 @@
-
-
-
-
- 选择军标库
-
-
创建军标库
+
+
+
+
+ 选择军标库
+
-
-
-
-
- 选择图标库
-
-
创建图标库
+
+
+
+
+ 选择图标库
+
{
let _winMap = await ipcRenderer.invoke('get-_winMap')
if (!_winMap.has(id)) {
try {
- const windowId = await ipcRenderer.invoke(
+ let windowId = await ipcRenderer.invoke(
'create-new-window',
{
title: '后台管理',
@@ -683,10 +683,11 @@ const intoBack = async () => {
devTools: true
}
},
- `http://localhost:${availablePort}/backManage/index.html#/login`,
+ `http://localhost:${availablePort}/backManage/index.html#/login?timestamp=${Date.now()}`,
{},
id
)
+ console.log('windowId', windowId, id)
} catch (error) {
console.error('创建窗口失败:', error)
}
diff --git a/src/renderer/src/views/components/propertyBox/CircleViewShed.vue b/src/renderer/src/views/components/propertyBox/CircleViewShed.vue
index cc0132d..381fa02 100644
--- a/src/renderer/src/views/components/propertyBox/CircleViewShed.vue
+++ b/src/renderer/src/views/components/propertyBox/CircleViewShed.vue
@@ -63,6 +63,7 @@
:min="0"
:max="maxNum"
placement="bottom"
+ style="max-width: 100%"
@change="precisionInput"
:show-tooltip="false"
popper-class="custom-tooltip"
@@ -156,6 +157,7 @@ const precisionInput = () => {
// precision.value = dom.max * 1
// }
visibility.precisions = precision.value
+ console.log('precision.value', visibility.precisions, precision.value)
}
const precisionChange = () => {}
const draw = (e) => {
@@ -167,6 +169,7 @@ const draw = (e) => {
//滑块
var maxNum: any = ref(100)
+var maxNumBar: any = ref(100)
const updateDataAttr = async () => {
await nextTick()
const sliderButton = document.querySelector('.el-slider__button-wrapper')
@@ -176,6 +179,7 @@ const updateDataAttr = async () => {
}
const precisionMaxInput = () => {
let dom: any = document.getElementById('precision')
+ console.log('maxNum.value', maxNum.value, dom.min, dom.max)
if (maxNum.value < dom.min * 1) {
maxNum.value = dom.min * 1
} else if (maxNum.value > dom.max * 1) {
@@ -183,7 +187,19 @@ const precisionMaxInput = () => {
}
// 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({
open
})
diff --git a/src/renderer/src/views/components/propertyBox/CutFill.vue b/src/renderer/src/views/components/propertyBox/CutFill.vue
index 51597bd..de454d6 100644
--- a/src/renderer/src/views/components/propertyBox/CutFill.vue
+++ b/src/renderer/src/views/components/propertyBox/CutFill.vue
@@ -191,6 +191,14 @@ const precisionMaxInput = () => {
}
// cutFill.heights = height.value
}
+watch(
+ () => maxNum.value,
+ (x, j) => {
+ if (!x) {
+ maxNum.value = 1
+ }
+ }
+)
const precisionInput = () => {
// let dom = document.getElementById('precision')
// if (precision.value < dom.min * 1) {
diff --git a/src/renderer/src/views/components/propertyBox/photo.vue b/src/renderer/src/views/components/propertyBox/photo.vue
index 378de18..d91cb35 100644
--- a/src/renderer/src/views/components/propertyBox/photo.vue
+++ b/src/renderer/src/views/components/propertyBox/photo.vue
@@ -14,7 +14,7 @@
@@ -205,9 +205,11 @@ let observer: IntersectionObserver | null = null
const treeRef: any = ref('')
watch(modelName, (val) => {
- if (treeRef.value && treeRef.value !== '') {
- treeRef.value?.filter(val)
- }
+ // if (treeRef.value && treeRef.value !== '') {
+ // treeRef.value?.filter(val)
+ // }
+ getModelList()
+ // categories.value = []
})
watch(isShowPup, (val) => {
if (!val) {
@@ -349,7 +351,6 @@ let typeArr = {
const modelClick = (index, row) => {
activeIndex.value = index
isShowPup.value = false
- console.log(index, row)
let selectedImg
if (selectCallback) {
if (butActiveIndex.value === 0) {
@@ -369,12 +370,21 @@ const modelClick = (index, row) => {
const getModelListByType = (id) => {
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) {
- categories.value = [...ordinaryPhoto]
+ let arr = ordinaryPhoto.filter((item) => {
+ return item.iconName.indexOf(modelName.value) > -1
+ })
+ // categories.value = [...ordinaryPhoto]
+ categories.value = arr
} else {
let formData = new FormData()
formData.append('iconTypeId', id)
+ formData.append('name', modelName.value)
PhotoApi.showModelByType(formData).then((res) => {
categories.value = res.data
})
@@ -391,13 +401,23 @@ const getModelList = async () => {
}
]
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) {
- categories.value = [...ordinaryPhoto]
+ let arr = ordinaryPhoto.filter((item) => {
+ return item.iconName.indexOf(modelName.value) > -1
+ })
+ // categories.value = [...ordinaryPhoto]
+ categories.value = arr
}
} 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) {
let data = transformNestedJson(res.data, 'name', 'label')
typeTreeData.value = data
@@ -503,8 +523,11 @@ defineExpose({
// height: 50vh;
:deep(.el-dialog) {
- background:
- linear-gradient(180deg, rgba(var(--color-base1), 0.2) 0%, rgba(var(--color-base1), 0) 100%),
+ background: linear-gradient(
+ 180deg,
+ rgba(var(--color-base1), 0.2) 0%,
+ rgba(var(--color-base1), 0) 100%
+ ),
rgba(0, 0, 0, 0.6);
border: 1px solid var(--color-border1);
padding-left: 0 !important;
@@ -561,22 +584,22 @@ defineExpose({
// height: 50vh;
:deep(
- .el-tabs--left .el-tabs__active-bar.is-left,
- .el-tabs--left .el-tabs__active-bar.is-right,
- .el-tabs--right .el-tabs__active-bar.is-left,
- .el-tabs--right .el-tabs__active-bar.is-right
- ) {
+ .el-tabs--left .el-tabs__active-bar.is-left,
+ .el-tabs--left .el-tabs__active-bar.is-right,
+ .el-tabs--right .el-tabs__active-bar.is-left,
+ .el-tabs--right .el-tabs__active-bar.is-right
+ ) {
width: 3px;
background: rgba(var(--color-base1), 1);
height: 40px !important;
}
:deep(
- .el-tabs--left .el-tabs__nav-wrap.is-left::after,
- .el-tabs--left .el-tabs__nav-wrap.is-right::after,
- .el-tabs--right .el-tabs__nav-wrap.is-left::after,
- .el-tabs--right .el-tabs__nav-wrap.is-right::after
- ) {
+ .el-tabs--left .el-tabs__nav-wrap.is-left::after,
+ .el-tabs--left .el-tabs__nav-wrap.is-right::after,
+ .el-tabs--right .el-tabs__nav-wrap.is-left::after,
+ .el-tabs--right .el-tabs__nav-wrap.is-right::after
+ ) {
width: 3px;
}
@@ -915,10 +938,7 @@ defineExpose({
width: 90px;
height: 32px;
opacity: 1;
- border-radius:
- 0px 4px,
- 4px,
- 0px;
+ border-radius: 0px 4px, 4px, 0px;
background: rgba(var(--color-base1), 0.2);
border: 1px solid rgba(var(--color-base1), 0.1);
display: flex;