feat(report): add annotated wrinkle views and restore capture countdown

This commit is contained in:
xsl
2026-10-15 19:45:21 +08:00
parent 2d80f6dfd0
commit 757b96dfad
23 changed files with 396 additions and 75 deletions
+5 -10
View File
@@ -22,7 +22,7 @@
return numeric(value) ? (Math.round((value + 1e-9) * 10) / 10).toFixed(1) : '-';
}
var gradeRule = 'display-score-8-9-v1';
var copyRule = 'wrinkles-excellent-acne-detected-v1';
var copyRule = 'wrinkles-excellent-acne-detected-water-v2';
function scoreOfP(P) {
return numeric(P) ? Math.round((Math.max(7, Math.min(10, 7 + 3 * P / 100)) + 1e-9) * 100) / 100 : null;
}
@@ -45,11 +45,13 @@
return selected;
}
function customerText(view) {
// Keep missing-data diagnostics in the saved/admin record, not on the
// customer report. Also suppress equivalent text in older snapshots.
if (view.valid === false || /本次未检出有效数据|本次未获取轮廓有效数据/.test(view.text || '')) return '';
if (view.key === 'wrinkles') return view.text.split('\n分区明细')[0];
if (view.key !== 'contour') return view.text;
// Also cover immutable old presentations, without modifying stored copy.
return view.text.replace(/侧脸角度数据未完整获取[;;]?/g, '')
.replace('本次未检出有效数据,请重新拍摄后查看。', '本次未获取轮廓有效数据。');
return view.text.replace(/侧脸角度数据未完整获取[;;]?/g, '');
}
function scalar(value) { return numeric(value) ? value : value && numeric(value.value) ? value.value : null; }
var wrinkleDefs = [
@@ -115,13 +117,6 @@
var viewS = valid ? scoreOfP(viewP) : null;
level = levelForScore(viewS);
var template = valid && level ? Copy.conclusion[d[0]][level] : '';
if (d[0] === 'water' && valid) {
vars.water_severity_note = numeric(vars.water_sev) && vars.water_sev >= 0 && vars.water_sev <= 100
? (vars.water_sev >= 60 ? '缺水程度较高(严重度 {water_sev}),' : '缺水严重度 {water_sev},') : '';
if (viewP !== vars.water_score) template = '水分分 {water_score};缺水面积 {water_area}%,缺水严重度 {water_sev}。水分分数与缺水指标不一致,本次按缺水指标评估,建议加强补水与保湿。';
// Resolve the optional phrase before normal scalar substitution.
template = template.replace(/\{water_severity_note\}/g, vars.water_severity_note);
}
if (d[0] === 'contour') {
var severity = vars.dark_circle_sev;
var description = numeric(severity) ? ['无明显黑眼圈', '黑眼圈轻度', '黑眼圈中度', '黑眼圈重度'][severity] : null;