This commit is contained in:
fan 2020-05-26 18:44:24 +08:00
commit 1aeb7e0d33
18 changed files with 518 additions and 147 deletions

View File

@ -1,10 +1,70 @@
import request from '@/utils/request';
/** 推送通知消息*/
export function listQuestionPage(data) {
// 分页查询理论试题
export function listQuestionPage(params) {
return request({
// url: `/api/pushMessage`,
// method: 'post',
// data: data
url: `/api/questionBank/questions/paging`,
method: 'get',
params
});
}
// 创建题目
export function createQuestion(data) {
return request({
url: `/api/questionBank/questions`,
method: 'post',
data
});
}
// 删除题目
export function deleteQuestion(questionId) {
return request({
url: `/api/questionBank/questions/${questionId}`,
method: 'delete'
});
}
// 更新题目
export function updateQuestion(questionId, data) {
return request({
url: `/api/questionBank/questions/${questionId}`,
method: 'put',
data
});
}
// 更新正确选项
export function updateAnswer(questionId, data) {
return request({
url: `/api/questionBank/questions/${questionId}/answer`,
method: 'put',
data
});
}
// 更新选项
export function updateOption(optionId, data) {
return request({
url: `/api/questionBank/questions/options/${optionId}`,
method: 'put',
data
});
}
// 获取题目信息
export function getQuestionInfo(questionId) {
return request({
url: `/api/questionBank/questions/${questionId}`,
method: 'get'
});
}
// 根据题目查询选项
export function getOptionsByQuestionId(questionId) {
return request({
url: `/api/questionBank/questions/${questionId}/options`,
method: 'get'
});
}

View File

@ -24,3 +24,20 @@ export function updateRace(id, data) {
data
});
}
/** 获取实操列表(题库)*/
export function getPracticeList() {
return request({
url: `/api/v1/competitionPractical/competition`,
method: 'get'
});
}
/** 获取单个实操详情(题库)*/
export function getPracticeByIdBasic() {
return request({
url: `/api/v1/competitionPractical/competition`,
method: 'get'
});
}

View File

@ -77,5 +77,7 @@ export default {
iscsSystem: 'Iscs System',
studentManage: 'Student manage',
examDetail: 'Exam detail',
raceManage: 'Race manage'
raceManage: 'Race manage',
practiceManage:'Practice manage',
bankManage: 'Bank manage'
};

View File

@ -83,5 +83,6 @@ export default {
examDetail: '考试详情',
raceManage: '竞赛管理',
recaList: '报名列表',
bankManage: '题库列表'
bankManage: '题库列表',
practiceManage:'实操列表'
};

File diff suppressed because one or more lines are too long

View File

@ -122,8 +122,9 @@ const RunPlanApproval = () => import('@/views/approval/runPlan/index');
const DeviceManage = () => import('@/views/system/deviceManage/index');
const MapSort = () => import('@/views/publish/publishMap/mapSort');
const StudentManage = () => import('@/views/studentManage');
const RaceManage = () => import('@/views/competitionManage/index');
const RaceManage = () => import('@/views/competitionManage/competition/index');
const BankManage = () => import('@/views/competitionManage/bankList/index');
const PracticeManage = () => import('@/views/competitionManage/practiceList/index');
const QuestionCreatePage = () => import('@/views/competitionManage/bankList/question-create-page');
const QuestionUpdatePage = () => import('@/views/competitionManage/bankList/question-update-page');
const GeneratePaper = () => import('@/views/competitionManage/generatePaper');
@ -941,6 +942,14 @@ export const asyncRouter = [
icon: 'design'
}
},
{
path: 'practice',
component: PracticeManage,
meta: {
i18n: 'router.practiceManage',
icon: 'design'
}
},
{
path: 'questionCreate',
component: QuestionCreatePage,

View File

@ -2,11 +2,11 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 张赛
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
// BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛

View File

@ -31,37 +31,37 @@
<script>
export default {
data() {
return {
show: false,
form: {
optionList: []
}
};
},
computed: {
title() {
return '详 情';
},
options() {
return this.form.optionList;
}
},
methods: {
checkType(option, type) {
return option.type == type;
},
appendIndex(str, index) {
return `${index+1}. ${str}`;
},
doShow(node) {
this.form = node.row||{};
this.show = true;
},
doClose(done) {
this.show = false;
}
}
data() {
return {
show: false,
form: {
optionList: []
}
};
},
computed: {
title() {
return '详 情';
},
options() {
return this.form.optionList;
}
},
methods: {
checkType(option, type) {
return option.type == type;
},
appendIndex(str, index) {
return `${index + 1}. ${str}`;
},
doShow(node) {
this.form = node.row || {};
this.show = true;
},
doClose(done) {
this.show = false;
}
}
};
</script>
<style lang="scss" scoped>

View File

@ -11,54 +11,54 @@
<script>
import ItemAnswer from './item-answer';
import { getOptionsByQuestionId} from '@/api/questionBank.js';
import { getOptionsByQuestionId } from '@/api/questionBank.js';
export default {
components: {
ItemAnswer
},
data() {
return {
show: false,
content: '',
optionList: [],
formParam: {}
};
},
computed: {
title() {
return '更新答案';
}
},
methods: {
doShow({index, row}) {
this.formParam = row;
this.content = row.topic;
getOptionsByQuestionId(row.id).then(resp => {
this.optionList = resp.data;
this.optionList.forEach((el, i) => {
if (el.correct) {
this.formParam.answer = i;
}
});
});
this.show = true;
},
doClose(done) {
this.show = false;
},
onAnswerChnage(answer) {
this.optionList.forEach((el, i) => { el.correct = i == answer; });
},
doUpdate() {
const index = this.optionList.findIndex((el, i) => { return i == this.formParam.answer; });
if (index >= 0) {
const answer = this.optionList[index];
this.$emit('updateAnswer', {questionId: answer.questionId, id: answer.id, correct: answer.correct});
}
this.doClose();
}
}
components: {
ItemAnswer
},
data() {
return {
show: false,
content: '',
optionList: [],
formParam: {}
};
},
computed: {
title() {
return '更新答案';
}
},
methods: {
doShow({index, row}) {
this.formParam = row;
this.content = row.topic;
getOptionsByQuestionId(row.id).then(resp => {
this.optionList = resp.data;
this.optionList.forEach((el, i) => {
if (el.correct) {
this.formParam.answer = i;
}
});
});
this.show = true;
},
doClose(done) {
this.show = false;
},
onAnswerChnage(answer) {
this.optionList.forEach((el, i) => { el.correct = i == answer; });
},
doUpdate() {
const index = this.optionList.findIndex((el, i) => { return i == this.formParam.answer; });
if (index >= 0) {
const answer = this.optionList[index];
this.$emit('updateAnswer', {questionId: answer.questionId, id: answer.id, correct: answer.correct});
}
this.doClose();
}
}
};
</script>

View File

@ -11,32 +11,32 @@
<script>
export default {
data() {
return {
show: false,
content: '',
formParam: null
};
},
computed: {
title() {
return '更新题目';
}
},
methods: {
doShow({index, row}) {
this.formParam = row;
this.content = row.topic;
this.show = true;
},
doClose(done) {
this.show = false;
},
doInput() {
this.formParam.topic = this.content;
this.$emit('updateQuestion', this.formParam);
this.doClose();
}
}
data() {
return {
show: false,
content: '',
formParam: null
};
},
computed: {
title() {
return '更新题目';
}
},
methods: {
doShow({index, row}) {
this.formParam = row;
this.content = row.topic;
this.show = true;
},
doClose(done) {
this.show = false;
},
doInput() {
this.formParam.topic = this.content;
this.$emit('updateQuestion', this.formParam);
this.doClose();
}
}
};
</script>

View File

@ -9,7 +9,7 @@
<script>
import { UrlConfig } from '@/scripts/ConstDic';
import { listQuestionPage } from '@/api/questionBank.js';
import { listQuestionPage, deleteQuestion, updateQuestion, updateAnswer } from '@/api/questionBank.js';
import DialogUpdateQuestion from './dialog-update-question';
import DialogUpdateAnswer from './dialog-update-answer';
import DialogDetail from './dialog-detail';
@ -48,6 +48,10 @@ export default {
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '题 目',
prop: 'topic'
},
{
title: '类 型',
prop: 'type',
@ -58,10 +62,6 @@ export default {
return '';
}
},
{
title: '题 目',
prop: 'topic'
},
{
title: '答 案',
prop: 'answer',
@ -72,6 +72,11 @@ export default {
return '';
}
},
{
title: '分值',
prop: 'score',
width: '100'
},
{
title: '创建人',
prop: 'createUserName',
@ -85,31 +90,31 @@ export default {
{
name: '更新题目',
handleClick: this.doUpdateQuestion,
showControl: (row) => { return row.createUserId == this.userId; },
// showControl: (row) => { return row.createUserId == this.userId; },
type: 'success'
},
{
name: '更新选项',
handleClick: this.doupdateAnswers,
showControl: (row) => { return row.createUserId == this.userId && row.type != 'judge'; },
// showControl: (row) => { return row.createUserId == this.userId && row.type != 'judge'; },
type: 'success'
},
{
name: '更新答案',
handleClick: this.doUpdateAnswer,
showControl: (row) => { return row.createUserId == this.userId; },
// showControl: (row) => { return row.createUserId == this.userId; },
type: 'success'
},
{
name: '删 除',
handleClick: this.doDelete,
showControl: (row) => { return row.createUserId == this.userId; },
// showControl: (row) => { return row.createUserId == this.userId; },
type: 'danger'
},
{
name: '预 览',
handleClick: this.doDetail,
showControl: (row) => { return row.createUserId != this.userId; }
handleClick: this.doDetail
// showControl: (row) => { return row.createUserId != this.userId; }
}
]
}
@ -130,10 +135,6 @@ export default {
this.$router.push({path: `${UrlConfig.bank.questionCreate}`});
},
doUpdate(index, row) {
this.$router.push({path: `${UrlConfig.bank.questionModify}/${row.id}`});
},
doUpdateQuestion(index, row) {
this.$refs.question.doShow({index, row});
},
@ -152,11 +153,11 @@ export default {
cancelButtonText: '取 消',
type: 'warning'
}).then(() => {
// deleteQuestion(row.id).then(resp => {
// this.reloadTable();
// }).catch(error => {
// this.$message.error(`: ${error.message}`);
// });
deleteQuestion(row.id).then(resp => {
this.reloadTable();
}).catch(error => {
this.$message.error(`删除试题失败: ${error.message}`);
});
}).catch( () => { });
},
@ -165,20 +166,19 @@ export default {
},
updateQuestion(form) {
// updateQuestion(form.id, form).then(resp => {
// this.reloadTable();
// }).catch(error => {
// this.$message.error(`: ${error.message}`);
// });
updateQuestion(form.id, form).then(resp => {
this.reloadTable();
}).catch(error => {
this.$message.error(`修改问题失败: ${error.message}`);
});
},
updateAnswer(form) {
// updateAnswer(form.questionId, form).then(resp => {
// this.reloadTable();
// }).catch(error => {
// this.$message.error(`: ${error.message}`);
// });
updateAnswer(form.questionId, form).then(resp => {
this.reloadTable();
}).catch(error => {
this.$message.error(`修改答案失败: ${error.message}`);
});
},
answerTags(row) {
const answer = [];

View File

@ -32,6 +32,7 @@ export default {
topic: '',
type: 'select',
answer: 0,
score: '',
optionList: []
}
};
@ -61,6 +62,7 @@ export default {
create() {
this.$refs.info.validate().then(valid => {
if (valid) {
// console.log(this.formModel);
createQuestion(this.formModel).then(resp => {
authUtils.setSessionStorage(this.path, JSON.stringify({
type: this.formModel.type
@ -84,6 +86,7 @@ export default {
&__container {
width: 55%;
margin: auto;
padding:20px 0px;
&-header {
margin-bottom: 10px;
.step-group {

View File

@ -1,6 +1,9 @@
<template>
<div>
<el-form ref="form" :model="option" :rules="rules" label-width="80px">
<el-form-item label="分 值" prop="score">
<el-input v-model="option.score" placeholder="请输入分值" style="width: 200px;" />
</el-form-item>
<el-form-item label="类 型" prop="type">
<el-select v-model="option.type" :disabled="disabled" placeholder="请选择试题类型" @change="onTypeChnage">
<el-option v-for="it in QuestionTypeList" :key="it.value" :label="it.label" :value="it.value" />
@ -87,6 +90,10 @@ export default {
topic: [
{ required: true, message: '请输入试题内容', trigger: 'blur' }
],
score: [
{ required: true, message: '请输入试题分值', trigger: 'blur' },
{ validator: this.validateScore, trigger: 'blur' }
],
type: [
{ required: true, message: '请输入试题类型', trigger: 'change' }
],
@ -112,6 +119,16 @@ export default {
this.option.optionList = this.templateMap[type]();
}
},
validateScore(rule, value, callback) {
if (Number(value) <= 0) {
callback(new Error('请输入正确的分值'));
} else if (Number(value)) {
this.option.score = Number(value);
callback();
} else {
callback(new Error('请输入数字'));
}
},
onAnswerChnage(answer) {
this.option.optionList.forEach((el, i) => { el.correct = i == answer; });
},

View File

@ -28,7 +28,8 @@ export default {
id: '',
topic: '',
type: '',
answer: 0
answer: 0,
score: ''
},
optionList: []
};

View File

@ -3,6 +3,7 @@
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<create-race ref="createRace" :map-list="mapList" @refresh="refresh" />
<input id="competition-manage-url" v-model="url" style="opacity: 0;">
<div id="bm" ref="bm" />
</div>
</template>

View File

@ -0,0 +1,110 @@
<template>
<el-dialog :title="title" :visible.sync="dialogVisible" width="500px" :before-close="doClose" center>
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doCreate">{{ $t('global.confirm') }}</el-button>
<el-button @click="doClose">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { getPracticeByIdBasic} from '@/api/race';
export default {
name: 'ScriptDraft',
props: {
title: {
type: String,
default() {
return '';
}
}
},
data() {
return {
dialogVisible: false,
mapList: [],
taskStatusList: [],
formModel: {
name: '',
mapId: '',
description:''
}
};
},
computed: {
form() {
const form = {
labelWidth: '120px',
items: [
{ prop: 'name', label: '实操名称', type: 'text' },
{ prop: 'description', label: '实操描述', type: 'textarea' }
]
};
return form;
},
rules() {
const crules = {
name: [
{ validator: this.validateScriptName, trigger: 'blur' },
{ validator: this.validateScriptName, trigger: 'change' }
],
description: [
{ validator: this.validateDescription, trigger: 'blur' },
{ validator: this.validateDescription, trigger: 'change' }
]
};
return crules;
}
},
methods: {
validateScriptName(rule, value, callback) {
if (value.trim().length === 0) {
this.formModel.name = this.formModel.name.replace(/\s/g, '');
return callback(new Error('请输入实操名称'));
} else {
return callback();
}
},
validateDescription(rule, value, callback) {
if (value.trim().length === 0) {
this.formModel.description = this.formModel.description.replace(/\s/g, '');
return callback(new Error('请输入实操描述'));
} else {
return callback();
}
},
doShow(questid) {
if (questid) {
getPracticeByIdBasic(questid).then(resp=>{
const data = {'name':resp.data.name, 'description':resp.data.description, 'mapId':resp.data.mapId};
this.formModel = data;
this.formModel.id = questid;
this.dialogVisible = true;
});
} else {
this.formModel.mapId = this.$route.params.mapId;
this.dialogVisible = true;
}
},
doCreate() {
const self = this;
this.$refs.dataform.validateForm(() => {
self.$emit('create', Object.assign({}, this.formModel));
self.doClose();
});
},
doClose() {
this.$refs.dataform.resetForm();
this.dialogVisible = false;
}
}
};
</script>
<style lang="scss" scoped>
/deep/ .el-dialog--center .el-dialog__body{
padding: 25px 65px 30px 10px;
}
</style>

View File

@ -0,0 +1,150 @@
<template>
<div>
<query-list-page ref="user" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<create-practice ref="createPractice" title="创建实操" @reloadTable="reloadTable" @create="handleConfirmCreate" />
<create-practice ref="modifyPractice" title="修改实操" @reloadTable="reloadTable" @create="handleConfirmModify" />
</div>
</template>
<script>
import { getPracticeList, getRaceList } from '@/api/race';
import CreatePractice from './create';
export default {
name:'PracticeManage',
components:{
CreatePractice
},
data() {
return {
raceList:[],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
reset: true,
labelWidth: '80px',
queryObject: {
raceId: {
type: 'select',
label: '竞赛名称',
config: {
data: []
}
},
name: {
type: 'text',
label: '实操名称'
}
}
},
queryList: {
// query: getPracticeList,
data:[
{id:1, raceId:2, name:'行调进行扣车操作', creatorName:'水墨'},
{id:2, raceId:4, name:'行调进行扣车操作', creatorName:'zyy'},
{id:3, raceId:3, name:'行调进行扣车操作', creatorName:'水墨'}
],
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '竞赛名称',
prop: 'raceId',
type: 'tag',
width: '320',
columnValue: (row) => { return this.getRaceName(row.raceId); },
tagType: (row) => {
return '';
}
},
{
title: '实操名称',
prop: 'name'
},
{
title: '创建人',
prop: 'creatorName',
width: '100'
},
{
type: 'button',
title: '操 作',
width: '420',
buttons: [
{
name: '录 制',
handleClick: this.doRecord,
type: 'success'
},
{
name: '更 新',
handleClick: this.doUpdate,
type: 'primary'
},
{
name: '删 除',
handleClick: this.doDelete,
type: 'danger'
},
{
name: '预 览',
handleClick: this.doDetail
}
]
}
],
actions: [
{ text: '添 加', handler: this.doCreate }
]
}
};
},
mounted() {
getRaceList({pageSize:999, pageNum:1}).then(res=>{
this.raceList = res.data.list;
this.queryForm.queryObject.raceId.config.data = [];
this.raceList.forEach(each=>{
this.queryForm.queryObject.raceId.config.data.push({label:each.name, value:each.id});
});
});
},
methods:{
doCreate() {
this.$refs.createPractice.doShow(null);
},
doDetail() {
},
doDelete() {
},
doRecord() {
},
//
doUpdate(index, row) {
this.$refs.modifyPractice.doShow(row.id);
},
getRaceName(raceId) {
let raceName = '';
this.raceList.forEach(each=>{
if (each.id == raceId) {
raceName = each.name;
}
});
return raceName;
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
},
handleConfirmCreate() {
},
handleConfirmModify() {
}
}
};
</script>