Commit cbbc85bc authored by 黄奎's avatar 黄奎

页面修改

parent f0aa4725
...@@ -103,35 +103,14 @@ ...@@ -103,35 +103,14 @@
</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">
<q-btn :key="fIndex" color="accent" :label="fItem.Name" style="margin-left:5px;"
@click="onItemClick(fItem)" />
</template>
<q-btn-dropdown color="accent" label="更多" style="margin-left:5px;">
<q-list>
<q-item v-for="(fItem,fIndex) in secondTypeList" @click="onItemClick(fItem)" clickable v-close-popup
:key="fIndex">
<q-item-section>
<q-item-label>{{fItem.Name}}</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
</div>
<div class="edit_stem">
{{questionName}}
</div> </div>
<div class="col-12"> <div class="col-12">
<template v-if="questionObj.Key=='cloze'">
<span class="question_number">选项处用##题号##替换,如##1##</span>
</template>
<div v-html="objOption.Title" @click="clickQuestion($event)"></div> <div v-html="objOption.Title" @click="clickQuestion($event)"></div>
</div> </div>
<br /> <br />
<!--单选题--> <!--单选题-->
...@@ -180,36 +159,21 @@ ...@@ -180,36 +159,21 @@
<br /> <br />
<span class="difficulty_Degree">难度</span> <span class="difficulty_Degree">难度</span>
<span>{{objOption.DifficultyTypeStr}}</span> <span>{{objOption.DifficultyTypeStr}}</span>
</div> </div>
<div class="col-12"> <div class="col-12">
<br /> <br />
<span class="difficulty_Degree">所属大类</span> <span class="difficulty_Degree">所属大类</span>
<select v-model="objOption.Category" class="selectBox blue-border"> {{objOption.CategoryName}}
<template v-for="(cItem,cIndex) in questionCategoryList">
<option :key="cIndex" :label="cItem.Name" :value="cItem.Id">
</option>
</template>
</select>
</div> </div>
<div class="col-12"> <div class="col-12">
<br /> <br />
<span class="difficulty_Degree">考级程度</span> <span class="difficulty_Degree">考级程度</span>
<select v-model="objOption.LevelType" class="selectBox blue-border"> {{objOption.LevelTypeName}}
<template v-for="(cItem,cIndex) in questionLevalTypeList">
<option :key="cIndex" :label="cItem.Name" :value="cItem.Id">
</option>
</template>
</select>
</div> </div>
<div class="col-12" style="margin-top:16px;"> <div class="col-12" style="margin-top:16px;">
<span class="difficulty_Degree">知识点: </span> <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"> <span class="knowledge_List" v-for="(x, i) in choosePointArray" :key="i">
{{x.PointName}} {{x.PointName}}
<i class="iconfont icon-shanchu1" @click="removePointTag(i)"></i>
</span> </span>
</div> </div>
</div> </div>
...@@ -219,28 +183,14 @@ ...@@ -219,28 +183,14 @@
<q-btn label="取消" flat color="grey-10" style="font-weight:400 !important" /> <q-btn label="取消" flat color="grey-10" style="font-weight:400 !important" />
</q-card-actions> </q-card-actions>
</q-card> </q-card>
<!--选择知识点-->
<questionpoint v-if="isShowPoint" :CourseId="CourseId" :openDialog="isShowPoint" @closed="closeQuestionPoint"
:multiple="true" @selected="getPointList">
</questionpoint>
</div> </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'
...@@ -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