后端服务启动判断

This commit is contained in:
zh
2025-11-13 14:38:23 +08:00
parent 2b7e0f45de
commit 1a0fcd1f41
8 changed files with 250 additions and 225 deletions

View File

@ -78,6 +78,8 @@ stopBatPath = process.platform === 'win32' ? stopBatPath.replace(/^(\w:)/, '/$1'
let isRestart = false let isRestart = false
let mainWindow; let mainWindow;
let isSeverInit = false
let isAppInit = false
function createWindow(): void { function createWindow(): void {
// Create the browser window. // Create the browser window.
@ -150,6 +152,10 @@ function createWindow(): void {
// 监听启动页完成的消息 // 监听启动页完成的消息
ipcMain.on('splash-completed', () => { ipcMain.on('splash-completed', () => {
// 启动页进度条已完成,可以关闭启动页并显示主窗口 // 启动页进度条已完成,可以关闭启动页并显示主窗口
if(isSeverInit) {
mainWindow.webContents.send('program-init')
}
isAppInit = true
setTimeout(() => { setTimeout(() => {
splashWindow.destroy() splashWindow.destroy()
mainWindow.maximize() // 先最大化 mainWindow.maximize() // 先最大化
@ -562,38 +568,53 @@ if (!gotTheLock) {
// buttons: ['确定'] // buttons: ['确定']
// }) // })
// 执行批处理文件 // 执行批处理文件
exec(startBatPath.substring(1, 200), (error, stdout, stderr) => { // exec(startBatPath.substring(1, 200), (error, stdout, stderr) => {
if (error) { // if (error) {
console.error(`执行错误: ${error.message}`);
return;
}
if (stderr) {
console.error(`错误输出: ${stderr}`);
return;
}
console.log(`批处理输出: ${stdout}`);
});
// const batProcess = spawn('cmd.exe', ['/c', startBatPath.substring(1, 200)]);
// // 实时监听标准输出stdout
// batProcess.stdout.on('data', (data) => {
// // data 是 Buffer 类型,转为字符串后输出
// console.log(`批处理输出: ${data.toString().trim()}`);
// });
// // 监听错误输出stderr
// batProcess.stderr.on('data', (data) => {
// console.error(`错误输出: ${data.toString().trim()}`);
// });
// // 监听进程执行出错(如文件不存在、权限问题等)
// batProcess.on('error', (error) => {
// console.error(`执行错误: ${error.message}`); // console.error(`执行错误: ${error.message}`);
// return;
// }
// if (stderr) {
// console.error(`错误输出: ${stderr}`);
// return;
// }
// console.log(`批处理输出: ${stdout}`);
// }); // });
// // 监听进程退出事件(执行结束后触发) const batProcess = spawn('cmd.exe', ['/c', startBatPath.substring(1, 200)]);
// batProcess.on('close', (code) => { // 实时监听标准输出stdout
// console.log(`批处理执行完毕,退出码: ${code}`); batProcess.stdout.on('data', (data) => {
// }); // data 是 Buffer 类型,转为字符串后输出
let string = data.toString().trim()
// console.log(`批处理输出: ${string}`);
// 临时处理:应用启动失败或项目文档地址出现时,认为服务初始化完成;后续需后端配合
if(string.indexOf('APPLICATION FAILED TO START') !== -1 || string.indexOf('项目文档地址') !== -1) {
if(!isSeverInit) {
isSeverInit = true
if(isAppInit) {
mainWindow.webContents.send('program-init')
}
}
}
});
ipcMain.on('judgment-isSeverInit', (event) => {
event.returnValue = isSeverInit
})
// 监听错误输出stderr
batProcess.stderr.on('data', () => {
// console.error(`错误输出: ${data.toString().trim()}`);
});
// 监听进程执行出错
batProcess.on('error', () => {
// console.error(`执行错误: ${error.message}`);
});
// 监听进程退出事件(执行结束后触发)
batProcess.on('close', (code) => {
console.log(`批处理执行完毕,退出码: ${code}`);
});
// Set app user model id for windows // Set app user model id for windows
electronApp.setAppUserModelId('com.electron') electronApp.setAppUserModelId('com.electron')

View File

@ -11,33 +11,6 @@ declare module 'vue' {
BaseDialog: typeof import('./src/components/dialog/baseDialog.vue')['default'] BaseDialog: typeof import('./src/components/dialog/baseDialog.vue')['default']
Directory: typeof import('./src/components/dialog/directory.vue')['default'] Directory: typeof import('./src/components/dialog/directory.vue')['default']
DirectoryEdit: typeof import('./src/components/dialog/directoryEdit.vue')['default'] DirectoryEdit: typeof import('./src/components/dialog/directoryEdit.vue')['default']
ElButton: typeof import('element-plus/es')['ElButton']
ElCard: typeof import('element-plus/es')['ElCard']
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup']
ElCol: typeof import('element-plus/es')['ElCol']
ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
ElDialog: typeof import('element-plus/es')['ElDialog']
ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElIcon: typeof import('element-plus/es')['ElIcon']
ElImage: typeof import('element-plus/es')['ElImage']
ElInput: typeof import('element-plus/es')['ElInput']
ElOption: typeof import('element-plus/es')['ElOption']
ElPagination: typeof import('element-plus/es')['ElPagination']
ElPopconfirm: typeof import('element-plus/es')['ElPopconfirm']
ElPopover: typeof import('element-plus/es')['ElPopover']
ElRow: typeof import('element-plus/es')['ElRow']
ElSelect: typeof import('element-plus/es')['ElSelect']
ElSlider: typeof import('element-plus/es')['ElSlider']
ElSwitch: typeof import('element-plus/es')['ElSwitch']
ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTabPane: typeof import('element-plus/es')['ElTabPane']
ElTabs: typeof import('element-plus/es')['ElTabs']
ElTooltip: typeof import('element-plus/es')['ElTooltip']
ElTree: typeof import('element-plus/es')['ElTree']
ElUpload: typeof import('element-plus/es')['ElUpload']
Index_b: typeof import('./src/components/SvgIcon/index_b.vue')['default'] Index_b: typeof import('./src/components/SvgIcon/index_b.vue')['default']
Pagination: typeof import('./src/components/Pagination/index.vue')['default'] Pagination: typeof import('./src/components/Pagination/index.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink'] RouterLink: typeof import('vue-router')['RouterLink']

View File

@ -36,6 +36,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
//@ts-nocheck
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import setTool from './components/setTool/setTool.vue' import setTool from './components/setTool/setTool.vue'
import weather from './components/weather/index.vue' import weather from './components/weather/index.vue'

View File

@ -214,7 +214,7 @@ const minusCircle = async (index) => {
} }
} }
const changeRadius = async (e) => { const changeRadius = async (e) => {
proxy.$handleInputLimit(e) proxy?.$handleInputLimit(e)
let newCircle = JSON.parse(JSON.stringify(circle.value)) let newCircle = JSON.parse(JSON.stringify(circle.value))
if (radiusUnit.value == 'km') { if (radiusUnit.value == 'km') {
for (let i = 0; i < newCircle.length; i++) { for (let i = 0; i < newCircle.length; i++) {

View File

@ -168,7 +168,7 @@ const remove = () => {
}) })
} }
const changeRadius = (e)=>{ const changeRadius = (e)=>{
proxy.$handleInputLimit(e) proxy?.$handleInputLimit(e)
if (radiusUnit.value == 'km') { if (radiusUnit.value == 'km') {
entityOptions.value.radius = radius.value * 1000 entityOptions.value.radius = radius.value * 1000
} }

View File

@ -199,7 +199,7 @@ const remove = () => {
}) })
} }
const changeRadius = (e) => { const changeRadius = (e) => {
proxy.$handleInputLimit(e) proxy?.$handleInputLimit(e)
if (radiusUnit.value == 'km') { if (radiusUnit.value == 'km') {
entityOptions.value.radius = radius.value * 1000 entityOptions.value.radius = radius.value * 1000
} }

View File

@ -11,14 +11,8 @@
<firstMenu class="absolute zIndex9" ref="firstMenuRef"></firstMenu> <firstMenu class="absolute zIndex9" ref="firstMenuRef"></firstMenu>
<!--底部菜单--> <!--底部菜单-->
<bottomMenu class="absolute zIndex9" ref="bottomMenuRef"></bottomMenu> <bottomMenu class="absolute zIndex9" ref="bottomMenuRef"></bottomMenu>
<input <input type="file" id="fileInputlink" style="display: none" multiple accept=".jpeg,.png,.jpg,.mp4,.pdf"
type="file" @input="uploadFile" />
id="fileInputlink"
style="display: none"
multiple
accept=".jpeg,.png,.jpg,.mp4,.pdf"
@input="uploadFile"
/>
<!-- 多点视线分析 --> <!-- 多点视线分析 -->
<!-- <Visibility ref="visibility"></Visibility> --> <!-- <Visibility ref="visibility"></Visibility> -->
@ -557,6 +551,122 @@ onMounted(async () => {
await YJ.on({ host: baseURL, token: localStorage.getItem('Authorization') }) await YJ.on({ host: baseURL, token: localStorage.getItem('Authorization') })
createEarth() createEarth()
}) })
// function getLatLngBySheetNumber(sheetNumber) {
// // 比例尺代码映射(逆向):代码 -> 比例尺及步长
// const scaleInfoMap = {
// '': { scale: '1:100万', lngStep: 6, latStep: 4 },
// 'B': { scale: '1:50万', lngStep: 3, latStep: 2 },
// 'C': { scale: '1:25万', lngStep: 1.5, latStep: 1 },
// 'D': { scale: '1:10万', lngStep: 0.5, latStep: 1 / 3 },
// 'E': { scale: '1:5万', lngStep: 0.25, latStep: 1 / 6 },
// 'F': { scale: '1:2.5万', lngStep: 0.125, latStep: 1 / 12 },
// 'G': { scale: '1:1万', lngStep: 0.0625, latStep: 1 / 24 },
// 'H': { scale: '1:5000', lngStep: 0.03125, latStep: 1 / 48 }
// };
// // 1:100万行号字母对应表A-V对应1-22
// const rowChars = 'ABCDEFGHIJKLMNOPQRSTUV';
// // 解析编号结构
// let scaleCode, row100WChar, col100W, subRow, subCol;
// // 1:100万编号格式1个字母 + 2位数字如J50
// if (sheetNumber.length === 3) {
// scaleCode = '';
// row100WChar = sheetNumber[0];
// col100W = parseInt(sheetNumber.slice(1), 10);
// subRow = 1; // 1:100万无细分默认第1行
// subCol = 1; // 1:100万无细分默认第1列
// }
// // 其他比例尺1个字母 + 2位数字 + 1位代码 + 3位行 + 3位列如J50E001001
// else if (sheetNumber.length === 10) {
// row100WChar = sheetNumber[0];
// col100W = parseInt(sheetNumber.slice(1, 3), 10);
// scaleCode = sheetNumber[3];
// subRow = parseInt(sheetNumber.slice(4, 7), 10);
// subCol = parseInt(sheetNumber.slice(7, 10), 10);
// } else {
// throw new Error('无效的图幅编号格式,请检查输入');
// }
// // 验证行字母合法性A-V
// const row100WIndex = rowChars.indexOf(row100WChar);
// if (row100WIndex === -1) {
// throw new Error('无效的1:100万图幅行字母必须为A-V');
// }
// const row100W = row100WIndex + 1; // 行号1-22
// // 验证列号合法性1-60
// if (col100W < 1 || col100W > 60) {
// throw new Error('无效的1:100万图幅列号必须为1-60');
// }
// // 验证比例尺代码和细分行列号
// const scaleInfo = scaleInfoMap[scaleCode];
// if (!scaleInfo) {
// throw new Error('不支持的比例尺代码必须为B-H或空');
// }
// if (subRow < 1 || subCol < 1) {
// throw new Error('细分行列号必须为正整数');
// }
// // 计算1:100万图幅的经纬度范围
// const minLng100W = (col100W - 31) * 6; // 1:100万图幅西边界经度
// const maxLng100W = minLng100W + 6; // 1:100万图幅东边界经度
// const maxLat100W = row100W * 4; // 1:100万图幅北边界纬度
// const minLat100W = maxLat100W - 4; // 1:100万图幅南边界纬度
// // 计算当前比例尺图幅在1:100万内的偏移量反推精确范围
// const { lngStep, latStep, scale } = scaleInfo;
// const minLng = minLng100W + (subCol - 1) * lngStep; // 图幅西边界经度
// const maxLng = minLng + lngStep; // 图幅东边界经度
// const maxLat = maxLat100W - (subRow - 1) * latStep; // 图幅北边界纬度(注意纬度方向是从北向南递增)
// const minLat = maxLat - latStep; // 图幅南边界纬度
// let object = {
// scale,
// longitude: [minLng, maxLng], // [西经, 东经]
// latitude: [minLat, maxLat] // [南纬, 北纬]
// }
// highlightSheetIndex(window.earth, object)
// return object;
// }
// function highlightSheetIndex(sdk, object) {
// let viewer = sdk.viewer;
// let height = 8848
// let positions = [
// Cesium.Cartesian3.fromDegrees(object.longitude[0], object.latitude[0], height),
// Cesium.Cartesian3.fromDegrees(object.longitude[1], object.latitude[0], height),
// Cesium.Cartesian3.fromDegrees(object.longitude[1], object.latitude[1], height),
// Cesium.Cartesian3.fromDegrees(object.longitude[0], object.latitude[1], height),
// Cesium.Cartesian3.fromDegrees(object.longitude[0], object.latitude[0], height),
// ]
// let gridPrimitives = new Cesium.PrimitiveCollection();
// gridPrimitives.name = 'highlightSheetIndexGridPrimitives';
// viewer.scene.primitives.add(gridPrimitives);
// const geometryInstances = new Cesium.GeometryInstance({
// geometry: new Cesium.GroundPolylineGeometry({
// positions: positions,
// width: 1,
// vertexFormat: Cesium.PerInstanceColorAppearance.VERTEX_FORMAT,
// arcType: Cesium.ArcType.RHUMB,
// })
// });
// gridPrimitives.add(new Cesium.GroundPolylinePrimitive({
// geometryInstances: geometryInstances,
// appearance: new Cesium.PolylineMaterialAppearance({
// material: Cesium.Material.fromType('Color', {
// color: Cesium.Color.fromCssColorString('#f00')
// })
// })
// }));
// }
// window.getLatLngBySheetNumber = getLatLngBySheetNumber
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@ -1,13 +1,7 @@
<template> <template>
<div <div class="login-container" style="position: fixed; width: 100vw; height: 100vh; left: 0; top: 0">
class="login-container" <transition name="video-fade" mode="out-in"
style="position: fixed; width: 100vw; height: 100vh; left: 0; top: 0" style="position: fixed; width: 100vw; height: 100vh; left: 0; top: 0; object-fit: cover">
>
<transition
name="video-fade"
mode="out-in"
style="position: fixed; width: 100vw; height: 100vh; left: 0; top: 0; object-fit: cover"
>
<!-- 第一个视频播放一次 --> <!-- 第一个视频播放一次 -->
<!-- <video v-if="!isFirstVideoPlayed" ref="firstVideoRef" key="first-video" muted @ended="onFirstVideoEnded" <!-- <video v-if="!isFirstVideoPlayed" ref="firstVideoRef" key="first-video" muted @ended="onFirstVideoEnded"
src="../../assets/video/login_front.mp4" src="../../assets/video/login_front.mp4"
@ -15,17 +9,11 @@
<!-- 第二个视频循环播放 --> <!-- 第二个视频循环播放 -->
<!-- <video v-else key="second-video" autoplay loop muted src="../../assets/video/login_feature.mp4" <!-- <video v-else key="second-video" autoplay loop muted src="../../assets/video/login_feature.mp4"
style="position: fixed; width: 100vw; height: 100vh; left: 0; top: 0; object-fit: cover"></video> --> style="position: fixed; width: 100vw; height: 100vh; left: 0; top: 0; object-fit: cover"></video> -->
<video <video key="second-video" autoplay loop muted src="../../assets/video/author_video.mp4"
key="second-video" style="position: fixed; width: 100vw; height: 100vh; left: 0; top: 0; object-fit: cover"></video>
autoplay
loop
muted
src="../../assets/video/author_video.mp4"
style="position: fixed; width: 100vw; height: 100vh; left: 0; top: 0; object-fit: cover"
></video>
</transition> </transition>
<!-- 登录页面 --> <!-- 登录页面 -->
<div class="rightBox" v-if="isDesktop && !isAuth"> <div class="rightBox" v-if="isDesktop">
<el-button size="small" :icon="Setting" @click="serviceDialog = true"> </el-button> <el-button size="small" :icon="Setting" @click="serviceDialog = true"> </el-button>
<el-button size="small" :icon="SwitchButton" @click="goExit"> </el-button> <el-button size="small" :icon="SwitchButton" @click="goExit"> </el-button>
</div> </div>
@ -39,95 +27,45 @@
</div> </div>
</div> </div>
</div> </div>
<el-form <el-form class="login-form" autoComplete="on" :model="loginForm" :rules="loginRules" ref="loginFormRef"
class="login-form" label-position="left">
autoComplete="on"
:model="loginForm"
:rules="loginRules"
ref="loginFormRef"
label-position="left"
>
<el-form-item prop="username"> <el-form-item prop="username">
<el-input <el-input name="username" type="text" v-model="loginForm.username" autoComplete="on" placeholder="请输入用户名"
name="username" :prefix-icon="User" />
type="text"
v-model="loginForm.username"
autoComplete="on"
placeholder="请输入用户名"
:prefix-icon="User"
/>
</el-form-item> </el-form-item>
<el-form-item prop="password"> <el-form-item prop="password">
<el-input <el-input type="password" @keyup.enter.native="handleLogin(loginFormRef)" v-model="loginForm.password"
type="password" autoComplete="on" placeholder="请输入密码" :prefix-icon="Unlock" show-password></el-input>
@keyup.enter.native="handleLogin(loginFormRef)"
v-model="loginForm.password"
autoComplete="on"
placeholder="请输入密码"
:prefix-icon="Unlock"
show-password
></el-input>
</el-form-item> </el-form-item>
<el-form-item class="rememberForget"> <el-form-item class="rememberForget">
<!-- justify-content: space-around;align-items: center; --> <!-- justify-content: space-around;align-items: center; -->
<div style="display: flex"> <div style="display: flex">
<svg <svg class="checkbox-svg" v-show="checkboxVModel" style="pointer-events: none"
class="checkbox-svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="14" height="14"
v-show="checkboxVModel" viewBox="0 0 14 14" fill="none">
style="pointer-events: none" <path fill="rgba(var(--color-base1), 1)"
xmlns="http://www.w3.org/2000/svg" d="M7.34788e-16 2L-2.20436e-15 12C-2.40727e-15 13.1046 0.895431 14 2 14L12 14C13.1046 14 14 13.1046 14 12L14 2C14 0.895431 13.1046 -1.46958e-15 12 -1.46958e-15L2 -1.46958e-15C0.895431 -1.60485e-15 8.02424e-16 0.895431 7.34788e-16 2Z">
xmlns:xlink="http://www.w3.org/1999/xlink" </path>
width="14"
height="14"
viewBox="0 0 14 14"
fill="none"
>
<path
fill="rgba(var(--color-base1), 1)"
d="M7.34788e-16 2L-2.20436e-15 12C-2.40727e-15 13.1046 0.895431 14 2 14L12 14C13.1046 14 14 13.1046 14 12L14 2C14 0.895431 13.1046 -1.46958e-15 12 -1.46958e-15L2 -1.46958e-15C0.895431 -1.60485e-15 8.02424e-16 0.895431 7.34788e-16 2Z"
></path>
<path <path
d="M5.47283 8.3039L3.10764 6.12807C3.06194 6.08647 2.99525 6.08647 2.94955 6.12946L2.04424 6.98093C1.98989 7.03224 1.98495 7.12376 2.03312 7.18201L6.03602 11.9566C6.09778 12.0301 6.20647 12.0065 6.24105 11.9136C7.03644 9.69343 9.25835 5.63439 11.9619 2.69585C11.999 2.65564 12.0101 2.59601 11.9904 2.54331L11.8211 2.08568C11.7915 2.00525 11.7038 1.97474 11.6396 2.02328C8.63587 4.21019 6.45966 6.92546 5.47283 8.3039Z" d="M5.47283 8.3039L3.10764 6.12807C3.06194 6.08647 2.99525 6.08647 2.94955 6.12946L2.04424 6.98093C1.98989 7.03224 1.98495 7.12376 2.03312 7.18201L6.03602 11.9566C6.09778 12.0301 6.20647 12.0065 6.24105 11.9136C7.03644 9.69343 9.25835 5.63439 11.9619 2.69585C11.999 2.65564 12.0101 2.59601 11.9904 2.54331L11.8211 2.08568C11.7915 2.00525 11.7038 1.97474 11.6396 2.02328C8.63587 4.21019 6.45966 6.92546 5.47283 8.3039Z"
fill="#004242" fill="#004242"></path>
></path>
</svg> </svg>
<svg <svg class="checkbox-svg" v-show="!checkboxVModel" style="pointer-events: none"
class="checkbox-svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="14" height="14"
v-show="!checkboxVModel" viewBox="0 0 14 14" fill="none">
style="pointer-events: none" <path fill-rule="evenodd" fill="url(#linear_border_2442_533_0)"
xmlns="http://www.w3.org/2000/svg" d="M0 12L0 2C0 0.895431 0.895431 0 2 0L12 0C13.1046 0 14 0.895431 14 2L14 12C14 13.1046 13.1046 14 12 14L2 14C0.895431 14 0 13.1046 0 12ZM2 12.5C1.72386 12.5 1.5 12.2761 1.5 12L1.5 2C1.5 1.72386 1.72386 1.5 2 1.5L12 1.5C12.2761 1.5 12.5 1.72386 12.5 2L12.5 12C12.5 12.2761 12.2761 12.5 12 12.5L2 12.5Z">
xmlns:xlink="http://www.w3.org/1999/xlink" </path>
width="14"
height="14"
viewBox="0 0 14 14"
fill="none"
>
<path
fill-rule="evenodd"
fill="url(#linear_border_2442_533_0)"
d="M0 12L0 2C0 0.895431 0.895431 0 2 0L12 0C13.1046 0 14 0.895431 14 2L14 12C14 13.1046 13.1046 14 12 14L2 14C0.895431 14 0 13.1046 0 12ZM2 12.5C1.72386 12.5 1.5 12.2761 1.5 12L1.5 2C1.5 1.72386 1.72386 1.5 2 1.5L12 1.5C12.2761 1.5 12.5 1.72386 12.5 2L12.5 12C12.5 12.2761 12.2761 12.5 12 12.5L2 12.5Z"
></path>
<defs> <defs>
<linearGradient <linearGradient id="linear_border_2442_533_0" x1="0" y1="-0.5574798583984375" x2="12.1173095703125"
id="linear_border_2442_533_0" y2="12.878036499023438" gradientUnits="userSpaceOnUse">
x1="0"
y1="-0.5574798583984375"
x2="12.1173095703125"
y2="12.878036499023438"
gradientUnits="userSpaceOnUse"
>
<stop offset="0.0625" stop-color="rgba(var(--color-base1), 1)" /> <stop offset="0.0625" stop-color="rgba(var(--color-base1), 1)" />
<stop offset="1" stop-color="var(--color-border1)" /> <stop offset="1" stop-color="var(--color-border1)" />
</linearGradient> </linearGradient>
</defs> </defs>
</svg> </svg>
<el-checkbox <el-checkbox :disabled="loading" v-model="checkboxVModel" @change="rememberpwd"
:disabled="loading" label="string">记住密码</el-checkbox>
v-model="checkboxVModel"
@change="rememberpwd"
label="string"
>记住密码</el-checkbox
>
<!-- <div style="cursor: pointer;">忘记密码</div> --> <!-- <div style="cursor: pointer;">忘记密码</div> -->
</div> </div>
</el-form-item> </el-form-item>
@ -150,24 +88,15 @@
<h2 class="greet"><span>欢迎您使用</span>实景三维电子沙盘系统</h2> <h2 class="greet"><span>欢迎您使用</span>实景三维电子沙盘系统</h2>
<div class="serviceContent"> <div class="serviceContent">
<el-tabs v-model="selectedService" class="demo-tabs" @tab-click="handleSelect"> <el-tabs v-model="selectedService" class="demo-tabs" @tab-click="handleSelect">
<el-tab-pane <el-tab-pane v-for="item in serviceOptions" :label="item.name" :name="item.name"></el-tab-pane>
v-for="item in serviceOptions"
:label="item.name"
:name="item.name"
></el-tab-pane>
</el-tabs> </el-tabs>
<div class="tabPanel"> <div class="tabPanel">
<template v-if="selectedService == '接口服务'"> <template v-if="selectedService == '接口服务'">
<div class="item"> <div class="item">
<span class="itemLabel">服务选择</span> <span class="itemLabel">服务选择</span>
<el-select class="select" popper-class="login-select-popper" v-model="servVal"> <el-select class="select" popper-class="login-select-popper" v-model="servVal">
<el-option <el-option size="mini" v-for="item in servOptions" :key="item.value" :label="item.name"
size="mini" :value="item.name">
v-for="item in servOptions"
:key="item.value"
:label="item.name"
:value="item.name"
>
</el-option> </el-option>
</el-select> </el-select>
</div> </div>
@ -199,13 +128,8 @@
<div class="item"> <div class="item">
<span class="itemLabel">串口选择</span> <span class="itemLabel">串口选择</span>
<el-select class="select" popper-class="login-select-popper" v-model="gpsVal"> <el-select class="select" popper-class="login-select-popper" v-model="gpsVal">
<el-option <el-option size="mini" v-for="item in gpsOptions" :key="item.value" :label="item.Product"
size="mini" :value="item.Name">
v-for="item in gpsOptions"
:key="item.value"
:label="item.Product"
:value="item.Name"
>
</el-option> </el-option>
</el-select> </el-select>
</div> </div>
@ -220,14 +144,8 @@
</div> </div>
</div> </div>
<!-- 授权页面 --> <!-- 授权页面 -->
<Dialog <Dialog ref="baseDialog" class="graffiti" title="系统授权" :closeCallback="closeCallBack" left="calc(50vw - 188px)"
ref="baseDialog" top="calc(50vh - 191px)">
class="graffiti"
title="系统授权"
:closeCallback="closeCallBack"
left="calc(50vw - 188px)"
top="calc(50vh - 191px)"
>
<template #content> <template #content>
<div class="auth_info custom_scroll_bar content_h"> <div class="auth_info custom_scroll_bar content_h">
<div class="auth_info_box"> <div class="auth_info_box">
@ -235,12 +153,7 @@
<span class="fankuai"></span> <span class="fankuai"></span>
{{ t('auths.authCode') }} {{ t('auths.authCode') }}
</div> </div>
<div <div class="auth_info_text" @click="copy(authInfo.license_code)" style="cursor: pointer" title="点击可复制">
class="auth_info_text"
@click="copy(authInfo.license_code)"
style="cursor: pointer"
title="点击可复制"
>
{{ authInfo.license_code || '' }} {{ authInfo.license_code || '' }}
<svg-icon name="copy" :size="20" style="margin-left: 30px"></svg-icon> <svg-icon name="copy" :size="20" style="margin-left: 30px"></svg-icon>
</div> </div>
@ -263,22 +176,13 @@
<span class="fankuai"></span> <span class="fankuai"></span>
{{ t('auths.authType') }} {{ t('auths.authType') }}
</div> </div>
<div <div v-if="authInfo.status != null" class="auth_info_text" style="font-size: 16px" :style="{
v-if="authInfo.status != null"
class="auth_info_text"
style="font-size: 16px"
:style="{
color: authInfo.status ? 'rgba(27, 248, 195, 1)' : 'rgba(255, 161, 69, 1)' color: authInfo.status ? 'rgba(27, 248, 195, 1)' : 'rgba(255, 161, 69, 1)'
}" }">
>
{{ authInfo.status ? t('auths.authTempExpire') : t('auths.authexpire') }} {{ authInfo.status ? t('auths.authTempExpire') : t('auths.authexpire') }}
</div> </div>
<!-- <div v-else class="auth_info_text">{{ authInfo.message || '无' }}</div> --> <!-- <div v-else class="auth_info_text">{{ authInfo.message || '无' }}</div> -->
<div <div v-else class="auth_info_text" style="font-size: 16px; color: rgba(241, 108, 85, 1)">
v-else
class="auth_info_text"
style="font-size: 16px; color: rgba(241, 108, 85, 1)"
>
{{ t('auths.noAuthexpire') }} {{ t('auths.noAuthexpire') }}
</div> </div>
</div> </div>
@ -294,6 +198,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
//@ts-nocheck
import { User, Unlock, Setting, SwitchButton } from '@element-plus/icons-vue' import { User, Unlock, Setting, SwitchButton } from '@element-plus/icons-vue'
import { useLogin } from './useLogin' import { useLogin } from './useLogin'
import { useSetUp } from './useSetUp' import { useSetUp } from './useSetUp'
@ -346,6 +251,7 @@ onMounted(() => {
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import useClipboard from 'vue-clipboard3' import useClipboard from 'vue-clipboard3'
import { ipcMain } from 'electron'
import { AuthApi } from '@/api/setting/auth' import { AuthApi } from '@/api/setting/auth'
import Dialog from '@/components/dialog/baseDialog.vue' import Dialog from '@/components/dialog/baseDialog.vue'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
@ -478,9 +384,9 @@ const getAuthCode = async () => {
const res = await AuthApi.authInfo() const res = await AuthApi.authInfo()
authInfo.value.license_code = res.data authInfo.value.license_code = res.data
} }
setTimeout(() => { // setTimeout(() => {
getAuthCode() // getAuthCode()
}, 5000) // }, 8000)
//复制 //复制
const copy = async (text) => { const copy = async (text) => {
@ -491,14 +397,28 @@ const copy = async (text) => {
ElMessage.error('复制失败') ElMessage.error('复制失败')
} }
} }
let isSeverInit = ipcRenderer.sendSync('judgment-isSeverInit');
// 如果服务端未初始化,等待初始化完成
if (isSeverInit) {
if (!router.currentRoute.value.query.type) { if (!router.currentRoute.value.query.type) {
setTimeout(() => {
getAuthCode() getAuthCode()
getAuthInfo() getAuthInfo()
}, 5000)
} else { } else {
isAuth.value = false isAuth.value = false
} }
}
else {
ipcRenderer.once('program-init', () => {
if (!router.currentRoute.value.query.type) {
getAuthCode()
getAuthInfo()
} else {
isAuth.value = false
}
})
}
</script> </script>
<style lang="scss"> <style lang="scss">
// 添加过渡样式 // 添加过渡样式
@ -875,8 +795,7 @@ if (!router.currentRoute.value.query.type) {
align-items: center; align-items: center;
margin: 15px 0; margin: 15px 0;
.select { .select {}
}
} }
} }
} }
@ -913,6 +832,7 @@ if (!router.currentRoute.value.query.type) {
} }
} }
} }
//授权 //授权
.auth_info { .auth_info {
width: 100%; width: 100%;
@ -964,8 +884,7 @@ if (!router.currentRoute.value.query.type) {
z-index: 99; z-index: 99;
background: linear-gradient(0deg, #00ffff33 0%, #00ffff00 100%), rgba(0, 0, 0, 0.6); background: linear-gradient(0deg, #00ffff33 0%, #00ffff00 100%), rgba(0, 0, 0, 0.6);
border: 1.5px solid; border: 1.5px solid;
border-image: linear-gradient(to bottom, rgba(var(--color-base1), 1) 6.25%, rgb(0, 200, 255) 100%) border-image: linear-gradient(to bottom, rgba(var(--color-base1), 1) 6.25%, rgb(0, 200, 255) 100%) 1;
1;
text-align: left; text-align: left;
font-family: 'sy-boldface'; font-family: 'sy-boldface';
} }
@ -1227,8 +1146,7 @@ if (!router.currentRoute.value.query.type) {
align-items: center; align-items: center;
margin: 15px 0; margin: 15px 0;
.select { .select {}
}
} }
} }
} }
@ -1241,6 +1159,7 @@ if (!router.currentRoute.value.query.type) {
width: 166px; width: 166px;
height: 40px; height: 40px;
border-radius: 0; border-radius: 0;
::v-deep span { ::v-deep span {
font-weight: 500; font-weight: 500;
} }
@ -1264,6 +1183,7 @@ if (!router.currentRoute.value.query.type) {
} }
} }
} }
::v-deep .el-popper { ::v-deep .el-popper {
z-index: 9999 !important; z-index: 9999 !important;
} }