试卷考试添加倒计时,倒计时结束提交试卷&试卷规则调整
This commit is contained in:
parent
2d1558b011
commit
516a3a4041
@ -269,12 +269,12 @@ export function generateExam(pcId) {
|
||||
}
|
||||
|
||||
/** 删除用户试卷 */
|
||||
export function deleteUserExam(param) {
|
||||
return request({
|
||||
url: `/api/v2/paper/user/${puId}`,
|
||||
method: 'method'
|
||||
});
|
||||
}
|
||||
// export function deleteUserExam(param) {
|
||||
// return request({
|
||||
// url: `/api/v2/paper/user/${puId}`,
|
||||
// method: 'DELETE'
|
||||
// });
|
||||
// }
|
||||
|
||||
/** 获取用户试卷完整信息
|
||||
* @param {Number} puId 用户试卷Id
|
||||
|
@ -27,7 +27,7 @@ export function handlerUrl() {
|
||||
// BASE_API = 'https://joylink.club/jlcloud';
|
||||
// BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
// BASE_API = 'http://114.116.51.125/jlcloud';
|
||||
// BASE_API = 'http://192.168.3.90:9000'; // 周寅
|
||||
BASE_API = 'http://192.168.3.47:9000'; // 周寅
|
||||
// BASE_API = 'http://192.168.3.94:9000'; // 旭强
|
||||
// BASE_API = 'http://192.168.3.15:9000'; // 张赛
|
||||
// BASE_API = 'http://192.168.3.5:9000'; // 夏增彬
|
||||
|
@ -3,6 +3,7 @@
|
||||
<div class="header">
|
||||
<div>满分: {{ composition.fullScore }}</div>
|
||||
<div>考试时间: {{ composition.validDuration }}分钟</div>
|
||||
<div>剩余时间:{{ countdown }}</div>
|
||||
</div>
|
||||
<!-- <div class="legend-area">
|
||||
<div class="legend">
|
||||
@ -82,11 +83,16 @@ export default {
|
||||
questionStateList: [[], []],
|
||||
currentQuestionIndex: 0,
|
||||
currentQuestionType: 1, // 1-理论, 2-实训
|
||||
examSceneRuleMap: {}
|
||||
examSceneRuleMap: {},
|
||||
examStartTime: 0,
|
||||
serverStartTime: 0,
|
||||
examInterval: null,
|
||||
countdown: '00:00:00'
|
||||
};
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$store.dispatch('trainingNew/setExamSwitch', false);
|
||||
if (this.examInterval) { clearInterval(this.examInterval); }
|
||||
},
|
||||
mounted() {
|
||||
EventBus.$on('trainExamSubmit', (data) => {
|
||||
@ -124,6 +130,36 @@ export default {
|
||||
});
|
||||
}
|
||||
});
|
||||
this.serverStartTime = data.systemTime;
|
||||
this.examStartTime = new Date().getTime();
|
||||
let hours = Math.floor(this.composition.validDuration / 60);
|
||||
let mins = this.composition.validDuration % 60;
|
||||
if (hours < 10) { hours = '0' + hours; }
|
||||
if (mins < 10) { mins = '0' + mins; }
|
||||
this.countdown = `${hours}:${mins}:00`;
|
||||
this.examInterval = setInterval(() => {
|
||||
const nowTime = new Date().getTime();
|
||||
const downTime = this.composition.validDuration * 60 * 1000 + this.examStartTime - nowTime;
|
||||
if (downTime <= 0) {
|
||||
clearInterval(this.examInterval);
|
||||
this.countdown = '00:00:00';
|
||||
this.$alert('考试时间已到,点击确定提交试卷', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
showClose: false,
|
||||
callback: () => {
|
||||
this.execSubmit();
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
let hours = Math.floor(downTime / (1000 * 60 * 60));
|
||||
let mins = Math.floor((downTime - (hours * 100 * 60 * 60)) / (1000 * 60));
|
||||
let seconds = Math.floor((downTime - (hours * 100 * 60 * 60) - (mins * 1000 * 60 )) / 1000);
|
||||
if (hours < 10) { hours = '0' + hours; }
|
||||
if (mins < 10) { mins = '0' + mins; }
|
||||
if (seconds < 10) { seconds = '0' + seconds; }
|
||||
this.countdown = `${hours}:${mins}:${seconds}`;
|
||||
}, 1000);
|
||||
this.paper = data.paper;
|
||||
this.questionList = [
|
||||
data.questionList.filter(e => e.type === 1),
|
||||
@ -175,30 +211,34 @@ export default {
|
||||
this.currentQuestionIndex--;
|
||||
}
|
||||
},
|
||||
submitExam() {
|
||||
const execSubmit = () => {
|
||||
submitPaper(this.paper.id).then(resp => {
|
||||
const { score, passScore, commonScore, trainingScore } = resp.data;
|
||||
const pass = score >= passScore;
|
||||
this.$alert(
|
||||
`${pass ? '恭喜您考试合格' : '考试不通过'}
|
||||
execSubmit() {
|
||||
submitPaper(this.paper.id).then(resp => {
|
||||
const { score, passScore, commonScore, trainingScore } = resp.data;
|
||||
const pass = score >= passScore;
|
||||
this.$alert(
|
||||
`${pass ? '恭喜您考试合格' : '考试不通过'}
|
||||
总分: ${score}
|
||||
理论: ${commonScore}
|
||||
实训: ${trainingScore}`,
|
||||
'考试结果'
|
||||
).then(() => {
|
||||
this.show = false;
|
||||
this.$store.dispatch('trainingNew/setExamSwitch', false);
|
||||
});
|
||||
'考试结果'
|
||||
).then(() => {
|
||||
this.show = false;
|
||||
this.$store.dispatch('trainingNew/setExamSwitch', false);
|
||||
});
|
||||
};
|
||||
});
|
||||
},
|
||||
submitExam() {
|
||||
if (this.examInterval) {
|
||||
clearInterval(this.examInterval);
|
||||
this.countdown = '00:00:00';
|
||||
}
|
||||
const finished = this.questionStateList.every(list => list.every(item => item === true));
|
||||
if (!finished) {
|
||||
this.$confirm('您还有题目未答完, 确认交卷吗?').then(() => {
|
||||
execSubmit();
|
||||
this.execSubmit();
|
||||
});
|
||||
} else {
|
||||
execSubmit();
|
||||
this.execSubmit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,6 @@ export default {
|
||||
mapId: this.$route.query.mapId,
|
||||
findState: 3
|
||||
}).then(resp => {
|
||||
console.log(resp);
|
||||
this.paperList = resp.data.list;
|
||||
});
|
||||
},
|
||||
|
@ -1,91 +1,102 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-dialogDrag
|
||||
:title="title"
|
||||
width="600px"
|
||||
:visible.sync="dialogShow"
|
||||
:before-close="handleCancel"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="140px">
|
||||
<el-form-item label="试题类型" prop="type">
|
||||
<el-select v-model="form.type" placeholder="请选择试题类型" style="width:240px;" @change="clearSubtype">
|
||||
<el-option v-for="item in types" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="规则类型" prop="subtype">
|
||||
<el-select
|
||||
v-model="form.subtype"
|
||||
placeholder="请选择规则类型"
|
||||
style="width:240px;"
|
||||
@change="subTypesChange"
|
||||
>
|
||||
<el-option v-for="item in subtypes" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="标签" required>
|
||||
<el-select v-model="form.tags" @change="getQuestionAmount">
|
||||
<el-option v-for="item in labels" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.subtype === 5" label="场景实训">
|
||||
<el-row style="border: 1px solid #DCDFE6;width: 400px;">
|
||||
<el-col :span="12" style="border-right: 1px solid #DCDFE6;overflow: hidden;text-align: center;"
|
||||
>场景实训名称</el-col
|
||||
>
|
||||
<el-col :span="12" style="text-align: center;">扮演角色</el-col>
|
||||
</el-row>
|
||||
<template v-for="scene in sceneTrainMap">
|
||||
<el-row :key="scene.id" style="border: 1px solid #DCDFE6;width: 400px;border-top: 0;">
|
||||
<el-col :span="12" style="border-right: 1px solid #DCDFE6;overflow: hidden;">
|
||||
<el-radio v-model="scene.check" :label="true" style="margin-left: 10px;">{{
|
||||
scene.name
|
||||
}}</el-radio>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-select
|
||||
v-model="scene.cosplayId"
|
||||
:disabled="!scene.check"
|
||||
size="mini"
|
||||
style="margin-left: 10px;"
|
||||
placeholder="请选择扮演角色"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in totalMemberList"
|
||||
v-show="scene.playerIdList.includes(item.value)"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
</el-form-item>
|
||||
<el-form-item v-show="form.subtype !== 5" label="题目数量" prop="amount">
|
||||
<el-input-number
|
||||
v-model="form.amount"
|
||||
:min="0"
|
||||
style="width: 200px; float: left; margin-right: 10px;"
|
||||
<el-dialog
|
||||
v-dialogDrag
|
||||
:title="title"
|
||||
width="600px"
|
||||
:visible.sync="dialogShow"
|
||||
:before-close="handleCancel"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="140px">
|
||||
<el-form-item label="试题类型" prop="type">
|
||||
<el-select v-model="form.type" placeholder="请选择试题类型" style="width:240px;" @change="clearSubtype">
|
||||
<el-option v-for="item in types" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="规则类型" prop="subtype">
|
||||
<el-select
|
||||
v-model="form.subtype"
|
||||
placeholder="请选择规则类型"
|
||||
style="width:240px;"
|
||||
@change="subTypesChange"
|
||||
>
|
||||
<el-option v-for="item in subtypes" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.subtype === 4" label="客户端" prop="trainingClient">
|
||||
<el-select
|
||||
v-model="form.trainingClient"
|
||||
placeholder="请选择客户端"
|
||||
style="width:240px;"
|
||||
@change="trainingClientChange"
|
||||
>
|
||||
<el-option v-for="item in clients" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="操作" required>
|
||||
<el-select v-model="form.tags" @change="getQuestionAmount">
|
||||
<el-option v-for="item in labels" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.subtype === 5" label="场景实训">
|
||||
<el-row style="border: 1px solid #DCDFE6;width: 400px;">
|
||||
<el-col
|
||||
:span="12"
|
||||
style="border-right: 1px solid #DCDFE6;overflow: hidden;text-align: center;"
|
||||
>场景实训名称</el-col>
|
||||
<el-col :span="12" style="text-align: center;">扮演角色</el-col>
|
||||
</el-row>
|
||||
<template v-for="scene in sceneTrainMap">
|
||||
<el-row :key="scene.id" style="border: 1px solid #DCDFE6;width: 400px;border-top: 0;">
|
||||
<el-col :span="12" style="border-right: 1px solid #DCDFE6;overflow: hidden;">
|
||||
<el-radio v-model="scene.check" :label="true" style="margin-left: 10px;">{{
|
||||
scene.name
|
||||
}}</el-radio>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-select
|
||||
v-model="scene.cosplayId"
|
||||
:disabled="!scene.check"
|
||||
size="mini"
|
||||
style="margin-left: 10px;"
|
||||
placeholder="请选择扮演角色"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in totalMemberList"
|
||||
v-show="scene.playerIdList.includes(item.value)"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
<span style="width: 190px; float: left;">
|
||||
{{ $t('publish.allNumberTipOne') }} {{ topicNum }} {{ $t('publish.allNumberTipTwo') }}
|
||||
</span>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('publish.scorePerQuestion')" prop="score">
|
||||
<el-input-number v-model="form.score" :precision="0" :min="0" style="width:200px" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="handleCancel">{{ $t('global.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="handleOk">{{ $t('global.confirm') }}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</el-select>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
</el-form-item>
|
||||
<el-form-item v-show="form.subtype !== 5" label="题目数量" prop="amount">
|
||||
<el-input-number
|
||||
v-model="form.amount"
|
||||
:min="0"
|
||||
style="width: 200px; float: left; margin-right: 10px;"
|
||||
/>
|
||||
<span style="width: 190px; float: left;">
|
||||
{{ $t('publish.allNumberTipOne') }} {{ topicNum }} {{ $t('publish.allNumberTipTwo') }}
|
||||
</span>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('publish.scorePerQuestion')" prop="score">
|
||||
<el-input-number v-model="form.score" :precision="0" :min="0" style="width:200px" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="handleCancel">{{ $t('global.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="handleOk">{{ $t('global.confirm') }}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getQuestionAmount, queryTagList } from '@/api/management/exam'
|
||||
import { getPublishTrainingListInOrg } from '@/api/jmap/training'
|
||||
import { getQuestionAmount, queryTagList } from '@/api/management/exam';
|
||||
import { getPublishTrainingListInOrg } from '@/api/jmap/training';
|
||||
|
||||
export default {
|
||||
name: 'EditRule',
|
||||
@ -93,53 +104,59 @@ export default {
|
||||
ruleList: {
|
||||
type: Array,
|
||||
default() {
|
||||
return []
|
||||
},
|
||||
return [];
|
||||
}
|
||||
},
|
||||
examData: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {}
|
||||
},
|
||||
return {};
|
||||
}
|
||||
},
|
||||
totalMemberList: {
|
||||
type: Array,
|
||||
default() {
|
||||
return []
|
||||
},
|
||||
return [];
|
||||
}
|
||||
},
|
||||
mapOptionList: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
var number = (rule, value, message) => {
|
||||
if (this.form.subtype !== 5) {
|
||||
if (!value) {
|
||||
return message(new Error(this.$t('publish.inputQuestionNumber')))
|
||||
return message(new Error(this.$t('publish.inputQuestionNumber')));
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (Number(value) == 0) {
|
||||
message(new Error(this.$t('publish.inputQuestionNumberError')))
|
||||
message(new Error(this.$t('publish.inputQuestionNumberError')));
|
||||
} else if (!Number(value)) {
|
||||
message(new Error(this.$t('publish.inputValidNumber')))
|
||||
message(new Error(this.$t('publish.inputValidNumber')));
|
||||
} else if (Number(value) > this.topicNum) {
|
||||
message(new Error(this.$t('publish.inputNumberError')))
|
||||
message(new Error(this.$t('publish.inputNumberError')));
|
||||
} else {
|
||||
message()
|
||||
message();
|
||||
}
|
||||
}, 100)
|
||||
}, 100);
|
||||
} else {
|
||||
message()
|
||||
message();
|
||||
}
|
||||
}
|
||||
};
|
||||
var score = (rule, value, message) => {
|
||||
if (!value) {
|
||||
return message(new Error(this.$t('publish.inputScorePerQuestion')))
|
||||
return message(new Error(this.$t('publish.inputScorePerQuestion')));
|
||||
} else {
|
||||
message()
|
||||
message();
|
||||
}
|
||||
}
|
||||
};
|
||||
const tagsValidator = (rule, value, message) => {
|
||||
message()
|
||||
}
|
||||
message();
|
||||
};
|
||||
return {
|
||||
form: {
|
||||
id: '',
|
||||
@ -148,7 +165,9 @@ export default {
|
||||
tags: '',
|
||||
amount: 1,
|
||||
score: 1,
|
||||
trainingClient: ''
|
||||
},
|
||||
clients: [],
|
||||
sceneInfo: [],
|
||||
labels: [],
|
||||
topicNum: 0,
|
||||
@ -161,48 +180,62 @@ export default {
|
||||
amount: [{ required: true, validator: number, trigger: 'blur' }],
|
||||
score: [{ required: true, validator: score, trigger: 'blur' }],
|
||||
tags: [{ validator: tagsValidator, trigger: 'blur' }],
|
||||
},
|
||||
}
|
||||
trainingClient: [{ required: true, message:'请选择实训客户端', trigger: 'change' }]
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
types() {
|
||||
return [{ value: 1, label: '理论题' }, { value: 2, label: '实训题' }]
|
||||
return [{ value: 1, label: '理论题' }, { value: 2, label: '实训题' }];
|
||||
},
|
||||
subtypes() {
|
||||
const data = {
|
||||
'1': [{ value: 1, label: '单选题' }, { value: 2, label: '多选题' }, { value: 3, label: '判断题' }],
|
||||
'2': [{ value: 4, label: '单操实训' }, { value: 5, label: '场景实训' }],
|
||||
}
|
||||
return data[this.form.type]
|
||||
'2': [{ value: 4, label: '单操实训' }, { value: 5, label: '场景实训' }]
|
||||
};
|
||||
return data[this.form.type];
|
||||
},
|
||||
title() {
|
||||
return this.isEditMode ? this.$t('publish.modifyRules') : this.$t('publish.addRules')
|
||||
},
|
||||
return this.isEditMode ? this.$t('publish.modifyRules') : this.$t('publish.addRules');
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
show(detail) {
|
||||
this.dialogShow = true
|
||||
this.dialogShow = true;
|
||||
const mapDetail = this.mapOptionList.find(item => item.id === this.examData.mapId);
|
||||
if (mapDetail && mapDetail.lineCode === '14') {
|
||||
this.clients = [
|
||||
{ label: '轨道详览', value: 'troDetailWork' },
|
||||
{ label: '现地客户端', value: 'localWork' }
|
||||
];
|
||||
} else {
|
||||
this.clients = [
|
||||
{ label: '行调客户端', value: 'dispatchWork' },
|
||||
{ label: '现地客户端', value: 'localWork' }
|
||||
];
|
||||
}
|
||||
console.log(this.clients, '*******');
|
||||
this.$nextTick(() => {
|
||||
this.$refs.form.resetFields()
|
||||
this.$refs.form.resetFields();
|
||||
if (detail) {
|
||||
this.isEditMode = true
|
||||
this.index = detail.index
|
||||
this.sceneInfo = detail.sceneInfo || []
|
||||
this.isEditMode = true;
|
||||
this.index = detail.index;
|
||||
this.sceneInfo = detail.sceneInfo || [];
|
||||
this.form = {
|
||||
type: detail.type,
|
||||
subtype: detail.subtype,
|
||||
amount: detail.amount,
|
||||
score: detail.score,
|
||||
id: detail.id || '',
|
||||
tags: detail.tags ? detail.tags[0] : '',
|
||||
}
|
||||
tags: detail.tags ? detail.tags[0] : ''
|
||||
};
|
||||
this.fillLabelsOption().then(() => {
|
||||
this.getQuestionAmount()
|
||||
})
|
||||
this.getQuestionAmount();
|
||||
});
|
||||
} else {
|
||||
this.isEditMode = false
|
||||
this.isEditMode = false;
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
isDuplicated() {
|
||||
const isDuplicated =
|
||||
@ -214,13 +247,18 @@ export default {
|
||||
rule.tags &&
|
||||
this.form.tags &&
|
||||
rule.tags.includes(this.form.tags)
|
||||
)
|
||||
return isDuplicated
|
||||
);
|
||||
return isDuplicated;
|
||||
},
|
||||
subTypesChange(val) {
|
||||
this.form.tags = ''
|
||||
this.fillLabelsOption()
|
||||
this.getQuestionAmount()
|
||||
this.form.tags = '';
|
||||
this.fillLabelsOption();
|
||||
this.getQuestionAmount();
|
||||
},
|
||||
trainingClientChange(val) {
|
||||
this.form.tags = '';
|
||||
this.fillLabelsOption();
|
||||
this.getQuestionAmount();
|
||||
},
|
||||
fillLabelsOption() {
|
||||
const param = {
|
||||
@ -228,24 +266,26 @@ export default {
|
||||
groupType: this.form.type,
|
||||
mapId: this.examData.mapId,
|
||||
subType: this.form.subtype,
|
||||
}
|
||||
trainingClient: this.form.trainingClient || null
|
||||
};
|
||||
return queryTagList(param).then(resp => {
|
||||
this.labels = [{ label: '无', value: '' }, ...resp.data.map(item => ({ label: item, value: item }))]
|
||||
})
|
||||
this.labels = [{ label: '无', value: '' }, ...resp.data.map(item => ({ label: item, value: item }))];
|
||||
});
|
||||
},
|
||||
getQuestionAmount(e) {
|
||||
if (!(this.form.type && this.form.subtype)) return
|
||||
if (!(this.form.type && this.form.subtype)) return;
|
||||
const param = {
|
||||
orgId: this.$store.state.user.companyId,
|
||||
groupType: this.form.type,
|
||||
subType: this.form.subtype,
|
||||
mapId: this.examData.mapId,
|
||||
}
|
||||
trainingClient: this.form.trainingClient || null
|
||||
};
|
||||
if (this.form.tags !== '') {
|
||||
param.tags = this.form.tags
|
||||
param.tags = this.form.tags;
|
||||
}
|
||||
if (this.form.subtype === 5) {
|
||||
const data = { mapId: this.examData.mapId, type: 'scene', labels: [this.form.tags] }
|
||||
const data = { mapId: this.examData.mapId, type: 'scene', labels: [this.form.tags] };
|
||||
getPublishTrainingListInOrg(data)
|
||||
.then(response => {
|
||||
if (response.data && response.data.length) {
|
||||
@ -254,50 +294,50 @@ export default {
|
||||
check: false,
|
||||
name: scene.name,
|
||||
playerIdList: JSON.parse(scene.playerIdJson),
|
||||
cosplayId: '',
|
||||
})
|
||||
})
|
||||
cosplayId: ''
|
||||
});
|
||||
});
|
||||
this.sceneInfo &&
|
||||
this.sceneInfo.forEach(scene => {
|
||||
this.sceneTrainMap[scene.publishTrainId].check = true
|
||||
this.sceneTrainMap[scene.publishTrainId].cosplayId = scene.cosplayId
|
||||
})
|
||||
this.sceneTrainMap[scene.publishTrainId].check = true;
|
||||
this.sceneTrainMap[scene.publishTrainId].cosplayId = scene.cosplayId;
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message.error('获取场景实训列表失败!')
|
||||
})
|
||||
this.$message.error('获取场景实训列表失败!');
|
||||
});
|
||||
} else {
|
||||
getQuestionAmount(param).then(resp => {
|
||||
this.topicNum = resp.data
|
||||
})
|
||||
this.topicNum = resp.data;
|
||||
});
|
||||
}
|
||||
},
|
||||
clearSubtype() {
|
||||
this.form.subtype = ''
|
||||
this.form.tags = ''
|
||||
this.labels = [{ label: '无', value: '' }]
|
||||
this.form.subtype = '';
|
||||
this.form.tags = '';
|
||||
this.labels = [{ label: '无', value: '' }];
|
||||
},
|
||||
handleSceneData() {
|
||||
let validFlag = true
|
||||
let validFlag = true;
|
||||
if (this.form.subtype === 5) {
|
||||
this.sceneInfo = []
|
||||
this.sceneInfo = [];
|
||||
for (const sceneId in this.sceneTrainMap) {
|
||||
const scene = this.sceneTrainMap[sceneId]
|
||||
const scene = this.sceneTrainMap[sceneId];
|
||||
if (scene.check && scene.cosplayId) {
|
||||
this.sceneInfo.push({ publishTrainId: sceneId, cosplayId: scene.cosplayId })
|
||||
this.sceneInfo.push({ publishTrainId: sceneId, cosplayId: scene.cosplayId });
|
||||
} else if (scene.check && !scene.cosplayId) {
|
||||
validFlag = false
|
||||
validFlag = false;
|
||||
}
|
||||
}
|
||||
this.form.amount = this.sceneInfo.length
|
||||
this.form.amount = this.sceneInfo.length;
|
||||
}
|
||||
if (!validFlag) {
|
||||
this.$message.warning('请选择场景实训的扮演角色!')
|
||||
this.$message.warning('请选择场景实训的扮演角色!');
|
||||
} else if (!this.form.amount) {
|
||||
this.$message.warning('请选择场景实训!')
|
||||
this.$message.warning('请选择场景实训!');
|
||||
}
|
||||
return validFlag
|
||||
return validFlag;
|
||||
},
|
||||
handleOk() {
|
||||
this.handleSceneData() &&
|
||||
@ -305,25 +345,25 @@ export default {
|
||||
if (valid) {
|
||||
if (this.ruleList.length > 0 && !this.isEditMode) {
|
||||
if (this.isDuplicated()) {
|
||||
this.$message.warning('与已有规则重复, 请重新选择')
|
||||
return
|
||||
this.$message.warning('与已有规则重复, 请重新选择');
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.$emit(
|
||||
'submit',
|
||||
{ ...this.form, sceneInfo: this.sceneInfo, topicNum: this.topicNum },
|
||||
this.isEditMode
|
||||
)
|
||||
this.handleCancel()
|
||||
);
|
||||
this.handleCancel();
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
handleCancel() {
|
||||
this.topicNum = 0
|
||||
this.dialogShow = false
|
||||
},
|
||||
},
|
||||
}
|
||||
this.topicNum = 0;
|
||||
this.dialogShow = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
/deep/ {
|
||||
|
@ -1,148 +1,148 @@
|
||||
<template>
|
||||
<div class="exam-rule">
|
||||
<el-form ref="form" :model="examData" :rules="rules" label-width="120px" class="demo-form">
|
||||
<el-form-item label="关联线路" prop="mapId" required>
|
||||
<el-select v-model="examData.mapId">
|
||||
<el-option
|
||||
v-for="option in mapOptionList"
|
||||
:key="option.value"
|
||||
:label="option.label"
|
||||
:value="option.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('publish.testName')" prop="name">
|
||||
<el-input v-model="examData.name" :maxlength="50" :placeholder="$t('publish.inputTestName')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="简介" prop="profile">
|
||||
<el-input v-model="examData.profile" :maxlength="100" placeholder="请输入简介" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('publish.testDuration')" prop="validDuration">
|
||||
<el-input-number
|
||||
v-model="examData.validDuration"
|
||||
placeholder="请输入"
|
||||
style="float: left; width: calc(100% - 80px);"
|
||||
:min="1"
|
||||
/>
|
||||
<span style="width:80px; display: block;float: left; text-align: center;"
|
||||
> {{ $t('publish.durationMinutes') }}</span
|
||||
>
|
||||
</el-form-item>
|
||||
<el-form-item label="开放时间要求" prop="haveDate">
|
||||
<el-switch v-model="haveDate" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="haveDate" :label="$t('publish.testDate')">
|
||||
<el-col :span="11">
|
||||
<el-form-item prop="startTime">
|
||||
<el-date-picker
|
||||
v-model="examData.startTime"
|
||||
type="datetime"
|
||||
:placeholder="$t('publish.startTestTime')"
|
||||
style="width: 100%;"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
:default-value="new Date()"
|
||||
:picker-options="pickerOptions"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col class="line" :span="2">-</el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item prop="endTime">
|
||||
<el-date-picker
|
||||
v-model="examData.endTime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
type="datetime"
|
||||
:placeholder="$t('publish.endTestTime')"
|
||||
style="width: 100%;"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('publish.fullScore')" prop="fullScore">
|
||||
<el-input-number v-model="examData.fullScore" placeholder="" :min="1" @change="fullScoreChange" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('publish.passingScore')" prop="passScore">
|
||||
<el-input-number v-model="examData.passScore" placeholder="" :min="1" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="exam-rule">
|
||||
<el-form ref="form" :model="examData" :rules="rules" label-width="120px" class="demo-form">
|
||||
<el-form-item label="关联线路" prop="mapId" required>
|
||||
<el-select v-model="examData.mapId">
|
||||
<el-option
|
||||
v-for="option in mapOptionList"
|
||||
:key="option.value"
|
||||
:label="option.label"
|
||||
:value="option.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('publish.testName')" prop="name">
|
||||
<el-input v-model="examData.name" :maxlength="50" :placeholder="$t('publish.inputTestName')" />
|
||||
</el-form-item>
|
||||
<el-form-item label="简介" prop="profile">
|
||||
<el-input v-model="examData.profile" :maxlength="100" placeholder="请输入简介" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('publish.testDuration')" prop="validDuration">
|
||||
<el-input-number
|
||||
v-model="examData.validDuration"
|
||||
placeholder="请输入"
|
||||
style="float: left; width: calc(100% - 80px);"
|
||||
:min="1"
|
||||
/>
|
||||
<span
|
||||
style="width:80px; display: block;float: left; text-align: center;"
|
||||
> {{ $t('publish.durationMinutes') }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="开放时间要求" prop="haveDate">
|
||||
<el-switch v-model="haveDate" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="haveDate" :label="$t('publish.testDate')">
|
||||
<el-col :span="11">
|
||||
<el-form-item prop="startTime">
|
||||
<el-date-picker
|
||||
v-model="examData.startTime"
|
||||
type="datetime"
|
||||
:placeholder="$t('publish.startTestTime')"
|
||||
style="width: 100%;"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
:default-value="new Date()"
|
||||
:picker-options="pickerOptions"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col class="line" :span="2">-</el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item prop="endTime">
|
||||
<el-date-picker
|
||||
v-model="examData.endTime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
type="datetime"
|
||||
:placeholder="$t('publish.endTestTime')"
|
||||
style="width: 100%;"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('publish.fullScore')" prop="fullScore">
|
||||
<el-input-number v-model="examData.fullScore" placeholder="" :min="1" @change="fullScoreChange" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('publish.passingScore')" prop="passScore">
|
||||
<el-input-number v-model="examData.passScore" placeholder="" :min="1" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { queryMapListByUser } from '@/api/jmap/map'
|
||||
|
||||
export default {
|
||||
name: 'ExamFrom',
|
||||
props: {
|
||||
examData: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {}
|
||||
},
|
||||
},
|
||||
},
|
||||
data() {
|
||||
var checkendTime = (rule, value, message) => {
|
||||
if (this.examData.startTime && value) {
|
||||
const startTime = new Date(this.examData.startTime).getTime()
|
||||
const endTime = new Date(value).getTime()
|
||||
if (startTime > endTime) {
|
||||
message(new Error('开始时间必须小于截止时间'))
|
||||
} else {
|
||||
message()
|
||||
}
|
||||
} else {
|
||||
message()
|
||||
}
|
||||
}
|
||||
var checkPassScore = (rule, value, message) => {
|
||||
if (value > this.examData.fullScore) {
|
||||
message(new Error('及格分必须小于等于满分'))
|
||||
} else {
|
||||
message()
|
||||
}
|
||||
}
|
||||
return {
|
||||
pickerOptions: {
|
||||
disabledDate(time) {
|
||||
return time.getTime() < new Date(new Date().toLocaleDateString()).getTime()
|
||||
},
|
||||
},
|
||||
haveDate: false,
|
||||
mapOptionList: [],
|
||||
selectDisable: false,
|
||||
rules: {
|
||||
mapId: [{ required: true, message: '请选择线路', trigger: 'blur' }],
|
||||
name: [{ required: true, message: this.$t('publish.inputTestName'), trigger: 'blur' }],
|
||||
validDuration: [{ required: true, message: this.$t('publish.inputTestDuration'), trigger: 'blur' }],
|
||||
fullScore: [{ required: true, message: this.$t('publish.inputFullScore'), trigger: 'blur' }],
|
||||
passScore: [
|
||||
{ required: true, message: this.$t('publish.inputPassingScore'), trigger: 'blur' },
|
||||
{ validator: checkPassScore, trigger: 'blur' },
|
||||
],
|
||||
endTime: [{ validator: checkendTime, trigger: 'change' }],
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
isEdit() {
|
||||
return this.$route.params.mode === 'edit'
|
||||
},
|
||||
},
|
||||
created() {
|
||||
queryMapListByUser().then(resp => {
|
||||
this.mapOptionList = resp.data.map(item => ({ label: item.name, value: Number(item.id) }))
|
||||
})
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
checkForm() {
|
||||
return this.$refs['form'].validate()
|
||||
},
|
||||
fullScoreChange() {
|
||||
this.$refs.form.validateField('passScore')
|
||||
},
|
||||
},
|
||||
}
|
||||
name: 'ExamFrom',
|
||||
props: {
|
||||
examData: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
mapOptionList: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
var checkendTime = (rule, value, message) => {
|
||||
if (this.examData.startTime && value) {
|
||||
const startTime = new Date(this.examData.startTime).getTime();
|
||||
const endTime = new Date(value).getTime();
|
||||
if (startTime > endTime) {
|
||||
message(new Error('开始时间必须小于截止时间'));
|
||||
} else {
|
||||
message();
|
||||
}
|
||||
} else {
|
||||
message();
|
||||
}
|
||||
};
|
||||
var checkPassScore = (rule, value, message) => {
|
||||
if (value > this.examData.fullScore) {
|
||||
message(new Error('及格分必须小于等于满分'));
|
||||
} else {
|
||||
message();
|
||||
}
|
||||
};
|
||||
return {
|
||||
pickerOptions: {
|
||||
disabledDate(time) {
|
||||
return time.getTime() < new Date(new Date().toLocaleDateString()).getTime();
|
||||
}
|
||||
},
|
||||
haveDate: false,
|
||||
selectDisable: false,
|
||||
rules: {
|
||||
mapId: [{ required: true, message: '请选择线路', trigger: 'blur' }],
|
||||
name: [{ required: true, message: this.$t('publish.inputTestName'), trigger: 'blur' }],
|
||||
validDuration: [{ required: true, message: this.$t('publish.inputTestDuration'), trigger: 'blur' }],
|
||||
fullScore: [{ required: true, message: this.$t('publish.inputFullScore'), trigger: 'blur' }],
|
||||
passScore: [
|
||||
{ required: true, message: this.$t('publish.inputPassingScore'), trigger: 'blur' },
|
||||
{ validator: checkPassScore, trigger: 'blur' }
|
||||
],
|
||||
endTime: [{ validator: checkendTime, trigger: 'change' }]
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
isEdit() {
|
||||
return this.$route.params.mode === 'edit';
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
checkForm() {
|
||||
return this.$refs['form'].validate();
|
||||
},
|
||||
fullScoreChange() {
|
||||
this.$refs.form.validateField('passScore');
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
.exam-rule {
|
||||
|
@ -6,11 +6,12 @@
|
||||
<el-step :title="$t('publish.examRuleMaking')" icon="el-icon-setting" />
|
||||
</el-steps>
|
||||
<div class="joylink-card forms">
|
||||
<exam-from v-show="currentStep === 1" ref="exam" :exam-data="examData" />
|
||||
<exam-from v-show="currentStep === 1" ref="exam" :map-option-list="mapOptionList" :exam-data="examData" />
|
||||
<rule-from
|
||||
v-show="currentStep === 2"
|
||||
ref="rule"
|
||||
:is-edit-mode="isEditMode"
|
||||
:map-option-list="mapOptionList"
|
||||
:rule-list="ruleList"
|
||||
:exam-data="examData"
|
||||
/>
|
||||
@ -35,7 +36,7 @@
|
||||
import RuleFrom from './rule';
|
||||
import ExamFrom from './examFrom';
|
||||
import { getPaperDetail } from '@/api/management/exam';
|
||||
|
||||
import { queryMapListByUser } from '@/api/jmap/map';
|
||||
import { createPaper, editPaper } from '@/api/management/exam';
|
||||
|
||||
export default {
|
||||
@ -57,7 +58,8 @@ export default {
|
||||
passScore: 60,
|
||||
mapId: ''
|
||||
},
|
||||
ruleList: []
|
||||
ruleList: [],
|
||||
mapOptionList: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -93,6 +95,9 @@ export default {
|
||||
});
|
||||
});
|
||||
}
|
||||
queryMapListByUser().then(resp => {
|
||||
this.mapOptionList = resp.data.map(item => ({ label: item.name, value: Number(item.id) }));
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
prevStep() {
|
||||
|
@ -52,7 +52,14 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<edit-rule ref="addRule" :rule-list="ruleList" :exam-data="examData" :total-member-list="totalMemberList" @submit="handleRuleSubmit" />
|
||||
<edit-rule
|
||||
ref="addRule"
|
||||
:rule-list="ruleList"
|
||||
:map-option-list="mapOptionList"
|
||||
:exam-data="examData"
|
||||
:total-member-list="totalMemberList"
|
||||
@submit="handleRuleSubmit"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -77,6 +84,12 @@ export default {
|
||||
},
|
||||
isEditMode: {
|
||||
type: Boolean
|
||||
},
|
||||
mapOptionList: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@ -132,7 +145,10 @@ export default {
|
||||
amount: formData.amount,
|
||||
score: formData.score,
|
||||
topicNum: formData.topicNum,
|
||||
tags: [formData.tags]
|
||||
tags: [formData.tags],
|
||||
subTypeParam: {
|
||||
client: formData.trainingClient
|
||||
}
|
||||
};
|
||||
if (formData.subtype === 5 && formData.sceneInfo && formData.sceneInfo.length) {
|
||||
data.sceneInfo = formData.sceneInfo;
|
||||
@ -142,7 +158,6 @@ export default {
|
||||
} else {
|
||||
this.ruleList.push(data);
|
||||
}
|
||||
console.log(this.ruleList, '333333333333');
|
||||
},
|
||||
deleteRule(data) {
|
||||
const index = data.$index;
|
||||
|
@ -114,7 +114,6 @@ export default {
|
||||
getRelatedFunctionList(mapId) {
|
||||
queryMapFunctionList({mapId: mapId, detail: true}).then(resp => {
|
||||
this.functionList = resp.data;
|
||||
console.log(resp);
|
||||
}).catch(() => {
|
||||
this.$message.error('获取地图功能列表失败!');
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user