fix(h5): center score stack, lock profile scroll and gate turn guidance

This commit is contained in:
xsl
2026-10-12 23:48:11 +08:00
parent 2a49ebdab2
commit 6f83f58a09
17 changed files with 1396 additions and 969 deletions
+13 -1
View File
@@ -304,6 +304,11 @@
var carousel = $('#skin-carousel');
skinSwipe = SwipeTrack.create(carousel, track, { count: SKINS.length, onSelect: goSkin });
// Limit the iOS rubber-band fallback to the fixed profile itself. The mobile
// wheel pickers live under body, so their vertical scrolling is untouched.
$('#s-profile').addEventListener('touchmove', function (e) {
if (e.cancelable) e.preventDefault();
}, { passive: false });
function cancelSkinDrag() { skinSwipe.cancel(); }
carousel.addEventListener('keydown', function (e) {
if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') { e.preventDefault(); goSkin(skinIndex + (e.key === 'ArrowRight' ? 1 : -1)); }
@@ -766,7 +771,14 @@
m.classList.toggle('no-face', cls === 'no-face');
m.classList.toggle('ok', cls === 'ok');
}
/* camera-hint-stage-pure-begin */
function captureStageHint(text, target, hasFrontPhoto) {
if ((target === 'front' || !hasFrontPhoto) && (text === '请向左转头' || text === '请向右转头')) return '请正对屏幕';
return text;
}
/* camera-hint-stage-pure-end */
function setHint(text, ok, silent) {
text = captureStageHint(text, CAM_STEPS[camStep].target, !!photos[0]);
var h = $('#cam-hint');
if (!text) { h.classList.remove('show', 'ok'); lastHint = ''; voice.dropHint(); return; }
if (text !== lastHint) {
@@ -949,7 +961,7 @@
$('#cam-next').classList.remove('show');
applyMirror();
resetDetectState();
voice.play(VOICE.step[camStep]); // 步骤引导语音
if (camStep === 0 || photos[camStep - 1]) voice.play(VOICE.step[camStep]); // 前一步合格照片已保存,才播下一步引导
}
var camSeq = 0; // 流程令牌:退出拍照/开始拍照时递增,使未决的快门/分析回调失效
+3 -8
View File
@@ -158,8 +158,8 @@
/**
* check(points, target, mirrored) -> { ok, hint }
* target: 'front' | 'left' | 'right'
* 'front' : |yaw|<=15 且 |pitch|<=18、|roll|<=15;不 ok 时给方向提示
* (UI 反馈 2026-10:动态提示「请向左转头」「请略微抬头」等,取代此前只提示回正)
* 'front' : |yaw|<=15 且 |pitch|<=18、|roll|<=15;角度不合格只提示回正,
* 不在正脸拍摄完成前播侧脸转头指令。
* 'left' : 画面中看到左脸 = 被摄者头向右转(语义 yaw ∈ [-70°,-30°]),|pitch|<=20
* 'right' : 画面中看到右脸 = 被摄者头向左转(语义 yaw ∈ [30°,70°]),|pitch|<=20
* ok=true 时 hint='保持不动';输入非法(含 estimate 返回 null 的退化特征点)时 ok=false、hint='请正对屏幕'。
@@ -183,12 +183,7 @@
if (Math.abs(sYaw) <= FRONT_YAW_MAX && Math.abs(pitch) <= FRONT_PITCH_MAX) {
return { ok: true, hint: HINT_KEEP, yaw: sYaw };
}
// 按超出阈值比例更大的一项引导回正:头偏向自己左侧(yaw>0)→请向右转头;抬头过多(pitch>0)→请略微低头
var yawOver = Math.abs(sYaw) / FRONT_YAW_MAX, pitchOver = Math.abs(pitch) / FRONT_PITCH_MAX;
if (yawOver >= pitchOver) {
return { ok: false, hint: sYaw > 0 ? HINT_TURN_RIGHT : HINT_TURN_LEFT, yaw: sYaw };
}
return { ok: false, hint: pitch > 0 ? HINT_LOWER : HINT_RAISE, yaw: sYaw };
return { ok: false, hint: HINT_FRONT, yaw: sYaw };
}
if (target === 'left' || target === 'right') {