升级electron egg脚手架版本
This commit is contained in:
@@ -1,94 +1,215 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, maximum-scale=1.0, minimum-scale=1.0" />
|
||||
<style>
|
||||
#loadingPage {
|
||||
background-color: #dedede;
|
||||
font-size: 12px;
|
||||
}
|
||||
.base {
|
||||
left: 50%;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
.desc {
|
||||
margin: 0, 0, 20px, 0;
|
||||
}
|
||||
.loading,
|
||||
.loading > div {
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.loading {
|
||||
display: block;
|
||||
font-size: 0;
|
||||
color: #06b359;
|
||||
}
|
||||
.loading.la-dark {
|
||||
color: #07C160;
|
||||
}
|
||||
.loading > div {
|
||||
display: inline-block;
|
||||
float: none;
|
||||
background-color: currentColor;
|
||||
border: 0 solid currentColor;
|
||||
}
|
||||
.loading {
|
||||
width: 92px;
|
||||
height: 92px;
|
||||
}
|
||||
.loading > div {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
background: transparent;
|
||||
border-style: solid;
|
||||
border-width: 2px;
|
||||
border-radius: 100%;
|
||||
animation: ball-clip-rotate-multiple-rotate 1s ease-in-out infinite;
|
||||
}
|
||||
.loading > div:first-child {
|
||||
position: absolute;
|
||||
width: 92px;
|
||||
height: 92px;
|
||||
border-right-color: transparent;
|
||||
border-left-color: transparent;
|
||||
}
|
||||
.loading > div:last-child {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border-top-color: transparent;
|
||||
border-bottom-color: transparent;
|
||||
animation-duration: 0.5s;
|
||||
animation-direction: reverse;
|
||||
}
|
||||
@keyframes ball-clip-rotate-multiple-rotate {
|
||||
0% {
|
||||
transform: translate(-50%, -50%) rotate(0deg);
|
||||
}
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>NPQS9100 正在启动...</title>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
50% {
|
||||
transform: translate(-50%, -50%) rotate(180deg);
|
||||
}
|
||||
body {
|
||||
font-family: 'Microsoft YaHei', Arial, sans-serif;
|
||||
background: transparent;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translate(-50%, -50%) rotate(360deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="boot">
|
||||
<div class='base'>
|
||||
<div class="loading">
|
||||
<div></div>
|
||||
<div></div>
|
||||
</div>
|
||||
</div>
|
||||
.loading-container {
|
||||
width: 480px;
|
||||
padding: 40px;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
border-radius: 20px;
|
||||
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
||||
text-align: center;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.logo {
|
||||
font-size: 32px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 10px;
|
||||
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 14px;
|
||||
opacity: 0.9;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.status-text {
|
||||
font-size: 16px;
|
||||
margin-bottom: 20px;
|
||||
min-height: 24px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.progress-bar-container {
|
||||
width: 100%;
|
||||
height: 8px;
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, #ffffff 0%, #f0f0f0 100%);
|
||||
border-radius: 4px;
|
||||
transition: width 0.3s ease;
|
||||
width: 0%;
|
||||
box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
|
||||
.progress-percent {
|
||||
font-size: 14px;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.spinner {
|
||||
display: inline-block;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.spinner div {
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
position: absolute;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
margin: 4px;
|
||||
border: 3px solid #fff;
|
||||
border-radius: 50%;
|
||||
animation: spinner 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
|
||||
border-color: #fff transparent transparent transparent;
|
||||
}
|
||||
|
||||
.spinner div:nth-child(1) {
|
||||
animation-delay: -0.45s;
|
||||
}
|
||||
|
||||
.spinner div:nth-child(2) {
|
||||
animation-delay: -0.3s;
|
||||
}
|
||||
|
||||
.spinner div:nth-child(3) {
|
||||
animation-delay: -0.15s;
|
||||
}
|
||||
|
||||
@keyframes spinner {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
.error-container {
|
||||
display: none;
|
||||
margin-top: 20px;
|
||||
padding: 15px;
|
||||
background: rgba(255, 0, 0, 0.2);
|
||||
border-radius: 8px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
.error-container.show {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.error-title {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.error-message {
|
||||
font-size: 14px;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.extra-info {
|
||||
font-size: 12px;
|
||||
opacity: 0.7;
|
||||
margin-top: 15px;
|
||||
font-style: italic;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="loading-container">
|
||||
<div class="logo">NPQS9100</div>
|
||||
<div class="subtitle">南京灿能电气自动化 · 自动检测平台</div>
|
||||
|
||||
<div class="status-text" id="statusText">正在初始化应用...</div>
|
||||
|
||||
<div class="progress-bar-container">
|
||||
<div class="progress-bar" id="progressBar"></div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<div class="progress-percent" id="progressPercent">0%</div>
|
||||
|
||||
<div class="spinner">
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
</div>
|
||||
|
||||
<div class="error-container" id="errorContainer">
|
||||
<div class="error-title">启动失败</div>
|
||||
<div class="error-message" id="errorMessage"></div>
|
||||
</div>
|
||||
|
||||
<div class="extra-info" id="extraInfo"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const { ipcRenderer } = require('electron');
|
||||
|
||||
const statusText = document.getElementById('statusText');
|
||||
const progressBar = document.getElementById('progressBar');
|
||||
const progressPercent = document.getElementById('progressPercent');
|
||||
const errorContainer = document.getElementById('errorContainer');
|
||||
const errorMessage = document.getElementById('errorMessage');
|
||||
const extraInfo = document.getElementById('extraInfo');
|
||||
|
||||
// 监听启动进度
|
||||
ipcRenderer.on('startup-progress', (event, data) => {
|
||||
statusText.textContent = data.label;
|
||||
progressBar.style.width = data.progress + '%';
|
||||
progressPercent.textContent = data.progress + '%';
|
||||
|
||||
// 显示额外信息
|
||||
let info = '';
|
||||
if (data.mysqlPort) {
|
||||
info += `MySQL 端口: ${data.mysqlPort} `;
|
||||
}
|
||||
if (data.javaPort) {
|
||||
info += `后端端口: ${data.javaPort} `;
|
||||
}
|
||||
if (data.dataPath) {
|
||||
info += `数据目录: ${data.dataPath}`;
|
||||
}
|
||||
|
||||
if (info) {
|
||||
extraInfo.textContent = info;
|
||||
}
|
||||
});
|
||||
|
||||
// 监听启动错误
|
||||
ipcRenderer.on('startup-error', (event, data) => {
|
||||
errorMessage.textContent = data.error;
|
||||
errorContainer.classList.add('show');
|
||||
progressBar.style.background = 'linear-gradient(90deg, #ff6b6b 0%, #ee5a6f 100%)';
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user