|
@@ -199,7 +199,23 @@ export default {
|
|
|
if (isEnable(val) && text) {
|
|
|
this.data.paragraph_list_parameter.text = text;
|
|
|
this.data.paragraph_list_parameter.is_first_sentence_first_hz_pinyin_first_char_upper_case =
|
|
|
- val.is_first_sentence_first_hz_pinyin_first_char_upper_case;
|
|
|
+ this.data.property.is_first_sentence_first_hz_pinyin_first_char_upper_case;
|
|
|
+ this.crateParsedTextInfoPinyin(text);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ },
|
|
|
+ 'data.property.is_first_sentence_first_hz_pinyin_first_char_upper_case': {
|
|
|
+ handler(val) {
|
|
|
+ let text = '';
|
|
|
+ this.data.option_list.forEach((item) => {
|
|
|
+ item.forEach((items) => {
|
|
|
+ text += `${items.content.replace(/<[^>]+>/g, '')}\n`;
|
|
|
+ });
|
|
|
+ });
|
|
|
+ if (text) {
|
|
|
+ this.data.paragraph_list_parameter.text = text;
|
|
|
+ this.data.paragraph_list_parameter.is_first_sentence_first_hz_pinyin_first_char_upper_case = val;
|
|
|
this.crateParsedTextInfoPinyin(text);
|
|
|
}
|
|
|
},
|
|
@@ -216,6 +232,7 @@ export default {
|
|
|
items.model_essay = [];
|
|
|
// this.data.answer_list[index][indexs].answer_list = [];
|
|
|
if (items.content) {
|
|
|
+ let inputIndex = 0;
|
|
|
items.content
|
|
|
.split(/<(p|div)[^>]*>(.*?)<\/(p|div)>/g)
|
|
|
.filter((s) => s && !s.match(/^(p|div)$/))
|
|
@@ -232,7 +249,9 @@ export default {
|
|
|
value: '',
|
|
|
type: 'input',
|
|
|
mark: getRandomNumber(),
|
|
|
+ inputIndex,
|
|
|
});
|
|
|
+ inputIndex++;
|
|
|
}
|
|
|
});
|
|
|
// // 去除所有的 font-size 样式
|
|
@@ -295,7 +314,49 @@ export default {
|
|
|
this.data.property.is_first_sentence_first_hz_pinyin_first_char_upper_case;
|
|
|
CrateParsedTextInfo_Pinyin(this.data.paragraph_list_parameter).then((res) => {
|
|
|
if (res.parsed_text) {
|
|
|
- this.data.paragraph_list = res.parsed_text.paragraph_list;
|
|
|
+ const mergedData = res.parsed_text.paragraph_list.map((outerArr, i) =>
|
|
|
+ outerArr.map((innerArr, j) =>
|
|
|
+ innerArr.map((newItem, k) => {
|
|
|
+ // 从 originalData 中找到对应的项
|
|
|
+ const originalItem = this.data.paragraph_list[i]?.[j]?.[k];
|
|
|
+
|
|
|
+ // 如果 originalItem 有 activeTextStyle,就合并到 newItem
|
|
|
+ if (originalItem?.activeTextStyle) {
|
|
|
+ return {
|
|
|
+ ...newItem,
|
|
|
+ activeTextStyle: originalItem.activeTextStyle,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ // 否则直接返回 newItem
|
|
|
+ return newItem;
|
|
|
+ }),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ this.data.paragraph_list = mergedData;
|
|
|
+ let pinyin_index = 0;
|
|
|
+ this.data.option_list.forEach((item, index) => {
|
|
|
+ item.forEach((items, indexs) => {
|
|
|
+ items.model_pinyin = [];
|
|
|
+ let inputIndex = 0;
|
|
|
+ if (items.content && mergedData[pinyin_index] && mergedData[pinyin_index][0]) {
|
|
|
+ mergedData[pinyin_index][0].forEach((itemP) => {
|
|
|
+ let isUnderline = /^_{3,}$/.test(itemP.text);
|
|
|
+ if (isUnderline) {
|
|
|
+ items.model_pinyin.push({
|
|
|
+ value: '',
|
|
|
+ type: 'input',
|
|
|
+ mark: getRandomNumber(),
|
|
|
+ inputIndex,
|
|
|
+ });
|
|
|
+ inputIndex++;
|
|
|
+ } else {
|
|
|
+ items.model_pinyin.push(itemP);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ pinyin_index++;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
},
|