Commit 2428c457528df881b7a5d1db848da3fca2184057
1 parent
df616627
参数命名修改
Showing
1 changed file
with
38 additions
and
38 deletions
src/views/examinationPaper/addQs.vue
... | ... | @@ -947,47 +947,47 @@ export default { |
947 | 947 | if (this.form.questionList[0]?.subQuestions) { |
948 | 948 | this.form.questionList?.map((item) => { |
949 | 949 | let types = [{}]; |
950 | - let addndex = 0; | |
950 | + let addIndex = 0; | |
951 | 951 | item.subQuestions?.map((sub, index) => { |
952 | 952 | if (!!sub.questionType) { |
953 | 953 | if ( |
954 | - sub.questionType == types[addndex].qusType && | |
954 | + sub.questionType == types[addIndex].qusType && | |
955 | 955 | sub.questionType != 5 |
956 | 956 | ) { |
957 | 957 | //同类型批量答案+1 |
958 | - types[addndex].subNum += 1; | |
958 | + types[addIndex].subNum += 1; | |
959 | 959 | if ( |
960 | - types[addndex].answerOptions.length < sub.answerOptions.length | |
960 | + types[addIndex].answerOptions.length < sub.answerOptions.length | |
961 | 961 | ) { |
962 | - types[addndex].answerOptions = sub.answerOptions; | |
962 | + types[addIndex].answerOptions = sub.answerOptions; | |
963 | 963 | } |
964 | 964 | |
965 | - // types[addndex].answerList += this.setAnswer( | |
965 | + // types[addIndex].answerList += this.setAnswer( | |
966 | 966 | // sub.questionType, |
967 | 967 | // sub.correctAnswer |
968 | 968 | // ); |
969 | - types[addndex].answerList = ""; | |
969 | + types[addIndex].answerList = ""; | |
970 | 970 | if (index == item.subQuestions.length - 1) { |
971 | 971 | //循环最后类型数量大于等于5,保存批量答案 |
972 | - if (types[addndex].subNum && types[addndex].subNum >= 5) { | |
973 | - types[addndex].endIndex = sub.questionIndex; | |
974 | - types[addndex].index = index; | |
972 | + if (types[addIndex].subNum && types[addIndex].subNum >= 5) { | |
973 | + types[addIndex].endIndex = sub.questionIndex; | |
974 | + types[addIndex].index = index; | |
975 | 975 | } |
976 | 976 | } |
977 | 977 | } else { |
978 | - if (types[addndex].subNum && types[addndex].subNum >= 5) { | |
978 | + if (types[addIndex].subNum && types[addIndex].subNum >= 5) { | |
979 | 979 | //不同类型时如果原有类型数量大于等于5,保存批量答案 |
980 | - types[addndex].endIndex = | |
980 | + types[addIndex].endIndex = | |
981 | 981 | item.subQuestions[index - 1].questionIndex; |
982 | - types[addndex].index = index - 1; | |
983 | - addndex += 1; | |
984 | - types[addndex] = {}; | |
982 | + types[addIndex].index = index - 1; | |
983 | + addIndex += 1; | |
984 | + types[addIndex] = {}; | |
985 | 985 | } |
986 | 986 | //不同类型初始化批量答案 |
987 | - types[addndex].qusType = sub.questionType; | |
988 | - types[addndex].subNum = 1; | |
989 | - types[addndex].answerOptions = sub.answerOptions; | |
990 | - types[addndex].answerList = ""; | |
987 | + types[addIndex].qusType = sub.questionType; | |
988 | + types[addIndex].subNum = 1; | |
989 | + types[addIndex].answerOptions = sub.answerOptions; | |
990 | + types[addIndex].answerList = ""; | |
991 | 991 | } |
992 | 992 | } |
993 | 993 | }); |
... | ... | @@ -1003,46 +1003,46 @@ export default { |
1003 | 1003 | }); |
1004 | 1004 | } else { |
1005 | 1005 | let types = [{}]; |
1006 | - let addndex = 0; | |
1006 | + let addIndex = 0; | |
1007 | 1007 | let questionList = [...this.form.questionList]; |
1008 | 1008 | this.form.questionList = questionList.map((sub, index) => { |
1009 | 1009 | if (!!sub.questionType) { |
1010 | 1010 | if ( |
1011 | - sub.questionType == types[addndex].qusType && | |
1011 | + sub.questionType == types[addIndex].qusType && | |
1012 | 1012 | sub.questionType != 5 |
1013 | 1013 | ) { |
1014 | 1014 | //同类型批量答案+1 |
1015 | - types[addndex].subNum += 1; | |
1015 | + types[addIndex].subNum += 1; | |
1016 | 1016 | if ( |
1017 | - types[addndex].answerOptions.length < sub.answerOptions.length | |
1017 | + types[addIndex].answerOptions.length < sub.answerOptions.length | |
1018 | 1018 | ) { |
1019 | - types[addndex].answerOptions = sub.answerOptions; | |
1019 | + types[addIndex].answerOptions = sub.answerOptions; | |
1020 | 1020 | } |
1021 | - // types[addndex].answerList += this.setAnswer( | |
1021 | + // types[addIndex].answerList += this.setAnswer( | |
1022 | 1022 | // sub.questionType, |
1023 | 1023 | // sub.correctAnswer |
1024 | 1024 | // ); |
1025 | - types[addndex].answerList = ""; | |
1025 | + types[addIndex].answerList = ""; | |
1026 | 1026 | if (index == questionList.length - 1) { |
1027 | 1027 | //循环最后类型数量大于等于5,保存批量答案 |
1028 | - if (types[addndex].subNum && types[addndex].subNum >= 5) { | |
1029 | - types[addndex].endIndex = sub.questionIndex; | |
1030 | - types[addndex].index = index; | |
1028 | + if (types[addIndex].subNum && types[addIndex].subNum >= 5) { | |
1029 | + types[addIndex].endIndex = sub.questionIndex; | |
1030 | + types[addIndex].index = index; | |
1031 | 1031 | } |
1032 | 1032 | } |
1033 | 1033 | } else { |
1034 | - if (types[addndex].subNum && types[addndex].subNum >= 5) { | |
1034 | + if (types[addIndex].subNum && types[addIndex].subNum >= 5) { | |
1035 | 1035 | //不同类型时如果原有类型数量大于等于5,保存批量答案 |
1036 | - types[addndex].endIndex = questionList[index - 1].questionIndex; | |
1037 | - types[addndex].index = index - 1; | |
1038 | - addndex += 1; | |
1039 | - types[addndex] = {}; | |
1036 | + types[addIndex].endIndex = questionList[index - 1].questionIndex; | |
1037 | + types[addIndex].index = index - 1; | |
1038 | + addIndex += 1; | |
1039 | + types[addIndex] = {}; | |
1040 | 1040 | } |
1041 | 1041 | //不同类型初始化批量答案 |
1042 | - types[addndex].qusType = sub.questionType; | |
1043 | - types[addndex].subNum = 1; | |
1044 | - types[addndex].answerOptions = sub.answerOptions; | |
1045 | - types[addndex].answerList = ""; | |
1042 | + types[addIndex].qusType = sub.questionType; | |
1043 | + types[addIndex].subNum = 1; | |
1044 | + types[addIndex].answerOptions = sub.answerOptions; | |
1045 | + types[addIndex].answerList = ""; | |
1046 | 1046 | } |
1047 | 1047 | } |
1048 | 1048 | return sub; | ... | ... |