Commit 9041ca3a authored by 纪泽龙's avatar 纪泽龙

Merge branch 'jzl'

parents c9bd53cd c809948b
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 17:56:05
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2023-01-10 14:19:22
* @LastEditTime: 2023-01-12 16:43:02
* @FilePath: /danger-manage-web/src/views/lessonsProgram/components/QuestionList.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -16,10 +16,29 @@
</div>
<div class="right">{{ courseName }}</div>
</div>
<div class="detail flex">
<div class="detail-item">
单选题{{bottomFrom.singleChoiceScore}}分/题,共{{ danxs }}题,计{{ danxs * bottomFrom.singleChoiceScore }}
</div>
<div class="detail-item">
多选题{{bottomFrom.multipleChoiceScore}}分/题,共{{ duoxs }}题,计{{ duoxs * bottomFrom.multipleChoiceScore }}
</div>
<div class="detail-item">
判断提{{bottomFrom.judgmentScore}}/题,共{{ pds }}题,计{{ pds * bottomFrom.judgmentScore }}
</div>
<div class="detail-item">
一共{{danxs+duoxs+pds}}道题,总共计{{
danxs * bottomFrom.singleChoiceScore +
duoxs * bottomFrom.multipleChoiceScore +
pds * bottomFrom.judgmentScore
}}
</div>
</div>
<div class="table flex" v-loading="loading">
<div class="th flex">
<div class="left">序号</div>
<!-- <div class="type">题目类型</div> -->
<div class="type">题目类型</div>
<div class="middle">题目名称</div>
<div class="right">操作</div>
</div>
......@@ -30,7 +49,7 @@
class="td flex"
>
<div class="left">{{ index + 1 }}</div>
<!-- <div class="type">{{item.topicType}}</div> -->
<div class="type">{{ topicTypeArr[item.topicType] }}</div>
<div class="middle zzz">
{{ item.topicTitle }}
</div>
......@@ -53,6 +72,7 @@
</div>
</div>
</div>
<div class="rightNum flex">
<div class="left">考试设置</div>
......@@ -61,7 +81,7 @@
<div>
<el-input
v-model="bottomFrom.singleChoiceScore"
style="width: 40px"
style="width: 50px"
size="mini"
></el-input>
</div>
......@@ -72,7 +92,7 @@
<div>
<el-input
v-model="bottomFrom.multipleChoiceScore"
style="width: 40px"
style="width: 50px"
size="mini"
></el-input>
</div>
......@@ -84,7 +104,7 @@
<div>
<el-input
v-model="bottomFrom.judgmentScore"
style="width: 40px"
style="width: 50px"
size="mini"
></el-input>
</div>
......@@ -146,6 +166,11 @@ export default {
questionList: [],
loading: false,
courseName: "",
topicTypeArr: {
1: "单选题",
2: "多选题",
3: "判断题",
},
};
},
// watch: {
......@@ -157,7 +182,17 @@ export default {
// }
// },
// },
computed: {
danxs() {
return this.questionList.filter((item) => item.topicType === 1).length;
},
duoxs() {
return this.questionList.filter((item) => item.topicType === 2).length;
},
pds() {
return this.questionList.filter((item) => item.topicType === 3).length;
},
},
created() {
console.log("this.courseId", this.courseId);
if (this.courseId) {
......@@ -179,6 +214,7 @@ export default {
this.questionList = res.rows.map((item) => {
return {
topicType: item.topicType,
topicId: item.topicId,
topicTitle: item.topicTitle,
};
......@@ -190,12 +226,12 @@ export default {
getLessonById(courseId) {
getLessonById(courseId).then((res) => {
console.log(res);
this.bottomFrom ={
singleChoiceScore: res.data.qualifiedNum,
multipleChoiceScore: res.data.multipleChoiceScore,
judgmentScore: res.data.judgmentScore,
qualifiedNum: res.data.qualifiedNum,
}
this.bottomFrom = {
singleChoiceScore: res.data.singleChoiceScore || 0,
multipleChoiceScore: res.data.multipleChoiceScore || 0,
judgmentScore: res.data.judgmentScore || 0,
qualifiedNum: res.data.qualifiedNum || 0,
};
this.courseName = res.data.courseName;
});
},
......@@ -236,10 +272,29 @@ export default {
// });
// return;
// }
// const danx = this.questionList.filter(item=>item.topicType===1);
// const duox = this.questionList.filter(item=>item.topicType===2);
// const pd = this.questionList.filter(item=>item.topicType===3);
// 如果有一个没写,就不允许保存
if (
!(
this.bottomFrom.singleChoiceScore > 0 &&
this.bottomFrom.multipleChoiceScore > 0 &&
this.bottomFrom.judgmentScore > 0 &&
this.fobottomFromrm.qualifiedNum > 0
)
) {
this.$message({
message: "请将分数填写完整",
type: "warning",
});
return;
}
changeLesson({
courseId: this.courseId,
// qualifiedNum: this.rightNum,
...this.bottomFrom
...this.bottomFrom,
}).then((res) => {
if (res.code == 200) {
this.$message({
......@@ -261,7 +316,7 @@ export default {
padding-bottom: 7px;
margin-bottom: 20px;
border-bottom: 1px solid #bbbbbb00;
position: relative;
.text {
margin-top: 13px;
margin-bottom: 32px;
......@@ -288,6 +343,15 @@ export default {
text-align: right;
}
}
.detail {
position: absolute;
top: 45px;
.detail-item {
margin-right: 20px;
color:red;
}
}
.table {
flex: 1;
height: 0;
......@@ -307,13 +371,13 @@ export default {
width: 15%;
text-align: center;
}
// .type {
// width: 10%;
// text-align: center;
// }
.type {
width: 10%;
text-align: center;
}
.middle {
width: 60%;
padding-left: 100px;
width: 50%;
padding-left: 50px;
}
.right {
width: 25%;
......@@ -339,13 +403,13 @@ export default {
width: 15%;
text-align: center;
}
// .type {
// width: 10%;
// text-align: center;
// }
.type {
width: 10%;
text-align: center;
}
.middle {
width: 60%;
padding-left: 100px;
width: 50%;
padding-left: 50px;
}
.right {
width: 25%;
......
......@@ -113,11 +113,11 @@
</template>
</el-table-column>
<!--<el-table-column label="视频" align="center" prop="video">-->
<!--<template v-slot="{ row: { courseName, video } }">-->
<!--<a @click="downLoadVideo(video, courseName)" class="down-load"-->
<!--&gt;下载视频</a-->
<!--&gt;-->
<!--</template>-->
<!--<template v-slot="{ row: { courseName, video } }">-->
<!--<a @click="downLoadVideo(video, courseName)" class="down-load"-->
<!--&gt;下载视频</a-->
<!--&gt;-->
<!--</template>-->
<!--</el-table-column>-->
<el-table-column
label="发布时间"
......@@ -343,7 +343,12 @@ export default {
return getLessonById(courseId);
})
.then((res) => {
if (res.data.qualifiedNum > 0) {
if (
res.data.singleChoiceScore > 0 &&
res.data.multipleChoiceScore > 0 &&
res.data.judgmentScore > 0 &&
res.data.qualifiedNum > 0
) {
return true;
}
})
......@@ -353,7 +358,7 @@ export default {
return issue({ courseId });
} else {
this.$message({
message: "请先录入答题合格数",
message: "请先在题目列表录入题目分数跟合格分数",
type: "warning",
});
}
......
......@@ -182,6 +182,7 @@ export default {
})
.then((res) => {
if (res.code == 200) {
console.log(res.data)
this.goodJobData = res.data;
this.goodJobShow = true;
}
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-21 17:20:49
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-09-28 11:56:49
* @LastEditTime: 2023-01-12 17:00:34
* @FilePath: /danger-manage-web/src/views/myLessons/components/GoodJob.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -13,17 +13,16 @@
<template v-if="goodJobData.answer >= goodJobData.qualifiedNum">
<div class="icon"><i class="iconfont icon-smiling" /></div>
<div>
恭喜你,做对{{ goodJobData.answer }}道题得分{{
Math.floor((goodJobData.answer / goodJobData.topicNum) * 100)
}},成绩合格!
<!-- 恭喜你,做对{{ goodJobData.answer }}道题 -->
恭喜你,得分{{ goodJobData.answer }},成绩合格!
</div>
</template>
<template v-else>
<div class="icon"><i class="iconfont icon-nanguo" /></div>
<div>
继续努力,做对{{ goodJobData.answer }}道题得分{{
Math.floor((goodJobData.answer / goodJobData.topicNum) * 100)
}},成绩不合格!
继续努力,
<!-- 做对{{ goodJobData.answer }}道题 -->
得分{{ goodJobData.answer }},成绩不合格!
</div>
</template>
</div>
......
......@@ -2,12 +2,13 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-21 11:00:14
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2023-01-10 14:36:39
* @LastEditTime: 2023-01-11 16:44:43
* @FilePath: /danger-manage-web/src/views/myLessons/components/Question.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="question flex">
<div class="tips">{{ tipsArr[questionObj.topicType] }}</div>
<div
class="top"
:class="{ flex: alignItemsCenter }"
......@@ -23,7 +24,7 @@
<div
class="item flex"
v-for="(item, index) in questionObj.question"
:key="item+'aas'+index"
:key="item + 'aas' + index"
>
<div class="letter">
{{ letters[index] }}
......@@ -38,10 +39,10 @@
<div class="change-wrapper flex">
<div
class="change"
:class="{ active: letterActive.indexOf(index)>=0 }"
:class="{ active: letterActive.indexOf(index) >= 0 }"
@click="changeLetter(index)"
v-for="(item, index) in questionObj.question"
:key="item+'a'+index"
:key="item + 'a' + index"
>
{{ letters[index] }}
</div>
......@@ -105,8 +106,8 @@ export default {
},
// 从外面传进来的选项,选择过的才有,没选择过的没有
selectLetter: {
type: [String, Number,Array],
default:()=>{
type: [String, Number, Array],
default: () => {
return [];
},
},
......@@ -117,6 +118,11 @@ export default {
// 如果传进来了,就是这个值,如果没有就是null,因为动画需要那个key的问题,会清空原始的盒子,所以要传一下值
letterActive: this.selectLetter,
letters,
tipsArr: {
1: "单选题",
2: "多选题",
3: "判断题",
},
};
},
mounted() {
......@@ -163,6 +169,19 @@ export default {
border-bottom: 1px solid #bbbbbb;
// background: red;
flex-direction: column;
position: relative;
.tips {
width: 80px;
height: 24px;
background: #1d84ff;
font-size: 14px;
color: #fff;
position: absolute;
top: -45px;
left: 0px;
text-align: center;
line-height: 24px;
}
.top {
background: #f9f9f9;
height: 54px;
......
......@@ -2,12 +2,14 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-21 11:00:14
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2023-01-10 15:32:10
* @LastEditTime: 2023-01-11 14:59:40
* @FilePath: /danger-manage-web/src/views/myLessons/components/Question.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="question flex">
<div class="tips">{{ tipsArr[questionObj.topicType] }}</div>
<div
class="top"
:class="{ flex: alignItemsCenter }"
......@@ -117,6 +119,11 @@ export default {
// 如果传进来了,就是这个值,如果没有就是null,因为动画需要那个key的问题,会清空原始的盒子,所以要传一下值
letterActive: this.selectLetter,
letters,
tipsArr: {
1: "单选题",
2: "多选题",
3: "判断题",
},
};
},
mounted() {
......@@ -170,6 +177,19 @@ export default {
border-bottom: 1px solid #bbbbbb;
// background: red;
flex-direction: column;
position: relative;
.tips {
width: 80px;
height: 24px;
background: #1d84ff;
font-size: 14px;
color: #fff;
position: absolute;
top: -45px;
left: 0px;
text-align: center;
line-height: 24px;
}
.top {
background: #f9f9f9;
height: 54px;
......
......@@ -26,19 +26,20 @@
</div>
<div class="right flex">
<div class="a">
<span
<!-- <span
class="text"
:class="{ red: item.examinationResult < item.qualifiedNum }"
>{{
(item.examinationResult &&item.topicNum)? Math.floor((item.examinationResult / item.topicNum) * 100):0
}}</span
>/<span>100</span>
>/<span>100</span> -->
<span class="text">{{item.examinationResult}}</span>/<span>{{item.totalScore}}</span>
</div>
<div class="b flex">
<div style="width: 60px">
<el-progress
:percentage="
Math.floor((item.examinationResult / item.topicNum) * 100)
Math.floor((item.examinationResult / item.totalScore) * 100)
"
:show-text="false"
></el-progress>
......@@ -64,6 +65,9 @@ export default {
data() {
return {};
},
mounted(){
console.log(this.list)
},
methods: {},
};
</script>
......
......@@ -5,6 +5,18 @@
目前录入题目是第<span>{{ questionNextNum }}</span
>道题
</div>
<div>
<el-radio-group
v-model="form.topicType"
size="mini"
@input="topicTypeChange"
>
<el-radio-button :label="1">单选</el-radio-button>
<el-radio-button :label="2">多选</el-radio-button>
<el-radio-button :label="3">判断</el-radio-button>
</el-radio-group>
</div>
<div class="right">{{ courseName }}</div>
</div>
......@@ -62,7 +74,7 @@
<div
@click="rightAnswerClick(index)"
class="right"
:class="{ active: answerNum === index }"
:class="{ active: answerNum.indexOf(index) >= 0 }"
>
设为正确答案
</div>
......@@ -77,7 +89,7 @@
</div>
</el-form-item>
<el-form-item
<!-- <el-form-item
class="noAttr"
:label="`选项${form.questions.length + 1}`"
prop=""
......@@ -99,17 +111,15 @@
:class="{ active: answerNum === form.questions.length }"
>
设为正确答案
</div>
<el-button
size="mini"
type="primary"
@click.prevent="add(addValue)"
>新增</el-button
>
</div>
</div> -->
<div style="padding-left: 30px" v-if="form.topicType != 3">
<el-button size="mini" type="primary" @click.prevent="add(addValue)"
>新增选项</el-button
>
</div>
<!-- </div>
</div>
</el-form-item>
</el-form-item> -->
</div>
</el-form>
</div>
......@@ -148,10 +158,11 @@ export default {
data() {
return {
form: {
topicType: 1,
topicTitle: "",
questions: [{ value: "" }, { value: "" }, { value: "" }],
questions: [{ value: "" }, { value: "" }],
},
answerNum: null,
answerNum: [],
addValue: "",
// 录入的是第几道题
questionNextNum: 1,
......@@ -166,10 +177,12 @@ export default {
console.log("?", res.data);
const data = res.data;
this.form = {
topicType: data.topicType,
topicTitle: data.topicTitle,
questions: JSON.parse(data.topicOption),
};
this.answerNum = data.answer;
// this.answerNum = data.answer;
this.answerNum = JSON.parse(data.answer);
});
}
......@@ -179,6 +192,23 @@ export default {
// this.getLessonById(this.bankId);
},
methods: {
// 题目类型变化
topicTypeChange(num) {
if (num == 1) {
this.answerNum = [];
} else if (num == 2) {
this.answerNum = [];
// this.form.questions=[{ value: "" }, { value: "" }];
} else {
this.answerNum = [];
const form = {
topicType: 3,
topicTitle: this.form.topicTitle,
questions: [{ value: "对" }, { value: "错" }],
};
this.form = form;
}
},
getQuestion() {
listSubject({ bankId: this.bankId }).then((res) => {
console.log(res);
......@@ -209,19 +239,46 @@ export default {
}
},
rightAnswerClick(index) {
this.answerNum = index;
console.log(index);
if (this.form.topicType === 2) {
const ind = this.answerNum.indexOf(index);
if (ind < 0) {
this.answerNum.push(index);
} else {
this.answerNum.splice(ind, 1);
}
this.answerNum = this.answerNum.sort((a, b) => {
return a - b;
});
console.log(this.answerNum);
} else {
// 判断跟单选模式差不多
this.answerNum = [index];
}
},
// 删除选项
removeDomain(question) {
const index = this.form.questions.indexOf(question);
console.log(index);
// 如果是正确答案,就让正确答案清空
if (this.answerNum === index) {
this.answerNum = null;
const ind = this.answerNum.indexOf(index);
if (ind >= 0) {
this.answerNum.splice(ind, 1);
}
// 如果是最后一位呗删除,那不用管,如果不是最后一位置,这一位删除之后,则这一位后面的所有数字都要-1;
if (index != this.form.questions.length - 1) {
this.answerNum = this.answerNum.map((item, i) => {
if (item >= index) {
return item - 1;
} else {
return item;
}
});
}
if (index >= 0) {
this.form.questions.splice(index, 1);
}
console.log(this.answerNum);
// console.log(this.form.questions)
},
// 新增选项
add(addValue) {
......@@ -230,7 +287,7 @@ export default {
},
save(num = 2) {
return new Promise((resove) => {
if (!this.answerNum && this.answerNum !== 0) {
if (this.answerNum.length <= 0) {
this.$message({
message: "警告,请设置一个正确答案",
type: "warning",
......@@ -242,7 +299,9 @@ export default {
const data = {};
data.topicTitle = this.form.topicTitle;
data.topicOption = JSON.stringify(this.form.questions);
data.answer = this.answerNum;
// data.answer = this.answerNum;
data.answer = JSON.stringify(this.answerNum);
data.topicType = this.form.topicType;
this.addQuestion(data).then((res) => {
if (res.code == 200) {
// 把修改的这个归位,变成正常添加
......@@ -273,9 +332,9 @@ export default {
reset() {
this.form = {
topicTitle: "",
questions: [{ value: "" }, { value: "" }, { value: "" }],
questions: [{ value: "" }, { value: "" }],
};
this.answerNum = null;
this.answerNum = [];
this.addValue = "";
},
},
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 17:56:05
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-27 16:03:40
* @LastEditTime: 2023-01-12 09:59:39
* @FilePath: /danger-manage-web/src/views/lessonsProgram/components/QuestionList.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -32,6 +32,7 @@
<div class="table flex" v-loading="loading">
<div class="th flex">
<div class="left">序号</div>
<div class="type">题目类型</div>
<div class="middle">题目名称</div>
<div class="right">操作</div>
</div>
......@@ -42,6 +43,7 @@
class="td flex"
>
<div class="left">{{ index + 1 }}</div>
<div class="type">{{ topicTypeArr[item.topicType] }}</div>
<div class="middle zzz">
{{ item.topicTitle }}
</div>
......@@ -189,7 +191,12 @@ export default {
url: process.env.VUE_APP_BASE_API + "/system/subject/import",
},
queryParams: {
bankId:0
bankId: 0,
},
topicTypeArr: {
1: "单选题",
2: "多选题",
3: "判断题",
},
};
},
......@@ -214,11 +221,14 @@ export default {
methods: {
// 文件下载处理
handleDownload(row) {
const a = document.createElement('a')
a.setAttribute('download', '试题导入模板')
a.setAttribute('target', '_blank')
a.setAttribute('href', 'http://36.138.181.113:8091/dangerManage/profile/upload/2022/kaoshi/shitimoban.xlsx')
a.click()
const a = document.createElement("a");
a.setAttribute("download", "试题导入模板");
a.setAttribute("target", "_blank");
a.setAttribute(
"href",
"http://36.138.181.113:8091/dangerManage/profile/upload/2022/kaoshi/shitimoban.xlsx"
);
a.click();
},
/** 导入按钮操作 */
......@@ -263,7 +273,6 @@ export default {
},
getQuestion(bankId) {
return listSubject(bankId).then((res) => {
this.questionList = res.rows.map((item) => {
return {
subjectId: item.subjectId,
......@@ -388,9 +397,13 @@ export default {
width: 15%;
text-align: center;
}
.type {
width: 10%;
text-align: center;
}
.middle {
width: 60%;
padding-left: 100px;
width: 50%;
padding-left: 50px;
}
.right {
width: 25%;
......@@ -416,9 +429,13 @@ export default {
width: 15%;
text-align: center;
}
.type {
width: 10%;
text-align: center;
}
.middle {
width: 60%;
padding-left: 10px;
width: 50%;
padding-left: 50px;
}
.right {
width: 25%;
......
......@@ -5,6 +5,17 @@
目前录入题目是第<span>{{ questionNextNum }}</span
>道题
</div>
<div>
<el-radio-group
v-model="form.topicType"
size="mini"
@input="topicTypeChange"
>
<el-radio-button :label="1">单选</el-radio-button>
<el-radio-button :label="2">多选</el-radio-button>
<el-radio-button :label="3">判断</el-radio-button>
</el-radio-group>
</div>
<div class="right">{{ courseName }}</div>
</div>
......@@ -40,15 +51,11 @@
:label="'选项' + (index + 1)"
:key="question.key"
:prop="'questions.' + index + '.value'"
:rules="
index === 0
? {
required: true,
message: '第一项不能为空不能为空',
trigger: 'blur',
}
: {}
"
:rules="{
required: true,
message: '第一项不能为空不能为空',
trigger: 'blur',
}"
>
<div class="add-select flex">
<el-input
......@@ -62,7 +69,7 @@
<div
@click="rightAnswerClick(index)"
class="right"
:class="{ active: answerNum === index }"
:class="{ active: answerNum.indexOf(index) >= 0 }"
>
设为正确答案
</div>
......@@ -100,7 +107,7 @@
>
设为正确答案
</div> -->
<div style="padding-left:30px">
<div style="padding-left: 30px">
<el-button size="mini" type="primary" @click.prevent="add(addValue)"
>新增选项</el-button
>
......@@ -141,10 +148,11 @@ export default {
data() {
return {
form: {
topicType: 1,
topicTitle: "",
questions: [{ value: "" }, { value: "" }],
},
answerNum: null,
answerNum: [],
addValue: "",
// 录入的是第几道题
questionNextNum: 1,
......@@ -159,10 +167,12 @@ export default {
console.log(res.data);
const data = res.data;
this.form = {
topicType: data.topicType,
topicTitle: data.topicTitle,
questions: JSON.parse(data.topicOption),
};
this.answerNum = data.answer;
// this.answerNum = data.answer;
this.answerNum = JSON.parse(data.answer);
});
}
......@@ -172,14 +182,31 @@ export default {
this.getLessonById(this.courseId);
},
methods: {
// 题目类型变化
topicTypeChange(num) {
if (num == 1) {
this.answerNum = [];
} else if (num == 2) {
this.answerNum = [];
// this.form.questions=[{ value: "" }, { value: "" }];
} else {
this.answerNum = [];
const form = {
topicType: 3,
topicTitle: this.form.topicTitle,
questions: [{ value: "对" }, { value: "错" }],
};
this.form = form;
}
},
getQuestion() {
getQuestion({ courseId: this.courseId }).then((res) => {
// 如果是修改 就是原来的值,如果不是,就是总数+1
console.log(res)
console.log(res);
if (this.topicId) {
res.rows.forEach((item, index) => {
if (item.topicId == this.topicId) {
this.questionNextNum = index+1;
this.questionNextNum = index + 1;
}
});
} else {
......@@ -202,20 +229,58 @@ export default {
}
},
rightAnswerClick(index) {
this.answerNum = index;
console.log(index);
if (this.form.topicType === 2) {
const ind = this.answerNum.indexOf(index);
if (ind < 0) {
this.answerNum.push(index);
} else {
this.answerNum.splice(ind, 1);
}
this.answerNum = this.answerNum.sort((a, b) => {
return a - b;
});
console.log(this.answerNum);
} else {
// 判断跟单选模式差不多
this.answerNum = [index];
}
},
// 删除选项
removeDomain(question) {
const index = this.form.questions.indexOf(question);
console.log(index);
// 如果是正确答案,就让正确答案清空
if (this.answerNum === index) {
this.answerNum = null;
const ind = this.answerNum.indexOf(index);
if (ind >= 0) {
this.answerNum.splice(ind, 1);
}
// 如果是最后一位呗删除,那不用管,如果不是最后一位置,这一位删除之后,则这一位后面的所有数字都要-1;
if (index != this.form.questions.length - 1) {
this.answerNum = this.answerNum.map((item, i) => {
if (item >= index) {
return item - 1;
} else {
return item;
}
});
}
if (index >= 0) {
this.form.questions.splice(index, 1);
}
console.log(this.answerNum);
// console.log(this.form.questions)
},
// 删除选项
// removeDomain(question) {
// const index = this.form.questions.indexOf(question);
// // 如果是正确答案,就让正确答案清空
// if (this.answerNum === index) {
// this.answerNum = null;
// }
// if (index >= 0) {
// this.form.questions.splice(index, 1);
// }
// },
// 新增选项
add(addValue) {
this.form.questions.push({ value: addValue });
......@@ -235,7 +300,9 @@ export default {
const data = {};
data.topicTitle = this.form.topicTitle;
data.topicOption = JSON.stringify(this.form.questions);
data.answer = this.answerNum;
// data.answer = this.answerNum;
data.answer = JSON.stringify(this.answerNum);
data.topicType = this.form.topicType;
this.addQuestion(data).then((res) => {
if (res.code == 200) {
// 把修改的这个归位,变成正常添加
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 17:56:05
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-26 16:55:10
* @LastEditTime: 2023-01-12 16:44:31
* @FilePath: /danger-manage-web/src/views/lessonsProgram/components/QuestionList.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -16,9 +16,36 @@
</div>
<div class="right">{{ courseName }}</div>
</div>
<div class="detail flex">
<div class="detail-item">
单选题{{ bottomFrom.singleChoiceScore }}分/题,共{{ danxs }}题,计{{
danxs * bottomFrom.singleChoiceScore
}}
</div>
<div class="detail-item">
多选题{{ bottomFrom.multipleChoiceScore }}分/题,共{{ duoxs }}题,计{{
duoxs * bottomFrom.multipleChoiceScore
}}
</div>
<div class="detail-item">
判断提{{ bottomFrom.judgmentScore }}/题,共{{ pds }}题,计{{
pds * bottomFrom.judgmentScore
}}
</div>
<div class="detail-item">
一共{{ danxs + duoxs + pds }}道题,总共计{{
danxs * bottomFrom.singleChoiceScore +
duoxs * bottomFrom.multipleChoiceScore +
pds * bottomFrom.judgmentScore
}}
</div>
</div>
<div class="table flex" v-loading="loading">
<div class="th flex">
<div class="left">序号</div>
<div class="type">题目类型</div>
<div class="middle">题目名称</div>
<div class="right">操作</div>
</div>
......@@ -29,6 +56,7 @@
class="td flex"
>
<div class="left">{{ index + 1 }}</div>
<div class="type">{{ topicTypeArr[item.topicType] }}</div>
<div class="middle zzz">
{{ item.topicTitle }}
</div>
......@@ -53,7 +81,7 @@
</div>
<div class="rightNum flex">
<div class="left">考试设置</div>
<div class="middle flex">
<!-- <div class="middle flex">
<div class="left-text">答对题目大于</div>
<div>
<el-input
......@@ -63,6 +91,52 @@
></el-input>
</div>
<div>为合格</div>
</div> -->
<div class="middle flex">
<div class="left-text">单选一题</div>
<div>
<el-input
v-model="bottomFrom.singleChoiceScore"
style="width: 50px"
size="mini"
></el-input>
</div>
<div></div>
</div>
<div class="middle flex">
<div class="left-text">多选一题</div>
<div>
<el-input
v-model="bottomFrom.multipleChoiceScore"
style="width: 50px"
size="mini"
></el-input>
</div>
<div></div>
</div>
<div class="middle flex">
<div class="left-text">判断一题</div>
<div>
<el-input
v-model="bottomFrom.judgmentScore"
style="width: 50px"
size="mini"
></el-input>
</div>
<div></div>
</div>
<div class="middle flex">
<div class="left-text">总分大于</div>
<div>
<el-input
v-model="bottomFrom.qualifiedNum"
style="width: 60px"
size="mini"
></el-input>
</div>
<div>为合格</div>
</div>
<div class="right">
<el-button
......@@ -96,11 +170,22 @@ export default {
return {
// 当前课程的第几题,调一遍接口
questionNum: null,
bottomFrom: {
singleChoiceScore: 0,
multipleChoiceScore: 0,
judgmentScore: 0,
qualifiedNum: 0,
},
// 答对几道题
rightNum: 0,
questionList: [],
loading: false,
courseName: "",
topicTypeArr: {
1: "单选题",
2: "多选题",
3: "判断题",
},
};
},
// watch: {
......@@ -112,7 +197,17 @@ export default {
// }
// },
// },
computed: {
danxs() {
return this.questionList.filter((item) => item.topicType === 1).length;
},
duoxs() {
return this.questionList.filter((item) => item.topicType === 2).length;
},
pds() {
return this.questionList.filter((item) => item.topicType === 3).length;
},
},
created() {
console.log("this.courseId", this.courseId);
if (this.courseId) {
......@@ -134,6 +229,7 @@ export default {
this.questionList = res.rows.map((item) => {
return {
topicType: item.topicType,
topicId: item.topicId,
topicTitle: item.topicTitle,
};
......@@ -145,7 +241,13 @@ export default {
getLessonById(courseId) {
getLessonById(courseId).then((res) => {
console.log(res);
this.rightNum = res.data.qualifiedNum;
// this.rightNum = res.data.qualifiedNum;
this.bottomFrom = {
singleChoiceScore: res.data.singleChoiceScore || 0,
multipleChoiceScore: res.data.multipleChoiceScore || 0,
judgmentScore: res.data.judgmentScore || 0,
qualifiedNum: res.data.qualifiedNum || 0,
};
this.courseName = res.data.courseName;
});
},
......@@ -179,16 +281,31 @@ export default {
});
},
saveRightNum() {
if (this.rightNum > this.questionList.length) {
// if (this.rightNum > this.questionList.length) {
// this.$message({
// message: "答对题目数应小于等于考试题目总数",
// type: "warning",
// });
// return;
// }
if (
!(
this.bottomFrom.singleChoiceScore > 0 &&
this.bottomFrom.multipleChoiceScore > 0 &&
this.bottomFrom.judgmentScore > 0 &&
this.bottomFrom.qualifiedNum > 0
)
) {
this.$message({
message: "答对题目数应小于等于考试题目总数",
message: "请将分数填写完整",
type: "warning",
});
return;
}
changeLesson({
courseId: this.courseId,
qualifiedNum: this.rightNum,
// qualifiedNum: this.rightNum,
...this.bottomFrom,
}).then((res) => {
if (res.code == 200) {
this.$message({
......@@ -211,6 +328,7 @@ export default {
padding-bottom: 7px;
margin-bottom: 20px;
border-bottom: 1px solid #bbbbbb00;
position: relative;
.text {
margin-top: 13px;
......@@ -238,6 +356,15 @@ export default {
text-align: right;
}
}
.detail {
position: absolute;
top: 45px;
.detail-item {
margin-right: 20px;
color: red;
}
}
.table {
flex: 1;
height: 0;
......@@ -257,9 +384,13 @@ export default {
width: 15%;
text-align: center;
}
.type {
width: 10%;
text-align: center;
}
.middle {
width: 60%;
padding-left: 100px;
width: 50%;
padding-left: 50px;
}
.right {
width: 25%;
......@@ -285,9 +416,13 @@ export default {
width: 15%;
text-align: center;
}
.type {
width: 10%;
text-align: center;
}
.middle {
width: 60%;
padding-left: 10px;
width: 50%;
padding-left: 50px;
}
.right {
width: 25%;
......
......@@ -83,7 +83,7 @@
width="180"
>
<template v-slot="{ row: { topicNum, courseId } }">
<div class="timuNum">
<div class="timuNum">
<div v-if="topicNum > 0">{{ `已录入${topicNum}题` }}</div>
<div v-else>未录入</div>
</div>
......@@ -114,7 +114,6 @@
<el-button
:disabled="status == 1"
v-if="status == 0"
size="mini"
type="text"
icon="el-icon-edit"
......@@ -131,7 +130,6 @@
<el-button
:disabled="status == 1"
v-if="status == 0"
size="mini"
type="text"
icon="el-icon-delete"
......@@ -328,7 +326,12 @@ export default {
return getLessonById(courseId);
})
.then((res) => {
if (res.data.qualifiedNum > 0) {
if (
res.data.singleChoiceScore > 0 &&
res.data.multipleChoiceScore > 0 &&
res.data.judgmentScore > 0 &&
res.data.qualifiedNum > 0
) {
return true;
}
})
......@@ -340,7 +343,7 @@ export default {
return testPublish({ courseId, personnelType: 1 });
} else {
this.$message({
message: "请先录入答题合格数",
message: "请先在题目列表录入题目分数跟合格分数",
type: "warning",
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment