|  | @@ -129,51 +129,26 @@
 | 
	
		
			
				|  |  |  </template>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  <script>
 | 
	
		
			
				|  |  | -import QuestionBase from '../common/QuestionBase.vue';
 | 
	
		
			
				|  |  | -import RichText from '@/components/common/RichText.vue';
 | 
	
		
			
				|  |  |  import UploadAudio from '../common/UploadAudio.vue';
 | 
	
		
			
				|  |  | +import QuestionMixin from '../common/QuestionMixin.js';
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import {
 | 
	
		
			
				|  |  | -  stemTypeList,
 | 
	
		
			
				|  |  | -  selectTypeList,
 | 
	
		
			
				|  |  | -  switchOption,
 | 
	
		
			
				|  |  | -  scoreTypeList,
 | 
	
		
			
				|  |  | -  computedQuestionNumber,
 | 
	
		
			
				|  |  | -  changeOptionType,
 | 
	
		
			
				|  |  | -  questionNumberTypeList,
 | 
	
		
			
				|  |  | -} from '@/views/exercise_questions/data/common';
 | 
	
		
			
				|  |  | -import { selectData } from '@/views/exercise_questions/data/select';
 | 
	
		
			
				|  |  | -import { getRandomNumber } from '@/utils/index';
 | 
	
		
			
				|  |  | +import { selectTypeList, scoreTypeList, changeOptionType } from '@/views/exercise_questions/data/common';
 | 
	
		
			
				|  |  | +import { selectData, getOption } from '@/views/exercise_questions/data/select';
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  export default {
 | 
	
		
			
				|  |  |    name: 'SelectQuestion',
 | 
	
		
			
				|  |  |    components: {
 | 
	
		
			
				|  |  | -    QuestionBase,
 | 
	
		
			
				|  |  | -    RichText,
 | 
	
		
			
				|  |  |      UploadAudio,
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  | +  mixins: [QuestionMixin],
 | 
	
		
			
				|  |  |    data() {
 | 
	
		
			
				|  |  |      return {
 | 
	
		
			
				|  |  | -      stemTypeList,
 | 
	
		
			
				|  |  |        selectTypeList,
 | 
	
		
			
				|  |  | -      switchOption,
 | 
	
		
			
				|  |  | -      scoreTypeList,
 | 
	
		
			
				|  |  | -      questionNumberTypeList,
 | 
	
		
			
				|  |  |        changeOptionType,
 | 
	
		
			
				|  |  | -      computedQuestionNumber,
 | 
	
		
			
				|  |  |        data: JSON.parse(JSON.stringify(selectData)),
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    methods: {
 | 
	
		
			
				|  |  | -    upload(file_id) {
 | 
	
		
			
				|  |  | -      this.data.file_id_list.push(file_id);
 | 
	
		
			
				|  |  | -    },
 | 
	
		
			
				|  |  | -    deleteFile(file_id) {
 | 
	
		
			
				|  |  | -      let index = this.data.file_id_list.indexOf(file_id);
 | 
	
		
			
				|  |  | -      if (index !== -1) {
 | 
	
		
			
				|  |  | -        this.data.file_id_list.splice(index, 1);
 | 
	
		
			
				|  |  | -      }
 | 
	
		
			
				|  |  | -    },
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 智能识别
 | 
	
		
			
				|  |  |       * @param {String} text 识别数据
 | 
	
	
		
			
				|  | @@ -186,25 +161,9 @@ export default {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |        if (arr.length > 0) {
 | 
	
		
			
				|  |  |          this.data.stem = arr[0];
 | 
	
		
			
				|  |  | -        this.data.option_list = arr.slice(1).map((content) => {
 | 
	
		
			
				|  |  | -          return {
 | 
	
		
			
				|  |  | -            mark: getRandomNumber(),
 | 
	
		
			
				|  |  | -            content,
 | 
	
		
			
				|  |  | -          };
 | 
	
		
			
				|  |  | -        });
 | 
	
		
			
				|  |  | +        this.data.option_list = arr.slice(1).map((content) => getOption(content));
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -    /**
 | 
	
		
			
				|  |  | -     * 设置题目内容
 | 
	
		
			
				|  |  | -     * @param {object} param
 | 
	
		
			
				|  |  | -     * @param {string} param.content 题目内容
 | 
	
		
			
				|  |  | -     */
 | 
	
		
			
				|  |  | -    setQuestion({ content }) {
 | 
	
		
			
				|  |  | -      this.data = JSON.parse(content);
 | 
	
		
			
				|  |  | -    },
 | 
	
		
			
				|  |  | -    deleteOption(i) {
 | 
	
		
			
				|  |  | -      this.data.option_list.splice(i, 1);
 | 
	
		
			
				|  |  | -    },
 | 
	
		
			
				|  |  |      changeSelectType(val) {
 | 
	
		
			
				|  |  |        if (val === selectTypeList[0].value && this.data.answer.select_list.length > 1) {
 | 
	
		
			
				|  |  |          this.data.answer.select_list = [this.data.answer.select_list[0]];
 | 
	
	
		
			
				|  | @@ -231,10 +190,7 @@ export default {
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      addOption() {
 | 
	
		
			
				|  |  | -      this.data.option_list.push({
 | 
	
		
			
				|  |  | -        mark: getRandomNumber(),
 | 
	
		
			
				|  |  | -        content: '',
 | 
	
		
			
				|  |  | -      });
 | 
	
		
			
				|  |  | +      this.data.option_list.push(getOption());
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |  };
 |