Initial commit

This commit is contained in:
yuchenglong
2025-11-20 10:00:02 +08:00
commit 8aa5f7802f
147 changed files with 132905 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
node_modules

BIN
dist/assets/QR-58b44157.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

BIN
dist/assets/avatar-46c46ce7.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
dist/assets/back-button-49793580.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

BIN
dist/assets/bg-8c252c22.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 KiB

BIN
dist/assets/button-62769f6e.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
dist/assets/button-loading-801352b2.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
dist/assets/confirm-button-11508f4a.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

BIN
dist/assets/icon-104ead59.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
dist/assets/idcard-555945da.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

1
dist/assets/index-0c3a5195.css vendored Normal file

File diff suppressed because one or more lines are too long

42
dist/assets/index-d39aadb6.js vendored Normal file

File diff suppressed because one or more lines are too long

BIN
dist/assets/radio-1-3c17655e.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
dist/assets/semicircle-c03690f9.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
dist/assets/success-d83b0b81.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

BIN
dist/assets/u2-card-8ae8ba13.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
dist/assets/u4-card-2168368b.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
dist/assets/wait-button-bf05d764.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

14
dist/index.html vendored Normal file
View File

@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Electron + React App</title>
<script type="module" crossorigin src="./assets/index-d39aadb6.js"></script>
<link rel="stylesheet" href="./assets/index-0c3a5195.css">
</head>
<body>
<div id="root"></div>
</body>
</html>

42
electron/main.js Normal file
View File

@@ -0,0 +1,42 @@
const { app, BrowserWindow } = require("electron");
const path = require("path");
function createWindow() {
const win = new BrowserWindow({
width: 1080,
height: 1920,
webPreferences: {
preload: path.join(__dirname, "preload.js"),
nodeIntegration: false,
contextIsolation: true,
},
});
// 开发环境下加载 Vite 开发服务器地址
// 生产环境下加载打包后的 index.html
const isDev = !app.isPackaged;
if (isDev) {
win.loadURL("http://localhost:5173");
// 打开开发者工具
win.webContents.openDevTools();
} else {
win.loadFile(path.join(__dirname, "../dist/index.html"));
}
}
app.whenReady().then(() => {
createWindow();
app.on("activate", () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});
});
app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
app.quit();
}
});

6
electron/preload.js Normal file
View File

@@ -0,0 +1,6 @@
const { contextBridge, ipcRenderer } = require("electron");
contextBridge.exposeInMainWorld("electronAPI", {
// 在这里暴露安全的 API 给渲染进程
// example: sendMessage: (message) => ipcRenderer.send('message', message)
});

12
index.html Normal file
View File

@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Electron + React App</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

9030
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

49
package.json Normal file
View File

@@ -0,0 +1,49 @@
{
"name": "yuanhe-checkin-electron",
"version": "1.0.0",
"description": "Electron application compatible with Windows 7",
"main": "electron/main.js",
"scripts": {
"dev": "concurrently \"vite\" \"wait-on tcp:5173 && electron .\"",
"build": "vite build",
"pack": "npm run build && electron-builder --dir",
"dist": "npm run build && electron-builder",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^7.9.6"
},
"devDependencies": {
"@types/react": "^19.2.6",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^4.2.1",
"concurrently": "^8.2.2",
"cross-env": "^7.0.3",
"electron": "^22.3.27",
"electron-builder": "^24.13.3",
"vite": "^4.5.2",
"wait-on": "^7.2.0"
},
"build": {
"appId": "com.yuanhe.checkin",
"productName": "YuanheCheckin",
"directories": {
"output": "release"
},
"files": [
"dist/**/*",
"electron/**/*"
],
"win": {
"target": [
"nsis",
"portable"
]
}
}
}

19
release/builder-debug.yml Normal file
View File

@@ -0,0 +1,19 @@
x64:
firstOrDefaultFilePatterns:
- '!**/node_modules'
- '!build{,/**/*}'
- '!release{,/**/*}'
- dist/**/*
- electron/**/*
- package.json
- '!**/*.{iml,hprof,orig,pyc,pyo,rbc,swp,csproj,sln,suo,xproj,cc,d.ts,mk,a,o,forge-meta,pdb}'
- '!**/._*'
- '!**/electron-builder.{yaml,yml,json,json5,toml,ts}'
- '!**/{.git,.hg,.svn,CVS,RCS,SCCS,__pycache__,.DS_Store,thumbs.db,.gitignore,.gitkeep,.gitattributes,.npmignore,.idea,.vs,.flowconfig,.jshintrc,.eslintrc,.circleci,.yarn-integrity,.yarn-metadata.json,yarn-error.log,yarn.lock,package-lock.json,npm-debug.log,appveyor.yml,.travis.yml,circle.yml,.nyc_output,.husky,.github,electron-builder.env}'
- '!.yarn{,/**/*}'
- '!.editorconfig'
- '!.yarnrc.yml'
nodeModuleFilePatterns:
- '**/*'
- dist/**/*
- electron/**/*

View File

@@ -0,0 +1,14 @@
directories:
output: release
buildResources: build
appId: com.yuanhe.checkin
productName: YuanheCheckin
files:
- filter:
- dist/**/*
- electron/**/*
win:
target:
- nsis
- portable
electronVersion: 22.3.27

View File

@@ -0,0 +1,21 @@
Copyright (c) Electron contributors
Copyright (c) 2013-2020 GitHub Inc.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1 @@
{"file_format_version": "1.0.0", "ICD": {"library_path": ".\\vk_swiftshader.dll", "api_version": "1.0.5"}}

Binary file not shown.

202
src/App.css Normal file
View File

@@ -0,0 +1,202 @@
:root {
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
font-size: 16px;
line-height: 24px;
font-weight: 400;
color: #0f0f0f;
background-color: #f6f6f6;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
/* 全局布局 */
html,
body,
#root {
height: 100%;
margin: 0;
}
body {
display: flex;
align-items: center;
justify-content: center;
background: #ffffff;
}
.app-container {
position: relative;
width: 1080px;
height: 1920px;
overflow: hidden;
}
/* 全局背景层 */
.global-background {
position: absolute;
top: 0;
left: 0;
width: 1080px;
height: 1920px;
background: url(./assets/bg.png) 100% no-repeat;
background-size: 100% 100%;
pointer-events: none;
z-index: 1;
}
.global-header {
display: flex;
flex-direction: row;
justify-content: space-between;
width: 927px;
height: 84px;
margin: 98px 0 0 82px;
pointer-events: auto;
}
.header-logo {
width: 248px;
height: 84px;
}
.header-title {
width: 442px;
height: 53px;
overflow-wrap: break-word;
color: rgba(255, 255, 255, 1);
font-size: 56px;
font-family: NotoSansCJKsc-Medium;
font-weight: 500;
text-align: center;
white-space: nowrap;
line-height: 56px;
margin-top: 17px;
}
.header-time {
width: 286px;
height: 24px;
overflow-wrap: break-word;
color: rgba(255, 255, 255, 1);
font-size: 31px;
font-family: NotoSansCJKsc-Medium;
font-weight: 500;
text-align: center;
white-space: nowrap;
line-height: 31px;
margin: 32px 0 0 724px;
pointer-events: auto;
}
/* 内容区域 */
.content-area {
position: relative;
width: 100%;
height: 100%;
z-index: 2;
pointer-events: auto;
}
.container {
margin: 0;
padding-top: 10vh;
display: flex;
flex-direction: column;
justify-content: center;
text-align: center;
}
.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: 0.75s;
}
.logo.tauri:hover {
filter: drop-shadow(0 0 2em #24c8db);
}
.row {
display: flex;
justify-content: center;
}
a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}
h1 {
text-align: center;
}
input,
button {
border-radius: 8px;
border: 1px solid transparent;
padding: 0.6em 1.2em;
font-size: 1em;
font-weight: 500;
font-family: inherit;
color: #0f0f0f;
background-color: #ffffff;
transition: border-color 0.25s;
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2);
}
button {
cursor: pointer;
}
button:hover {
border-color: #396cd8;
}
button:active {
border-color: #396cd8;
background-color: #e8e8e8;
}
input,
button {
outline: none;
}
#greet-input {
margin-right: 5px;
}
@media (prefers-color-scheme: dark) {
:root {
color: #f6f6f6;
background-color: #2f2f2f;
}
a:hover {
color: #24c8db;
}
input,
button {
color: #ffffff;
background-color: #0f0f0f98;
}
button:active {
background-color: #0f0f0f69;
}
}

77
src/App.tsx Normal file
View File

@@ -0,0 +1,77 @@
import { Routes, Route } from "react-router-dom";
import { useEffect, useState } from "react";
// import { listen } from "@tauri-apps/api/event";
import "./App.css";
import icon from "./assets/icon.png";
import U1 from "./pages/U1/u1";
import U2 from "./pages/U2/u2";
import U3 from "./pages/U3/u3";
import U4 from "./pages/U4/u4";
import UI6 from "./pages/UI6/UI6";
import UI7 from "./pages/UI7/UI7";
function App() {
const [time, setTime] = useState<string>(() => formatDate(new Date()));
useEffect(() => {
const id = setInterval(() => setTime(formatDate(new Date())), 1000);
// let unlisten: (() => void) | null = null;
// (async () => {
// try {
// const off = await listen("idcard-error", (e) => {
// console.error("[idcard-error]", e.payload);
// });
// unlisten = off;
// } catch (err) {
// console.error("failed to set idcard-error listener", err);
// }
// })();
return () => {
clearInterval(id);
// if (unlisten) unlisten();
};
}, []);
return (
<div className="app-container">
{/* 全局背景层 */}
<div className="global-background">
{/* 顶部固定区域 - 始终显示 */}
<div className="global-header">
<img className="header-logo" alt="logo" src={icon} />
<span className="header-title"></span>
</div>
<span className="header-time">{time}</span>
</div>
{/* 路由内容区域 */}
<div className="content-area">
<Routes>
<Route path="/" element={<U1 />} />
<Route path="/u2" element={<U2 />} />
<Route path="/u3" element={<U3 />} />
<Route path="/u4" element={<U4 />} />
<Route path="/UI6" element={<UI6 />} />
<Route path="/UI7" element={<UI7 />} />
</Routes>
</div>
</div>
);
}
export default App;
function pad(num: number) {
return String(num).padStart(2, "0");
}
function formatDate(d: Date) {
const Y = d.getFullYear();
const M = pad(d.getMonth() + 1);
const D = pad(d.getDate());
const hh = pad(d.getHours());
const mm = pad(d.getMinutes());
const ss = pad(d.getSeconds());
return `${Y}-${M}-${D} ${hh}:${mm}:${ss}`;
}

Some files were not shown because too many files have changed in this diff Show More