Browse Source

跳转设置

master
DIAMOND 7 months ago
parent
commit
d822f593ac
  1. 52
      electron/electron.js
  2. 2
      package.json
  3. 45
      src/views/military/modules/Home.vue

52
electron/electron.js

@ -1,6 +1,10 @@
// electron/electron.js // electron/electron.js
const path = require('path'); const path = require('path');
const { app, BrowserWindow, ipcMain } = require('electron'); const {
app,
BrowserWindow,
ipcMain
} = require('electron');
const isDev = process.env.IS_DEV == 'true' ? true : false; const isDev = process.env.IS_DEV == 'true' ? true : false;
@ -50,7 +54,8 @@ ipcMain.on('openRtsp', (event, rtsp) => {
name: `socket-${addPort}`, name: `socket-${addPort}`,
streamUrl: rtsp, streamUrl: rtsp,
wsPort: addPort, wsPort: addPort,
ffmpegPath: app.isPackaged ? ffmpegPath.replace('app.asar', 'app.asar.unpacked') : ffmpegPath, ffmpegPath: app.isPackaged ? ffmpegPath.replace('app.asar', 'app.asar.unpacked') :
ffmpegPath,
ffmpegOptions: { ffmpegOptions: {
'-stats': '', '-stats': '',
'-r': 30, '-r': 30,
@ -97,6 +102,44 @@ ipcMain.on('closeRtsp', (event, rtsp) => {
} }
}); });
/**
* 跳转程序 url
*/
ipcMain.on('jumpTo', (event, url) => {
console.log("jumpTo",event, url);
// if (newWin) {
// newWin.focus() // 存在 则聚焦
// return
// }
const newWin = new BrowserWindow({
width: 900,
height: 620,
minWidth: 900,
minHeight: 620,
frame: true, //是否显示边缘框
fullscreen: false, //是否全屏显示
title: "项目名",
autoHideMenuBar: false,
webPreferences: {
javascript: true,
plugins: true,
allowRunningInsecureContent: true,
// 允许web端使用node
nodeIntegration: true,
contextIsolation: false,
// 同源策略关闭
webSecurity: false,
}
})
// newWin.loadURL(winURL + '#/路由地址') // 此处写 你要打开的路由地址
newWin.loadURL(url) // 此处写 你要打开的路由地址
// newWin.on('close', () => {
// newWin = null
// })
});
/////////////////////////////////////////// ///////////////////////////////////////////
function createWindow() { function createWindow() {
@ -120,9 +163,10 @@ function createWindow() {
// and load the index.html of the app. // and load the index.html of the app.
// win.loadFile("index.html"); // win.loadFile("index.html");
mainWindow.loadURL(isDev ? 'http://localhost:3200' : `file://${path.join(__dirname, '../dist/index.html')}`); // mainWindow.loadURL(isDev ? 'http://localhost:3200' :
// `file://${path.join(__dirname, '../dist/index.html')}`);
// mainWindow.loadURL('http://127.0.0.1:5500'); mainWindow.loadURL('http://localhost:3200');
// Open the DevTools. // Open the DevTools.
// if (isDev) { // if (isDev) {
mainWindow.webContents.openDevTools(); mainWindow.webContents.openDevTools();

2
package.json

@ -30,7 +30,7 @@
"output": "dist_electron" "output": "dist_electron"
}, },
"electronDownload": { "electronDownload": {
"mirror": "https://npm.taobao.org/mirrors/electron/" "mirror": "https://npmmirror.com/mirrors/electron/"
} }
}, },
"scripts": { "scripts": {

45
src/views/military/modules/Home.vue

@ -5,25 +5,25 @@
<div> <div>
<a-row :gutter="24" :style="{ padding: '30px 140px' }"> <a-row :gutter="24" :style="{ padding: '30px 140px' }">
<a-col :span="8"> <a-col :span="8">
<router-link target="_blank" :to="{ name: 'VideoMonitor' }"> <!-- <router-link target="_blank" :to="{ name: 'VideoMonitor' }"> -->
<a-card hoverable class="a-card" @mouseenter="mouseOver($event, 1)" @mouseleave="mouseLeave($event, 1)"> <a-card hoverable class="a-card" @mouseenter="mouseOver($event, 1)" @mouseleave="mouseLeave($event, 1)" @click="jumpTo('videoMonitor')">
<template #cover><img slot="cover" alt="example" src="@/assets/earthMap/photoelectricity.png" <template #cover><img slot="cover" alt="example" src="@/assets/earthMap/photoelectricity.png"
class="cardImg" ref="photoelectricImg" /></template> class="cardImg" ref="photoelectricImg" /></template>
<span class="a-card-title" ref="cardTitle">视频监控</span> <span class="a-card-title" ref="cardTitle">视频监控</span>
</a-card> </a-card>
</router-link> <!-- </router-link> -->
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<router-link target="_blank" :to="{ name: 'ElectronicMap' }"> <!-- <router-link target="_blank" :to="{ name: 'ElectronicMap' }"> -->
<a-card hoverable class="a-card" @mouseenter="mouseOver($event, 2)" @mouseleave="mouseLeave($event, 2)"> <a-card hoverable class="a-card" @mouseenter="mouseOver($event, 2)" @mouseleave="mouseLeave($event, 2)" @click="jumpTo('electronicMap')">
<template #cover> <template #cover>
<img slot="cover" alt="example" src="@/assets/earthMap/map.png" class="cardImg" ref="cardImg" /> <img slot="cover" alt="example" src="@/assets/earthMap/map.png" class="cardImg" ref="cardImg" />
</template> </template>
<span class="a-card-title" ref="cardTitle">电子地图</span> <span class="a-card-title" ref="cardTitle">电子地图</span>
</a-card> </a-card>
</router-link> <!-- </router-link> -->
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-card hoverable class="a-card" @mouseenter="mouseOver($event, 3)" @mouseleave="mouseLeave($event, 3)" <a-card hoverable class="a-card" @mouseenter="mouseOver($event, 3)" @mouseleave="mouseLeave($event, 3)"
@ -31,7 +31,7 @@
<template #cover> <img slot="cover" alt="example" src="@/assets/earthMap/scene.png" class="cardImg" <template #cover> <img slot="cover" alt="example" src="@/assets/earthMap/scene.png" class="cardImg"
ref="cardImg" /></template> ref="cardImg" /></template>
<span class="a-card-title" ref="cardTitle">场景配置</span> <span class="a-card-title" ref="cardTitle">区域配置</span>
</a-card> </a-card>
</a-col> </a-col>
@ -76,8 +76,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue'; import { ref } from 'vue';
import { defHttp } from '/@/utils/http/axios'; import { defHttp } from '/@/utils/http/axios';
import photoelectricity_hover from "@/assets/earthMap/photoelectricity_hover.png" import photoelectricity_hover from "@/assets/earthMap/photoelectricity_hover.png"
import map_hover from "@/assets/earthMap/map_hover.png" import map_hover from "@/assets/earthMap/map_hover.png"
import scene_hover from "@/assets/earthMap/scene_hover.png" import scene_hover from "@/assets/earthMap/scene_hover.png"
@ -92,7 +90,7 @@ import scene from "@/assets/earthMap/scene.png"
import camera_management from "@/assets/earthMap/camera_management.png" import camera_management from "@/assets/earthMap/camera_management.png"
import warnInfo from "@/assets/earthMap/warnInfo.png" import warnInfo from "@/assets/earthMap/warnInfo.png"
import { useRouter, useRoute } from 'vue-router'; import { useRouter, useRoute } from 'vue-router';
const { ipcRenderer } = require('electron');
// //
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
@ -181,17 +179,17 @@ function openPage(index) {
break break
case 3: case 3:
// routePath = '/device/SiteView' // routePath = '/device/SiteView'
routePath = '/defence/ElectronicMap/flyto/config' routePath = '/scene/manage'
break break
case 4: case 4:
routePath = '/device/MsDeviceInfoList' routePath = '/device/info'
break break
case 5: case 5:
// routePath = '/device/PerimeterAlarmView' // routePath = '/device/PerimeterAlarmView'
routePath = '/camera/cameraSet' routePath = '/cameraManage'
break break
case 6: case 6:
routePath = '/statistics/warnList' routePath = '/prewarn/manage'
break break
} }
@ -204,7 +202,24 @@ function openPage(index) {
}) */ }) */
} }
//
function jumpTo(pathName){
let url = ''
switch (pathName) {
case "videoMonitor":
url = "http://192.168.1.50:3122/"
break;
case "electronicMap":
url = "http://192.168.1.50:3500/"
break;
default:
break;
}
// // let path=window.location.protocol+'//'+url
// // window.location.href=path
// window.open(url,'_blank')
ipcRenderer.send('jumpTo',url)
}
</script> </script>

Loading…
Cancel
Save