CrazyIter_Bin 4 tháng trước cách đây
mục cha
commit
0df447cebf

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

@@ -0,0 +1,39 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
+  <PropertyGroup>
+    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
+    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
+    <Name>IES.ExamClient</Name>
+    <RootNamespace>IES.ExamClient</RootNamespace>
+  </PropertyGroup>
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>7fa6faa3-e176-4e56-b542-2e8176850924</ProjectGuid>
+    <ProjectHome>.</ProjectHome>
+    <StartupFile>app.js</StartupFile>
+    <StartWebBrowser>False</StartWebBrowser>
+    <SearchPath>
+    </SearchPath>
+    <WorkingDirectory>.</WorkingDirectory>
+    <OutputPath>.</OutputPath>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <ProjectTypeGuids>{3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}</ProjectTypeGuids>
+    <StartWebBrowser>false</StartWebBrowser>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
+    <DebugSymbols>true</DebugSymbols>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
+    <DebugSymbols>true</DebugSymbols>
+  </PropertyGroup>
+  <ItemGroup>
+    <Content Include="app.js" />
+    <Content Include="header.bmp" />
+    <Content Include="logo.ico" />
+    <Content Include="sidebar.bmp" />
+    <Content Include="package.json" />
+    <Content Include="README.md" />
+  </ItemGroup>
+  <Import Project="$(VSToolsPath)\Node.js Tools\Microsoft.NodejsToolsV2.targets" />
+</Project>

+ 3 - 0
TEAMModelOS.Extension/IES.Exam/IES.ExamClient/README.md

@@ -0,0 +1,3 @@
+# IES.ExamClient
+
+

+ 88 - 0
TEAMModelOS.Extension/IES.Exam/IES.ExamClient/app.js

@@ -0,0 +1,88 @@
+const { app, BrowserWindow, Menu } = require('electron/main');
+const { spawn } = require('child_process');
+const net = require('net');
+//const si = require('systeminformation');
+//const startDotnet = () => {
+//    return new Promise((resolve, reject) => {
+//        dotnetProcess = spawn('dotnet', ['run', '--project', '../IES.ExamServer/IES.ExamServer.csproj']);
+//        dotnetProcess.stdout.on('data', (data) => {
+//            console.log(`stdout: ${data}`);
+//            // 假设dotnet服务启动后会输出包含"Now listening on"的日志
+//            if (data.toString().includes('Now listening on')) {
+//                resolve();
+//            }
+//        });
+
+//        dotnetProcess.stderr.on('data', (data) => {
+//            console.log(`stderr: ${data}`);
+//            reject(new Error(`Dotnet process error: ${data}`));
+//        });
+
+//        dotnetProcess.on('close', (code) => {
+//            console.log(`child process exited with code ${code}`);
+//            if (code !== 0) {
+//                reject(new Error(`Dotnet process exited with code ${code}`));
+//            }
+//        });
+//    });
+//};
+// 获取网卡信息
+// 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');
+}
+
+//si.networkInterfaces()
+//    .then(data => {
+//        console.log('Network Interfaces:', data);
+//        //mainWindow.webContents.send('network-interfaces', data);
+//    })
+//    .catch(error => {
+//        console.error('Error fetching network interfaces:', error);
+//    });
+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();
+    }
+});

BIN
TEAMModelOS.Extension/IES.Exam/IES.ExamClient/header.bmp


BIN
TEAMModelOS.Extension/IES.Exam/IES.ExamClient/logo.ico


+ 50 - 0
TEAMModelOS.Extension/IES.Exam/IES.ExamClient/package.json

@@ -0,0 +1,50 @@
+{
+  "name": "examclient",
+  "version": "1.0.0",
+  "description": "IES.ExamClient",
+  "main": "app.js",
+  "scripts": {
+    "start": "electron .",
+    "test": "echo \"Error: no test specified\" && exit 1",
+    "package": "electron-packager . --platform=win32 --arch=ia32 --out=dist --overwrite",
+    "build": "electron-builder --win --ia32"
+  },
+  "keywords": [],
+  "author": "",
+  "license": "MIT",
+  "devDependencies": {
+    "electron": "20.3.12"
+  },
+  "build": {
+    "appId": "exam.habook.local",
+    "productName": "评测教师端",
+    "directories": {
+      "output": "dist"
+    },
+    "win": {
+      "target": "nsis",
+      "sign": false,
+      "requestedExecutionLevel": "requireAdministrator",
+      "icon": "logo.ico"
+    },
+    "nsis": {
+      "runAfterFinish": false,
+      "oneClick": false,
+      "perMachine": true,
+      "allowToChangeInstallationDirectory": true,
+      "createDesktopShortcut": true,
+      "createStartMenuShortcut": true,
+      "installerHeader": "header.bmp",
+      "installerSidebar": "sidebar.bmp"
+    },
+    "extraFiles": [
+      {
+        "from": "server",
+        "to": "server",
+        "filter": [
+          "**/*"
+        ]
+      }
+    ]
+  }
+}

BIN
TEAMModelOS.Extension/IES.Exam/IES.ExamClient/sidebar.bmp


+ 3 - 0
TEAMModelOS.Extension/IES.Exam/IES.ExamServer/Program.cs

@@ -3,9 +3,12 @@ using IES.ExamServer.DI.SignalRHost;
 using IES.ExamServer.Filters;
 using Microsoft.AspNetCore.StaticFiles;
 using NLog.Extensions.Logging;
+using SkiaSharp;
+using System.Drawing;
 using System.Text;
 using System.Text.Encodings.Web;
 using System.Text.Unicode;
+using static System.Net.Mime.MediaTypeNames;
 
 namespace IES.ExamServer.Server
 {

+ 3 - 2
TEAMModelOS.Extension/IES.Exam/IES.ExamViews/src/view/login/Admin.vue

@@ -328,10 +328,11 @@ export default {
                 public static readonly string _Message_grant_type_download_file = "download_file"; //下载评测试卷
                 public static readonly string _Message_grant_type_upload_data = "upload_data"; //推送学生作答
             */
+            let apiPrefix = process.env.NODE_ENV === 'production' ? '' : '/api'
             this.signalR = new SignalRService()
-            this.signalR.initSignalR(`/api/signalr/exam?grant_type=ies_qrcode_login&clientid=${this.deviceInfo.device}`)
+            this.signalR.initSignalR(`${apiPrefix}/signalr/exam?grant_type=ies_qrcode_login&clientid=${this.deviceInfo.device}`)
             this.signalR.onReceiveConnection((message) => {
-                console.log('222222222', message);
+                console.log('signalr连接结果:', message);
             })
             this.signalR.onMessageReceived((message) => {
                 // status: -1 error(红),0 info(黑、白),1 success(绿),2 warning(黄)

+ 7 - 0
TEAMModelOS.sln

@@ -49,6 +49,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IES.ExamServer", "TEAMModel
 EndProject
 Project("{54A90642-561A-4BB1-A94E-469ADEE60C69}") = "IES.ExamViews", "TEAMModelOS.Extension\IES.Exam\IES.ExamViews\IES.ExamViews.esproj", "{837FAA7E-E897-49EC-905E-4071CA25539A}"
 EndProject
+Project("{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}") = "IES.ExamClient", "TEAMModelOS.Extension\IES.Exam\IES.ExamClient\IES.ExamClient.njsproj", "{7FA6FAA3-E176-4E56-B542-2E8176850924}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -131,6 +133,10 @@ Global
 		{837FAA7E-E897-49EC-905E-4071CA25539A}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{837FAA7E-E897-49EC-905E-4071CA25539A}.Release|Any CPU.Build.0 = Release|Any CPU
 		{837FAA7E-E897-49EC-905E-4071CA25539A}.Release|Any CPU.Deploy.0 = Release|Any CPU
+		{7FA6FAA3-E176-4E56-B542-2E8176850924}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{7FA6FAA3-E176-4E56-B542-2E8176850924}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{7FA6FAA3-E176-4E56-B542-2E8176850924}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{7FA6FAA3-E176-4E56-B542-2E8176850924}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -154,6 +160,7 @@ Global
 		{6B34DA2A-7527-426F-AD36-F5CE923CED62} = {9B74B53F-20E8-46CC-903B-62AEB1583DD7}
 		{41AABD1E-815E-4981-892F-074ED0A18EE4} = {50CC8BCA-FB13-492E-849D-1E1870DEBBAB}
 		{837FAA7E-E897-49EC-905E-4071CA25539A} = {50CC8BCA-FB13-492E-849D-1E1870DEBBAB}
+		{7FA6FAA3-E176-4E56-B542-2E8176850924} = {50CC8BCA-FB13-492E-849D-1E1870DEBBAB}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {76440725-5E50-4288-851F-BA5C0BC8E8C6}