Commit 459dbe9a authored by zhengke's avatar zhengke

修改

parent bc7dead5
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
</template> </template>
<template v-slot:body-cell-Title="props"> <template v-slot:body-cell-Title="props">
<td style="width:400px;"> <td style="width:400px;">
<div v-html="props.row.Title" class="quetion_Title"> <div @click="goDetail(props.row)" v-html="props.row.Title" class="quetion_Title">
</div> </div>
</td> </td>
</template> </template>
...@@ -500,6 +500,12 @@ ...@@ -500,6 +500,12 @@
} }
}); });
}); });
},
//点击跳转
goDetail(item){
this.OpenNewUrl('questionInfo',{
'QuestionId':item.QuestionId
})
} }
} }
} }
......
<style>
.edit_stem {
font-size: 14px;
color: #646873;
line-height: 34px;
/* margin-bottom: 16px; */
overflow: hidden;
padding: 4px 0;
cursor: default;
}
.difficulty_Degree {
display: inline-block;
width: 70px;
height: 26px;
line-height: 26px;
color: #181E33;
font-size: 13px;
}
.selectBox {
display: inline-block;
vertical-align: top;
text-align: left;
position: relative;
cursor: pointer;
width: 75px;
line-height: 24px;
height: 24px;
background: #FFFFFF;
border: 1px solid #E1E1E5;
border-radius: 4px;
font-size: 12px;
color: #181E33;
}
.blue-border {
border: 1px solid #FFFFFF;
box-shadow: 0 0 7px 1px #75BAFF;
outline: none;
}
.addKnowledge {
display: inline-block;
width: 98px;
height: 28px;
border-radius: 4px;
border: 1px dashed #E1EAF4;
text-align: center;
line-height: 28px;
color: #91A0B5;
margin-right: 12px;
margin-bottom: 8px;
color: #CAD5E6;
cursor: pointer;
font-size: 12px;
line-height: 24px;
}
.addKnowledge:hover {
opacity: 0.7;
}
.knowledge_List {
display: inline-block;
padding: 0 14px;
height: 28px;
border-radius: 4px;
border: 1px dashed #E1EAF4;
text-align: center;
line-height: 28px;
color: #91A0B5;
margin-right: 12px;
margin-bottom: 8px;
position: relative;
cursor: pointer;
}
.knowledge_List:hover {
color: rgba(139, 146, 166, 0.7);
}
.knowledge_List:hover i {
display: block !important;
}
.knowledge_List i {
position: absolute;
font-size: 15px;
display: none;
right: -8px;
top: -10px;
}
.question_number {
color: #A8A8B3;
font-size: 12px;
margin-top: -8px;
padding-bottom: 12px;
display: inline-block;
}
</style>
<template>
<div>
<q-card style="width: 1400px;max-width:900px;">
<q-card-section>
<div class="text-h6">{{objOption.QuestionId==0?'新增问题信息':'修改问题信息'}}</div>
</q-card-section>
<q-card-section class="q-pt-none scroll" style="max-height: 70vh">
<div class="row wrap">
<div class="col-12" v-html="objOption.Title"></div>
<div class="edit_stem">
{{questionName}}
</div>
<div class="col-12">
<template v-if="questionObj.Key=='cloze'">
<span class="question_number">选项处用##题号##替换,如##1##</span>
</template>
<UeEditor v-if="questionObj.Key!='sharing-choose'" v-model="objOption.Title" :config="config"
ref="UE_Title"></UeEditor>
</div>
<br />
<div class="col-12">
<div style="margin:20px 0;">答案解析</div>
<UeEditor v-model="objOption.AnswerParse" :config="config" ref="AnswerParse"></UeEditor>
</div>
<br />
<div class="col-12">
<br />
<span class="difficulty_Degree">难度</span>
<select v-model="objOption.DifficultyType" class="selectBox blue-border">
<template v-for="(cItem,cIndex) in questionDifficultyTypeList">
<option :key="cIndex" :label="cItem.Name" :value="cItem.Id">
</option>
</template>
</select>
</div>
<div class="col-12">
<br />
<span class="difficulty_Degree">所属大类</span>
<select v-model="objOption.Category" class="selectBox blue-border">
<template v-for="(cItem,cIndex) in questionCategoryList">
<option :key="cIndex" :label="cItem.Name" :value="cItem.Id">
</option>
</template>
</select>
</div>
<div class="col-12">
<br />
<span class="difficulty_Degree">考级程度</span>
<select v-model="objOption.LevelType" class="selectBox blue-border">
<template v-for="(cItem,cIndex) in questionLevalTypeList">
<option :key="cIndex" :label="cItem.Name" :value="cItem.Id">
</option>
</template>
</select>
</div>
<div class="col-12" style="margin-top:16px;">
<span class="difficulty_Degree">知识点: </span>
<a class="addKnowledge" @click="isShowPoint=true">
<i class="iconfont icon-add" style="position:relative;top:1px;"></i>选择知识点
</a>
<span class="knowledge_List" v-for="(x, i) in choosePointArray" :key="i">
{{x.PointName}}
<i class="iconfont icon-shanchu1" @click="removePointTag(i)"></i>
</span>
</div>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white">
<q-btn label="取消" flat color="grey-10" style="font-weight:400 !important" @click="closeCourseForm" />
<q-btn label="立即提交" color="accent q-px-md" style="font-weight:400 !important" :loading="saveCourseLoading"
@click="setQuestion" />
</q-card-actions>
</q-card>
</div>
</template>
<script>
import {
queryQuestionTypeList,
queryDifficultyType,
saveQuestion,
queryQuestionInfo,
queryQuestionCategory,
queryQuestionLevelType
} from '../../api/question/question'
import {
CreateQuestion, //生成问题
} from '../../api/question/questionconfig'
import UeEditor from '../../components/editor/UeEditor'
//知识点列表
export default {
components: {},
props: {
setingObj: {
type: Object,
default: null
},
CourseId: {
type: Number, //课程编号
default: 0,
},
BankId: {
type: String, //题库编号
default: "0",
}
},
data() {
return {
config: {
initialFrameWidth: null,
initialFrameHeight: 80,
},
persistent: true,
objOption: {
QuestionId: 0, //问题编号
CourseId: 0, //课程编号
BankId: 0, //题库编号
Title: "", //问题名称
DifficultyType: 1, //难易程度
AnswerParse: "", //答案解析JSON
QuestionTypeId: 0, //问题类型
QuestionTypeKey: "", //问题类型Key
Knowledge: "", //知识点编号
IsUpdateJobExam: 0, //是否同步修改引用此题目的作业和考试(1-是)
SortNum: 0, //排序
Answer: "", //问题JSON
IsMutex: 0, //填空题(答案顺序打乱也判正确)
Category: 0, //大类
LevelType: 0, //考级程度
},
AnswerList: [],
optionTitle: "",
questionObj: {}, //题目类型对象
firstTypeList: [], //前5个数组
secondTypeList: [], //后面的题型
questionDifficultyTypeList: [], //问题难易程度列表
saveCourseLoading: false,
isShowPoint: false, //是否显示知识点弹窗
choosePointArray: [], //知识点列表
questionCategoryList: [], //问题大类
questionLevalTypeList: [],
}
},
computed: {
questionName: {
get() {
var str = "";
var sumData = [];
sumData = sumData.concat(this.firstTypeList).concat(this.secondTypeList);
if (sumData && sumData.length > 0) {
sumData.forEach(item => {
if (item.Key == this.objOption.QuestionTypeKey) {
str = item.Name;
}
})
}
return str;
},
},
},
created() {
this.getQuestionType();
this.getDifficultyType();
this.getQuestionCategory();
this.getQuestionLevelType();
},
mounted() {
if (this.$route.query.QuestionId) {
let QuestionId = this.$route.query.QuestionId;
this.initObj(QuestionId);
}
},
methods: {
//获取问题大类
getQuestionCategory() {
queryQuestionCategory().then(res => {
this.questionCategoryList = res.Data;
})
},
//获取问题考级程度
getQuestionLevelType() {
queryQuestionLevelType().then(res => {
this.questionLevalTypeList = res.Data;
})
},
//移除知识点
removePointTag(index) {
this.choosePointArray.splice(index, 1);
},
//获取知识点列表
getPointList(obj) {
if (obj && obj.length > 0) {
if (this.choosePointArray && this.choosePointArray.length > 0) {
this.choosePointArray = this.choosePointArray.concat(obj);
} else {
this.choosePointArray = obj;
}
}
},
//关闭知识点弹窗
closeQuestionPoint() {
this.isShowPoint = false;
},
//获取子组件内容
getChildData(obj) {
if (obj) {
this.objOption.QuestionContent = JSON.stringify(obj);
}
},
//题型点击
onItemClick(item) {
this.AnswerList = [];
this.questionObj = item;
this.objOption.QuestionTypeId = item.QId;
this.objOption.QuestionTypeKey = item.Key;
var obj = CreateQuestion(item.Key);
this.AnswerList = obj;
if (obj) {
this.objOption.QuestionContent = JSON.stringify(obj);
}
},
//获取题型列表
getQuestionType() {
queryQuestionTypeList({}).then(res => {
if (res.Code == 1) {
var tempArray = res.Data;
if (tempArray && tempArray.length > 0) {
this.firstTypeList = tempArray.slice(0, 5);
this.secondTypeList = tempArray.slice(5);
}
}
});
},
//获取问题难易程度列表
getDifficultyType() {
queryDifficultyType().then(res => {
if (res.Code == 1) {
this.questionDifficultyTypeList = res.Data;
}
});
},
//初始化表单
initObj(id) {
this.objOption.CourseId = this.CourseId;
this.objOption.BankId = this.BankId;
queryQuestionInfo({
QuestionId: id
}).then(res => {
this.objOption.QuestionId = res.Data.QuestionId;
this.objOption.Title = res.Data.Title;
this.objOption.DifficultyType = res.Data.DifficultyType;
this.objOption.AnswerParse = res.Data.AnswerParse;
this.objOption.QuestionTypeId = res.Data.QuestionTypeId;
this.objOption.QuestionTypeKey = res.Data.QuestionTypeKey;
this.objOption.Knowledge = res.Data.Knowledge;
this.objOption.IsUpdateJobExam = res.Data.IsUpdateJobExam;
this.objOption.SortNum = res.Data.SortNum;
this.objOption.Answer = res.Data.Answer;
this.objOption.IsMutex = res.Data.IsMutex;
this.questionObj.Key = res.Data.QuestionTypeKey;
this.questionObj.QId = res.Data.QuestionTypeId;
this.objOption.Category = res.Data.Category;
this.objOption.LevelType = res.Data.LevelType;
this.objOption.Title = res.Data.Title;
if (res.Data.QuestionContentObj) {
this.AnswerList = res.Data.QuestionContentObj;
this.objOption.QuestionContent = JSON.stringify(res.Data.QuestionContentObj);
} else {
this.onItemClick(this.questionObj);
}
if (res.Data.QuestionPointList && res.Data.QuestionPointList.length > 0) {
this.choosePointArray = res.Data.QuestionPointList;
}
})
},
//关闭弹窗
closeCourseForm() {
this.$emit('close')
this.persistent = false
},
//保存问题
setQuestion() {
//验证方法
if (this.validateType()) {
var pointIds = "";
if (this.choosePointArray && this.choosePointArray.length > 0) {
this.choosePointArray.forEach(item => {
pointIds += ',' + item.PointId
});
}
if (pointIds != '') {
pointIds = pointIds.substring(1);
}
this.objOption.Knowledge = pointIds;
this.saveCourseLoading = true;
saveQuestion(this.objOption).then(res => {
this.saveCourseLoading = false
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '数据保存成功!',
position: 'top'
})
this.$emit("success")
this.closeSaveForm()
}).catch(() => {
this.saveCourseLoading = false
})
}
},
//验证
validateType() {
//连线题
var result = true;
if (this.objOption.QuestionTypeKey == 'matching') {
if (this.objOption.QuestionContent) {
var myArr = JSON.parse(this.objOption.QuestionContent);
for (var i = 0; i < myArr[0].length; i++) {
if (myArr[0][i].Content == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `第一组第${i+1}行数据内容为空!`
})
result = false;
return;
}
}
if (this.isRepeat(myArr[0], 1)) {
result = this.isRepeat(myArr[0], 1);
} else {
return;
}
for (var i = 0; i < myArr[1].length; i++) {
if (myArr[1][i].Content == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `第二组第${i+1}行数据内容为空!`
})
result = false;
return;
}
}
if (this.isRepeat(myArr[1], 2)) {
result = this.isRepeat(myArr[1], 2);
} else {
return;
}
}
}
//公用选择题
if (this.objOption.QuestionTypeKey == 'sharing-choose') {
if (this.objOption.QuestionContent) {
var myArr = JSON.parse(this.objOption.QuestionContent);
for (var i = 0; i < myArr[0].length; i++) {
if (myArr[0][i].Content == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `选项内容不能为空!`
})
result = false;
return;
}
}
if (this.isRepeat(myArr[0], 3)) {
result = this.isRepeat(myArr[0], 3);
} else {
return;
}
for (var i = 0; i < myArr[1].length; i++) {
if (myArr[1][i].Content == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `题干内容不能为空!`
})
result = false;
return;
}
}
if (this.isRepeat(myArr[1], 4)) {
result = this.isRepeat(myArr[1], 4);
} else {
return;
}
}
}
//其他何口语题
if (this.objOption.QuestionTypeKey == 'other' || this.objOption.QuestionTypeKey == 'spoken') {
if (this.objOption.Title == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `请输入试题的题干`
})
result = false;
return;
}
}
//听力题 阅读理解
if (this.objOption.QuestionTypeKey == 'listening' || this.objOption.QuestionTypeKey == 'reading-comprehensio') {
if (this.objOption.QuestionContent) {
var myArr = JSON.parse(this.objOption.QuestionContent);
for (var i = 0; i < myArr.length; i++) {
if (myArr[i].SubTitle == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `请输入第${i+1}小题题干!`
})
result = false;
return;
}
for (var j = 0; j < myArr[i].SubAnwser.length; j++) {
if (myArr[i].SubAnwser[j].Content === '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `请输入第${i+1}小题选项`
})
result = false;
return;
}
}
if (this.isRepeat(myArr[i].SubAnwser, 3)) {
result = this.isRepeat(myArr[i].SubAnwser, 3);
} else {
return;
}
}
}
}
//口语题
if (this.objOption.QuestionTypeKey == 'spoken') {
if (this.objOption.Title == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `请输入试题的题干`
})
result = false;
return;
}
}
//阅读理解
if (this.objOption.QuestionTypeKey == 'cloze') {
if (this.objOption.Title == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `请输入试题的题干`
})
result = false;
return;
}
if (this.objOption.QuestionContent) {
var myArr = JSON.parse(this.objOption.QuestionContent);
for (var i = 0; i < myArr.length; i++) {
for (var j = 0; j < myArr[i].length; j++)
if (myArr[i][j].Content === '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `请输入第${i+1}小题选项`
})
result = false;
return;
}
if (this.isRepeat(myArr[i], 3)) {
result = this.isRepeat(myArr[i], 3);
} else {
return;
}
}
}
}
//排序题
if (this.objOption.QuestionTypeKey == 'sorting-problem') {
if (this.objOption.Title == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `请输入试题的题干`
})
result = false;
return;
}
if (this.objOption.QuestionContent) {
var myArr = JSON.parse(this.objOption.QuestionContent);
for (var i = 0; i < myArr[0].length; i++) {
if (myArr[0].Content == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `请输入试题选项`
})
result = false;
return;
}
if (this.isRepeat(myArr[0], 3)) {
result = this.isRepeat(myArr[0], 3);
} else {
return;
}
}
}
}
//资料提 分录题 多选题
if (this.objOption.QuestionTypeKey == 'data-question' || this.objOption.QuestionTypeKey == 'entry-problem' ||
this.objOption.QuestionTypeKey == 'multiple' ||
this.objOption.QuestionTypeKey == 'single') {
if (this.objOption.Title == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `请输入题干!`
})
result = false;
return;
}
if (this.objOption.QuestionContent) {
var myArr = JSON.parse(this.objOption.QuestionContent);
for (var i = 0; i < myArr.length; i++) {
if (myArr[i].Content == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `请输入第${i+1}的选项!`
})
result = false;
return;
}
if (this.isRepeat(myArr, 3)) {
result = this.isRepeat(myArr, 3);
} else {
return;
}
}
}
}
//计算题
if (this.objOption.QuestionTypeKey == 'calculation' || this.objOption.QuestionTypeKey == 'essay-question' ||
this.objOption.QuestionTypeKey == 'noun-explanation') {
if (this.objOption.Title == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `请输入题干!`
})
result = false;
return;
}
if (this.objOption.Answer == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `请输入回答!`
})
result = false;
return;
}
}
//判断题
if (this.objOption.QuestionTypeKey == 'judge') {
if (this.objOption.Title == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `请输入题干!`
})
result = false;
return;
}
}
return result;
},
//js 判断重复
isRepeat(Arr, type) {
var result = true;
var msg = '';
switch (type) {
case 1:
msg = '第1组数据选项不能相同'
break;
case 2:
msg = '第2组数据选项不能相同'
break;
case 3:
msg = '选项内容不能相同'
break;
case 4:
msg = '题干内容不能相同!';
break;
default:
}
let num = 0;
for (var i = 0; i < Arr.length - 1; i++) {
for (var j = i + 1; j < Arr.length; j++) {
if (Arr[i].Content === Arr[j].Content) {
this.$q.notify({
type: 'negative',
position: "top",
message: msg
})
num++;
}
}
}
if (num > 0) {
result = false;
} else {
result = true;
}
return result;
}
},
}
</script>
...@@ -510,6 +510,11 @@ const routes = [{ ...@@ -510,6 +510,11 @@ const routes = [{
component: () => component: () =>
import("pages/course/question.vue") import("pages/course/question.vue")
}, },
{
path: "/course/questionInfo", //题库详情
component: () =>
import("pages/course/questionInfo.vue")
},
{ {
path: "/sale/quotation", //报价单 path: "/sale/quotation", //报价单
component: () => component: () =>
......
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