feat(report): unify display grades and add contour side photos

This commit is contained in:
xsl
2026-10-15 17:14:05 +08:00
parent 60f0965c5a
commit 2d80f6dfd0
21 changed files with 557 additions and 49 deletions
+10 -1
View File
@@ -36,11 +36,12 @@ assert(!text.includes('分区明细') && !text.includes('标准化长度'));
const approved = {
'预警': '全脸共检测到皱纹 12 条、细纹 34 条,面中、口周、眼周等区域已出现静态纹倾向,纹路已呈现固化趋势,并非临时性干纹。',
'改善': '全脸共检测到皱纹 12 条、细纹 34 条,面部整体平整,仅眼周或口周有细微的干纹,无明显静态深纹,纹路面积占比相对较低。',
'良好': '面中、口周、眼周等各区域均无明显皱纹沟壑,无静态深纹与粗纹,各类纹路面积均处于极低水平,面部整体平整细腻。'
'良好': '全脸共检测到皱纹 12 条、细纹 34 条;整体纹路状态较好,建议维持日常淡纹与保湿护理。'
};
for (const level of Object.keys(approved)) {
const fixture = JSON.parse(modelBefore);
fixture.cats.wrinkles.level = level;
fixture.cats.wrinkles.P = { '预警': 20, '改善': 50, '良好': 90 }[level];
fixture.cats.wrinkles.vars.wr_cnt = 12;
fixture.cats.wrinkles.vars.fl_cnt = 34;
assert.equal(ReportUI.build(fixture, result).views.find(view => view.key === 'wrinkles').text, approved[level]);
@@ -49,6 +50,7 @@ assert.equal(JSON.stringify(model), modelBefore);
assert.equal(JSON.stringify(result), rawBefore);
const excellent = JSON.parse(JSON.stringify(model));
excellent.cats.smooth.level = '良好'; // Legacy level name maps to new "优秀".
excellent.cats.smooth.P = 90;
excellent.cats.smooth.vars.pore_cnt = 7;
excellent.cats.smooth.vars.blackhead_cnt = 2;
let smooth = ReportUI.build(excellent, result).views.find(view => view.key === 'smooth');
@@ -67,6 +69,13 @@ assert(crop.width < 1600 && crop.height < 1800);
assert(crop.left <= 1479 && crop.top <= 1133);
assert(crop.left + crop.width >= 2595 && crop.top + crop.height >= 2249);
assert(Math.abs(crop.width / crop.height - 215 / 278) < 1e-8);
const moved = sandbox.vizShiftContentDown(crop,{left:1479,top:1133,width:1116,height:1116},.09);
assert(Math.abs(moved.top-(crop.top-crop.height*.09))<1e-8);
assert.equal(moved.width,crop.width);assert.equal(moved.height,crop.height);assert.equal(moved.left,crop.left);
assert(moved.top>=0&&moved.top+moved.height>=2249);
assert.equal(sandbox.vizShiftContentDown(crop,null,.09),crop);
const edgeCrop=sandbox.vizFaceCrop(1000,1000,{left:100,top:0,width:300,height:300});
assert.equal(sandbox.vizShiftContentDown(edgeCrop,{left:100,top:0,width:300,height:300},.09).top,0);
for (const rect of [null, { left: NaN }, { left: 0, top: 0, width: -1, height: 20 },
{ left: 3900, top: 0, width: 1000, height: 1000 }, { left: 0, top: 0, width: '100', height: 100 }]) {
const full = sandbox.vizFaceCrop(4000, 3000, rect);