|
@@ -51,7 +51,7 @@
|
|
|
placeholder="选项内容"
|
|
|
:maxLength="200"
|
|
|
v-decorator="[
|
|
|
- `answers${index}`,
|
|
|
+ `answers-${index}`,
|
|
|
{
|
|
|
rules: [
|
|
|
{ required: true, message: 'Please input content!' },
|
|
@@ -66,7 +66,7 @@
|
|
|
:label-col="labelCol"
|
|
|
:wrapper-col="wrapperCol"
|
|
|
>
|
|
|
- <a-input
|
|
|
+ <!-- <a-input
|
|
|
placeholder="答案格式为大写字母"
|
|
|
:maxLength="200"
|
|
|
v-decorator="[
|
|
@@ -75,7 +75,24 @@
|
|
|
rules: [{ required: true, message: 'Please input content!' }],
|
|
|
},
|
|
|
]"
|
|
|
- />
|
|
|
+ /> -->
|
|
|
+ <a-select
|
|
|
+ mode="multiple"
|
|
|
+ v-decorator="[
|
|
|
+ 'finalAnswerIndexs',
|
|
|
+ {
|
|
|
+ rules: [{ required: true, message: 'Please input content!' }],
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ >
|
|
|
+ <a-select-option
|
|
|
+ v-for="(item, index) in optionsList"
|
|
|
+ :key="index"
|
|
|
+ :value="index"
|
|
|
+ >
|
|
|
+ {{ index | formatQuestionIndex }}
|
|
|
+ </a-select-option>
|
|
|
+ </a-select>
|
|
|
</a-form-item>
|
|
|
<a-form-item
|
|
|
label="必学日期"
|
|
@@ -132,6 +149,7 @@
|
|
|
|
|
|
<script>
|
|
|
import { ENGINEERING_WORK_LIST } from '@/common/Constant';
|
|
|
+import { formatQuestionIndex } from '@/filters';
|
|
|
export default {
|
|
|
name: 'examQusetionCreateMultiple',
|
|
|
props: {},
|
|
@@ -176,6 +194,10 @@ export default {
|
|
|
questionOptionDeleteFun(index) {
|
|
|
this.optionsList.splice(index, 1);
|
|
|
},
|
|
|
+ // 操作:选择答案
|
|
|
+ handleChange(values) {
|
|
|
+ console.log(values);
|
|
|
+ },
|
|
|
// 操作:选择日期
|
|
|
onDateChange(date, dateString) {
|
|
|
if (date) {
|
|
@@ -190,13 +212,37 @@ export default {
|
|
|
this.loginForm.validateFields((err, values) => {
|
|
|
if (!err) {
|
|
|
let params = {
|
|
|
- ...values,
|
|
|
+ type: this.questionType,
|
|
|
+ content: values.content,
|
|
|
+ engineeringWorkChooseValue: values.engineeringWorkChooseValue,
|
|
|
+ studyDate: this.studyDate,
|
|
|
+ finalAnswer: this.formatQuestionFinalAnswerArr(
|
|
|
+ values.finalAnswerIndexs
|
|
|
+ ),
|
|
|
+ answers: this.formatQuestionAnswersArr(values),
|
|
|
};
|
|
|
- params.studyDate = this.studyDate;
|
|
|
this.httpQuestFun(params);
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ // 把答案下标转换为大写英文字母放入一个数组中
|
|
|
+ formatQuestionFinalAnswerArr(indexs) {
|
|
|
+ let arr = '';
|
|
|
+ indexs.forEach((item) => {
|
|
|
+ arr += formatQuestionIndex(item);
|
|
|
+ });
|
|
|
+ return [arr];
|
|
|
+ },
|
|
|
+ // 把选项放入一个数组中
|
|
|
+ formatQuestionAnswersArr(values) {
|
|
|
+ let arr = [];
|
|
|
+ for (let key in values) {
|
|
|
+ if (key.includes('answers-')) {
|
|
|
+ arr.push(values[key]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return arr;
|
|
|
+ },
|
|
|
// 表单提交请求
|
|
|
httpQuestFun(params) {
|
|
|
this.loading = true;
|