|
@@ -141,13 +141,17 @@ export default {
|
|
const IS_NOUNS = questionType === "NOUNS";
|
|
const IS_NOUNS = questionType === "NOUNS";
|
|
|
|
|
|
// 构建选项元素信息
|
|
// 构建选项元素信息
|
|
|
|
+ console.log("options.length", options.length);
|
|
const opitonList = options.map((optionIds) => {
|
|
const opitonList = options.map((optionIds) => {
|
|
const elements = getElementsByIds(optionIds);
|
|
const elements = getElementsByIds(optionIds);
|
|
const width = maxNum(elements.map((elem) => elem.w));
|
|
const width = maxNum(elements.map((elem) => elem.w));
|
|
|
|
+ console.log(width, this.maxColumnWidth, this.TEXT_INDENT_SIZE);
|
|
const percent = this.getSizePercent(
|
|
const percent = this.getSizePercent(
|
|
width,
|
|
width,
|
|
- this.maxColumnWidth - this.TEXT_INDENT_SIZE
|
|
|
|
|
|
+ this.maxColumnWidth - this.TEXT_INDENT_SIZE,
|
|
|
|
+ options.length
|
|
);
|
|
);
|
|
|
|
+ console.log("percent", percent);
|
|
return {
|
|
return {
|
|
percent,
|
|
percent,
|
|
resetPercent: null,
|
|
resetPercent: null,
|
|
@@ -159,13 +163,16 @@ export default {
|
|
let resetPercent = 1;
|
|
let resetPercent = 1;
|
|
// 奇数选项,段落匹配,全部一行
|
|
// 奇数选项,段落匹配,全部一行
|
|
if (
|
|
if (
|
|
- (optionCount % 2 > 0 && !IS_BANKED_CLOZE && !IS_NOUNS) ||
|
|
|
|
|
|
+ (optionCount % 2 > 0 &&
|
|
|
|
+ !IS_BANKED_CLOZE &&
|
|
|
|
+ !IS_NOUNS &&
|
|
|
|
+ optionCount !== 5) ||
|
|
IS_PARAGRAPH_MATCHING
|
|
IS_PARAGRAPH_MATCHING
|
|
) {
|
|
) {
|
|
resetPercent = 1;
|
|
resetPercent = 1;
|
|
} else {
|
|
} else {
|
|
const maxPercent = maxNum(opitonList.map((item) => item.percent));
|
|
const maxPercent = maxNum(opitonList.map((item) => item.percent));
|
|
- resetPercent = this.getResetPercent(maxPercent);
|
|
|
|
|
|
+ resetPercent = this.getResetPercent(maxPercent, optionCount);
|
|
}
|
|
}
|
|
opitonList.forEach((item) => {
|
|
opitonList.forEach((item) => {
|
|
item.resetPercent = resetPercent;
|
|
item.resetPercent = resetPercent;
|
|
@@ -441,15 +448,38 @@ export default {
|
|
textIndent: `-${this.TEXT_INDENT_SIZE}px`,
|
|
textIndent: `-${this.TEXT_INDENT_SIZE}px`,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
- getSizePercent(size, fullSize) {
|
|
|
|
|
|
+ getSizePercent(size, fullSize, optionLength) {
|
|
const rate = size / fullSize;
|
|
const rate = size / fullSize;
|
|
|
|
+ if (optionLength == 5) {
|
|
|
|
+ if (rate <= 0.2) {
|
|
|
|
+ return 0.2;
|
|
|
|
+ } else if (rate <= 0.33) {
|
|
|
|
+ return 0.33;
|
|
|
|
+ } else if (rate <= 0.5) {
|
|
|
|
+ return 0.5;
|
|
|
|
+ } else {
|
|
|
|
+ return 1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if (rate <= 0.25) return 0.25;
|
|
if (rate <= 0.25) return 0.25;
|
|
if (rate <= 0.5) return 0.5;
|
|
if (rate <= 0.5) return 0.5;
|
|
return 1;
|
|
return 1;
|
|
},
|
|
},
|
|
- getResetPercent(maxPercent) {
|
|
|
|
|
|
+ getResetPercent(maxPercent, optionCount) {
|
|
|
|
+ if (optionCount == 5) {
|
|
|
|
+ if (maxPercent > 0.5) {
|
|
|
|
+ return 1;
|
|
|
|
+ } else if (maxPercent > 0.33) {
|
|
|
|
+ return 0.5;
|
|
|
|
+ } else if (maxPercent > 0.2) {
|
|
|
|
+ return 0.33;
|
|
|
|
+ } else {
|
|
|
|
+ return 0.2;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if (maxPercent > 0.5) return 1;
|
|
if (maxPercent > 0.5) return 1;
|
|
if (maxPercent > 0.25) return 0.5;
|
|
if (maxPercent > 0.25) return 0.5;
|
|
|
|
+
|
|
return 0.25;
|
|
return 0.25;
|
|
},
|
|
},
|
|
calcInitColumnHeight(column) {
|
|
calcInitColumnHeight(column) {
|