diff --git a/gncs.html b/gncs.html new file mode 100644 index 0000000..2b6cef6 --- /dev/null +++ b/gncs.html @@ -0,0 +1,159 @@ + + + + + + 智眼-软件功能测试 + + + +
+

功能测试页面

+ +
+ 摄像头 +
+
+ +
+ 人脸距离过近 +
+
+ +
+ 屏幕锁定密码解锁 +
+
+
+ + + + + + + + diff --git a/index.html b/index.html new file mode 100644 index 0000000..f152fb3 --- /dev/null +++ b/index.html @@ -0,0 +1,238 @@ + + + + + + + 智眼-启动首页 + + + + + +
+
+
+ + +
+
+ + + + +
+
+ + + + + diff --git a/index.js b/index.js new file mode 100644 index 0000000..1278ab5 --- /dev/null +++ b/index.js @@ -0,0 +1,46 @@ +const { app, BrowserWindow } = require('electron'); + +const { spawn } = require('child_process'); +const path = require('path'); + +const flaskProcess = spawn('python', [path.join(__dirname, 'app.py')]); + +flaskProcess.stdout.on('data', (data) => { + console.log(`Flask: ${data}`); +}); + +// 监听Node.js进程的关闭事件 +process.on('SIGINT', () => { + console.log('Closing Node.js application and Python script...'); + + // 杀掉Python进程 + pythonProcess.kill('SIGINT'); + + // 完全退出Node.js应用 + process.exit(); +}); + +let mainWindow; + +app.whenReady().then(() => { + mainWindow = new BrowserWindow({ + width: 430, + height: 680, + icon: path.join(__dirname, 'assets', 'icon.ico'), + webPreferences: { + nodeIntegration: false, // 禁用 Node 集成 + contextIsolation: true, // 启用上下文隔离 + }, + }); + + // 加载 HTTP 服务的 URL + mainWindow.loadURL('http://127.0.0.1:5000/'); + + mainWindow.on('closed', () => { + mainWindow = null; + }); +}); + +app.on('window-all-closed', () => { + if (process.platform !== 'darwin') app.quit(); +}); diff --git a/package.json b/package.json new file mode 100644 index 0000000..b5279bd --- /dev/null +++ b/package.json @@ -0,0 +1,17 @@ +{ + "name": "iteyes", + "version": "1.0.0", + "description": "A program that intelligently controls eye health", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "start": "electron .", + "package": "electron-packager . needle-server --platform=win32 --arch=x64 --out=./out --asar --app-version=1.0.0 --overwrite --ignore=node_modules --electron-version=$(npm list electron --depth=0 | jq -r '.dependencies.electron.version')" + }, + "author": "宫瑞骏,张晓星", + "license": "ISC", + "devDependencies": { + "electron": "^33.0.1", + "electron-packager": "^17.1.2" + } +}