Browse Source

跳转设置

master
DIAMOND 10 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
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;
@ -50,7 +54,8 @@ ipcMain.on('openRtsp', (event, rtsp) => {
name: `socket-${addPort}`,
streamUrl: rtsp,
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: {
'-stats': '',
'-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() {
@ -120,9 +163,10 @@ function createWindow() {
// and load the index.html of the app.
// 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.
// if (isDev) {
mainWindow.webContents.openDevTools();

2
package.json

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

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

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

Loading…
Cancel
Save