class Paper_2 { constructor(report) { this.report = new Report(report); } /** * 评分 */ score() { // 总分数 let scores = []; // 获取需要进行配置对比的组件 const wName1 = "名校区消费情况"; const widget = this.report.getWidgetByName(wName1); if (!widget) { alert("未找到" + wName1 + "对应组件"); return 0; } // 评分点1 - 组件名是xxx的组件 scores.push(this.score_1); return scores.reduce((pre, cur, curIdx) => { const div = document.createElement("div"); const curScore = cur(widget); div.innerText = "评分点" + (curIdx + 1) + ":" + curScore + "分"; document.getElementById("console").append(div); return pre + curScore; }, 0); } /** * 评分点1-标题名称为 "名校区消费情况" */ score_1(widget) { if (widget.getPlainWidgetName() === '名校区消费情况') { return 1; } return 0; } }