From d37b4ff3798970a2ddbf0670684fbfdfa7f2f93a Mon Sep 17 00:00:00 2001 From: lixiaolong <702156524@qq.com> Date: Wed, 28 Oct 2026 17:30:35 +0800 Subject: [PATCH] =?UTF-8?q?refactor(mobile):=20=E9=87=8D=E6=9E=84=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=AB=AF=E5=BA=94=E7=94=A8=E7=BB=93=E6=9E=84=E5=92=8C?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 Account 组件中的 Text 导入移动到顶部 - 移除 App.tsx 中的 expo-updates 相关代码 - 添加 PackageUpdates 相关组件和 hooks - 更新应用名称从 "CMVR 物资管理" 为 "车研物资" - 添加应用图标和自适应图标配置 - 更新 Android 权限配置,添加 REQUEST_INSTALL_PACKAGES 权限 - 修改堆栈导航数据结构,支持路由参数传递 - 添加阅读尺寸偏好设置功能 - 重构登录界面为独立组件 LoginView - 添加文件库界面组件 FileLibrary - 更新状态栏样式逻辑 - 调整 Tab 栏样式和尺寸 - 集成包更新和应用更新对话框 - 修复导入语句顺序和类型引用 - 优化业务列表组件的路由参数处理 - 添加作用域参数用于 API 请求区分 --- mobile-app/app.config.js | 10 +- mobile-app/package-lock.json | 198 +++++++++++++++--- mobile-app/package.json | 5 + mobile-app/src/App.tsx | 147 +++---------- mobile-app/src/core/message-center.ts | 13 +- mobile-app/src/core/modules.ts | 5 +- mobile-app/src/core/network.ts | 42 +++- mobile-app/src/core/updates.ts | 76 +++++-- mobile-app/src/dialogs.tsx | 5 +- mobile-app/src/files.tsx | 27 ++- mobile-app/src/screens/Account.tsx | 3 +- mobile-app/src/screens/ArrivalActions.tsx | 12 +- mobile-app/src/screens/ArrivalListParts.tsx | 23 +- mobile-app/src/screens/ArrivalOperation.tsx | 37 +++- mobile-app/src/screens/ArrivalPhotos.tsx | 12 +- mobile-app/src/screens/Assistant.tsx | 60 ++++-- mobile-app/src/screens/Feedback.tsx | 3 +- mobile-app/src/screens/MessageCenter.tsx | 14 +- mobile-app/src/screens/Workspace.tsx | 57 +++-- mobile-app/src/ui.tsx | 39 ++-- mobile-app/tests/arrival-actions.test.mjs | 13 +- mobile-app/tests/arrival-list.test.mjs | 8 +- mobile-app/tests/arrival-photos.test.mjs | 7 +- mobile-app/tests/field-operations.test.mjs | 4 +- mobile-app/tests/message-center.test.mjs | 2 +- mobile-app/tests/mobile-layout.test.mjs | 19 +- mobile-app/tests/network.test.mjs | 13 ++ mobile-app/tests/ui-contract.test.mjs | 4 +- mobile-app/tests/updates.test.mjs | 61 +++++- .../tests/usability-regression.test.mjs | 11 +- .../system/SysNoticeController.java | 10 + .../web/service/archive/ArchiveAnalytics.java | 2 +- .../web/service/archive/ArchiveCosts.java | 14 +- .../web/service/archive/ArchiveExporter.java | 4 +- .../web/service/archive/ArchivePersonnel.java | 6 +- .../web/service/archive/ArchiveReview.java | 2 +- .../web/service/archive/ArchiveService.java | 4 +- .../service/files/ResumableUploadService.java | 6 +- .../web/service/files/UploadTargets.java | 9 +- .../com/ruoyi/web/service/kpi/KpiService.java | 2 +- .../workspace/ProjectWorkspaceFlowTest.java | 2 +- .../impl/PurchaseArrivalPhotosTest.java | 9 +- .../web/service/archive/ArchiveFlowTest.java | 19 +- .../common/storage/BusinessFileStorage.java | 4 +- .../framework/config/SecurityConfig.java | 4 + .../mapper/project/manage/PmUserMapper.xml | 3 +- ruoyi-system/pom.xml | 11 + .../workspace/ProjectAchievementService.java | 2 +- .../project/workspace/ProjectTeamService.java | 2 +- .../com/ruoyi/system/domain/SysNotice.java | 12 ++ .../system/mapper/SysNoticeReadMapper.java | 2 + .../system/service/ISysNoticeReadService.java | 1 + .../impl/SysNoticeReadServiceImpl.java | 17 ++ .../service/impl/SysNoticeServiceImpl.java | 15 +- .../impl/PurchaseArrivalPhotoService.java | 4 +- .../mapper/system/SysNoticeMapper.xml | 6 +- .../mapper/system/SysNoticeReadMapper.xml | 12 ++ .../resources/mapper/system/SysUserMapper.xml | 6 + ruoyi-ui-vue3/package-lock.json | 17 ++ ruoyi-ui-vue3/package.json | 1 + ruoyi-ui-vue3/src/api/system/notice.js | 5 +- .../src/api/warehouse/arrival-photos.js | 4 +- .../src/components/ArrivalPhotos/index.vue | 2 +- .../components/HeaderNotice/DetailView.vue | 31 +-- .../layout/components/HeaderNotice/index.vue | 15 +- ruoyi-ui-vue3/src/utils/resumable-upload.js | 2 +- .../src/views/archive/ArchiveCost.vue | 14 +- .../src/views/archive/ArchiveReview.vue | 6 +- .../views/archive/archive-cost-validation.js | 5 +- .../src/views/archive/archive-model.js | 3 +- .../src/views/archive/cost-analysis.vue | 3 +- ruoyi-ui-vue3/src/views/archive/index.vue | 5 +- .../src/views/system/notice/index.vue | 41 ++-- .../tests/runtime/archive-module.spec.js | 12 +- .../tests/runtime/arrival-photos.spec.js | 2 +- .../tests/runtime/message-center.spec.js | 21 ++ scripts/projectdev/vue3-all-pages-audit.cjs | 4 +- 77 files changed, 880 insertions(+), 433 deletions(-) diff --git a/mobile-app/app.config.js b/mobile-app/app.config.js index 836b98e..76b1195 100644 --- a/mobile-app/app.config.js +++ b/mobile-app/app.config.js @@ -3,12 +3,14 @@ module.exports = () => { const env = environment(); const cleartextHosts = [...new Set([env.apiUrl, env.updateOrigin].filter(url => url.startsWith('http:')).map(url => new URL(url).hostname))]; return { - name: env.variant === 'prod' ? 'CMVR 物资管理' : 'CMVR 物资管理·开发', + name: env.variant === 'prod' ? '车研物资' : '车研物资·开发', + icon: `./assets/brand/app-icon-blue-${env.variant}.png`, slug: 'cmvr-wms', version: '1.0.0', orientation: 'portrait', userInterfaceStyle: 'automatic', platforms: ['android', 'web'], - android: { package: env.variant === 'prod' ? 'cn.cmvr.wms' : 'cn.cmvr.wms.dev', versionCode: env.variant === 'dev' ? 2 : 1, - permissions: [], blockedPermissions: ['android.permission.RECORD_AUDIO'] }, - plugins: ['expo-secure-store', 'expo-status-bar', './plugins/with-short-cmake-paths.cjs', './plugins/with-private-build-inputs.cjs', ['./plugins/with-internal-network.cjs', { hosts: cleartextHosts }], + android: { package: env.variant === 'prod' ? 'cn.cmvr.wms' : 'cn.cmvr.wms.dev', versionCode: env.variant === 'dev' ? 5 : 3, + adaptiveIcon: { foregroundImage: `./assets/brand/app-icon-blue-${env.variant}-adaptive.png`, backgroundColor: '#ffffff' }, + permissions: ['android.permission.REQUEST_INSTALL_PACKAGES'], blockedPermissions: ['android.permission.RECORD_AUDIO'] }, + plugins: ['./plugins/with-apk-installer.cjs', 'expo-sharing', 'expo-secure-store', 'expo-status-bar', './plugins/with-short-cmake-paths.cjs', './plugins/with-private-build-inputs.cjs', ['./plugins/with-internal-network.cjs', { hosts: cleartextHosts }], ...(env.variant === 'prod' ? ['./plugins/with-release-signing.cjs'] : [])], runtimeVersion: { policy: 'fingerprint' }, updates: { enabled: env.updatesEnabled, url: `${env.updateOrigin}/updates/${env.variant}`, diff --git a/mobile-app/package-lock.json b/mobile-app/package-lock.json index 73da152..51189a5 100644 --- a/mobile-app/package-lock.json +++ b/mobile-app/package-lock.json @@ -9,16 +9,21 @@ "version": "0.1.0", "dependencies": { "@expo/vector-icons": "^15.1.1", + "@noble/hashes": "^2.4.0", "expo": "~58.0.14", + "expo-application": "~58.1.2", "expo-constants": "~58.0.12", "expo-crypto": "~58.0.7", "expo-document-picker": "~58.0.4", + "expo-file-system": "~58.0.12", "expo-font": "~58.0.8", "expo-image-picker": "~58.0.10", "expo-secure-store": "~58.0.2", + "expo-sharing": "~58.0.20", "expo-status-bar": "~58.0.3", "expo-system-ui": "~58.0.6", "expo-updates": "~58.0.17", + "htmlparser2": "^12.0.0", "react": "19.3.0", "react-dom": "19.3.0", "react-native": "0.88.0", @@ -1107,9 +1112,9 @@ } }, "node_modules/@expo/config-plugins": { - "version": "58.0.9", - "resolved": "https://registry.npmjs.org/@expo/config-plugins/-/config-plugins-58.0.9.tgz", - "integrity": "sha512-HyP7V1QgDxeHcOEh4qQH7cfK7cI7wNp0y9lszAu98SRYCshhDbwB9gWpFfnpX1GQUtgiqG4Hvgh1z3ntcGwAjw==", + "version": "58.0.10", + "resolved": "https://registry.npmmirror.com/@expo/config-plugins/-/config-plugins-58.0.10.tgz", + "integrity": "sha512-oW0geRREubSsqV2d0EwkK0rRcAoB7a68CnJx7s8Al33HoTtEg7KLTQNcKlSTmmwoUESQQvAmzNqAZy4ajuCBKA==", "license": "MIT", "dependencies": { "@expo/config-types": "^58.0.3", @@ -1123,7 +1128,7 @@ "glob": "^13.0.0", "semver": "^7.7.4", "slugify": "^1.6.6", - "xcode": "^3.0.1", + "xcode": "^4.0.0", "xml2js": "0.6.0" } }, @@ -1528,6 +1533,18 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@noble/hashes": { + "version": "2.4.0", + "resolved": "https://registry.npmmirror.com/@noble/hashes/-/hashes-2.4.0.tgz", + "integrity": "sha512-X5XaVWZIBCT7HHZGm5I7ZQXDwLG+bGXuSrMQAW+7Zvl87h1kmc1ZB1VSRJcpUfoUrGQp4Fkoxm5kZ+Ms+aW+eA==", + "license": "MIT", + "engines": { + "node": ">= 20.19.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@noxcturnal/noxcturnal-darwin-arm64": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/@noxcturnal/noxcturnal-darwin-arm64/-/noxcturnal-darwin-arm64-0.1.5.tgz", @@ -2702,6 +2719,73 @@ "integrity": "sha512-Ndrrf6BMPalkQPd/zubL+4YghH2J9NspapQ09uDXwYbvOPkP0oaqf5CkcwJ0b50kS2O3ul6yVu+jz+RY62Cejg==", "license": "MIT" }, + "node_modules/dom-serializer": { + "version": "3.1.1", + "resolved": "https://registry.npmmirror.com/dom-serializer/-/dom-serializer-3.1.1.tgz", + "integrity": "sha512-4MEa38/QexBob6gFNwu+EGdWvhJ1OKuNwdYY3Y3NyeWDQfnGeDYQUDfIRzWu5B5gsv03so2Uxd28YC6zrsx3Lw==", + "license": "MIT", + "dependencies": { + "domelementtype": "^3.0.0", + "domhandler": "^6.0.0", + "entities": "^8.0.0" + }, + "engines": { + "node": ">=20.19.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "node_modules/domelementtype": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/domelementtype/-/domelementtype-3.0.0.tgz", + "integrity": "sha512-umCQid3jKbDmVjx8jGaW7uUykm4DEUeyV21hPxNMo2nV955DhUThwqyOIDtreepP31hl84X7G5U9ZfsWvIB3Pg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "license": "BSD-2-Clause", + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/domhandler": { + "version": "6.0.1", + "resolved": "https://registry.npmmirror.com/domhandler/-/domhandler-6.0.1.tgz", + "integrity": "sha512-gYzvtM72ZtxQO0T048kd6HWSbbGCNOUwcnfQ01cqIJ4X2IYKFFHZ5mKvrQETcFXxsRObZulDaKmy//R7TPtsBg==", + "license": "BSD-2-Clause", + "dependencies": { + "domelementtype": "^3.0.0" + }, + "engines": { + "node": ">=20.19.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "node_modules/domutils": { + "version": "4.0.2", + "resolved": "https://registry.npmmirror.com/domutils/-/domutils-4.0.2.tgz", + "integrity": "sha512-qI4JLRKnSzqFqr7hAlS5xQDusBCjKSEG4t4+7aNrIQMHBcsC2TGEhuyABJdYkgSewL57PNLYEiibY2iPKhKpaA==", + "license": "BSD-2-Clause", + "dependencies": { + "dom-serializer": "^3.0.0", + "domelementtype": "^3.0.0", + "domhandler": "^6.0.0" + }, + "engines": { + "node": ">=20.19.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/fb55/domutils?sponsor=1" + } + }, "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -2729,6 +2813,18 @@ "node": ">= 0.8" } }, + "node_modules/entities": { + "version": "8.1.0", + "resolved": "https://registry.npmmirror.com/entities/-/entities-8.1.0.tgz", + "integrity": "sha512-kxL7msIffSuh9aaFAMD7rxAIuTRMAHMeBtgHW2yUdWw732ZNh4MehkF2gdjvtdmikkaIP9bFDDJOPlsvm7avrA==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=20.19.0" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, "node_modules/error-stack-parser": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/error-stack-parser/-/error-stack-parser-2.1.4.tgz", @@ -2846,6 +2942,15 @@ } } }, + "node_modules/expo-application": { + "version": "58.1.2", + "resolved": "https://registry.npmmirror.com/expo-application/-/expo-application-58.1.2.tgz", + "integrity": "sha512-WYFdNHGaxe/j69oYREhK0cKsKYszuIuz399WXYCP+M1grfO+FCWB/RbuMgaXJsLWlzqhNjA/zLgfJ+33FwrQvw==", + "license": "MIT", + "peerDependencies": { + "expo": "*" + } + }, "node_modules/expo-constants": { "version": "58.0.12", "resolved": "https://registry.npmjs.org/expo-constants/-/expo-constants-58.0.12.tgz", @@ -2884,6 +2989,16 @@ "integrity": "sha512-mhRYnE35MzGxR1Xnl9FAg7/yHaocy4xoVzgsDmS9cbK+1wM6l74/I/73/E4Kr6wChdVZfeS6S+Tv4I1qYbGY2g==", "license": "MIT" }, + "node_modules/expo-file-system": { + "version": "58.0.12", + "resolved": "https://registry.npmmirror.com/expo-file-system/-/expo-file-system-58.0.12.tgz", + "integrity": "sha512-Ytua0iPjhacvM5eEpPFtrc2iWwdcIfQ3s/9ps0awxGCaHs54DI9weo8wPUJImfcKPmiseqVGM4TFg4lHfD0XmQ==", + "license": "MIT", + "peerDependencies": { + "expo": "*", + "react-native": "*" + } + }, "node_modules/expo-font": { "version": "58.0.8", "resolved": "https://registry.npmjs.org/expo-font/-/expo-font-58.0.8.tgz", @@ -3008,6 +3123,22 @@ "node": "^22.13.0 || ^24.3.0 || ^26.0.0 || >=27.0.0" } }, + "node_modules/expo-sharing": { + "version": "58.0.20", + "resolved": "https://registry.npmmirror.com/expo-sharing/-/expo-sharing-58.0.20.tgz", + "integrity": "sha512-FxfBGaiWYNmV12bDbT81TAi08MGN1OdQtz9WLscN3He0We3w9RfIQNAhCSOJLKpcFvbNAXZ4nkOjpO8q3I8LRw==", + "license": "MIT", + "dependencies": { + "@expo/config-plugins": "^58.0.10", + "@expo/config-types": "^58.0.3", + "@expo/plist": "^0.10.1" + }, + "peerDependencies": { + "expo": "*", + "react": "*", + "react-native": "*" + } + }, "node_modules/expo-status-bar": { "version": "58.0.3", "resolved": "https://registry.npmjs.org/expo-status-bar/-/expo-status-bar-58.0.3.tgz", @@ -3427,16 +3558,6 @@ "react-native": "*" } }, - "node_modules/expo/node_modules/expo-file-system": { - "version": "58.0.9", - "resolved": "https://registry.npmjs.org/expo-file-system/-/expo-file-system-58.0.9.tgz", - "integrity": "sha512-JT0km3Wa+wDz/7Rli8ifreoMnmk68ulf/uaWzRA26xm/4K+jGTY+cDhnboRmpmXUCBkED6uqxWmNoXjaVU9VUw==", - "license": "MIT", - "peerDependencies": { - "expo": "*", - "react-native": "*" - } - }, "node_modules/expo/node_modules/expo-keep-awake": { "version": "58.0.3", "resolved": "https://registry.npmjs.org/expo-keep-awake/-/expo-keep-awake-58.0.3.tgz", @@ -3773,6 +3894,28 @@ "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", "license": "ISC" }, + "node_modules/htmlparser2": { + "version": "12.0.0", + "resolved": "https://registry.npmmirror.com/htmlparser2/-/htmlparser2-12.0.0.tgz", + "integrity": "sha512-Tz7u1i95/g2x2jz81+x0FBVhBhY5aRTvD3tXXdFaljuNdzDLJ8UGNRrTcj2cgQvAg3iW/h77Fz15nLW0L0CrZw==", + "funding": [ + "https://github.com/fb55/htmlparser2?sponsor=1", + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "license": "MIT", + "dependencies": { + "domelementtype": "^3.0.0", + "domhandler": "^6.0.0", + "domutils": "^4.0.2", + "entities": "^8.0.0" + }, + "engines": { + "node": ">=20.19.0" + } + }, "node_modules/http-errors": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", @@ -5206,7 +5349,7 @@ }, "node_modules/plist": { "version": "3.1.1", - "resolved": "https://registry.npmjs.org/plist/-/plist-3.1.1.tgz", + "resolved": "https://registry.npmmirror.com/plist/-/plist-3.1.1.tgz", "integrity": "sha512-ZIfcLJC+7E7FBFnDxm9MPmt7D+DidyQ26lewieO75AdhA2ayMtsJSES0iWzqJQbcVRSrTufQoy0DR94xHue0oA==", "license": "MIT", "dependencies": { @@ -5220,7 +5363,7 @@ }, "node_modules/plist/node_modules/@xmldom/xmldom": { "version": "0.9.12", - "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.9.12.tgz", + "resolved": "https://registry.npmmirror.com/@xmldom/xmldom/-/xmldom-0.9.12.tgz", "integrity": "sha512-5AXjrcMClTryPe9LgZrygpB1lj7s0S9E0+W+AHaVKAVyHanafK86iPSvG5xHVSp/jC+VH1UXu0TAEmY279xH7A==", "license": "MIT", "engines": { @@ -5837,7 +5980,7 @@ }, "node_modules/simple-plist": { "version": "1.3.1", - "resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.3.1.tgz", + "resolved": "https://registry.npmmirror.com/simple-plist/-/simple-plist-1.3.1.tgz", "integrity": "sha512-iMSw5i0XseMnrhtIzRb7XpQEXepa9xhWxGUojHBL43SIpQuDQkh3Wpy67ZbDzZVr6EKxvwVChnVpdl8hEVLDiw==", "license": "MIT", "dependencies": { @@ -6282,16 +6425,6 @@ "node": ">= 0.4.0" } }, - "node_modules/uuid": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-7.0.3.tgz", - "integrity": "sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg==", - "deprecated": "uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028).", - "license": "MIT", - "bin": { - "uuid": "dist/bin/uuid" - } - }, "node_modules/validate-npm-package-name": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-5.0.1.tgz", @@ -6416,16 +6549,15 @@ } }, "node_modules/xcode": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/xcode/-/xcode-3.0.1.tgz", - "integrity": "sha512-kCz5k7J7XbJtjABOvkc5lJmkiDh8VhjVCGNiqdKCscmVpdVUpEAyXv1xmCLkQJ5dsHqx3IPO4XW+NTDhU/fatA==", + "version": "4.0.0", + "resolved": "https://registry.npmmirror.com/xcode/-/xcode-4.0.0.tgz", + "integrity": "sha512-dDaoWzc9EP2fp9FS9PVZUkyvFxY4y1TOV9pcKaKLk++Ei/qb97XDFEVP7GnW7Osii/TzVABJ0jq2F+9/lq0TVA==", "license": "Apache-2.0", "dependencies": { - "simple-plist": "^1.1.0", - "uuid": "^7.0.3" + "simple-plist": "^1.3.1" }, "engines": { - "node": ">=10.0.0" + "node": ">=14.17.0" } }, "node_modules/xml2js": { diff --git a/mobile-app/package.json b/mobile-app/package.json index c8781e4..82e9f6b 100644 --- a/mobile-app/package.json +++ b/mobile-app/package.json @@ -16,16 +16,21 @@ }, "dependencies": { "@expo/vector-icons": "^15.1.1", + "@noble/hashes": "^2.4.0", "expo": "~58.0.14", + "expo-application": "~58.1.2", "expo-constants": "~58.0.12", "expo-crypto": "~58.0.7", "expo-document-picker": "~58.0.4", + "expo-file-system": "~58.0.12", "expo-font": "~58.0.8", "expo-image-picker": "~58.0.10", "expo-secure-store": "~58.0.2", + "expo-sharing": "~58.0.20", "expo-status-bar": "~58.0.3", "expo-system-ui": "~58.0.6", "expo-updates": "~58.0.17", + "htmlparser2": "^12.0.0", "react": "19.3.0", "react-dom": "19.3.0", "react-native": "0.88.0", diff --git a/mobile-app/src/App.tsx b/mobile-app/src/App.tsx index 7938481..3db499f 100644 --- a/mobile-app/src/App.tsx +++ b/mobile-app/src/App.tsx @@ -1,15 +1,19 @@ +import {Text,ReadingContext,type ReadingSize} from './typography'; +import {usePackageUpdates,PackageUpdateDialog,PackageUpdateStatus} from './PackageUpdates'; +import {LoginView} from './screens/LoginView'; +import {BusinessList} from './screens/BusinessList'; +import {FileLibrary} from './screens/FileLibrary'; import {ArrivalHistory} from './screens/ArrivalHistory'; import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { ActivityIndicator, AppState, BackHandler, FlatList, Image, KeyboardAvoidingView, Modal, Platform, - Keyboard, Pressable, ScrollView, Text, View } from 'react-native'; + Keyboard, Pressable, ScrollView, View } from 'react-native'; import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context'; import Constants from 'expo-constants'; import * as SecureStore from 'expo-secure-store'; -import * as Updates from 'expo-updates'; import * as Crypto from 'expo-crypto'; import { StatusBar } from 'expo-status-bar'; import { ApiClient, allows, internalUrl } from './core/network'; -import { createUpdateCheck, type UpdateState } from './core/updates'; +import { AppUpdateDialog, useAppUpdates, type AppUpdateControls } from './AppUpdates'; import { modules, display, recordDisplay, routeComponents, validDate, type Module, type Row, localDate } from './core/modules'; import { AppearanceContext, Button, Card, Choice, Field, Heading, Icon, Note, s, useTheme, type Appearance, type IconName } from './ui'; import { Assistant } from './screens/Assistant'; @@ -34,24 +38,30 @@ type User={user:Row; permissions:string[]; pages?:string[];pwdChrtype?:string}; const preferences={get:async(key:string)=>Platform.OS==='web'?localStorage.getItem(key):SecureStore.getItemAsync(key), put:async(key:string,value:string)=>{if(Platform.OS==='web')localStorage.setItem(key,value);else await SecureStore.setItemAsync(key,value);}}; export default function App(){ + const updates=useAppUpdates(); const [mode,setMode]=useState('system'); + const [reading,setReading]=useState('compact'); + useEffect(()=>{void preferences.get('cmvr.reading-size').then(value=>{if(['compact','standard','large'].includes(value||''))setReading(value as ReadingSize);}).catch(()=>{});},[]); + const changeReading=useCallback((value:ReadingSize)=>{setReading(value);void preferences.put('cmvr.reading-size',value).catch(()=>{});},[]); const [server,setServer]=useState(variant==='dev'?null:nativeBase); useEffect(()=>{if(variant!=='dev')return;let alive=true;void preferences.get(developmentServerKey).then(value=>{if(alive)setServer(value?developmentServer(value):nativeBase);}).catch(()=>{if(alive)setServer(nativeBase);});return()=>{alive=false;};},[]); const saveServer=useCallback(async(value:string)=>{await preferences.put(developmentServerKey,value);setServer(value);},[]); useEffect(()=>{void (Platform.OS==='web'?Promise.resolve(localStorage.getItem('cmvr.appearance')):SecureStore.getItemAsync('cmvr.appearance')).then(value=>{if(['system','light','dark'].includes(value||''))setMode(value as Appearance);}).catch(()=>{});},[]); const change=useCallback((value:Appearance)=>{setMode(value);if(Platform.OS==='web')try{localStorage.setItem('cmvr.appearance',value);}catch{}else void SecureStore.setItemAsync('cmvr.appearance',value).catch(()=>{});},[]); - return {server?:正在读取开发服务设置…}; + return {server?:正在读取开发服务设置…}; } -function Root({server,saveServer}:{server:string;saveServer:(value:string)=>Promise}){ +function Root({server,saveServer,updates}:{server:string;saveServer:(value:string)=>Promise;updates:AppUpdateControls}){ const storage=useMemo(()=>{const key=serverTokenKey(variant,server);return {get:()=>Platform.OS==='web'?Promise.resolve(null):SecureStore.getItemAsync(key),put:(token:string)=>Platform.OS==='web'?Promise.resolve():SecureStore.setItemAsync(key,token),clear:()=>Platform.OS==='web'?Promise.resolve():SecureStore.deleteItemAsync(key)};},[server]); const t=useTheme(); const [user,setUser]=useState(null),[starting,setStarting]=useState(true); - const [tab,setTab]=useState('home'),[stack,setStack]=useState([]),[aiVisited,setAiVisited]=useState(false),[keyboard,setKeyboard]=useState(false),[update,setUpdate]=useState('disabled'); + const [tab,setTab]=useState('home'),[stack,setStack]=useState<{key:string;query:Row}[]>([]),[aiVisited,setAiVisited]=useState(false),[keyboard,setKeyboard]=useState(false); const [unreadMessages,setUnreadMessages]=useState({count:0,exact:true});const messageSerial=useRef(0); - const page=stack[stack.length-1]; + const entry=stack[stack.length-1],page=entry?.key; + const scope=server+'|'+String(user?.user.userId||'anonymous'); const epoch=useRef(0),leave=useRef(null); const bindLeave=useCallback((guard:LeaveGuard|null)=>{leave.current=guard;},[]); const reset=useCallback(()=>{epoch.current++;messageSerial.current++;setUnreadMessages({count:0,exact:true});setUser(null);setTab('home');setStack([]);setAiVisited(false);leave.current=null;void storage.clear();},[storage]); const api=useMemo(()=>variant==='dev'?connectionClient(server,reset,Platform.OS==='web'?globalThis.location.origin:undefined):new ApiClient(base,reset),[reset,server]); + const packageUpdates=usePackageUpdates(api,scope,!!user); const refreshMessages=useCallback(()=>{ const current=epoch.current,id=++messageSerial.current;if(!user){setUnreadMessages({count:0,exact:true});return;} void Promise.all([api.request('/system/notifications/unread'),api.request('/system/notice/listTop')]).then(([inbox,notices])=>{ @@ -71,47 +81,46 @@ function Root({server,saveServer}:{server:string;saveServer:(value:string)=>Prom } const connection=variant==='dev'?:undefined; const identity=useCallback(async()=>{const [info,routes]=await Promise.all([api.request('/getInfo'),api.request('/getRouters')]);return {...info,pages:routeComponents(routes.data||[])};},[api]); - const check=useMemo(()=>createUpdateCheck({...Updates,isEnabled:Platform.OS==='android'&&!__DEV__&&Updates.isEnabled},setUpdate),[]); - useEffect(()=>{void check();let alive=true;const current=epoch.current; + useEffect(()=>{let alive=true;const current=epoch.current; void storage.get().then(async token=>{if(!alive||!token)return;api.authenticate(token);try{const data=await identity();if(alive&&epoch.current===current)setUser(data);}catch{api.clear();await storage.clear();}}) - .catch(()=>{}).finally(()=>{if(alive)setStarting(false);});return()=>{alive=false;};},[api,check,identity]); + .catch(()=>{}).finally(()=>{if(alive)setStarting(false);});return()=>{alive=false;};},[api,identity]); const back=useCallback(()=>{const proceed=()=>{Keyboard.dismiss();setStack(old=>old.slice(0,-1));};if(leave.current)leave.current(proceed);else proceed();},[]); useEffect(()=>{const sub=BackHandler.addEventListener('hardwareBackPress',()=>{if(page){back();return true;}if(tab!=='home'){setTab('home');return true;}return false;});return()=>sub.remove();},[page,tab,back]); useEffect(()=>{const show=Keyboard.addListener('keyboardDidShow',()=>setKeyboard(true)),hide=Keyboard.addListener('keyboardDidHide',()=>setKeyboard(false));return()=>{show.remove();hide.remove();};},[]); - function open(name:string){const proceed=()=>{Keyboard.dismiss();setStack(old=>[...old,name]);};if(leave.current)leave.current(proceed);else proceed();} + function open(name:string,query:Row={}){const proceed=()=>{Keyboard.dismiss();setStack(old=>[...old,{key:name,query}]);};if(leave.current)leave.current(proceed);else proceed();} function go(name:string){Keyboard.dismiss();if(name==='assistant')setAiVisited(true);setTab(name);} function logout(){Alert.alert('退出登录','确认退出当前账号?未发送的对话内容不会保留。',[{text:'取消',style:'cancel'},{text:'退出',style:'destructive',onPress:()=>{void api.request('/logout',{method:'POST'}).catch(()=>{});api.clear();reset();}}]);} async function login(token:string){const current=epoch.current;api.authenticate(token);try{const data=await identity(); if(current!==epoch.current)return;await storage.put(token);if(current===epoch.current)setUser(data);}catch(error){api.clear();await storage.clear();throw error;}} - const updateText={disabled:'开发模式 · 未启用远程更新',checking:'正在检查内网更新…',current:'已是当前版本',downloading:'正在后台下载更新,不影响操作…',ready:'更新已备妥,下次启动生效',failed:'暂未连接更新服务,继续使用当前版本'}[update]; const permitted=modules.filter(m=>allows(user?.permissions||[],...m.permissions)&&(!m.pages||m.pages.some(p=>user?.pages?.includes(p)))); const selected=permitted.find(m=>m.key===page); const ai=allows(user?.permissions||[],['ai:assistant:use']); const titles:Record={home:'工作台',business:'业务中心',assistant:'AI 助手',me:'我的',messages:'消息中心',profile:'个人资料',password:'账号与密码',feedback:'问题与建议','feedback-list':'我的反馈',settings:'设置',about:'关于应用'}; const tabs:[string,string,IconName][]=[['home','工作台','grid-outline'],['business','业务','layers-outline'],...(ai?[['assistant','AI','sparkles-outline'] as [string,string,IconName]]:[]),['me','我的','person-outline']]; - return + return {starting?正在连接你的工作空间正在恢复登录并核对当前账号信息,请稍候。: !user?:<> {page&&} - {selected?.title||titles[page||tab]} + {selected?.title||titles[page||tab]} {!!selected?.guide&&Alert.alert(selected.title+' · 操作指引',selected.guide)} style={{padding:10}}>} {page!=='messages'&&open('messages')} style={{padding:10,position:'relative'}}>{!!messageBadge(unreadMessages.count,unreadMessages.exact)&&{messageBadge(unreadMessages.count,unreadMessages.exact)}}} {!page&&{variant==='prod'?'内网工作空间':'开发环境'}} - {!page&&tab==='home'&&} + {!page&&tab==='home'&&} {!page&&tab==='business'&&} {!page&&tab==='me'&&} {page==='messages'&&} {aiVisited&&ai&&} - {!!selected&&} + {selected?.key==='files'?:!!selected&&} {(page==='profile'||page==='password')&&setUser(old=>old?{...old,user:{...old.user,...profile}}:null)}/>} {(page==='feedback'||page==='feedback-list')&&} - {(page==='settings'||page==='about')&&} + {(page==='settings'||page==='about')&&} logout={logout} about={page==='about'}/>} - {!page&&!keyboard&&{tabs.map(([key,label,icon])=>go(key)} style={{flex:1,alignItems:'center',justifyContent:'center',minHeight:57,gap:3}}>{label})}} + {!page&&!keyboard&&{tabs.map(([key,label,icon])=>go(key)} style={{flex:1,alignItems:'center',justifyContent:'center',minHeight:50,gap:3}}>{label})}} } + {!packageUpdates.visible&&} ; } function Login({api,onLogin,server,connection}:{api:ApiClient;onLogin:(token:string)=>Promise;server:string;connection?:React.ReactNode}){ @@ -124,105 +133,5 @@ function Login({api,onLogin,server,connection}:{api:ApiClient;onLogin:(token:str if(!username.trim()||!password||captcha.captchaEnabled!==false&&!code.trim()){setError('请填写账号、密码和验证码。');return;} lock.current=true;setBusy(true);setError('');try{const data=await api.request('/login',{method:'POST',anonymous:true,body:{username:username.trim(),password,code,uuid:captcha.uuid}});await onLogin(data.token);setPassword('');} catch(e){await refresh();setError((e as Error).message);}finally{lock.current=false;setBusy(false);}} - return - CMVR · 项目物资管理欢迎回到工作空间请连接公司内网,使用现有账号登录。 - - {connecting&&正在连接内网服务,准备登录信息…} - {!!captcha&&captcha.captchaEnabled!==false&&<> - {!!captcha?.img&&void refresh()}>}} - {!!error&&{error}}'}),dialog=defineComponent({template:'
'}) diff --git a/ruoyi-ui-vue3/tests/runtime/arrival-photos.spec.js b/ruoyi-ui-vue3/tests/runtime/arrival-photos.spec.js index 49f6daf..7b22478 100644 --- a/ruoyi-ui-vue3/tests/runtime/arrival-photos.spec.js +++ b/ruoyi-ui-vue3/tests/runtime/arrival-photos.spec.js @@ -24,7 +24,7 @@ it('read-only saved photos load privately on demand and never expose upload or r await wrapper.find('button').trigger('click');await flushPromises();expect(request).toHaveBeenCalledOnce();expect(request.mock.calls[0][0].url).toContain('/content');expect(document.body.textContent).not.toContain('上传照片');expect(document.body.textContent).not.toContain('移除') }) it('non-images and oversized files do not upload; each arrival is limited to nine photos',async()=>{ - request.mockImplementation(async c=>({data:{id:c.data.get('uploadId'),name:'到货.png'}}));page();await choose([new File(['not image'],'file.txt',{type:'text/plain'}),new File([new Uint8Array(5*1024*1024+1)],'large.png',{type:'image/png'})]);expect(request).not.toHaveBeenCalled() + request.mockImplementation(async c=>({data:{id:c.data.get('uploadId'),name:'到货.png'}}));page();await choose([new File(['not image'],'file.txt',{type:'text/plain'}),new File([new Uint8Array(20*1024*1024+1)],'large.png',{type:'image/png'})]);expect(request).not.toHaveBeenCalled() await choose(Array.from({length:10},picture));expect(wrapper.props('modelValue')).toHaveLength(9);expect(request).toHaveBeenCalledTimes(9) }) it('saved photo loading errors can retry without editing the arrival or its photo metadata',async()=>{ diff --git a/ruoyi-ui-vue3/tests/runtime/message-center.spec.js b/ruoyi-ui-vue3/tests/runtime/message-center.spec.js index 2233ac3..5653550 100644 --- a/ruoyi-ui-vue3/tests/runtime/message-center.spec.js +++ b/ruoyi-ui-vue3/tests/runtime/message-center.spec.js @@ -5,12 +5,14 @@ import ElementPlus from 'element-plus' import Center from '@/layout/components/HeaderNotice/index.vue' const api = vi.hoisted(() => ({ list: vi.fn(), unread: vi.fn(), detail: vi.fn(), read: vi.fn(), notices: vi.fn(), notice: vi.fn(), readNotices: vi.fn() })) +const files = vi.hoisted(() => ({ download: vi.fn() })) const identity = reactive({ id: 1 }) const navigation = vi.hoisted(() => ({ push: vi.fn() })) vi.mock('@/store/modules/user', () => ({ default: () => identity })) vi.mock('vue-router', () => ({ useRouter: () => navigation })) vi.mock('@/api/system/notification', () => ({ listNotifications: api.list, notificationUnread: api.unread, getNotification: api.detail, readNotificationBatch: api.read })) vi.mock('@/api/system/notice', () => ({ listNoticeTop: api.notices, getNotice: api.notice, markNoticeReadAll: api.readNotices })) +vi.mock('@/api/system/files', () => ({ downloadFile: files.download, fileSize: bytes => bytes+' B' })) let wrapper const dom = () => new DOMWrapper(document.body) const message = (id = 7) => ({ id, title: '模拟站内消息', content: '\n纯文本正文', readAt: null, deliveredAt: '2026-10-20 11:00' }) @@ -21,6 +23,7 @@ async function open() { } beforeEach(() => { vi.clearAllMocks(); identity.id = 1 + files.download.mockResolvedValue() api.unread.mockResolvedValue({ data: { count: 1, exact: true } }) api.notices.mockResolvedValue({ data: [] }) api.list.mockResolvedValue({ data: { items: [message()], hasMore: false, nextCursor: null } }) @@ -72,6 +75,24 @@ it('announcement and message read operations stay separate and the badge respect await button('标为已读').trigger('click'); await flushPromises() expect(api.readNotices).toHaveBeenCalledExactlyOnceWith('7'); expect(api.read).not.toHaveBeenCalled() }) +it('ordinary recipients can see and download saved announcement attachments without management permission', async () => { + const attachment={id:'notice-file',name:'库存管理.apk',size:26400542} + api.notices.mockResolvedValue({data:[{noticeId:8,noticeTitle:'下载公告',isRead:false}]}) + api.notice.mockResolvedValue({data:{noticeTitle:'下载公告',noticeContent:'请下载附件',attachments:[attachment]}}) + await open();await dom().findAll('input[type="radio"]').find(item=>item.element.value==='notices').setValue();await flushPromises();await dom().find('.message-item').trigger('click');await flushPromises() + expect(dom().find('[aria-label="公告附件"]').text()).toContain('库存管理.apk');expect(dom().text()).toContain('附件(1)');expect(button('移除')).toBeUndefined();expect(button('公告管理')).toBeUndefined() + await button('下载').trigger('click');await flushPromises();expect(files.download).toHaveBeenCalledWith(attachment,expect.anything());expect(api.read).not.toHaveBeenCalled();expect(api.readNotices).not.toHaveBeenCalled() + await button('← 返回列表').trigger('click');await flushPromises();expect(dom().find('[aria-label="公告附件"]').exists()).toBe(false) +}) +it('empty announcements and inbox messages do not display stale announcement attachments', async () => { + api.notices.mockResolvedValue({data:[{noticeId:8,noticeTitle:'无附件公告',isRead:false}]});api.notice.mockResolvedValue({data:{noticeTitle:'无附件公告',noticeContent:'正文',attachments:[]}}) + await open();await dom().findAll('input[type="radio"]').find(item=>item.element.value==='notices').setValue();await flushPromises();await dom().find('.message-item').trigger('click');await flushPromises();expect(dom().find('[aria-label="公告附件"]').exists()).toBe(false) +}) +it('announcement detail retains numbered steps and bullets instead of flattening editor HTML',async()=>{ + api.notices.mockResolvedValue({data:[{noticeId:9,noticeTitle:'操作步骤',isRead:false}]});api.notice.mockResolvedValue({data:{noticeTitle:'操作步骤',noticeContent:'

使用说明

  1. 安装
  2. 登录
  3. 下载附件
  • 补充说明
'}}) + await open();await dom().findAll('input[type="radio"]').find(item=>item.element.value==='notices').setValue();await flushPromises();await dom().find('.message-item').trigger('click');await flushPromises() + expect(dom().findAll('.message-richcontent ol>li')).toHaveLength(3);expect(dom().findAll('.message-richcontent ul>li')).toHaveLength(1);expect(dom().find('.message-richcontent strong').text()).toBe('使用说明');expect(dom().text()).not.toContain('hidden-script');expect(api.readNotices).not.toHaveBeenCalled() +}) it('KPI reminders expose a validated personal assessment link only after opening the message', async () => { api.detail.mockResolvedValue({data:{...message(),businessType:'KPI_REMINDER',sourcePath:'/kpi/assessment/42'}}) await open();expect(button('查看KPI')).toBeUndefined() diff --git a/scripts/projectdev/vue3-all-pages-audit.cjs b/scripts/projectdev/vue3-all-pages-audit.cjs index bf052fa..384e32b 100644 --- a/scripts/projectdev/vue3-all-pages-audit.cjs +++ b/scripts/projectdev/vue3-all-pages-audit.cjs @@ -36,7 +36,9 @@ const {checkForms}=require('./vue3-form-display-check.cjs') await page.evaluate(async url=>{await document.querySelector('#app').__vue_app__.config.globalProperties.$router.push(url)},route.url);assert.equal(new URL(page.url()).pathname,route.url,'actual router must display the audited route');await settled() const checks=[] for(const viewport of [{width:1366,height:768},{width:1024,height:600}]){ - await page.setViewportSize(viewport);await page.waitForTimeout(180) + await page.setViewportSize(viewport);await settled() + // ResizeObserver and table layout finish asynchronously, especially during parallel builds. + await page.waitForFunction(()=>[...document.querySelectorAll('.business-list-page__table > .el-table')].filter(e=>e.getClientRects().length).every(e=>Math.abs(e.getBoundingClientRect().height-e.parentElement.clientHeight)<=2)) checks.push(await page.evaluate(()=>{const stage=document.querySelector('.desktop-viewport'),visible=e=>e.getClientRects().length&&getComputedStyle(e).visibility!=='hidden',box=e=>{const r=e.getBoundingClientRect();return {x:r.x,y:r.y,width:r.width,height:r.height,bottom:r.bottom,right:r.right}};return {viewport:[innerWidth,innerHeight],document:[document.documentElement.scrollWidth,document.documentElement.scrollHeight],root:stage?.firstElementChild?.className,rootScroll:stage?.firstElementChild?{height:stage.firstElementChild.clientHeight,scroll:stage.firstElementChild.scrollHeight}:null,tables:[...(stage?.querySelectorAll('div.el-table')||[])].filter(e=>visible(e)&&e.querySelector('.el-table__body-wrapper')).map(e=>{const b=box(e);let lastRowReachable=b.bottom<=innerHeight+1;if(!lastRowReachable){let parent=e.parentElement;while(parent&&!(parent.scrollHeight>parent.clientHeight+1&&/auto|scroll/.test(getComputedStyle(parent).overflowY)))parent=parent.parentElement;if(parent&&box(parent).bottom<=innerHeight+1){const before=parent.scrollTop;parent.scrollTop=parent.scrollHeight;const last=e.querySelector('.el-table__body tbody tr:last-child')||e;lastRowReachable=box(last).bottom<=Math.min(innerHeight,box(parent).bottom)+1;parent.scrollTop=before}}return {...b,lastRowReachable,columns:[...e.querySelectorAll('.el-table__header th')].map(c=>({text:c.innerText,width:c.getBoundingClientRect().width}))}}),headers:[...(stage?.querySelectorAll('.query-toolbar,.business-list-page__header')||[])].filter(visible).map(e=>({...box(e),overflow:e.scrollWidth-e.clientWidth})),loading:[...document.querySelectorAll('.el-loading-mask')].filter(e=>visible(e)&&Number(getComputedStyle(e).opacity)>.1).length}})) await checkControlCells(page,route.title+' '+viewport.width) await checkForms(page,route.title+' '+viewport.width,'.desktop-viewport')