Commit 0f4ec037 authored by zhengke's avatar zhengke

修改

parent 0b9cd057
......@@ -97,11 +97,25 @@
html += '<img src="' + e[i].fileUrl + '" style="max-width: 100%;">';
}
}
console.log(e,'文件');
if (this.uploadType == 2) {
for (let i in e) {
html +=
`<p><span contenteditable="false" style="display:-webkit-box;margin-top:10px;background: #F7F8FA;padding: 14px 16px;max-width: 572px;overflow: hidden;cursor:pointer;-webkit-box-align: center;text-align:left;cursor:pointer;" name="${e[i].fileName}" data="xls" data="996d63ec05ac942608319958a0fa3480">` +
`<img src="http://mooc2-ans.chaoxing.com/images/questionbank/icon/txt.png" style="width:42px; height:42px; overflow:hidden; margin-right:14px;border-radius:4px;">${e[i].fileName}</span></p>`
var type = e[i].fileName.split('.')[1];
if(type=='xlsx'||type=='xls'){
html +=
`<p><span contenteditable="false" style="display:-webkit-box;margin-top:10px;background: #F7F8FA;padding: 14px 16px;max-width: 572px;overflow: hidden;cursor:pointer;-webkit-box-align: center;text-align:left;cursor:pointer;" name="${e[i].fileName}" data="xls">` +
`<img src="http://mooc2-ans.chaoxing.com/images/questionbank/icon/excel.png" style="width:42px; height:42px; overflow:hidden; margin-right:14px;border-radius:4px;"><span style="font-size:14px; color:#181E33; line-height:20px; display:block; overflow:hidden; text-overflow:ellipsis;">${e[i].fileName}</span></span></p>`
}
if(type=='txt'){
html +=
`<p><span contenteditable="false" style="display:-webkit-box;margin-top:10px;background: #F7F8FA;padding: 14px 16px;max-width: 572px;overflow: hidden;cursor:pointer;-webkit-box-align: center;text-align:left;cursor:pointer;" name="${e[i].fileName}" data="xls">` +
`<img src="http://mooc2-ans.chaoxing.com/images/questionbank/icon/txt.png" style="width:42px; height:42px; overflow:hidden; margin-right:14px;border-radius:4px;"><span style="font-size:14px; color:#181E33; line-height:20px; display:block; overflow:hidden; text-overflow:ellipsis;">${e[i].fileName}</span></span></p>`
}
if(type=='ppt'||type=='pptx'){
html +=
`<p><span contenteditable="false" style="display:-webkit-box;margin-top:10px;background: #F7F8FA;padding: 14px 16px;max-width: 572px;overflow: hidden;cursor:pointer;-webkit-box-align: center;text-align:left;cursor:pointer;" name="${e[i].fileName}" data="xls">` +
`<img src="http://mooc2-ans.chaoxing.com/images/questionbank/icon/ppt.png" style="width:42px; height:42px; overflow:hidden; margin-right:14px;border-radius:4px;"><span style="font-size:14px; color:#181E33; line-height:20px; display:block; overflow:hidden; text-overflow:ellipsis;">${e[i].fileName}</span></span></p>`
}
}
}
this.ue.execCommand('inserthtml', html);
......
<style>
.edit_stem{
.edit_stem {
font-size: 14px;
color: #646873;
line-height: 34px;
......@@ -8,7 +8,8 @@
padding: 4px 0;
cursor: default;
}
.difficulty_Degree{
.difficulty_Degree {
display: inline-block;
width: 70px;
height: 26px;
......@@ -16,6 +17,7 @@
color: #181E33;
font-size: 13px;
}
.selectBox {
display: inline-block;
vertical-align: top;
......@@ -30,13 +32,15 @@
border-radius: 4px;
font-size: 12px;
color: #181E33;
}
.blue-border {
}
.blue-border {
border: 1px solid #FFFFFF;
box-shadow: 0 0 7px 1px #75BAFF;
outline: none;
}
.addKnowledge{
}
.addKnowledge {
display: inline-block;
width: 98px;
height: 28px;
......@@ -47,48 +51,55 @@
color: #91A0B5;
margin-right: 12px;
margin-bottom: 8px;
color:#CAD5E6;
color: #CAD5E6;
cursor: pointer;
font-size:12px;
font-size: 12px;
line-height: 24px;
}
.addKnowledge:hover {
}
.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;
}
}
.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>
<q-dialog v-model="persistent" persistent content-class="bg-grey-1" transition-show="scale" transition-hide="scale">
......@@ -128,14 +139,17 @@
</div>
<br />
<!--单选题-->
<single v-if="questionObj.Key=='single'" :questionData="AnswerList" @getChild="getChildData" :setOption="objOption"></single>
<single v-if="questionObj.Key=='single'||questionObj.Key=='single-number'" :questionData="AnswerList" @getChild="getChildData"
:setOption="objOption"></single>
<!--多选题-->
<multiple v-if="questionObj.Key=='multiple'" :questionData="AnswerList" @getChild="getChildData" :setOption="objOption"></multiple>
<multiple v-if="questionObj.Key=='multiple'" :questionData="AnswerList" @getChild="getChildData"
:setOption="objOption"></multiple>
<!--填空题-->
<fill-in v-if="questionObj.Key=='fill-in'" :questionData="AnswerList" @getChild="getChildData"
:setOption="objOption"></fill-in>
<!--判断题-->
<judge v-if="questionObj.Key=='judge'" :questionData="AnswerList" @getChild="getChildData" :setOption="objOption"></judge>
<judge v-if="questionObj.Key=='judge'" :questionData="AnswerList" @getChild="getChildData"
:setOption="objOption"></judge>
<!--简答题、名词解释、论述题、计算题、口语题、其它-->
<short-answer v-if="questionObj.Key=='short-answer'||questionObj.Key=='noun-explanation'||questionObj.Key=='essay-question'
||questionObj.Key=='calculation' || questionObj.Key=='spoken'|| questionObj.Key=='other'
......@@ -391,6 +405,7 @@
this.questionObj.QId = res.Data.QuestionTypeId;
if (res.Data.QuestionContentObj) {
this.AnswerList = res.Data.QuestionContentObj;
this.objOption.QuestionContent = JSON.stringify(res.Data.QuestionContent);
} else {
this.onItemClick(this.questionObj);
}
......@@ -421,31 +436,269 @@
},
//保存问题
setQuestion() {
var pointIds = "";
if (this.choosePointArray && this.choosePointArray.length > 0) {
this.choosePointArray.forEach(item => {
pointIds += ',' + item.PointId
});
//验证方法
console.log(this.objOption, 'objOption');
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
})
}
if (pointIds != '') {
pointIds = pointIds.substring(1);
},
//验证
validateType() {
//连线题
var result = true;
if (this.objOption.QuestionTypeKey == 'matching') {
if (this.objOption.QuestionContent) {
var myArr = JSON.parse(this.objOption.QuestionContent);
console.log(myArr, 'myArr');
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;
}
}
}
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
})
//公用选择题
if (this.objOption.QuestionTypeKey == 'sharing-choose') {
if (this.objOption.QuestionContent) {
var myArr = JSON.parse(this.objOption.QuestionContent);
console.log(myArr, 'myArr');
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);
console.log(myArr, 'myArr');
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);
// console.log(myArr,'myArr');
// 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:
}
console.log(Arr, 'arrrr');
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++;
}
}
}
console.log(num, 'numberrer');
if (num > 0) {
result = false;
} else {
result = true;
}
console.log(result, '返回');
return result;
}
},
}
......
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