From 398f0bd097787d356f69e9f11dc50c3c2f5e8d9d Mon Sep 17 00:00:00 2001 From: Sakura-RanChen <1908198662@qq.com> Date: Tue, 3 Nov 2026 15:56:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=9B=B8=E5=85=B3=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/manager-mobile/manifest.config.ts | 6 +- .../components/secure-random-bridge/index.vue | 126 ++++++++++++++++++ main/manager-mobile/src/manifest.json | 1 + .../src/pages/forgot-password/index.vue | 7 + main/manager-mobile/src/pages/login/index.vue | 7 + .../src/pages/register/index.vue | 7 + .../manager-mobile/src/utils/secure-random.ts | 117 ++++++++-------- 7 files changed, 213 insertions(+), 58 deletions(-) create mode 100644 main/manager-mobile/src/components/secure-random-bridge/index.vue diff --git a/main/manager-mobile/manifest.config.ts b/main/manager-mobile/manifest.config.ts index c6a00f386..ff930f248 100644 --- a/main/manager-mobile/manifest.config.ts +++ b/main/manager-mobile/manifest.config.ts @@ -120,8 +120,10 @@ export default defineManifestConfig({ /* 小程序特有相关 */ 'mp-weixin': { appid: VITE_WX_APPID, - // 最低基础库:wx.getRandomValues 要求 >= 2.17.3(sm-crypto 0.5.x 的 - // 随机源垫片依赖该 API),低于此版本的客户端将无法完成登录加密 + // 仅供开发者工具选择调试基础库版本;线上客户端的最低基础库门槛需在 + // 微信公众平台「开发管理 → 基础库最低版本设置」中配置(代码里改不动)。 + // 功能硬性要求:wx.getRandomValues 需基础库 >= 2.17.3,低于该版本的 + // 线上客户端登录时将收到 fail-closed 报错 libVersion: '2.19.4', setting: { urlCheck: false, diff --git a/main/manager-mobile/src/components/secure-random-bridge/index.vue b/main/manager-mobile/src/components/secure-random-bridge/index.vue new file mode 100644 index 000000000..8659bd0c4 --- /dev/null +++ b/main/manager-mobile/src/components/secure-random-bridge/index.vue @@ -0,0 +1,126 @@ + + + + + + + diff --git a/main/manager-mobile/src/manifest.json b/main/manager-mobile/src/manifest.json index 67225dc8e..2c4ababcc 100644 --- a/main/manager-mobile/src/manifest.json +++ b/main/manager-mobile/src/manifest.json @@ -92,6 +92,7 @@ "minified": true }, "usingComponents": true, + "libVersion": "2.19.4", "optimization": { "subPackages": true }, diff --git a/main/manager-mobile/src/pages/forgot-password/index.vue b/main/manager-mobile/src/pages/forgot-password/index.vue index 69f8a7cd2..dc25f555c 100644 --- a/main/manager-mobile/src/pages/forgot-password/index.vue +++ b/main/manager-mobile/src/pages/forgot-password/index.vue @@ -13,6 +13,10 @@ import { onLoad } from '@dcloudio/uni-app' import { computed, onMounted, ref } from 'vue' // 导入API接口 import { retrievePassword, sendSmsCode } from '@/api/auth' +// #ifdef APP-PLUS +// App 端随机源桥接:为 SM2 加密提供安全随机数(无视觉展示) +import SecureRandomBridge from '@/components/secure-random-bridge/index.vue' +// #endif // 导入国际化相关功能 import { initI18n, t } from '@/i18n' import { useConfigStore } from '@/store' @@ -305,6 +309,9 @@ onMounted(async () => { class="app-container box-border h-screen w-full" :style="{ paddingTop: `${safeAreaInsets?.top}px` }" > + + + diff --git a/main/manager-mobile/src/pages/login/index.vue b/main/manager-mobile/src/pages/login/index.vue index 5b15f1d42..25e8239a6 100644 --- a/main/manager-mobile/src/pages/login/index.vue +++ b/main/manager-mobile/src/pages/login/index.vue @@ -13,6 +13,10 @@ import type { LoginData } from '@/api/auth' import type { Language } from '@/store/lang' import { computed, onMounted, ref } from 'vue' import { login } from '@/api/auth' +// #ifdef APP-PLUS +// App 端随机源桥接:为 SM2 加密提供安全随机数(无视觉展示) +import SecureRandomBridge from '@/components/secure-random-bridge/index.vue' +// #endif // 导入国际化相关功能 import { changeLanguage, getCurrentLanguage, getSupportedLanguages, initI18n, t } from '@/i18n' import { useConfigStore, useUserStore } from '@/store' @@ -281,6 +285,9 @@ onMounted(async () => {