CrazyIter_Bin 4 months ago
parent
commit
5bd147bce4

+ 3 - 3
TEAMModelBI/TEAMModelBI.csproj

@@ -65,9 +65,9 @@
 		<SpaRoot>ClientApp\</SpaRoot>
 		<DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
 		<UserSecretsId>078b5d89-7d90-4f6a-88fc-7d96025990a8</UserSecretsId>
-		<Version>5.2501.22</Version>
-		<AssemblyVersion>5.2501.22.1</AssemblyVersion>
-		<FileVersion>5.2501.22.1</FileVersion>
+		<Version>5.2502.5</Version>
+		<AssemblyVersion>5.2502.5.1</AssemblyVersion>
+		<FileVersion>5.2502.5.1</FileVersion>
 		<Description>TEAMModelBI(BI)</Description>
 		<PackageReleaseNotes>BI版本说明版本切换标记2022000908</PackageReleaseNotes>
 		<PackageId>TEAMModelBI</PackageId>

+ 1 - 0
TEAMModelOS.Extension/IES.Exam/IES.ExamClient/IES.ExamClient.njsproj

@@ -28,6 +28,7 @@
     <DebugSymbols>true</DebugSymbols>
   </PropertyGroup>
   <ItemGroup>
+    <Content Include="app.原始备份.js" />
     <Content Include="app.js" />
     <Content Include="header.bmp" />
     <Content Include="logo.ico" />

+ 82 - 43
TEAMModelOS.Extension/IES.Exam/IES.ExamClient/app.js

@@ -1,57 +1,96 @@
-const { app, BrowserWindow, Menu } = require('electron/main');
-const { spawn } = require('child_process');
-const net = require('net');
-
-// 获取网卡信息
-// npm start  启动命令
-const platform = process.platform;
-if (platform === 'win32') {
-    console.log('Running on Windows');
-} else if (platform === 'linux') {
-    console.log('Running on Linux');
-} else if (platform === 'darwin') {
-    console.log('Running on macOS');
-} else {
-    console.log('Running on an unknown platform');
-}
+const { app, BrowserWindow } = require('electron');
+const path = require('path');
+const https = require('https');
+const fs = require('fs');
+const { exec } = require('child_process');
+const axios = require('axios');
+let mainWindow;
+let netProcess;
+let baseUrl = 'https://exam.habook.local:8888';
+const cert = fs.readFileSync('cert.pem');
+const agent = new https.Agent({
+    ca: cert
+});
+function createWindow() {
+    mainWindow = new BrowserWindow({
+        width: 1200,
+        height: 800,
+        webPreferences: {
+            nodeIntegration: true,
+            contextIsolation: false,
+        },
+        show: false
+    });
 
+    // 加载 .NET 6 项目托管的 Vue 页面
+    // mainWindow.loadURL('https://exam.habook.local:8888/');
 
-const createWindow = async () => {
-    try {
-        //await startDotnet();
-        const win = new BrowserWindow({
-            width: 800,
-            height: 600
-            //webPreferences: {
-            //    nodeIntegration: true,
-            //    contextIsolation: false,
-            //},
-        });
-        // 忽略证书错误
-        //win.webContents.session.setCertificateVerifyProc((request, callback) => {
-        //    callback(0); // 允许所有证书
-        //});
-        win.maximize();
-        win.loadURL('https://exam.habook.local:8888');
-    } catch (error) {
-        console.error('Error starting dotnet or loading window:', error);
-    }
-};
+    mainWindow.on('closed', () => {
+        mainWindow = null;
+        // 关闭 .NET 6 进程
+        if (netProcess) {
+            netProcess.kill();
+        }
 
-// Menu.setApplicationMenu(null);
+        if (process.platform !== 'darwin') {
+            app.quit();
+        }
+    });
+}
 
-app.whenReady().then(() => {
+app.on('ready', () => {
+    https.globalAgent = agent;
+    const exePath = path.join(__dirname, 'server', 'IES.ExamServer.exe');
+    // 使用绝对路径启动 .NET 6 的 exe 文件
+    console.log('exePath:', exePath);
+    netProcess = exec(`"${exePath}"`, { cwd: path.dirname(exePath) }, (error, stdout, stderr) => {
+        if (error) {
+            console.error(`Process error: ${error}`);
+            return;
+        }
+        console.log(`stdout: ${stdout}`);
+        console.error(`stderr: ${stderr}`);
+    });
+    console.log(baseUrl + "/index/health");
     createWindow();
+    // 检测 Web API 是否启动完成
+    const checkApiReady = async () => {
+        try {
+            // 向 Web API 发送请求
 
-    app.on('activate', () => {
-        if (BrowserWindow.getAllWindows().length === 0) {
-            createWindow();
+            const response = await axios.get(baseUrl + "/index/health", {
+                //httpsAgent: new (require('https').Agent)({
+                //    rejectUnauthorized: false // 禁用 SSL 验证
+                //})
+                httpsAgent: agent
+            })
+            if (response.status === 200) {
+                console.log('Web API is ok...');
+                mainWindow.loadURL(baseUrl); // 加载 Web API 的 URL
+                mainWindow.show(); // 显示窗口
+            }
+        } catch (error) {
+            console.log('Web API starting...');
+            // 如果请求失败,继续等待
+            setTimeout(checkApiReady, 1000); // 每隔 1 秒重试一次
         }
-    });
+    };
+    checkApiReady();
 });
 
 app.on('window-all-closed', () => {
+    // 关闭 .NET 6 进程
+    if (netProcess) {
+        netProcess.kill();
+    }
+
     if (process.platform !== 'darwin') {
         app.quit();
     }
+});
+
+app.on('activate', () => {
+    if (mainWindow === null) {
+        createWindow();
+    }
 });

+ 57 - 0
TEAMModelOS.Extension/IES.Exam/IES.ExamClient/app.原始备份.js

@@ -0,0 +1,57 @@
+const { app, BrowserWindow, Menu } = require('electron/main');
+const { spawn } = require('child_process');
+const net = require('net');
+
+// 获取网卡信息
+// npm start  启动命令
+const platform = process.platform;
+if (platform === 'win32') {
+    console.log('Running on Windows');
+} else if (platform === 'linux') {
+    console.log('Running on Linux');
+} else if (platform === 'darwin') {
+    console.log('Running on macOS');
+} else {
+    console.log('Running on an unknown platform');
+}
+
+
+const createWindow = async () => {
+    try {
+        //await startDotnet();
+        const win = new BrowserWindow({
+            width: 800,
+            height: 600
+            //webPreferences: {
+            //    nodeIntegration: true,
+            //    contextIsolation: false,
+            //},
+        });
+        // 忽略证书错误
+        //win.webContents.session.setCertificateVerifyProc((request, callback) => {
+        //    callback(0); // 允许所有证书
+        //});
+        win.maximize();
+        win.loadURL('https://exam.habook.local:8888');
+    } catch (error) {
+        console.error('Error starting dotnet or loading window:', error);
+    }
+};
+
+// Menu.setApplicationMenu(null);
+
+app.whenReady().then(() => {
+    createWindow();
+
+    app.on('activate', () => {
+        if (BrowserWindow.getAllWindows().length === 0) {
+            createWindow();
+        }
+    });
+});
+
+app.on('window-all-closed', () => {
+    if (process.platform !== 'darwin') {
+        app.quit();
+    }
+});

+ 2 - 2
TEAMModelOS.Extension/IES.Exam/IES.ExamClient/package.json

@@ -24,8 +24,8 @@
     "win": {
       "target": "nsis",
       "sign": false,
-      "requestedExecutionLevel": "requireAdministrator",
-      "icon": "logo.ico"
+      "icon": "logo.ico",
+      "descriptionconfig": "可选配置: requestedExecutionLevel:requireAdministrator"
     },
     "nsis": {
       "runAfterFinish": false,

+ 41 - 0
TEAMModelOS.Extension/IES.Exam/IES.ExamServer/Configs/cer/install_certificate.bat

@@ -0,0 +1,41 @@
+@echo off
+echo Importing certificate
+
+net session >nul 2>&1
+if %errorLevel% neq 0 (
+    echo Please run this script as an administrator
+    pause
+    exit /b
+)
+
+if not exist "%~dp0certificate.cer" (
+    echo Certificate file does not exist:%~dp0certificate.cer
+    pause
+    exit /b
+)
+
+set "certSubject="
+for /f "tokens=*" %%i in ('certutil -dump "%~dp0certificate.cer" ^| findstr /i "CN="') do (
+    set "certSubject=%%i"
+)
+
+if defined certSubject (
+    echo Deleting existing certificate with the same name
+    certutil -delstore "Root" "%certSubject%"
+    if %errorLevel% equ 0 (
+        echo Existing certificate deleted successfully
+    ) else (
+        echo Failed to delete existing certificate (may not exist)
+    )
+)
+
+echo Importing new certificate
+certutil -addstore -f "Root" "%~dp0certificate.cer"
+if %errorLevel% equ 0 (
+    echo Certificate imported successfully
+) else (
+    echo Certificate import failed
+)
+
+echo Certificate installation completed
+pause

+ 42 - 0
TEAMModelOS.Extension/IES.Exam/IES.ExamServer/Configs/cer/modify_hosts.bat

@@ -0,0 +1,42 @@
+@echo off
+echo Configuring hosts file
+
+net session >nul 2>&1
+if %errorLevel% neq 0 (
+    echo Please run this script as an administrator
+    pause
+    exit /b
+)
+
+set "hostsFile=C:\Windows\System32\drivers\etc\hosts"
+set "newEntry=192.168.8.132 exam.habook.local"
+
+if not exist "%hostsFile%" (
+    echo hosts file does not exist:%hostsFile%
+    pause
+    exit /b
+)
+
+
+findstr /v /i /c:"exam.habook.local" "%hostsFile%" > "%hostsFile%.tmp"
+if %errorLevel% equ 0 (
+    move /y "%hostsFile%.tmp" "%hostsFile%" >nul 2>&1
+    echo Removed all entries containing exam.habook.local
+) else (
+    echo Failed to remove entries containing exam.habook.local
+    pause
+    exit /b
+)
+
+
+echo %newEntry% >> "%hostsFile%"
+if %errorLevel% equ 0 (
+    echo Hosts file configured successfully
+) else (
+    echo Hosts file configuration failed
+    pause
+    exit /b
+)
+
+echo Hosts file modification completed
+pause

+ 84 - 0
TEAMModelOS.Extension/IES.Exam/IES.ExamServer/Configs/cer/选择ip映射.bat

@@ -0,0 +1,84 @@
+@echo off
+echo Configuring hosts file
+
+:: 检查是否以管理员身份运行
+net session >nul 2>&1
+if %errorLevel% neq 0 (
+    echo Please run this script as an administrator
+    pause
+    exit /b
+)
+
+:: 设置hosts文件路径
+set "hostsFile=C:\Windows\System32\drivers\etc\hosts"
+
+:: 检查hosts文件是否存在
+if not exist "%hostsFile%" (
+    echo hosts file does not exist:%hostsFile%
+    pause
+    exit /b
+)
+
+:: 删除所有以.habook.local结尾的条目
+findstr /v /i /c:".habook.local" "%hostsFile%" > "%hostsFile%.tmp"
+if %errorLevel% equ 0 (
+    move /y "%hostsFile%.tmp" "%hostsFile%" >nul 2>&1
+    echo Removed all entries containing .habook.local
+) else (
+    echo Failed to remove entries containing .habook.local
+    pause
+    exit /b
+)
+
+:: 获取当前电脑的所有IP地址
+echo Getting IP addresses...
+ipconfig | findstr /i "IPv4 Address" > ip_list.txt
+
+:: 显示IP地址列表并让用户选择
+echo Available IP addresses:
+setlocal enabledelayedexpansion
+set /a count=0
+for /f "tokens=2 delims=:" %%i in (ip_list.txt) do (
+    set /a count+=1
+    set "ip!count!=%%i"
+    echo !count!. %%i
+)
+
+:: 如果没有任何IP地址,退出脚本
+if %count% equ 0 (
+    echo No IP addresses found.
+    del ip_list.txt
+    pause
+    exit /b
+)
+
+:: 让用户选择一个IP地址
+:choose_ip
+set /p "choice=Please choose an IP address (1-%count%): "
+if not defined ip%choice% (
+    echo Invalid choice. Please try again.
+    goto choose_ip
+)
+
+:: 获取用户选择的IP地址
+for /f "tokens=1,2 delims==" %%i in ('set ip%choice%') do set "selectedIP=%%j"
+
+:: 去除IP地址中的空格
+set "selectedIP=%selectedIP: =%"
+
+:: 添加新的映射条目
+set "newEntry=%selectedIP% exam.habook.local"
+echo %newEntry% >> "%hostsFile%"
+if %errorLevel% equ 0 (
+    echo Hosts file configured successfully
+) else (
+    echo Hosts file configuration failed
+    pause
+    exit /b
+)
+
+:: 清理临时文件
+del ip_list.txt
+
+echo Hosts file modification completed
+pause

+ 3 - 3
TEAMModelOS.Function/TEAMModelOS.Function.csproj

@@ -5,9 +5,9 @@
     <OutputType>Exe</OutputType>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
-	<Version>5.2501.22</Version>
-	<AssemblyVersion>5.2501.22.1</AssemblyVersion>
-	<FileVersion>5.2501.22.1</FileVersion>
+	<Version>5.2502.5</Version>
+	<AssemblyVersion>5.2502.5.1</AssemblyVersion>
+	<FileVersion>5.2502.5.1</FileVersion>
 	<PackageId>TEAMModelOS.FunctionV4</PackageId>
 	<Authors>teammodel</Authors>
 	<Company>醍摩豆(成都)信息技术有限公司</Company>

+ 3 - 3
TEAMModelOS.SDK/TEAMModelOS.SDK.csproj

@@ -1,9 +1,9 @@
 <Project Sdk="Microsoft.NET.Sdk">
 	<PropertyGroup>
 		<TargetFramework>net8.0</TargetFramework>
-		<Version>5.2501.22</Version>
-		<AssemblyVersion>5.2501.22.1</AssemblyVersion>
-		<FileVersion>5.2501.22.1</FileVersion>
+		<Version>5.2502.5</Version>
+		<AssemblyVersion>5.2502.5.1</AssemblyVersion>
+		<FileVersion>5.2502.5.1</FileVersion>
 		<PackageReleaseNotes>发版</PackageReleaseNotes>
 	</PropertyGroup>
 

+ 4 - 4
TEAMModelOS/TEAMModelOS.csproj

@@ -80,11 +80,11 @@
 		<SpaRoot>ClientApp\</SpaRoot>
 		<DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
 		<UserSecretsId>078b5d89-7d90-4f6a-88fc-7d96025990a8</UserSecretsId>
-		<Version>5.2501.22</Version>
-		<AssemblyVersion>5.2501.22.1</AssemblyVersion>
-		<FileVersion>5.2501.22.1</FileVersion>
+		<Version>5.2502.5</Version>
+		<AssemblyVersion>5.2502.5.1</AssemblyVersion>
+		<FileVersion>5.2502.5.1</FileVersion>
 		<Description>TEAMModelOS(IES5)</Description>
-		<PackageReleaseNotes>IES版本说明版本切换标记5.2501.22.1</PackageReleaseNotes>
+		<PackageReleaseNotes>IES版本说明版本切换标记5.2502.5.1</PackageReleaseNotes>
 		<PackageId>TEAMModelOS</PackageId>
 		<Authors>teammodel</Authors>
 		<Company>醍摩豆(成都)信息技术有限公司</Company>

+ 1 - 1
TEAMModelOS/appsettings.Development.json

@@ -18,7 +18,7 @@
     "IdTokenSalt": "8263692E2213497BB55E74792B7900B4",
     "HttpTrigger": "https://teammodelosfunction-test.chinacloudsites.cn/api/",
     //"HttpTrigger": "http://localhost:7071/api/"
-    "Version": "5.2501.22.1"
+    "Version": "5.2502.5.1"
   },
   "Azure": {
     // 测试站数据库

+ 1 - 1
TEAMModelOS/appsettings.json

@@ -18,7 +18,7 @@
     "Exp": 86400,
     "IdTokenSalt": "8263692E2213497BB55E74792B7900B4",
     "HttpTrigger": "https://teammodelosfunction.chinacloudsites.cn/api/",
-    "Version": "5.2501.22.1"
+    "Version": "5.2502.5.1"
   },
   "Azure": {
     "Storage": {