Ver código fonte

fix: 移除默认配置强制检查,允许用户自由配置服务器地址

- 修复系统启动时默认配置可连接成功时阻止用户配置服务器的问题
- 在 serverConfigSlice.ts 中注释掉默认配置检查代码
- 移除 getDefaultConfig() 调用和 isDefaultConfig 判断逻辑
- 允许用户即使默认配置可用也能自定义服务器配置

改动文件:
- src/features/serverConfig/state/serverConfigSlice.ts
- CHANGELOG.md
- package.json
dengdx 2 semanas atrás
pai
commit
6066fdbfa0

+ 23 - 0
CHANGELOG.md

@@ -2,6 +2,29 @@
 
 本项目的所有重要变更都将记录在此文件中。
 
+## [1.22.1] - 2025-12-29 12:14
+
+### 修复 (Fixed)
+- **移除默认配置强制检查,允许用户自由配置服务器地址** ([src/features/serverConfig/state/serverConfigSlice.ts](src/features/serverConfig/state/serverConfigSlice.ts))
+  - 修复系统启动时默认配置可连接成功时阻止用户配置服务器的问题
+  - 在 checkServerConnection thunk 中注释掉默认配置检查代码
+  - 移除 getDefaultConfig() 调用和 isDefaultConfig 判断逻辑
+  - 移除 needsConfig 返回分支,不再强制要求用户配置
+  - 允许用户即使默认配置可用也能自定义服务器配置
+
+**核心改进:**
+- 用户体验优化:即使默认配置可连接,用户也可以自由配置服务器地址
+- 逻辑简化:移除默认配置强制验证逻辑,直接进行连接测试
+- 代码清晰:减少条件判断分支,提升代码可读性
+- 灵活性提升:不再限制用户的配置自由度
+
+**改动文件:**
+- src/features/serverConfig/state/serverConfigSlice.ts
+- CHANGELOG.md
+- package.json (版本更新: 1.22.0 -> 1.22.1)
+
+---
+
 ## [1.22.0] - 2025-12-22 19:27
 
 ### 新增 (Added)

+ 2 - 2
package-lock.json

@@ -1,12 +1,12 @@
 {
   "name": "zsis",
-  "version": "1.16.0",
+  "version": "1.22.1",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
       "name": "zsis",
-      "version": "1.16.0",
+      "version": "1.22.1",
       "dependencies": {
         "@babel/runtime": "^7.24.4",
         "@cornerstonejs/core": "^3.28.0",

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "zsis",
-  "version": "1.22.0",
+  "version": "1.22.1",
   "private": true,
   "description": "医学成像系统",
   "main": "main.js",

+ 7 - 7
src/features/serverConfig/state/serverConfigSlice.ts

@@ -79,14 +79,14 @@ export const checkServerConnection = createAsyncThunk(
       // 1. 加载本地配置
       const config = await ConfigService.getServerConfig();
 
-      // 2. 如果是默认配置(未配置过),需要配置
-      const defaultConfig = ConfigService.getDefaultConfig();
-      const isDefaultConfig = !config ||
-        (config.ip === defaultConfig.ip && config.apiPort === defaultConfig.apiPort);
+      // // 2. 如果是默认配置(未配置过),需要配置
+      // const defaultConfig = ConfigService.getDefaultConfig();
+      // const isDefaultConfig = !config ||
+      //   (config.ip === defaultConfig.ip && config.apiPort === defaultConfig.apiPort);
 
-      if (isDefaultConfig) {
-        return { needsConfig: true, config: null };
-      }
+      // if (isDefaultConfig) {
+      //   return { needsConfig: true, config: null };
+      // }
 
       // 3. 测试连接
       const testResult = await ConfigService.testConnection(config.ip, config.apiPort);