Commit 39aed7b5 authored by 纪泽龙's avatar 纪泽龙

培训课程管理增加详情

parent 72494017
......@@ -11,9 +11,15 @@
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-button :disabled="checkLock" :label="1"
>单选</el-radio-button
>
<el-radio-button :disabled="checkLock" :label="2"
>多选</el-radio-button
>
<el-radio-button :disabled="checkLock" :label="3"
>判断</el-radio-button
>
</el-radio-group>
</div>
......@@ -29,7 +35,7 @@
:rules="{
required: true,
message: '必须输入题目内容',
trigger: 'blur',
trigger: ['blur', 'change'],
}"
>
<el-input
......@@ -38,6 +44,7 @@
resize="none"
rows="4"
v-model="form.topicTitle"
:disabled="checkLock"
>
</el-input>
</el-form-item>
......@@ -55,7 +62,7 @@
:rules="{
required: true,
message: '选项内容不能为空不能为空',
trigger: 'change',
trigger: ['blur', 'change'],
}"
>
<div class="add-select flex">
......@@ -65,6 +72,7 @@
style="flex: 1; margin-right: 10px"
rows="2"
v-model="question.value"
:disabled="checkLock"
></el-input>
<div class="flex algin-items">
<div
......@@ -111,7 +119,11 @@
设为正确答案
</div> -->
<div style="padding-left: 30px" v-if="form.topicType != 3">
<el-button size="mini" type="primary" @click.prevent="add(addValue)"
<el-button
size="mini"
:disabled="!checkLock"
type="primary"
@click.prevent="add(addValue)"
>新增选项</el-button
>
</div>
......@@ -146,6 +158,10 @@ export default {
topicId: {
type: Number,
},
// 如果是查看,就禁止修改
checkLock: {
type: Boolean,
},
},
components: {},
data() {
......@@ -171,7 +187,7 @@ export default {
console.log(res.data);
const data = res.data;
this.form = {
topicType :data.topicType,
topicType: data.topicType,
topicTitle: data.topicTitle,
questions: JSON.parse(data.topicOption),
};
......@@ -232,6 +248,7 @@ export default {
}
},
rightAnswerClick(index) {
if (this.checkLock) return;
if (this.form.topicType === 2) {
const ind = this.answerNum.indexOf(index);
if (ind < 0) {
......@@ -250,6 +267,8 @@ export default {
},
// 删除选项
removeDomain(question) {
if (this.checkLock) return;
const index = this.form.questions.indexOf(question);
console.log(index);
// 如果是正确答案,就让正确答案清空
......@@ -279,7 +298,7 @@ export default {
},
save(num = 2) {
return new Promise((resove) => {
if (this.answerNum.length<=0) {
if (this.answerNum.length <= 0) {
this.$message({
message: "警告,请设置一个正确答案",
type: "warning",
......@@ -292,8 +311,8 @@ export default {
data.topicTitle = this.form.topicTitle;
data.topicOption = JSON.stringify(this.form.questions);
data.answer = JSON.stringify(this.answerNum);
data.topicType=this.form.topicType;
console.log(data)
data.topicType = this.form.topicType;
console.log(data);
this.addQuestion(data).then((res) => {
if (res.code == 200) {
// 把修改的这个归位,变成正常添加
......@@ -323,7 +342,7 @@ export default {
});
},
reset() {
const topicType = this.form.topicType
const topicType = this.form.topicType;
this.form = {
topicType,
topicTitle: "",
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-12-27 09:30:19
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-28 10:29:18
* @LastEditTime: 2023-02-01 16:15:10
* @FilePath: /danger-manage-web/src/views/educationPlanExam/textPaper/components/ChangeQuestion.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -193,7 +193,8 @@ export default {
this.loading = false;
});
},
saveAndNext() {
save(num=2) {
const topicInfos = this.list
.filter((item) => item.checked)
.map((item) => {
......@@ -202,18 +203,20 @@ export default {
quan: item.changeNum,
};
});
console.log(this.courseId, topicInfos);
const data = { courseId: this.courseId, topicInfos };
console.log(data);
bachAddTopic(data).then((res) => {
console.log(res);
if (res.code == 200) {
this.$parent.$parent.componentsNumChange(2);
this.$parent.$parent.componentsNumChange(num);
this.$parent.$parent.$parent.getList();
}
});
},
saveAndNext(){
this.save(3)
},
resetClick() {},
search() {
this.getList();
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 10:38:49
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2023-01-13 15:59:47
* @LastEditTime: 2023-02-01 16:16:44
* @FilePath: /danger-manage-web/src/views/lessonsProgram/components/addLesson.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -24,6 +24,7 @@
:is="currentComponent"
:courseId.sync="courseId"
:topicId.sync="topicId"
:checkLock="checkLock"
ref="current"
></component>
</transition>
......@@ -32,27 +33,31 @@
<QuestionList/> -->
</div>
<div slot="footer" class="dialog-footer">
<div slot="footer" class="dialog-footer" v-if="!checkLock">
<el-button
type="primary"
v-if="this.componentsNum == 2"
v-if="this.componentsNum == 2 && !checkLock"
@click="componentsNumChange(4)"
>从题库选择</el-button
>
<el-button
type="primary"
v-if="this.componentsNum == 1 || this.componentsNum == 3"
@click="save"
>保存</el-button
v-if="this.componentsNum == 4 ||this.componentsNum==3"
@click="componentsNumChange(2)"
>返回题目列表</el-button
>
<el-button
type="primary"
v-if="this.componentsNum == 4"
@click="componentsNumChange(2)"
>返回题目列表</el-button
v-if="
this.componentsNum == 1 ||
this.componentsNum == 3 ||
this.componentsNum == 4
"
@click="save"
>保存</el-button
>
<el-button type="primary" @click="saveAndNext">{{
<el-button type="primary" @click="saveAndNext" v-if="!checkLock">{{
saveNextText
}}</el-button>
<el-button
......@@ -63,6 +68,16 @@
>
<el-button @click="dialogCancel">取消</el-button>
</div>
<div slot="footer" class="dialog-footer" v-else>
<el-button
type="primary"
v-if="this.componentsNum == 3 && checkLock"
@click="componentsNumChange(2)"
>返回题目列表</el-button
>
<el-button type="primary" @click="dialogCancel">{{ "确认" }}</el-button>
<el-button @click="dialogCancel">取消</el-button>
</div>
</el-dialog>
</template>
......@@ -72,7 +87,6 @@ import AddQuestion from "./AddQuestion";
import QuestionList from "./QuestionList";
import ChangeQuestion from "./ChangeQuestion";
export default {
name: "AnswerLesson",
props: {
......@@ -87,6 +101,9 @@ export default {
courseId: {
type: Number,
},
checkLock: {
type: Boolean,
},
},
// components: {
// Lesson,
......@@ -116,14 +133,14 @@ export default {
this.currentComponent = QuestionList;
this.title = "题目列表";
} else if(num===3) {
} else if (num === 3) {
this.currentComponent = AddQuestion;
if (this.topicId) {
this.title = "修改题目";
} else {
this.title = "新增题目";
}
}else if (num == 4) {
} else if (num == 4) {
this.currentComponent = ChangeQuestion;
this.title = "从题库选题";
}
......@@ -167,6 +184,8 @@ export default {
this.topicId = null;
}
this.$emit("update:visible", false);
// 关闭的时候归位
this.$emit("update:checkLock", false);
},
// 把ID改变了
changeCourseId(courseId) {
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 10:59:44
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2023-01-04 17:47:53
* @LastEditTime: 2023-02-01 15:21:15
* @FilePath: /danger-manage-web/src/views/lessonsProgram/components/Lession.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -17,34 +17,33 @@
>
<div class="top flex">
<el-form-item label="课程标题" prop="courseName">
<el-input style="width: 400px" v-model="form.courseName"></el-input>
<el-input style="width: 400px" v-model="form.courseName" :disabled="checkLock"></el-input>
</el-form-item>
<!--<el-form-item label="培训计划" prop="courseType">-->
<!--<el-select-->
<!--v-model="form.courseType"-->
<!--placeholder="请选择培训计划"-->
<!--clearable-->
<!--size="small"-->
<!--&gt;-->
<!--<el-option-->
<!--v-for="course in courseOptions"-->
<!--:key="course.planId"-->
<!--:label="course.planName"-->
<!--:value="course.planId"-->
<!--/>-->
<!--</el-select>-->
<!--<el-select-->
<!--v-model="form.courseType"-->
<!--placeholder="请选择培训计划"-->
<!--clearable-->
<!--size="small"-->
<!--&gt;-->
<!--<el-option-->
<!--v-for="course in courseOptions"-->
<!--:key="course.planId"-->
<!--:label="course.planName"-->
<!--:value="course.planId"-->
<!--/>-->
<!--</el-select>-->
<!--</el-form-item>-->
</div>
<div class="flex">
<el-form-item label="培训计划" prop="courseType">
<el-select
v-model="form.courseType"
placeholder="请选择培训计划"
clearable
size="small"
:disabled="checkLock"
>
<el-option
v-for="course in courseOptions"
......@@ -54,8 +53,18 @@
/>
</el-select>
</el-form-item>
<el-form-item label="培训时长" prop="duration" style="margin-left: 55px">
<el-input style="width: 220px" placeholder="分钟" type="number" v-model="form.duration"></el-input>
<el-form-item
label="培训时长"
prop="duration"
style="margin-left: 55px"
>
<el-input
style="width: 220px"
placeholder="分钟"
type="number"
v-model="form.duration"
:disabled="checkLock"
></el-input>
</el-form-item>
</div>
<div class="flex">
......@@ -67,6 +76,7 @@
type="datetime"
placeholder="选择日期时间"
default-time="00:00:00"
:disabled="checkLock"
/>
</el-form-item>
<el-form-item label="结束时间" prop="testEndTime">
......@@ -76,12 +86,13 @@
type="datetime"
placeholder="选择日期时间"
default-time="00:00:00"
:disabled="checkLock"
/>
</el-form-item>
</div>
<!-- </div> -->
<el-form-item label="课程内容" prop="courseConent">
<Editor v-model="form.courseConent" :min-height="192" />
<Editor v-model="form.courseConent" :min-height="192" :readOnly="checkLock"/>
<el-input
v-show="false"
disabled
......@@ -90,7 +101,7 @@
</el-form-item>
<div class="flex">
<el-form-item label="视频上传" v-if="!readOnly" prop="video">
<el-form-item label="视频上传" v-if="!readOnly" prop="video">
<FileUpload
listType="picture"
@resFun="getFileInfoVideo"
......@@ -98,6 +109,7 @@
:fileArr="fileListVideo"
:fileSize="500"
:fileType="['mp4']"
:disabled="checkLock"
/>
<el-input v-show="false" disabled v-model="form.video"></el-input>
</el-form-item>
......@@ -108,6 +120,7 @@
@remove="listRemoveFile"
:fileArr="fileListFile"
:fileType="fileType"
:disabled="checkLock"
/>
<el-input v-show="false" disabled v-model="form.enclosure"></el-input>
</el-form-item>
......@@ -133,6 +146,9 @@ export default {
courseId: {
type: Number,
},
checkLock:{
type:Boolean,
}
},
components: {
Editor,
......@@ -204,8 +220,16 @@ export default {
getLessonById(this.courseId).then((res) => {
if (res.code == 200) {
const data = res.data;
const { courseName, courseType, courseConent, video, enclosure,duration,testStartTime,testEndTime } =
data;
const {
courseName,
courseType,
courseConent,
video,
enclosure,
duration,
testStartTime,
testEndTime,
} = data;
this.form = {
courseName,
courseType,
......@@ -214,21 +238,22 @@ export default {
enclosure,
duration,
testStartTime,
testEndTime
testEndTime,
};
this.fileListVideo = [
console.log('video',video)
this.fileListVideo = video? [
{
name: courseName + "视频",
url: uploadfile,
},
];
]:[];
this.fileListFile = [
{
name: courseName + "附件",
url: uploadfile,
},
];
console.log("--",this.fileListFile);
console.log("--", this.fileListFile);
}
});
},
......@@ -280,14 +305,18 @@ export default {
message: "保存课程成功",
type: "success",
});
// 隐藏dia
this.$parent.$parent.dialogCancel()
} else if (num == 3) {
this.$message({
message: "保存课程成功,请开始录入题目",
type: "success",
});
// 跳转动态路由,并且把ID改变添加用
this.$parent.$parent.componentsNumChange(num);
this.$parent.$parent.changeCourseId(courseId);
}
this.$parent.$parent.componentsNumChange(num);
this.$parent.$parent.changeCourseId(courseId);
this.$parent.$parent.$parent.getList();
return true;
......@@ -307,7 +336,7 @@ export default {
.form-wrapper {
padding-top: 22px;
width: 100%;
height: 650px;
height: 680px;
overflow: hidden;
// padding-bottom: 10px;
margin-bottom: 20px;
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 17:56:05
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2023-01-31 14:03:36
* @LastEditTime: 2023-02-01 15:51:54
* @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
-->
......@@ -71,12 +71,21 @@
<div class="right">
<div>
<el-button
v-if="!checkLock"
@click="edit(item.topicId)"
icon="el-icon-edit"
type="text"
>修改</el-button
>
<el-button
v-if="checkLock"
@click="edit(item.topicId)"
icon="el-icon-edit"
type="text"
>查看</el-button
>
<el-button
v-if="!checkLock"
@click="deleteLesson(item.topicId)"
icon="el-icon-delete"
type="text"
......@@ -98,6 +107,7 @@
v-model="bottomFrom.singleChoiceScore"
style="width: 50px"
size="mini"
:disabled="checkLock"
></el-input>
</div>
<div></div>
......@@ -109,6 +119,7 @@
v-model="bottomFrom.multipleChoiceScore"
style="width: 50px"
size="mini"
:disabled="checkLock"
></el-input>
</div>
<div></div>
......@@ -121,6 +132,7 @@
v-model="bottomFrom.judgmentScore"
style="width: 50px"
size="mini"
:disabled="checkLock"
></el-input>
</div>
<div></div>
......@@ -133,6 +145,7 @@
v-model="bottomFrom.qualifiedNum"
style="width: 60px"
size="mini"
:disabled="checkLock"
></el-input>
</div>
<div>为合格</div>
......@@ -144,6 +157,7 @@
icon="el-icon-check"
size="mini"
type="success"
:disabled="checkLock"
>保存</el-button
>
</div>
......@@ -164,6 +178,9 @@ export default {
courseId: {
type: Number,
},
checkLock: {
type: Boolean,
},
},
components: {},
data() {
......
......@@ -131,9 +131,9 @@
prop="topicNum"
width="180"
>
<template v-slot="{ row: { topicNum, courseId } }">
<div @click="checkQuestion(courseId)" class="timuNum">
<div v-if="topicNum > 0">{{ `已录入${topicNum}题` }}</div>
<template v-slot="{ row: { topicNum, courseId, status } }">
<div @click="checkQuestion(courseId, status)" class="timuNum">
<div v-if="topicNum > 0">{{status==0? `已录入${topicNum}题`:'查看' }}</div>
<div v-else>未录入</div>
</div>
</template>
......@@ -153,6 +153,14 @@
@click="changeLesson(courseId)"
>修改</el-button
>
<el-button
v-if="status == 1"
size="mini"
type="text"
icon="el-icon-edit"
@click="checkLesson(courseId)"
>详情</el-button
>
<el-button
size="mini"
type="text"
......@@ -183,6 +191,7 @@
ref="Dia"
:componentsNum.sync="componentsNum"
:courseId.sync="courseId"
:checkLock.sync="checkLock"
:visible.sync="dilogFlag"
/>
</div>
......@@ -230,6 +239,8 @@ export default {
componentsNum: 1,
// 点击的id,如果是新增为空
courseId: null,
// false为编辑,true为查看,查看不允许编辑的时候
checkLock: false,
};
},
computed: {
......@@ -275,21 +286,34 @@ export default {
},
/** 新增按钮操作 */
handleAdd() {
this.checkLock = false;
this.$refs.Dia.title = "新增培训课程";
this.componentsNum = 1;
this.courseId = null;
this.dilogFlag = true;
},
changeLesson(courseId) {
this.checkLock = false;
this.$refs.Dia.title = "修改培训课程";
this.componentsNum = 1;
this.courseId = courseId;
this.dilogFlag = true;
},
checkLesson(courseId) {
this.checkLock = true;
this.$refs.Dia.title = "查看培训课程";
this.componentsNum = 1;
this.courseId = courseId;
this.dilogFlag = true;
},
// 直接查看考题
checkQuestion(courseId) {
checkQuestion(courseId, status) {
// 要查看考题的id
if (status == 1) {
this.checkLock = true;
}
this.courseId = courseId;
console.log(this.courseId);
// 2代表列表组件
......
......@@ -112,7 +112,6 @@
>录入考题</el-button
>
<el-button
:disabled="status == 1"
v-if="status == 0"
size="mini"
type="text"
......@@ -120,6 +119,14 @@
@click="changeLesson(courseId)"
>编辑</el-button
>
<el-button
v-if="status == 1"
size="mini"
type="text"
icon="el-icon-edit"
@click="checkLesson(courseId)"
>详情</el-button
>
<el-button
size="mini"
type="text"
......@@ -128,7 +135,6 @@
>删除</el-button
>
<el-button
:disabled="status == 1"
v-if="status == 0"
size="mini"
type="text"
......@@ -151,6 +157,7 @@
ref="Dia"
:componentsNum.sync="componentsNum"
:courseId.sync="courseId"
:checkLock="checkLock"
:visible.sync="dilogFlag"
/>
<el-dialog title="提示" :visible.sync="issue" width="30%">
......@@ -204,6 +211,8 @@ export default {
// 点击的id,如果是新增为空
courseId: null,
issue: false,
// false为编辑,true为查看,查看不允许编辑的时候
checkLock: false,
};
},
computed: {
......@@ -257,12 +266,22 @@ export default {
},
/** 新增按钮操作 */
handleAdd() {
this.checkLock = false;
this.$refs.Dia.title = "新增考试试卷";
this.componentsNum = 1;
this.courseId = null;
this.dilogFlag = true;
},
changeLesson(courseId) {
this.checkLock = false;
this.$refs.Dia.title = "修改考试试卷";
this.componentsNum = 1;
this.courseId = courseId;
this.dilogFlag = true;
},
checkLesson(courseId) {
this.checkLock = true;
this.$refs.Dia.title = "修改考试试卷";
this.componentsNum = 1;
this.courseId = courseId;
......
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