feat: 生产部署 + 会议全链路 (执行方分配/费用结算/签到脱敏/H5相机)

- 生产 nginx 三路径: ry-vue3 /hg/, ry-h5 /camera/, API /hg-api, .env 分环境
- 签约链接/摄像头 base-url 走 yml, 不再硬编码 /hg 与 localhost
- 新增 biz_project_executor_assign (镜像 sponsor_assign) 执行方项目级分配
- 会议费用后台汇总 FeeCalcScheduler + 结算回写项目金额 + 状态流转调度
- 签到表拍照高斯模糊脱敏 extra_oss_url, 新增 PosterService/StageDeriver
- 清理 biz_support_intent 旧表 (6 Java/XML 删除)
- ry-h5 相机黑屏修复: 显式 video.play() + 动态 apiBase 上传
- 资源: simhei 字体 / logo.png / qrcode_1.png / favicon.ico

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
郭庆泰
2026-08-24 01:00:09 +08:00
co-authored by Claude
parent 80a276e661
commit 904e28710f
123 changed files with 6008 additions and 1706 deletions
+149 -5
View File
@@ -52,6 +52,11 @@ video.setAttribute('playsinline', 'true')
// iOS 必须: 不静音黑屏 (否则 iOS 拒绝播放)
video.muted = true
// 显式 play(): <video autoplay> 只在元素首次加载时触发一次, 而 srcObject 是
// 异步挂上的, 此时视频还没源, 浏览器不会自动重放 → 黑屏 + 播放按钮.
// 静音 + playsinline 下, 现代浏览器默认放行静音自动播放, 直接 play() 起流.
video.play()
const fallbackTimer = setTimeout(() => {
if (video.readyState < 1) {
console.warn('[camera] srcObject 没生效,尝试 Object.defineProperty 强写')
@@ -82,14 +87,11 @@ video.addEventListener(
() => {
clearTimeout(fallbackTimer)
console.log('[camera] loadedmetadata 触发, readyState:', video.readyState, 'isStream:', video.srcObject === stream)
// 数据真正就绪后再补一次 play(), 兜底个别浏览器首次 play() 因无数据被打断
video.play()
},
{ once: true }
)
// 不手动调 video.play():
// 1. UTS 把 HTMLVideoElement.play() 类型当 void,链式 .catch 会报 undefined.catch
// 2. <video autoplay muted playsinline> + srcObject 已让浏览器自动起流
// 若某些浏览器不自动播放,在用户点击 shutter 等交互中再触发 play()
}
export function stopCamera(video: HTMLVideoElement): void {
@@ -115,6 +117,148 @@ export function captureFrame(video: HTMLVideoElement): string {
return canvas.toDataURL('image/jpeg', 0.85)
}
/** 生成归一化一维高斯核 (半径 radius) */
function buildGaussianKernel(radius: number): number[] {
const size = radius * 2 + 1
const sigma = radius / 2
const kernel: number[] = new Array(size)
let sum = 0
for (let i = 0; i < size; i++) {
const x = i - radius
const v = Math.exp(-(x * x) / (2 * sigma * sigma))
kernel[i] = v
sum += v
}
for (let i = 0; i < size; i++) kernel[i] = kernel[i] / sum
return kernel
}
/**
* 对 RGBA 数组的竖直条带 [y0, y1) 做可分离高斯模糊, 返回新数组 (不修改原数组).
* 水平卷积范围向外扩 radius, 保证条带边界处垂直卷积有正确的邻域上下文.
*/
function gaussianBlurBand(
data: Uint8ClampedArray,
width: number,
height: number,
y0: number,
y1: number,
radius: number
): Uint8ClampedArray {
const kernel = buildGaussianKernel(radius)
const r = radius
const kSize = kernel.length
const hy0 = Math.max(0, y0 - r)
const hy1 = Math.min(height, y1 + r)
// 1) 水平卷积: 读 data, 写 h1 (仅 [hy0, hy1) 行, 其余照抄)
const h1 = new Uint8ClampedArray(data)
const row = new Array<number>(width * 4)
for (let y = hy0; y < hy1; y++) {
const base = y * width * 4
for (let x = 0; x < width; x++) {
let rr = 0
let gg = 0
let bb = 0
let aa = 0
for (let k = 0; k < kSize; k++) {
let sx = x + k - r
if (sx < 0) sx = 0
if (sx >= width) sx = width - 1
const idx = base + sx * 4
const wt = kernel[k]
rr += data[idx] * wt
gg += data[idx + 1] * wt
bb += data[idx + 2] * wt
aa += data[idx + 3] * wt
}
const o = x * 4
row[o] = rr
row[o + 1] = gg
row[o + 2] = bb
row[o + 3] = aa
}
for (let i = 0; i < width * 4; i++) h1[base + i] = row[i]
}
// 2) 垂直卷积: 读 h1, 写 h2 (仅 [y0, y1) 行, 其余照抄 h1)
const h2 = new Uint8ClampedArray(h1)
const band = y1 - y0
const col = new Array<number>(band * 4)
for (let x = 0; x < width; x++) {
for (let yy = 0; yy < band; yy++) {
const y = y0 + yy
let rr = 0
let gg = 0
let bb = 0
let aa = 0
for (let k = 0; k < kSize; k++) {
let sy = y + k - r
if (sy < 0) sy = 0
if (sy >= height) sy = height - 1
const idx = (sy * width + x) * 4
const wt = kernel[k]
rr += h1[idx] * wt
gg += h1[idx + 1] * wt
bb += h1[idx + 2] * wt
aa += h1[idx + 3] * wt
}
const o = yy * 4
col[o] = rr
col[o + 1] = gg
col[o + 2] = bb
col[o + 3] = aa
}
for (let yy = 0; yy < band; yy++) {
const idx = ((y0 + yy) * width + x) * 4
const o = yy * 4
h2[idx] = col[o]
h2[idx + 1] = col[o + 1]
h2[idx + 2] = col[o + 2]
h2[idx + 3] = col[o + 3]
}
}
return h2
}
/**
* 截图并同时生成两张图: 清晰版 + 竖直条带 [start, end] 高斯模糊版 (签到表脱敏用).
* 同一帧出两张, 避免两次截图不一致.
*/
export function captureFrameWithBlur(
video: HTMLVideoElement,
start: number,
end: number,
radius: number
): { sharp: string; blurred: string } {
const w = video.videoWidth || video.clientWidth
const h = video.videoHeight || video.clientHeight
if (!w || !h) {
throw new Error('视频流尚未就绪,无法截图')
}
const canvas = document.createElement('canvas')
canvas.width = w
canvas.height = h
const ctx = canvas.getContext('2d')
if (!ctx) throw new Error('无法获取 canvas 2D 上下文')
ctx.drawImage(video, 0, 0, w, h)
const sharp = canvas.toDataURL('image/jpeg', 0.85)
const y0 = Math.max(0, Math.floor(h * start))
const y1 = Math.min(h, Math.floor(h * end))
let blurred = sharp
if (y1 - y0 > 1) {
const imgData = ctx.getImageData(0, 0, w, h)
const dst = gaussianBlurBand(imgData.data, w, h, y0, y1, radius)
imgData.data.set(dst)
ctx.putImageData(imgData, 0, 0)
blurred = canvas.toDataURL('image/jpeg', 0.85)
}
return { sharp, blurred }
}
export function describeCameraError(err: unknown): string {
const name = (err as DOMException)?.name || ''
switch (name) {