新增 有家相册 uni-app 前端(uniapp/youjiala,H5 / 微信小程序 / App 三端)

从旧 WebVue 移植的地基部分:
- 登录页(RSA+MD5 密码加密、redirect 回跳、中英文切换)与登录后落地页
- 401 / 403 / 404 错误页 + error-panel 通用外壳(文案走 ErrorPage 语言包)
- 登录守卫双链路:uni.addInterceptor 拦站内跳转,页面级 onShow 复核冷启动深链
- 单一请求链路 common/http.interceptor:JWT 唯一来源、401 并发刷新单例、
  业务异常识别、HTTP 403 跳无权限页
- H5 干净短地址:initRouter 前向 __uniRoutes 追加克隆记录(router/h5-clean-url)
- 路由登记表 router/routes.ts(PAGE_PATHS / pageUrl / PAGE_PERMISSIONS)
  与新增页面四步登记约定(src/md/page-routing.md)
- i18n:uView Pro 语言包 + 后端词条合并,双取值(后端 zh-cn/en,包名 zh-CN/en-US)
- 后端接口层 service/ 与数据模型 data/auto/ 为生成器产物,不手改

不入库的内容:
- 摘除脚手架残留的 Harmony 签名密码(manifest.json signingConfigs 与
  harmony-configs/build-profile.json5 的 keyPassword / storePassword 已置空)
- 忽略 node_modules、dist、unpackage、.hbuilderx、.agents、pnpm-lock.yaml
  及根目录临时截图
This commit is contained in:
owenchen committed 2026-10-13 08:27:34 +08:00
1 parent 74757f9eb4
commit 6a8258ac4b
274 files changed
+30291

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
// 跨端密码加密工具(H5 / 小程序 / App 均可用)
// 说明:原 jsencrypt 依赖浏览器 window.crypto,小程序/App 无 DOM 会失败;
// wxmp-rsa 是 jsencrypt 同源 fork(jsbn 纯 JS 实现,随机数走 Math.random 兜底),
// 无任何浏览器全局依赖,API 与 jsencrypt 完全一致,一套代码全端运行。
import CryptoJS from "crypto-js";
import { JSEncrypt } from "wxmp-rsa";
/** MD5 摘要(小写 hex),与旧系统 WebVue 的 CryptoJS.MD5(...).toString() 输出一致 */
export function md5Hex(text: string): string {
return CryptoJS.MD5(text).toString();
}
/**
* RSA 公钥加密(PKCS#1 v1.5),返回 base64 密文
* @param plaintext 待加密明文
* @param publicKeyPem 后端 /Auth/GetRsaPublicKey 返回的 PEM 公钥(无换行的裸格式也可)
* @returns 加密失败返回空串,调用方需判空兜底
*/
export function rsaEncrypt(plaintext: string, publicKeyPem: string): string {
const encryptor = new JSEncrypt();
encryptor.setPublicKey(publicKeyPem);
// encrypt 失败返回 false(非 nullish),用 || 兜底为空串
return encryptor.encrypt(plaintext) || "";
}
/**
* 登录密码密文:RSA( Guid + MD5(密码) ),算法与旧系统 WebVue 登录完全一致
* Guid 同时作为请求体 LoginData.Guid 发送,服务端解密后比对前缀防重放
*/
export function encryptLoginPassword(
password: string,
guid: string,
publicKeyPem: string,
): string {
return rsaEncrypt(guid + md5Hex(password), publicKeyPem);
}