Commit 12b3a02a authored by 纪泽龙's avatar 纪泽龙

修改题库的Dia内部的属性名开始之前

parent f7b9295f
import request from '@/utils/request'
// 查询题库题目列表
export function listSubject(query) {
return request({
url: '/system/subject/list',
method: 'get',
params: query
})
}
// 查询题库题目详细
export function getSubject(subjectId) {
return request({
url: '/system/subject/' + subjectId,
method: 'get'
})
}
// 新增题库题目
export function addSubject(data) {
return request({
url: '/system/subject',
method: 'post',
data: data
})
}
// 修改题库题目
export function updateSubject(data) {
return request({
url: '/system/subject',
method: 'put',
data: data
})
}
// 删除题库题目
export function delSubject(subjectId) {
return request({
url: '/system/subject/' + subjectId,
method: 'delete'
})
}
// 导出题库题目
export function exportSubject(query) {
return request({
url: '/system/subject/export',
method: 'get',
params: query
})
}
\ No newline at end of file
......@@ -175,7 +175,17 @@ export default {
methods: {
getQuestion() {
getQuestion({ courseId: this.courseId }).then((res) => {
this.questionNextNum = res.total + 1;
// 如果是修改 就是原来的值,如果不是,就是总数+1
console.log(res)
if (this.topicId) {
res.rows.forEach((item, index) => {
if (item.topicId == this.topicId) {
this.questionNextNum = index+1;
}
});
} else {
this.questionNextNum = res.total + 1;
}
});
},
getLessonById(courseId) {
......@@ -249,7 +259,8 @@ export default {
this.save(3).then((res) => {
if (res) {
this.reset();
this.questionNextNum++;
// this.questionNextNum++;
this.getQuestion();
}
});
},
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 10:38:49
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-09-28 17:48:07
* @LastEditTime: 2022-12-17 10:24:41
* @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
-->
......
......@@ -123,6 +123,7 @@ import {
getQuestion,
getLessonById,
} from "@/api/educationPlanExam/lessonsProgram.js";
import { addSubject ,getSubject,listSubject,updateSubject} from "@/api/educationPlanExam/subject";
export default {
name: "AnswerLesson",
......@@ -156,8 +157,8 @@ export default {
created() {
// 如果存在就是修改
if (this.topicId) {
checkQuestion(this.topicId).then((res) => {
console.log(res.data);
getSubject(this.topicId).then((res) => {
console.log('?',res.data);
const data = res.data;
this.form = {
topicTitle: data.topicTitle,
......@@ -174,8 +175,18 @@ export default {
},
methods: {
getQuestion() {
getQuestion({ courseId: this.courseId }).then((res) => {
this.questionNextNum = res.total + 1;
listSubject({ bankId: this.courseId }).then((res) => {
console.log(res)
// 如果是修改 就是原来的值,如果不是,就是总数+1
if (this.topicId) {
res.rows.forEach((item, index) => {
if (item.subjectId == this.topicId) {
this.questionNextNum = index+1;
}
});
} else {
this.questionNextNum = res.total + 1;
}
});
},
getLessonById(courseId) {
......@@ -187,9 +198,9 @@ export default {
addQuestion(data) {
// 如果是修改,就用修改的方法,如果是新增,就用新增的方法
if (this.topicId) {
return changeQuestion({ topicId: this.topicId, ...data });
return updateSubject({ subjectId: this.topicId, ...data });
} else {
return addQuestion({ courseId: this.courseId, ...data });
return addSubject({ bankId: this.courseId, ...data });
}
},
rightAnswerClick(index) {
......@@ -249,7 +260,8 @@ export default {
this.save(3).then((res) => {
if (res) {
this.reset();
this.questionNextNum++;
// this.questionNextNum++;
this.getQuestion();
}
});
},
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 10:59:44
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-16 16:43:06
* @LastEditTime: 2022-12-16 17:35:04
* @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
-->
......@@ -91,7 +91,7 @@ import {
updateBank,
getBank,
} from "@/api/system/questionBank.js";
} from "@/api/educationPlanExam/questionBank";
// 所有部门
import { treeselect } from "@/api/system/dept";
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 17:56:05
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-16 10:23:13
* @LastEditTime: 2022-12-17 11:06:28
* @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
-->
......@@ -10,11 +10,11 @@
<div ref="myBody" class="add-question flex">
<div class="text flex">
<div class="left">
目前有<span>{{ questionNum || 0}}</span
目前有<span>{{ questionNum || 0 }}</span
>道题
<!-- <span class="warn">温馨提示:发布课程前需要进行考试设置</span> -->
</div>
<div class="right">{{courseName}}</div>
<div class="right">{{ courseName }}</div>
</div>
<div class="table flex" v-loading="loading">
<div class="th flex">
......@@ -35,13 +35,13 @@
<div class="right">
<div>
<el-button
@click="edit(item.topicId)"
@click="edit(item.subjectId)"
icon="el-icon-edit"
type="text"
>修改</el-button
>
<el-button
@click="deleteLesson(item.topicId)"
@click="deleteLesson(item.subjectId)"
icon="el-icon-delete"
type="text"
>删除</el-button
......@@ -85,6 +85,9 @@ import {
changeLesson,
getLessonById,
} from "@/api/educationPlanExam/lessonsProgram";
import { listSubject, delSubject } from "@/api/educationPlanExam/subject";
import { getBank } from "@/api/educationPlanExam/questionBank";
export default {
name: "AnswerLesson",
props: {
......@@ -101,7 +104,7 @@ export default {
rightNum: 0,
questionList: [],
loading: false,
courseName:'',
courseName: "",
};
},
// watch: {
......@@ -117,7 +120,7 @@ export default {
created() {
console.log("this.courseId", this.courseId);
if (this.courseId) {
this.getQuestion({ courseId: this.courseId });
this.getQuestion({ bankId: this.courseId });
// 获取只题目正确几题算过关
this.getLessonById(this.courseId);
}
......@@ -130,12 +133,13 @@ export default {
this.$parent.$parent.componentsNumChange(3);
},
getQuestion(courseId) {
return getQuestion(courseId).then((res) => {
console.log(res);
console.log(courseId);
return listSubject(courseId).then((res) => {
console.log("题库res", res);
this.questionList = res.rows.map((item) => {
return {
topicId: item.topicId,
subjectId: item.subjectId,
topicTitle: item.topicTitle,
};
});
......@@ -144,14 +148,14 @@ export default {
});
},
getLessonById(courseId) {
getLessonById(courseId).then((res) => {
console.log(res);
this.rightNum = res.data.qualifiedNum;
this.courseName = res.data.courseName;
getBank(courseId).then((res) => {
// console.log(res);
// this.rightNum = res.data.qualifiedNum;
this.courseName = res.data.bankName;
});
},
edit(topicId) {
this.$emit("update:topicId", topicId);
edit(subjectId) {
this.$emit("update:topicId", subjectId);
this.$parent.$parent.componentsNumChange(3);
},
deleteLesson(topicId) {
......@@ -162,7 +166,7 @@ export default {
})
.then(() => {
this.loading = true;
return deleteQuestion(topicId);
return delSubject(topicId);
})
.then((res) => {
if (res.code == 200) {
......@@ -171,7 +175,7 @@ export default {
type: "success",
});
}
return this.getQuestion({ courseId: this.courseId });
return this.getQuestion({ bankId: this.courseId });
})
.finally(() => {
this.loading = false;
......@@ -187,16 +191,17 @@ export default {
});
return;
}
changeLesson({ courseId: this.courseId, qualifiedNum: this.rightNum }).then(
(res) => {
if (res.code == 200) {
this.$message({
message: "答题合格数修改成功",
type: "success",
});
}
changeLesson({
courseId: this.courseId,
qualifiedNum: this.rightNum,
}).then((res) => {
if (res.code == 200) {
this.$message({
message: "答题合格数修改成功",
type: "success",
});
}
);
});
},
},
};
......
......@@ -5,8 +5,9 @@
ref="queryForm"
:inline="true"
label-width="68px"
>
<el-form-item label="课件类别" prop="courseType">
<!-- <el-form-item label="课件类别" prop="courseType">
<el-select
v-model="queryParams.courseType"
placeholder="请选择课程类型"
......@@ -20,7 +21,22 @@
:value="course.planId"
/>
</el-select>
</el-form-item>
</el-form-item> -->
<el-form-item
label="归属部门"
prop="deptId"
ref="treeItem"
>
<Treeselect
class="tree"
v-model="queryParams.deptId"
:options="deptOptions"
:show-count="true"
placeholder="请选择归属部门"
style="width:200px"
/>
</el-form-item>
<el-form-item label="名称" prop="courseName">
<el-input
v-model="queryParams.courseName"
......@@ -29,7 +45,7 @@
size="small"
/>
</el-form-item>
<el-form-item label="发布时间" prop="releaseTime">
<!-- <el-form-item label="发布时间" prop="releaseTime">
<el-date-picker
v-model="queryParams.releaseTime"
value-format="yyyy-MM-dd HH:mm:ss"
......@@ -38,7 +54,7 @@
default-time="12:00:00"
>
</el-date-picker>
</el-form-item>
</el-form-item> -->
<el-form-item>
<el-button
......@@ -68,7 +84,7 @@
</el-col>
</el-row>
<el-table v-loading="loading" :data="lessonsList">
<el-table v-loading="loading" :data="bankList">
<el-table-column label="题库序号" align="center" prop="bankNum" />
<el-table-column label="题库名称" align="center" prop="bankName">
</el-table-column>
......@@ -84,7 +100,7 @@
</template>
</el-table-column>
<el-table-column label="附件" align="center" prop="enclosure">
<!-- <el-table-column label="附件" align="center" prop="enclosure">
<template v-slot="{ row: { enclosure } }">
<a
v-if="enclosure && enclosure.indexOf('.txt') >= 0"
......@@ -94,7 +110,7 @@
>
<a v-else :href="enclosure" class="down-load">下载附件</a>
</template>
</el-table-column>
</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"
......@@ -173,26 +189,28 @@
</template>
<script>
import {
getLessons,
getLessonById,
issue,
deleteLesson,
} from "@/api/educationPlanExam/lessonsProgram.js";
import { listBank,delBank } from "@/api/system/questionBank.js";
// import {
// getLessons,
// getLessonById,
// issue,
// deleteLesson,
// } from "@/api/educationPlanExam/lessonsProgram.js";
import { listBank,delBank } from "@/api/educationPlanExam/questionBank";
// 部门列表
import { treeselect } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
// 获取课程类型
import { getPlanList } from "@/api/educationPlanExam/trainingProgram";
import { mapGetters, mapMutations } from "vuex";
// import { getPlanList } from "@/api/educationPlanExam/trainingProgram";
// import { mapGetters, mapMutations } from "vuex";
import Dia from "./components/Dia";
export default {
name: "",
name: "questionBank",
components: {
Dia,
Treeselect
},
data() {
return {
......@@ -201,13 +219,15 @@ export default {
// 总条数
total: 0,
// courseOptions: [],
lessonsList: [],
bankList: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
courseType: null,
courseName: null,
// 所属部门
deptId: null,
// 题库名称
bankName: null,
releaseTime: "",
},
// 表单参数
......@@ -226,16 +246,16 @@ export default {
};
},
computed: {
...mapGetters(["courseOptions"]),
// ...mapGetters(["courseOptions"]),
},
created() {
this.getPlanList();
// this.getPlanList();
this.getTreeselect();
this.getList();
},
methods: {
...mapMutations({ setOptions: "SET_COURSE_OPTIONS" }),
// ...mapMutations({ setOptions: "SET_COURSE_OPTIONS" }),
/** 查询部门下拉树结构 */
getTreeselect() {
treeselect().then((response) => {
......@@ -261,18 +281,18 @@ export default {
}
},
// 获取课程类别,也就是计划名称
getPlanList() {
getPlanList().then((res) => {
const courseOptions = res.data.map((item) => {
return {
planId: item.planId,
planName: item.planName,
};
});
// this.$store.commit("SET_COURSE_OPTIONS");
this.setOptions(courseOptions);
});
},
// getPlanList() {
// getPlanList().then((res) => {
// const courseOptions = res.data.map((item) => {
// return {
// planId: item.planId,
// planName: item.planName,
// };
// });
// // this.$store.commit("SET_COURSE_OPTIONS");
// this.setOptions(courseOptions);
// });
// },
/** 查询课程列表 */
getList() {
......@@ -280,7 +300,7 @@ export default {
listBank(this.queryParams)
.then((res) => {
console.log(res);
this.lessonsList = res.rows.map((item, index) => {
this.bankList = res.rows.map((item, index) => {
return {
bankNum:
index +
......@@ -400,79 +420,79 @@ export default {
if (!cellValue) return "-";
else return cellValue;
},
downloadText(url) {
// url = url.replace(/\\/g, "/");
const xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.responseType = "blob";
//xhr.setRequestHeader('Authorization', 'Basic a2VybWl0Omtlcm1pdA==');
xhr.onload = function () {
if (xhr.readyState === 4 && xhr.status === 200) {
let blob = this.response;
console.log(blob);
// 转换一个blob链接
// 注: URL.createObjectURL() 静态方法会创建一个 DOMString(DOMString 是一个UTF-16字符串),
// 其中包含一个表示参数中给出的对象的URL。这个URL的生命周期和创建它的窗口中的document绑定
let downLoadUrl = window.URL.createObjectURL(
new Blob([blob], {
type: "txt",
})
);
// 视频的type是video/mp4,图片是image/jpeg
// 01.创建a标签
let a = document.createElement("a");
// 02.给a标签的属性download设定名称
a.download = name;
// 03.设置下载的文件名
a.href = downLoadUrl;
// 04.对a标签做一个隐藏处理
a.style.display = "none";
// 05.向文档中添加a标签
document.body.appendChild(a);
// 06.启动点击事件
a.click();
// 07.下载完毕删除此标签
a.remove();
}
};
// downloadText(url) {
// // url = url.replace(/\\/g, "/");
// const xhr = new XMLHttpRequest();
// xhr.open("GET", url, true);
// xhr.responseType = "blob";
// //xhr.setRequestHeader('Authorization', 'Basic a2VybWl0Omtlcm1pdA==');
// xhr.onload = function () {
// if (xhr.readyState === 4 && xhr.status === 200) {
// let blob = this.response;
// console.log(blob);
// // 转换一个blob链接
// // 注: URL.createObjectURL() 静态方法会创建一个 DOMString(DOMString 是一个UTF-16字符串),
// // 其中包含一个表示参数中给出的对象的URL。这个URL的生命周期和创建它的窗口中的document绑定
// let downLoadUrl = window.URL.createObjectURL(
// new Blob([blob], {
// type: "txt",
// })
// );
// // 视频的type是video/mp4,图片是image/jpeg
// // 01.创建a标签
// let a = document.createElement("a");
// // 02.给a标签的属性download设定名称
// a.download = name;
// // 03.设置下载的文件名
// a.href = downLoadUrl;
// // 04.对a标签做一个隐藏处理
// a.style.display = "none";
// // 05.向文档中添加a标签
// document.body.appendChild(a);
// // 06.启动点击事件
// a.click();
// // 07.下载完毕删除此标签
// a.remove();
// }
// };
xhr.send();
},
downLoadVideo(url, name) {
var xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.responseType = "arraybuffer"; // 返回类型blob
xhr.onload = function () {
if (xhr.readyState === 4 && xhr.status === 200) {
let blob = this.response;
console.log(blob);
// 转换一个blob链接
// 注: URL.createObjectURL() 静态方法会创建一个 DOMString(DOMString 是一个UTF-16字符串),
// 其中包含一个表示参数中给出的对象的URL。这个URL的生命周期和创建它的窗口中的document绑定
let downLoadUrl = window.URL.createObjectURL(
new Blob([blob], {
type: "video/mp4",
})
);
// 视频的type是video/mp4,图片是image/jpeg
// 01.创建a标签
let a = document.createElement("a");
// 02.给a标签的属性download设定名称
a.download = name;
// 03.设置下载的文件名
a.href = downLoadUrl;
// 04.对a标签做一个隐藏处理
a.style.display = "none";
// 05.向文档中添加a标签
document.body.appendChild(a);
// 06.启动点击事件
a.click();
// 07.下载完毕删除此标签
a.remove();
}
};
xhr.send();
},
// xhr.send();
// },
// downLoadVideo(url, name) {
// var xhr = new XMLHttpRequest();
// xhr.open("GET", url, true);
// xhr.responseType = "arraybuffer"; // 返回类型blob
// xhr.onload = function () {
// if (xhr.readyState === 4 && xhr.status === 200) {
// let blob = this.response;
// console.log(blob);
// // 转换一个blob链接
// // 注: URL.createObjectURL() 静态方法会创建一个 DOMString(DOMString 是一个UTF-16字符串),
// // 其中包含一个表示参数中给出的对象的URL。这个URL的生命周期和创建它的窗口中的document绑定
// let downLoadUrl = window.URL.createObjectURL(
// new Blob([blob], {
// type: "video/mp4",
// })
// );
// // 视频的type是video/mp4,图片是image/jpeg
// // 01.创建a标签
// let a = document.createElement("a");
// // 02.给a标签的属性download设定名称
// a.download = name;
// // 03.设置下载的文件名
// a.href = downLoadUrl;
// // 04.对a标签做一个隐藏处理
// a.style.display = "none";
// // 05.向文档中添加a标签
// document.body.appendChild(a);
// // 06.启动点击事件
// a.click();
// // 07.下载完毕删除此标签
// a.remove();
// }
// };
// xhr.send();
// },
},
};
</script>
......
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