|  | @@ -1,130 +1,60 @@
 | 
	
		
			
				|  |  |  <template>
 | 
	
		
			
				|  |  | -  <div class="question-type">
 | 
	
		
			
				|  |  | +  <el-dialog title="选择题型" :visible="visible" width="270px" :show-close="false" :center="true" @close="dialogClose">
 | 
	
		
			
				|  |  |      <el-cascader
 | 
	
		
			
				|  |  | -      v-model="typeArr"
 | 
	
		
			
				|  |  | +      v-model="type"
 | 
	
		
			
				|  |  |        :options="questionTypeOption"
 | 
	
		
			
				|  |  |        :show-all-levels="false"
 | 
	
		
			
				|  |  |        :props="{ expandTrigger: 'hover' }"
 | 
	
		
			
				|  |  | -      @change="handleChange"
 | 
	
		
			
				|  |  |      />
 | 
	
		
			
				|  |  | -    <div class="intelligent-recognition" @click="showRecognition"><SvgIcon icon-class="copy" :size="14" />智能识别</div>
 | 
	
		
			
				|  |  | -    <SvgIcon v-if="isChild" class-name="pointer" icon-class="delete" :size="14" @click="$emit('deleteQuestion')" />
 | 
	
		
			
				|  |  | -    <div v-else class="save-tip">{{ saveDate }} 已自动保存</div>
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    <IntelligentRecognition :visible.sync="dialogVisible" @recognition="handleRecognition" />
 | 
	
		
			
				|  |  | -  </div>
 | 
	
		
			
				|  |  | +    <div slot="footer">
 | 
	
		
			
				|  |  | +      <el-button @click="dialogClose">取消</el-button>
 | 
	
		
			
				|  |  | +      <el-button type="primary" @click="confirm">确定</el-button>
 | 
	
		
			
				|  |  | +    </div>
 | 
	
		
			
				|  |  | +  </el-dialog>
 | 
	
		
			
				|  |  |  </template>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  <script>
 | 
	
		
			
				|  |  | -import { questionTypeOption } from '@/views/exercise_questions/data/questionType';
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -import IntelligentRecognition from '../common/IntelligentRecognition.vue';
 | 
	
		
			
				|  |  | +import { questionTypeOption, questionDataList } from '@/views/exercise_questions/data/questionType';
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  export default {
 | 
	
		
			
				|  |  |    name: 'SelectQuestionType',
 | 
	
		
			
				|  |  | -  components: {
 | 
	
		
			
				|  |  | -    IntelligentRecognition,
 | 
	
		
			
				|  |  | -  },
 | 
	
		
			
				|  |  | -  inject: ['curSaveDate', 'recognition', 'updateCurQuestionType'],
 | 
	
		
			
				|  |  |    props: {
 | 
	
		
			
				|  |  | -    type: {
 | 
	
		
			
				|  |  | -      type: Array,
 | 
	
		
			
				|  |  | -      required: true,
 | 
	
		
			
				|  |  | -    },
 | 
	
		
			
				|  |  | -    isChild: {
 | 
	
		
			
				|  |  | +    visible: {
 | 
	
		
			
				|  |  |        type: Boolean,
 | 
	
		
			
				|  |  | -      default: false,
 | 
	
		
			
				|  |  | -    },
 | 
	
		
			
				|  |  | -    questionTypeOption: {
 | 
	
		
			
				|  |  | -      type: Array,
 | 
	
		
			
				|  |  | -      default: () => questionTypeOption,
 | 
	
		
			
				|  |  | +      required: true,
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    data() {
 | 
	
		
			
				|  |  |      return {
 | 
	
		
			
				|  |  | -      dialogVisible: false, // 智能识别弹窗
 | 
	
		
			
				|  |  | -      typeArr: this.type,
 | 
	
		
			
				|  |  | +      questionTypeOption,
 | 
	
		
			
				|  |  | +      type: ['base', 'select'],
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  | -  computed: {
 | 
	
		
			
				|  |  | -    saveDate() {
 | 
	
		
			
				|  |  | -      return this.curSaveDate();
 | 
	
		
			
				|  |  | -    },
 | 
	
		
			
				|  |  | -  },
 | 
	
		
			
				|  |  | -  watch: {
 | 
	
		
			
				|  |  | -    type(val) {
 | 
	
		
			
				|  |  | -      this.typeArr = val;
 | 
	
		
			
				|  |  | -    },
 | 
	
		
			
				|  |  | -  },
 | 
	
		
			
				|  |  |    methods: {
 | 
	
		
			
				|  |  | -    handleChange(val) {
 | 
	
		
			
				|  |  | -      if (this.isChild) {
 | 
	
		
			
				|  |  | -        return this.$emit('updateCurQuestionType', val);
 | 
	
		
			
				|  |  | -      }
 | 
	
		
			
				|  |  | -      this.updateCurQuestionType(val);
 | 
	
		
			
				|  |  | +    dialogClose() {
 | 
	
		
			
				|  |  | +      this.$emit('update:visible', false);
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    // 处理智能识别
 | 
	
		
			
				|  |  | -    handleRecognition(text) {
 | 
	
		
			
				|  |  | -      if (this.isChild) {
 | 
	
		
			
				|  |  | -        return this.$emit('recognition', text);
 | 
	
		
			
				|  |  | -      }
 | 
	
		
			
				|  |  | -      this.recognition(text);
 | 
	
		
			
				|  |  | -    },
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    showRecognition() {
 | 
	
		
			
				|  |  | -      this.dialogVisible = true;
 | 
	
		
			
				|  |  | +    confirm() {
 | 
	
		
			
				|  |  | +      this.$emit('update:visible', false);
 | 
	
		
			
				|  |  | +      let type = this.type[this.type.length - 1];
 | 
	
		
			
				|  |  | +      this.$emit('addQuestionToExercise', type, type === 'select' ? 'single' : '', questionDataList[type]);
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |  };
 | 
	
		
			
				|  |  |  </script>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  <style lang="scss" scoped>
 | 
	
		
			
				|  |  | -.question-type {
 | 
	
		
			
				|  |  | -  display: flex;
 | 
	
		
			
				|  |  | -  align-items: center;
 | 
	
		
			
				|  |  | -  justify-content: space-between;
 | 
	
		
			
				|  |  | -  width: 100%;
 | 
	
		
			
				|  |  | -  padding: 4px 8px;
 | 
	
		
			
				|  |  | -  background-color: #fff;
 | 
	
		
			
				|  |  | -  border: $border;
 | 
	
		
			
				|  |  | -  border-bottom-width: 0;
 | 
	
		
			
				|  |  | -  border-radius: 8px 8px 0 0;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -  .el-cascader {
 | 
	
		
			
				|  |  | -    width: 110px;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    :deep .el-input__inner {
 | 
	
		
			
				|  |  | -      background-color: #fff;
 | 
	
		
			
				|  |  | -      border-color: #fff;
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -  .intelligent-recognition {
 | 
	
		
			
				|  |  | -    display: flex;
 | 
	
		
			
				|  |  | -    column-gap: 8px;
 | 
	
		
			
				|  |  | -    align-items: center;
 | 
	
		
			
				|  |  | -    font-size: 14px;
 | 
	
		
			
				|  |  | -    color: #333;
 | 
	
		
			
				|  |  | -    cursor: pointer;
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | +:deep div.el-dialog__header {
 | 
	
		
			
				|  |  | +  padding-top: 16px;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  .save-tip {
 | 
	
		
			
				|  |  | -    font-size: 12px;
 | 
	
		
			
				|  |  | -    color: #858585;
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | +:deep .el-dialog__body {
 | 
	
		
			
				|  |  | +  padding: 16px 25px;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  </style>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  <style lang="scss">
 | 
	
		
			
				|  |  | -.el-popper.el-cascader__dropdown {
 | 
	
		
			
				|  |  | -  .el-cascader-node.in-active-path {
 | 
	
		
			
				|  |  | -    background-color: $fill-color;
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -  .el-cascader-node.is-active {
 | 
	
		
			
				|  |  | -    color: $main-color;
 | 
	
		
			
				|  |  | -    background-color: #e8f3ff;
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | +.el-cascader-menu__wrap {
 | 
	
		
			
				|  |  | +  height: 270px;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  </style>
 |