|  | @@ -20,7 +20,13 @@
 | 
	
		
			
				|  |  |                {{ computedQuestionNumber(i, data.option_number_show_mode) }}
 | 
	
		
			
				|  |  |              </span>
 | 
	
		
			
				|  |  |              <div class="option-content">
 | 
	
		
			
				|  |  | -              <RichText v-model="item.content" :class="'repeat' + i" placeholder="输入内容" :inline="true" />
 | 
	
		
			
				|  |  | +              <RichText
 | 
	
		
			
				|  |  | +                v-model="item.content"
 | 
	
		
			
				|  |  | +                class="repeat-richtext"
 | 
	
		
			
				|  |  | +                placeholder="输入内容"
 | 
	
		
			
				|  |  | +                :inline="true"
 | 
	
		
			
				|  |  | +                @handleRichTextBlur="handleRichTextBlur"
 | 
	
		
			
				|  |  | +              />
 | 
	
		
			
				|  |  |              </div>
 | 
	
		
			
				|  |  |              <UploadAudio
 | 
	
		
			
				|  |  |                v-if="data.other.audio_generation_method === 'upload'"
 | 
	
	
		
			
				|  | @@ -115,7 +121,7 @@ import UploadAudio from '../common/UploadAudio.vue';
 | 
	
		
			
				|  |  |  import QuestionMixin from '../common/QuestionMixin.js';
 | 
	
		
			
				|  |  |  import SoundRecord from '../common/SoundRecord.vue';
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import { selectTypeList, changeOptionType } from '@/views/exercise_questions/data/common';
 | 
	
		
			
				|  |  | +import { selectTypeList, changeOptionType, addTone } from '@/views/exercise_questions/data/common';
 | 
	
		
			
				|  |  |  import { repeatData, getOption, audioGenerationMethodList } from '@/views/exercise_questions/data/repeat';
 | 
	
		
			
				|  |  |  import { GetStaticResources } from '@/api/app';
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -143,6 +149,7 @@ export default {
 | 
	
		
			
				|  |  |            loading: false,
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  |        ],
 | 
	
		
			
				|  |  | +      matically_pinyin_obj: {},
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    watch: {
 | 
	
	
		
			
				|  | @@ -201,17 +208,78 @@ export default {
 | 
	
		
			
				|  |  |          })
 | 
	
		
			
				|  |  |          .catch(() => {});
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | +    handleReplaceTone(value, mark) {
 | 
	
		
			
				|  |  | +      if (!value) return;
 | 
	
		
			
				|  |  | +      value.split(/\s+/).forEach((item) => {
 | 
	
		
			
				|  |  | +        this.handleValue(item);
 | 
	
		
			
				|  |  | +      });
 | 
	
		
			
				|  |  | +      this.matically_pinyin_obj[mark] = this.res_arr
 | 
	
		
			
				|  |  | +        .map((item) =>
 | 
	
		
			
				|  |  | +          item.map(({ number, con }) => (number && con ? addTone(Number(number), con) : number || con || '')),
 | 
	
		
			
				|  |  | +        )
 | 
	
		
			
				|  |  | +        .filter((item) => item.length > 0)
 | 
	
		
			
				|  |  | +        .join(' ');
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    handleValue(valItem) {
 | 
	
		
			
				|  |  | +      let numList = [];
 | 
	
		
			
				|  |  | +      if (/[A-Za-zü]+\d/g.test(valItem)) {
 | 
	
		
			
				|  |  | +        valItem.split('').forEach((item, i) => {
 | 
	
		
			
				|  |  | +          if (/\d/.test(item)) {
 | 
	
		
			
				|  |  | +            let con = valItem.replace(/\d/g, '');
 | 
	
		
			
				|  |  | +            numList.push({
 | 
	
		
			
				|  |  | +              index: i,
 | 
	
		
			
				|  |  | +              number: item,
 | 
	
		
			
				|  |  | +              con,
 | 
	
		
			
				|  |  | +              isTran: true,
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +      } else {
 | 
	
		
			
				|  |  | +        numList = [];
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +      this.res_arr.push(numList.length === 0 ? [{ con: valItem }] : numList);
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    handleItemPinyin(content, mark) {
 | 
	
		
			
				|  |  | +      let content_arr = content.trim().split(' ');
 | 
	
		
			
				|  |  | +      this.res_arr = [];
 | 
	
		
			
				|  |  | +      this.$set(this.matically_pinyin_obj, mark, []);
 | 
	
		
			
				|  |  | +      content_arr.forEach((items, index) => {
 | 
	
		
			
				|  |  | +        let items_trim = items.trim();
 | 
	
		
			
				|  |  | +        if (items_trim) {
 | 
	
		
			
				|  |  | +          this.handleReplaceTone(items_trim, mark);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      });
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    // 转成带声调的拼音
 | 
	
		
			
				|  |  | +    handleRichTextBlur() {
 | 
	
		
			
				|  |  | +      let rich_rext_arr = document.getElementsByClassName('repeat-richtext');
 | 
	
		
			
				|  |  | +      if (rich_rext_arr) {
 | 
	
		
			
				|  |  | +        for (let i = 0; i < rich_rext_arr.length; i++) {
 | 
	
		
			
				|  |  | +          let content = rich_rext_arr[i].innerText;
 | 
	
		
			
				|  |  | +          let index = content.search(/0|1|2|3|4/);
 | 
	
		
			
				|  |  | +          if (index > -1) {
 | 
	
		
			
				|  |  | +            this.handleItemPinyin(content, this.data.option_list[i].mark);
 | 
	
		
			
				|  |  | +            setTimeout(() => {
 | 
	
		
			
				|  |  | +              document.getElementsByClassName('repeat-richtext')[i].innerText =
 | 
	
		
			
				|  |  | +                this.matically_pinyin_obj[this.data.option_list[i].mark];
 | 
	
		
			
				|  |  | +            }, 100);
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |      // 自动生成音频
 | 
	
		
			
				|  |  |      handleMatically(item, i) {
 | 
	
		
			
				|  |  |        if (
 | 
	
		
			
				|  |  | -        document.getElementsByClassName(`repeat${i}`) &&
 | 
	
		
			
				|  |  | -        document.getElementsByClassName(`repeat${i}`)[0] &&
 | 
	
		
			
				|  |  | -        document.getElementsByClassName(`repeat${i}`)[0].innerText
 | 
	
		
			
				|  |  | +        document.getElementsByClassName('repeat-richtext') &&
 | 
	
		
			
				|  |  | +        document.getElementsByClassName('repeat-richtext')[i] &&
 | 
	
		
			
				|  |  | +        document.getElementsByClassName('repeat-richtext')[i].innerText
 | 
	
		
			
				|  |  |        ) {
 | 
	
		
			
				|  |  |          this.loading_list[i].loading = true;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          let MethodName = 'tool-PinyinToVoiceFile';
 | 
	
		
			
				|  |  |          let data = {
 | 
	
		
			
				|  |  | -          pinyin: document.getElementsByClassName(`repeat${i}`)[0].innerText.trim().split(' ').join(','),
 | 
	
		
			
				|  |  | +          pinyin: document.getElementsByClassName('repeat-richtext')[i].innerText.trim().split(' ').join(','),
 | 
	
		
			
				|  |  |          };
 | 
	
		
			
				|  |  |          GetStaticResources(MethodName, data)
 | 
	
		
			
				|  |  |            .then((res) => {
 |