Commit b6c0064f authored by 罗超's avatar 罗超

Merge branch 'master' of http://gitlab.oytour.com/luochao/confucius into master

# Conflicts:
#	src/api/teacher/index.js
parents 94ea3ac4 48885fff
......@@ -291,3 +291,4 @@ export function DeletePaperDetails(data) {
data
})
}
......@@ -227,3 +227,51 @@ export function getExaminationStudentPage(data) {
data
})
}
/** 删除试卷、文件夹
* @param {*} data
*/
export function deletePaperInfo(data) {
return request({
url: '/Exam/DeletePaper',
method: 'post',
data
})
}
/**
* 复制试卷
* @param {*} data
*/
export function copyPaperInfo(data) {
return request({
url: '/Exam/CopyPaper',
method: 'post',
data
})
}
/**
* 获取文件夹树形结构
* @param {*} data
*/
export function queryFolderTree(data) {
return request({
url: '/Exam/GetFolderTree',
method: 'post',
data
})
}
/**
* 移动到文件夹
* @param {*} data
*/
export function movePaperInfo(data) {
return request({
url: '/Exam/MovePaper',
method: 'post',
data
})
}
<!--移动到文件夹-->
<template>
<q-dialog v-model="persistent" content-class="bg-grey-1" persistent transition-show="scale" transition-hide="scale">
<q-card style="width: 500px;max-width:500px;">
<q-card-section>
<div class="text-h6">移动至 (选择目标目录)</div>
</q-card-section>
<q-card-section class="q-pt-none scroll" style="max-height: 70vh">
<div>
<el-tree :data="dataList" show-checkbox node-key="PaperId" ref="paperFolderTree" highlight-current
:props="defaultProps" @check="checkChange">
</el-tree>
</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="closeSaveForm" />
<q-btn label="确认" color="accent" class="q-px-md" style="font-weight:400 !important" :loading="saveLoading"
@click="setMoveFolderInfo" />
</q-card-actions>
</q-card>
</q-dialog>
</template>
<script>
import {
queryFolderTree,
movePaperInfo,
savePaperFolderInfo
} from '../../api/teacher/index'
export default {
props: {
saveObj: {
type: Object,
default: null
}
},
data() {
return {
persistent: true,
objOption: {
PaperId: 0,
PaperName: '', //文件夹名称
PaperType: 1, //试卷类型(1-文件夹,2-试卷)
ParentId: 0, //上级文件夹编号
},
saveLoading: false,
defaultProps: {
children: 'ChildList',
label: 'PaperName'
},
dataList: [], //数据列表
//移动文件夹参数
moveMsg: {
PaperId: 0,
ParentId: 0,
},
}
},
created() {
if (this.saveObj && this.saveObj.PaperId) {
this.moveMsg.PaperId = this.saveObj.PaperId;
}
},
mounted() {
this.initObj();
},
methods: {
//选择改变
checkChange(data) {
var labvalojb = data; //暂存选中节点
this.$refs.paperFolderTree.setCheckedKeys([]); //删除所有选中节点
this.$refs.paperFolderTree.setCheckedNodes([labvalojb]); //选中已选中节点
},
initObj() {
queryFolderTree({}).then(res => {
if (res.Code == 1) {
this.dataList = res.Data;
}
})
},
closeSaveForm() {
this.$emit('close')
this.persistent = false
},
setMoveFolderInfo() {
this.saveLoading = true;
var checkArray = this.$refs.paperFolderTree.getCheckedNodes();
if (checkArray != null && checkArray.length > 0) {
this.moveMsg.ParentId = checkArray[0].PaperId;
} else {
this.$q.notify({
type: 'negative',
position: "top",
message: `请选择目标文件夹`
})
}
movePaperInfo(this.moveMsg).then(res => {
this.saveLoading = false
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '数据保存成功!',
position: 'top'
})
this.$emit("success")
this.closeSaveForm();
}).catch(() => {
this.saveLoading = false
})
},
},
}
</script>
<style>
</style>
......@@ -58,8 +58,7 @@
v-if="item.QuestionKey=='single' ||item.QuestionKey=='multiple'|| item.QuestionKey=='single-number'">
<tr v-for="(subItem,subIndex) in item.SubAnwser">
<td style="width:40px;text-align:center;">
<template
v-if="item.QuestionKey=='single'||item.QuestionKey=='multiple'|| item.QuestionKey=='single-number'">
<template v-if="item.QuestionKey=='single'||item.QuestionKey=='single-number'">
<div class="Answer_List" @click="ChangeItem(item,subItem)" :class="{'Is_Answer':subItem.IsAnswer}">
{{subItem.Name}}
</div>
......@@ -113,6 +112,7 @@
<template v-if="item.QuestionKey=='short-answer'">
<tr v-for="(subItem,subIndex) in item.SubAnwser">
<td colspan="3">
答案<br />
<UeEditor v-model="subItem.Content" :config="config"></UeEditor>
</td>
</tr>
......@@ -229,6 +229,7 @@
SubTitle: "", //题目内容
SubAnwser: ""
};
if (item.Key == "short-answer") {
qObj.SubAnwser = [];
qObj.SubAnwser.push({
......@@ -237,6 +238,7 @@
} else {
qObj.SubAnwser = CreateQuestion(item.Key);
}
console.log("qObj", qObj)
this.data.push(qObj);
},
//删除选项
......
......@@ -7,7 +7,6 @@
</style>
<template>
<div class="v_judgeQuestion">
{{data}}
<table v-if="data&&data.QuestionContentObj&&data.QuestionContentObj.length>0" class="common_TiTable">
<tbody v-for="(item,index) in data.QuestionContentObj" :key="index">
<tr>
......
......@@ -104,7 +104,7 @@
<template v-if="item.QuestionKey=='short-answer'">
<tr v-for="(subItem,subIndex) in item.SubAnwser">
<td colspan="3">
<div v-html="subItem.Content"></div>
答案: <div v-html="subItem.Content"></div>
</td>
</tr>
</template>
......
......@@ -129,21 +129,36 @@
<template v-if="scope.row.PaperType==2">
<q-btn flat size="xs" color="primary" style="font-weight:400" @click="goExameEdit(scope.row)"
label="编辑" />
<q-btn-dropdown flat size="xs" color="dark" label="更多" style="margin-left: 10px">
<q-list>
<q-item clickable v-close-popup @click="publishExam(scope.row)">
<q-item-section>
<q-item-label>发布考试</q-item-label>
</q-item-section>
</q-item>
<q-item clickable v-close-popup @click="showPaperInfo(scope.row)">
<q-item-section>
<q-item-label>详情</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
</template>
<q-btn-dropdown flat size="xs" color="dark" label="更多" style="margin-left: 10px">
<q-list>
<q-item clickable v-close-popup @click="publishExam(scope.row)" v-if="scope.row.PaperType==2">
<q-item-section>
<q-item-label>发布考试</q-item-label>
</q-item-section>
</q-item>
<q-item clickable v-close-popup @click="showPaperInfo(scope.row)" v-if="scope.row.PaperType==2">
<q-item-section>
<q-item-label>详情</q-item-label>
</q-item-section>
</q-item>
<q-item clickable v-close-popup @click="movePaperInfo(scope.row)">
<q-item-section>
<q-item-label>移动到</q-item-label>
</q-item-section>
</q-item>
<q-item clickable v-close-popup @click="copyPaperInfo(scope.row)" v-if="scope.row.PaperType==2">
<q-item-section>
<q-item-label>复制</q-item-label>
</q-item-section>
</q-item>
<q-item clickable v-close-popup @click="deletePaperInfo(scope.row)">
<q-item-section>
<q-item-label>删除</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
</template>
</el-table-column>
</el-table>
......@@ -152,17 +167,23 @@
</div>
<paperfolderForm v-if="isShowExamFolder" :saveObj="examObj"  @close="closeExamForm"  @success="refreshPage">
</paperfolderForm>
<movefolderForm v-if="isShowMoveFolder" :saveObj="examObj"  @close="closeExamForm"  @success="refreshPage">
</movefolderForm>
</div>
</template>
<script>
import paperfolderForm from '../../components/exam/paperfolder-form'
import movefolderForm from '../../components/exam/movefolder-form'
import {
GetPaperPage
GetPaperPage,
deletePaperInfo,
copyPaperInfo
} from '../../api/teacher/index';
//获取校区列表
export default {
components: {
paperfolderForm
paperfolderForm,
movefolderForm,
},
meta: {
title: "考试管理"
......@@ -181,6 +202,7 @@
dataList: [],
expandKeys: [],
isShowExamFolder: false, //是否显示新增文件夹
isShowMoveFolder: false, //是否显示
examObj: {}, //弹窗对象
}
},
......@@ -235,6 +257,7 @@
//关闭弹窗
closeExamForm() {
this.isShowExamFolder = false;
this.isShowMoveFolder = false;
},
//发布考试
publishExam(item) {
......@@ -255,6 +278,72 @@
this.OpenNewUrl('/exam/paperInfo', {
Id: PaperId
})
},
//移动到文件夹
movePaperInfo(item) {
this.examObj = item;
this.isShowMoveFolder = true;
},
//复制试卷
copyPaperInfo(item) {
var msg = {
PaperId: item.PaperId
}
var message = "是否要复制【" + item.PaperName + "】试卷?";
this.$q.dialog({
title: '提示信息',
message: message,
cancel: true,
persistent: true,
ok: "确定",
cancel: "取消",
}).onOk(() => {
copyPaperInfo(msg).then(res => {
if (res.Code == 1) {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '操作成功!',
position: 'top'
})
this.refreshPage();
}
});
})
},
//删除
deletePaperInfo(item) {
var msg = {
PaperId: item.PaperId
}
var message = "";
if (item.PaperType == 1) {
message = "是否要删除【" + item.PaperName + "】及下面的内容?";
} else {
message = "是否要删除【" + item.PaperName + "】试卷?"
}
this.$q.dialog({
title: '提示信息',
message: message,
cancel: true,
persistent: true,
ok: "确定",
cancel: "取消",
}).onOk(() => {
deletePaperInfo(msg).then(res => {
if (res.Code == 1) {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '操作成功!',
position: 'top'
})
this.refreshPage();
}
});
})
}
}
}
......
......@@ -895,46 +895,70 @@
}
}
//填空题
}
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 (this.DataObj.GroupList[k].QuestionTypeKey == 'fill-in'){
for (let i = 0; i < this.DataObj.GroupList[k].DetailsList.length; i++) {
if (this.DataObj.GroupList[k].DetailsList[i].Title == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `${this.DataObj.GroupList[k].GroupName}${i+1}题标题为空!`
})
result = false;
return;
}
for (let j = 0; j < this.DataObj.GroupList[k].DetailsList[i].QuestionContentObj.length; j++) {
if (this.DataObj.GroupList[k].DetailsList[i].QuestionContentObj[j].Content == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `请填写${this.DataObj.GroupList[k].GroupName}${i+1}空!`
})
result = false;
return;
}
}
}
}
}
if (num > 0) {
result = false;
} else {
result = true;
//判断题
if (this.DataObj.GroupList[k].QuestionTypeKey == 'judge'||this.DataObj.GroupList[k].QuestionTypeKey == 'reading-comprehensio'||
this.DataObj.GroupList[k].QuestionTypeKey == 'spoken'||this.DataObj.GroupList[k].QuestionTypeKey == 'other'||this.DataObj.GroupList[k].QuestionTypeKey == 'noun-explanation'){
for (let i = 0; i < this.DataObj.GroupList[k].DetailsList.length; i++) {
if (this.DataObj.GroupList[k].DetailsList[i].Title == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `${this.DataObj.GroupList[k].GroupName}${i+1}题标题为空!`
})
result = false;
return;
}
}
}
//简答题 论述题
if (this.DataObj.GroupList[k].QuestionTypeKey == 'short-answer'||this.DataObj.GroupList[k].QuestionTypeKey == 'essay-question'||
this.DataObj.GroupList[k].QuestionTypeKey == 'calculation'||this.DataObj.GroupList[k].QuestionTypeKey == 'entry-problem'){
for (let i = 0; i < this.DataObj.GroupList[k].DetailsList.length; i++) {
if (this.DataObj.GroupList[k].DetailsList[i].Title == '') {
this.$q.notify({
type: 'negative',
position: "top",
message: `${this.DataObj.GroupList[k].GroupName}${i+1}题标题为空!`
})
result = false;
return;
}
if(this.DataObj.GroupList[k].DetailsList[i].Answer == ''){
this.$q.notify({
type: 'negative',
position: "top",
message: `请输入${this.DataObj.GroupList[k].GroupName}${i+1}题答案`
})
result = false;
return;
}
}
}
}
return result;
},
......
<style>
.examPaper_Top {
width: 100%;
.examPaperInfo_Top {
height: 83px;
border-bottom: 1px solid #d9d9d9;
display: flex;
align-items: center;
justify-content: space-between;
margin: 0 100px;
}
.Exam-main {
width: 100%;
height: auto !important;
overflow: hidden;
margin-top: 20px;
margin: 20px 100px;
}
.Exam-left {
......@@ -221,14 +220,36 @@
color: #2961fe;
}
.pGroupName {
color: #202020;
font-size: 16px;
}
.paper_Title p {
display: inline;
}
.pGNameDiv {
font-size: 12px;
margin-top: 20px;
}
.Exam-main .common_TiTable {
border-spacing: 0;
}
.examPaperInfo_Top .vClozeQuestion .clozeTest_question_tit {
margin: 15px 0;
}
</style>
<template>
<div class="examPaper page-body">
<div class="examPaper_Top">
<div style="width:80%;display:flex;">
<div style="width:36%;margin-right:20px;">
<div class="examPaperInfo_Top">
<div>
<div>
{{DataObj.PaperName}} <br />
创建人: &nbsp;&nbsp;&nbsp;题量:{{examNum}} &nbsp;&nbsp;&nbsp; 满分:{{examScore}}
创建人:{{DataObj.CreateByName}} &nbsp;&nbsp;&nbsp;题量:{{examNum}} &nbsp;&nbsp;&nbsp; 满分:{{examScore}}
<q-checkbox size="xs" v-model="isShowAnswer" label="显示答案" />
</div>
</div>
......@@ -239,14 +260,14 @@
<div class="Exam-main">
<template v-if="DataObj&&DataObj.GroupList&&DataObj.GroupList.length>0">
<div v-for="(gItem,gIndex) in DataObj.GroupList" :key="gIndex">
<span>{{gIndex+1}}{{gItem.GroupName}} (共 {{gItem.DetailsList.length}} 题,{{gItem.GScore}}分)</span>
<div class="pGNameDiv"><span class="pGroupName">{{NoToChinese(gIndex+1)}}{{gItem.GroupName}}</span> (共
{{gItem.DetailsList.length}} 题,{{gItem.GScore}}分)</div>
<div v-for="(dItem,dIndex) in gItem.DetailsList" :key="dIndex">
<span>{{dIndex+1}}</span>
<span v-html="dItem.Title"></span>
<span>
<span class="paper_Title" v-html="dItem.Title"></span>
<span style="margin:10px 0;display:inline-block;">
({{dItem.Score}}分)
</span>
<br />
<!--单选题-->
<v-single v-if="dItem.QuestionTypeKey=='single'||dItem.QuestionTypeKey=='single-number'"
:questionObj="dItem" :isShowAnswer="isShowAnswer">
......@@ -345,6 +366,7 @@
PaperType: 2, //试卷类型(1-文件夹,2-试卷)
ParentId: 0, //父节点编号,
GroupList: [], //试卷答题分类
CreateByName: "", //创建人
},
isShowAnswer: false, //是否显示答案
examScore: 0, //总分,
......@@ -362,6 +384,35 @@
}
},
methods: {
NoToChinese(str) {
str = str + '';
var len = str.length - 1;
var idxs = ['', '十', '百', '千', '万', '十', '百', '千', '亿', '十', '百', '千', '万', '十', '百', '千', '亿'];
var num = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九'];
return str.replace(/([1-9]|0+)/g, function ($, $1, idx, full) {
var pos = 0;
if ($1[0] != '0') {
pos = len - idx;
if (idx == 0 && $1[0] == 1 && idxs[len - idx] == '十') {
return idxs[len - idx];
}
return num[$1[0]] + idxs[len - idx];
} else {
var left = len - idx;
var right = len - idx + $1.length;
if (Math.floor(right / 4) - Math.floor(left / 4) > 0) {
pos = left - left % 4;
}
if (pos) {
return idxs[pos] + num[$1[0]];
} else if (idx + $1.length >= len) {
return '';
} else {
return num[$1[0]]
}
}
});
},
//获取试卷详情
GetPaperInfo() {
GetPaper(this.msg).then(res => {
......@@ -375,6 +426,7 @@
this.DataObj.CreateNum = tempData.CreateNum;
this.DataObj.PaperType = tempData.PaperType;
this.DataObj.ParentId = tempData.ParentId;
this.DataObj.CreateByName = tempData.CreateByName;
if (tempData.GroupList && tempData.GroupList.length > 0) {
this.DataObj.GroupList = tempData.GroupList;
}
......
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