Commit cbbc85bc authored by 黄奎's avatar 黄奎

页面修改

parent f0aa4725
...@@ -102,146 +102,96 @@ ...@@ -102,146 +102,96 @@
</style> </style>
<template> <template>
<div> <div>
<q-card style="width: 1400px;max-width:900px;"> <q-card>
<q-card-section class="q-pt-none scroll" style="max-height: 70vh"> <q-card-section class="q-pt-none scroll">
<div class="row wrap"> <div class="row wrap">
<div class="col-12" v-if="objOption.QuestionId==0" style="margin-bottom:20px"> <div class="col-12 edit_stem">
题型 {{objOption.QuestionTypeName}}
<template v-for="(fItem,fIndex) in firstTypeList"> </div>
<q-btn :key="fIndex" color="accent" :label="fItem.Name" style="margin-left:5px;" <div class="col-12">
@click="onItemClick(fItem)" /> <div v-html="objOption.Title" @click="clickQuestion($event)"></div>
</template> </div>
<q-btn-dropdown color="accent" label="更多" style="margin-left:5px;"> <br />
<q-list> <!--单选题-->
<q-item v-for="(fItem,fIndex) in secondTypeList" @click="onItemClick(fItem)" clickable v-close-popup <v-single v-if="questionObj.Key=='single'||questionObj.Key=='single-number'" :questionData="AnswerList"
:key="fIndex"> @getChild="getChildData" :setOption="objOption"></v-single>
<q-item-section> <!--多选题-->
<q-item-label>{{fItem.Name}}</q-item-label> <v-multiple v-if="questionObj.Key=='multiple'" :questionData="AnswerList" @getChild="getChildData"
</q-item-section> :setOption="objOption"></v-multiple>
</q-item> <!--填空题-->
</q-list> <v-fillin v-if="questionObj.Key=='fill-in'" :questionData="AnswerList" @getChild="getChildData"
</q-btn-dropdown> :setOption="objOption"></v-fillin>
</div> <!--判断题-->
<div class="edit_stem"> <v-judge v-if="questionObj.Key=='judge'" :questionData="AnswerList" @getChild="getChildData"
{{questionName}} :setOption="objOption"></v-judge>
</div> <!--简答题、名词解释、论述题、计算题、口语题、其它-->
<div class="col-12"> <v-shortanswer v-if="questionObj.Key=='short-answer'||questionObj.Key=='noun-explanation'||questionObj.Key=='essay-question'
<template v-if="questionObj.Key=='cloze'">
<span class="question_number">选项处用##题号##替换,如##1##</span>
</template>
<div v-html="objOption.Title" @click="clickQuestion($event)"></div>
</div>
<br />
<!--单选题-->
<v-single v-if="questionObj.Key=='single'||questionObj.Key=='single-number'" :questionData="AnswerList"
@getChild="getChildData" :setOption="objOption"></v-single>
<!--多选题-->
<v-multiple v-if="questionObj.Key=='multiple'" :questionData="AnswerList" @getChild="getChildData"
:setOption="objOption"></v-multiple>
<!--填空题-->
<v-fillin v-if="questionObj.Key=='fill-in'" :questionData="AnswerList" @getChild="getChildData"
:setOption="objOption"></v-fillin>
<!--判断题-->
<v-judge v-if="questionObj.Key=='judge'" :questionData="AnswerList" @getChild="getChildData"
:setOption="objOption"></v-judge>
<!--简答题、名词解释、论述题、计算题、口语题、其它-->
<v-shortanswer v-if="questionObj.Key=='short-answer'||questionObj.Key=='noun-explanation'||questionObj.Key=='essay-question'
||questionObj.Key=='calculation' || questionObj.Key=='spoken'|| questionObj.Key=='other' ||questionObj.Key=='calculation' || questionObj.Key=='spoken'|| questionObj.Key=='other'
" :setOption="objOption"> </v-shortanswer> " :setOption="objOption"> </v-shortanswer>
<!--分录题、资料题--> <!--分录题、资料题-->
<v-entryproblem v-if="questionObj.Key=='entry-problem'|| questionObj.Key=='data-question'" <v-entryproblem v-if="questionObj.Key=='entry-problem'|| questionObj.Key=='data-question'"
:questionData="AnswerList" :setOption="objOption" @getChild="getChildData"> :questionData="AnswerList" :setOption="objOption" @getChild="getChildData">
</v-entryproblem> </v-entryproblem>
<!--连线题--> <!--连线题-->
<v-matching v-if="questionObj.Key=='matching'" :questionData="AnswerList" :setOption="objOption" <v-matching v-if="questionObj.Key=='matching'" :questionData="AnswerList" :setOption="objOption"
@getChild="getChildData"></v-matching> @getChild="getChildData"></v-matching>
<!--排序题--> <!--排序题-->
<v-sortingproblem v-if="questionObj.Key=='sorting-problem'" :questionData="AnswerList" :setOption="objOption" <v-sortingproblem v-if="questionObj.Key=='sorting-problem'" :questionData="AnswerList" :setOption="objOption"
@getChild="getChildData"></v-sortingproblem> @getChild="getChildData"></v-sortingproblem>
<!--完型填空--> <!--完型填空-->
<v-cloze v-if="questionObj.Key=='cloze'" :questionData="AnswerList" :setOption="objOption" <v-cloze v-if="questionObj.Key=='cloze'" :questionData="AnswerList" :setOption="objOption"
@getChild="getChildData"></v-cloze> @getChild="getChildData"></v-cloze>
<!--阅读理解、听力题--> <!--阅读理解、听力题-->
<v-readingcomprehensio v-if="questionObj.Key=='reading-comprehensio'||questionObj.Key=='listening'" <v-readingcomprehensio v-if="questionObj.Key=='reading-comprehensio'||questionObj.Key=='listening'"
:questionData="AnswerList" :setOption="objOption" @getChild="getChildData"></v-readingcomprehensio> :questionData="AnswerList" :setOption="objOption" @getChild="getChildData"></v-readingcomprehensio>
<!--共用选择题--> <!--共用选择题-->
<v-sharingchoose v-if="questionObj.Key=='sharing-choose'" :questionData="AnswerList" @getChild="getChildData" <v-sharingchoose v-if="questionObj.Key=='sharing-choose'" :questionData="AnswerList" @getChild="getChildData"
:setOption="objOption"> :setOption="objOption">
</v-sharingchoose> </v-sharingchoose>
<br />
<div class="col-12">
<div style="margin:20px 0;">答案解析</div>
<div v-html="objOption.AnswerParse"></div>
</div>
<br />
<div class="col-12">
<br /> <br />
<div class="col-12"> <span class="difficulty_Degree">难度</span>
<div style="margin:20px 0;">答案解析</div> <span>{{objOption.DifficultyTypeStr}}</span>
<div v-html="objOption.AnswerParse"></div> </div>
</div> <div class="col-12">
<br /> <br />
<div class="col-12"> <span class="difficulty_Degree">所属大类</span>
<br /> {{objOption.CategoryName}}
<span class="difficulty_Degree">难度</span> </div>
<span>{{objOption.DifficultyTypeStr}}</span> <div class="col-12">
<br />
</div> <span class="difficulty_Degree">考级程度</span>
<div class="col-12"> {{objOption.LevelTypeName}}
<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> </div>
</q-card-section> <div class="col-12" style="margin-top:16px;">
<q-separator /> <span class="difficulty_Degree">知识点: </span>
<q-card-actions align="right" class="bg-white"> <span class="knowledge_List" v-for="(x, i) in choosePointArray" :key="i">
<q-btn label="取消" flat color="grey-10" style="font-weight:400 !important" /> {{x.PointName}}
</q-card-actions> </span>
</q-card> </div>
<!--选择知识点--> </div>
<questionpoint v-if="isShowPoint" :CourseId="CourseId" :openDialog="isShowPoint" @closed="closeQuestionPoint" </q-card-section>
:multiple="true" @selected="getPointList"> <q-separator />
</questionpoint> <q-card-actions align="right" class="bg-white">
</div> <q-btn label="取消" flat color="grey-10" style="font-weight:400 !important" />
</q-card-actions>
</q-card>
</div>
</template> </template>
<script> <script>
import { import {
queryQuestionTypeList,
queryDifficultyType,
saveQuestion,
queryQuestionInfo, queryQuestionInfo,
queryQuestionCategory,
queryQuestionLevelType
} from '../../api/question/question' } from '../../api/question/question'
import {
CreateQuestion, //生成问题
} from '../../api/question/questionconfig'
import UeEditor from '../../components/editor/UeEditor'
//知识点列表
import questionpoint from '../../components/question/questionpoint'
import vSingle from '../../components/questiontype/v-single' import vSingle from '../../components/questiontype/v-single'
import vMultiple from '../../components/questiontype/v-multiple' import vMultiple from '../../components/questiontype/v-multiple'
import vFillIn from '../../components/questiontype/v-fillin' import vFillIn from '../../components/questiontype/v-fillin'
...@@ -255,8 +205,6 @@ ...@@ -255,8 +205,6 @@
import vSharingChoose from '../../components/questiontype/v-sharingchoose' import vSharingChoose from '../../components/questiontype/v-sharingchoose'
export default { export default {
components: { components: {
UeEditor,
questionpoint, //知识点
vSingle, //单选题 vSingle, //单选题
vMultiple, //多选题 vMultiple, //多选题
vFillIn, //填空题 vFillIn, //填空题
...@@ -285,11 +233,6 @@ ...@@ -285,11 +233,6 @@
}, },
data() { data() {
return { return {
config: {
initialFrameWidth: null,
initialFrameHeight: 80,
},
persistent: true,
objOption: { objOption: {
QuestionId: 0, //问题编号 QuestionId: 0, //问题编号
CourseId: 0, //课程编号 CourseId: 0, //课程编号
...@@ -306,114 +249,30 @@ ...@@ -306,114 +249,30 @@
IsMutex: 0, //填空题(答案顺序打乱也判正确) IsMutex: 0, //填空题(答案顺序打乱也判正确)
Category: 0, //大类 Category: 0, //大类
LevelType: 0, //考级程度 LevelType: 0, //考级程度
QuestionTypeName: "", //题目类型
CategoryName: "", //分类
DifficultyTypeStr: "", //难易程度
LevelTypeName: "", //考级程度
}, },
AnswerList: [], AnswerList: [],
optionTitle: "",
questionObj: {}, //题目类型对象 questionObj: {}, //题目类型对象
firstTypeList: [], //前5个数组
secondTypeList: [], //后面的题型
questionDifficultyTypeList: [], //问题难易程度列表
isShowPoint: false, //是否显示知识点弹窗
choosePointArray: [], //知识点列表 choosePointArray: [], //知识点列表
questionCategoryList: [], //问题大类
questionLevalTypeList: [],
} }
}, },
computed: { 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();
}, },
created() {},
mounted() { mounted() {
this.initObj() this.initObj()
}, },
methods: { 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) { getChildData(obj) {
if (obj) { if (obj) {
this.objOption.QuestionContent = JSON.stringify(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() { initObj() {
var qId = 0; var qId = 0;
...@@ -438,70 +297,30 @@ ...@@ -438,70 +297,30 @@
this.questionObj.QId = res.Data.QuestionTypeId; this.questionObj.QId = res.Data.QuestionTypeId;
this.objOption.Category = res.Data.Category; this.objOption.Category = res.Data.Category;
this.objOption.LevelType = res.Data.LevelType; this.objOption.LevelType = res.Data.LevelType;
this.objOption.QuestionTypeName = res.Data.QuestionTypeName;
this.objOption.CategoryName = res.Data.CategoryName;
this.objOption.DifficultyTypeStr = res.Data.DifficultyTypeStr;
this.objOption.LevelTypeName = res.Data.LevelTypeName;
if (res.Data.QuestionContentObj) { if (res.Data.QuestionContentObj) {
this.AnswerList = res.Data.QuestionContentObj; this.AnswerList = res.Data.QuestionContentObj;
this.objOption.QuestionContent = JSON.stringify(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) { if (res.Data.QuestionPointList && res.Data.QuestionPointList.length > 0) {
this.choosePointArray = res.Data.QuestionPointList; this.choosePointArray = res.Data.QuestionPointList;
} }
}) })
this.optionTitle = "修改问题信息"
}
},
//关闭弹窗
closeCourseForm() {
}, },
 clickQuestion(e) { //标题点击事件
        if ((e.target.nodeName == 'SPAN' || e.target.nodeName == 'P' || e.target.nodeName == 'IMG') && event.target clickQuestion(e) {
          .className == 'attachNew') { if ((e.target.nodeName == 'SPAN' || e.target.nodeName == 'P' || e.target.nodeName == 'IMG') && event.target
          var url = e.target.getAttribute("accesskey"); .className == 'attachNew') {
          if (url && url != '') { var url = e.target.getAttribute("accesskey");
            window.open(url) if (url && url != '') {
          } window.open(url)
        }
      },
//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;
} }
} }
......
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