试卷考试添加倒计时,倒计时结束提交试卷&试卷规则调整

This commit is contained in:
fan 2023-05-20 16:10:54 +08:00
parent 2d1558b011
commit 516a3a4041
9 changed files with 434 additions and 336 deletions

View File

@ -269,12 +269,12 @@ export function generateExam(pcId) {
} }
/** 删除用户试卷 */ /** 删除用户试卷 */
export function deleteUserExam(param) { // export function deleteUserExam(param) {
return request({ // return request({
url: `/api/v2/paper/user/${puId}`, // url: `/api/v2/paper/user/${puId}`,
method: 'method' // method: 'DELETE'
}); // });
} // }
/** /**
* @param {Number} puId 用户试卷Id * @param {Number} puId 用户试卷Id

View File

@ -27,7 +27,7 @@ export function handlerUrl() {
// BASE_API = 'https://joylink.club/jlcloud'; // BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://114.116.51.125/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.94:9000'; // 旭强
// BASE_API = 'http://192.168.3.15:9000'; // 张赛 // BASE_API = 'http://192.168.3.15:9000'; // 张赛
// BASE_API = 'http://192.168.3.5:9000'; // 夏增彬 // BASE_API = 'http://192.168.3.5:9000'; // 夏增彬

View File

@ -3,6 +3,7 @@
<div class="header"> <div class="header">
<div>满分: {{ composition.fullScore }}</div> <div>满分: {{ composition.fullScore }}</div>
<div>考试时间: {{ composition.validDuration }}分钟</div> <div>考试时间: {{ composition.validDuration }}分钟</div>
<div>剩余时间{{ countdown }}</div>
</div> </div>
<!-- <div class="legend-area"> <!-- <div class="legend-area">
<div class="legend"> <div class="legend">
@ -82,11 +83,16 @@ export default {
questionStateList: [[], []], questionStateList: [[], []],
currentQuestionIndex: 0, currentQuestionIndex: 0,
currentQuestionType: 1, // 1-, 2- currentQuestionType: 1, // 1-, 2-
examSceneRuleMap: {} examSceneRuleMap: {},
examStartTime: 0,
serverStartTime: 0,
examInterval: null,
countdown: '00:00:00'
}; };
}, },
beforeDestroy() { beforeDestroy() {
this.$store.dispatch('trainingNew/setExamSwitch', false); this.$store.dispatch('trainingNew/setExamSwitch', false);
if (this.examInterval) { clearInterval(this.examInterval); }
}, },
mounted() { mounted() {
EventBus.$on('trainExamSubmit', (data) => { 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.paper = data.paper;
this.questionList = [ this.questionList = [
data.questionList.filter(e => e.type === 1), data.questionList.filter(e => e.type === 1),
@ -175,8 +211,7 @@ export default {
this.currentQuestionIndex--; this.currentQuestionIndex--;
} }
}, },
submitExam() { execSubmit() {
const execSubmit = () => {
submitPaper(this.paper.id).then(resp => { submitPaper(this.paper.id).then(resp => {
const { score, passScore, commonScore, trainingScore } = resp.data; const { score, passScore, commonScore, trainingScore } = resp.data;
const pass = score >= passScore; const pass = score >= passScore;
@ -191,14 +226,19 @@ export default {
this.$store.dispatch('trainingNew/setExamSwitch', 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)); const finished = this.questionStateList.every(list => list.every(item => item === true));
if (!finished) { if (!finished) {
this.$confirm('您还有题目未答完, 确认交卷吗?').then(() => { this.$confirm('您还有题目未答完, 确认交卷吗?').then(() => {
execSubmit(); this.execSubmit();
}); });
} else { } else {
execSubmit(); this.execSubmit();
} }
} }
} }

View File

@ -81,7 +81,6 @@ export default {
mapId: this.$route.query.mapId, mapId: this.$route.query.mapId,
findState: 3 findState: 3
}).then(resp => { }).then(resp => {
console.log(resp);
this.paperList = resp.data.list; this.paperList = resp.data.list;
}); });
}, },

View File

@ -23,16 +23,27 @@
<el-option v-for="item in subtypes" :key="item.value" :label="item.label" :value="item.value" /> <el-option v-for="item in subtypes" :key="item.value" :label="item.label" :value="item.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="标签" required> <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-select v-model="form.tags" @change="getQuestionAmount">
<el-option v-for="item in labels" :key="item.value" :label="item.label" :value="item.value" /> <el-option v-for="item in labels" :key="item.value" :label="item.label" :value="item.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item v-if="form.subtype === 5" label="场景实训"> <el-form-item v-if="form.subtype === 5" label="场景实训">
<el-row style="border: 1px solid #DCDFE6;width: 400px;"> <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="border-right: 1px solid #DCDFE6;overflow: hidden;text-align: center;"
>场景实训名称</el-col>
<el-col :span="12" style="text-align: center;">扮演角色</el-col> <el-col :span="12" style="text-align: center;">扮演角色</el-col>
</el-row> </el-row>
<template v-for="scene in sceneTrainMap"> <template v-for="scene in sceneTrainMap">
@ -84,8 +95,8 @@
</template> </template>
<script> <script>
import { getQuestionAmount, queryTagList } from '@/api/management/exam' import { getQuestionAmount, queryTagList } from '@/api/management/exam';
import { getPublishTrainingListInOrg } from '@/api/jmap/training' import { getPublishTrainingListInOrg } from '@/api/jmap/training';
export default { export default {
name: 'EditRule', name: 'EditRule',
@ -93,53 +104,59 @@ export default {
ruleList: { ruleList: {
type: Array, type: Array,
default() { default() {
return [] return [];
}, }
}, },
examData: { examData: {
type: Object, type: Object,
default() { default() {
return {} return {};
}, }
}, },
totalMemberList: { totalMemberList: {
type: Array, type: Array,
default() { default() {
return [] return [];
}, }
}, },
mapOptionList: {
type: Array,
default() {
return [];
}
}
}, },
data() { data() {
var number = (rule, value, message) => { var number = (rule, value, message) => {
if (this.form.subtype !== 5) { if (this.form.subtype !== 5) {
if (!value) { if (!value) {
return message(new Error(this.$t('publish.inputQuestionNumber'))) return message(new Error(this.$t('publish.inputQuestionNumber')));
} }
setTimeout(() => { setTimeout(() => {
if (Number(value) == 0) { if (Number(value) == 0) {
message(new Error(this.$t('publish.inputQuestionNumberError'))) message(new Error(this.$t('publish.inputQuestionNumberError')));
} else if (!Number(value)) { } else if (!Number(value)) {
message(new Error(this.$t('publish.inputValidNumber'))) message(new Error(this.$t('publish.inputValidNumber')));
} else if (Number(value) > this.topicNum) { } else if (Number(value) > this.topicNum) {
message(new Error(this.$t('publish.inputNumberError'))) message(new Error(this.$t('publish.inputNumberError')));
} else { } else {
message() message();
} }
}, 100) }, 100);
} else { } else {
message() message();
}
} }
};
var score = (rule, value, message) => { var score = (rule, value, message) => {
if (!value) { if (!value) {
return message(new Error(this.$t('publish.inputScorePerQuestion'))) return message(new Error(this.$t('publish.inputScorePerQuestion')));
} else { } else {
message() message();
}
} }
};
const tagsValidator = (rule, value, message) => { const tagsValidator = (rule, value, message) => {
message() message();
} };
return { return {
form: { form: {
id: '', id: '',
@ -148,7 +165,9 @@ export default {
tags: '', tags: '',
amount: 1, amount: 1,
score: 1, score: 1,
trainingClient: ''
}, },
clients: [],
sceneInfo: [], sceneInfo: [],
labels: [], labels: [],
topicNum: 0, topicNum: 0,
@ -161,48 +180,62 @@ export default {
amount: [{ required: true, validator: number, trigger: 'blur' }], amount: [{ required: true, validator: number, trigger: 'blur' }],
score: [{ required: true, validator: score, trigger: 'blur' }], score: [{ required: true, validator: score, trigger: 'blur' }],
tags: [{ validator: tagsValidator, trigger: 'blur' }], tags: [{ validator: tagsValidator, trigger: 'blur' }],
}, trainingClient: [{ required: true, message:'请选择实训客户端', trigger: 'change' }]
} }
};
}, },
computed: { computed: {
types() { types() {
return [{ value: 1, label: '理论题' }, { value: 2, label: '实训题' }] return [{ value: 1, label: '理论题' }, { value: 2, label: '实训题' }];
}, },
subtypes() { subtypes() {
const data = { const data = {
'1': [{ value: 1, label: '单选题' }, { value: 2, label: '多选题' }, { value: 3, label: '判断题' }], '1': [{ value: 1, label: '单选题' }, { value: 2, label: '多选题' }, { value: 3, label: '判断题' }],
'2': [{ value: 4, label: '单操实训' }, { value: 5, label: '场景实训' }], '2': [{ value: 4, label: '单操实训' }, { value: 5, label: '场景实训' }]
} };
return data[this.form.type] return data[this.form.type];
}, },
title() { title() {
return this.isEditMode ? this.$t('publish.modifyRules') : this.$t('publish.addRules') return this.isEditMode ? this.$t('publish.modifyRules') : this.$t('publish.addRules');
}, }
}, },
methods: { methods: {
show(detail) { 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.$nextTick(() => {
this.$refs.form.resetFields() this.$refs.form.resetFields();
if (detail) { if (detail) {
this.isEditMode = true this.isEditMode = true;
this.index = detail.index this.index = detail.index;
this.sceneInfo = detail.sceneInfo || [] this.sceneInfo = detail.sceneInfo || [];
this.form = { this.form = {
type: detail.type, type: detail.type,
subtype: detail.subtype, subtype: detail.subtype,
amount: detail.amount, amount: detail.amount,
score: detail.score, score: detail.score,
id: detail.id || '', id: detail.id || '',
tags: detail.tags ? detail.tags[0] : '', tags: detail.tags ? detail.tags[0] : ''
} };
this.fillLabelsOption().then(() => { this.fillLabelsOption().then(() => {
this.getQuestionAmount() this.getQuestionAmount();
}) });
} else { } else {
this.isEditMode = false this.isEditMode = false;
} }
}) });
}, },
isDuplicated() { isDuplicated() {
const isDuplicated = const isDuplicated =
@ -214,13 +247,18 @@ export default {
rule.tags && rule.tags &&
this.form.tags && this.form.tags &&
rule.tags.includes(this.form.tags) rule.tags.includes(this.form.tags)
) );
return isDuplicated return isDuplicated;
}, },
subTypesChange(val) { subTypesChange(val) {
this.form.tags = '' this.form.tags = '';
this.fillLabelsOption() this.fillLabelsOption();
this.getQuestionAmount() this.getQuestionAmount();
},
trainingClientChange(val) {
this.form.tags = '';
this.fillLabelsOption();
this.getQuestionAmount();
}, },
fillLabelsOption() { fillLabelsOption() {
const param = { const param = {
@ -228,24 +266,26 @@ export default {
groupType: this.form.type, groupType: this.form.type,
mapId: this.examData.mapId, mapId: this.examData.mapId,
subType: this.form.subtype, subType: this.form.subtype,
} trainingClient: this.form.trainingClient || null
};
return queryTagList(param).then(resp => { 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) { getQuestionAmount(e) {
if (!(this.form.type && this.form.subtype)) return if (!(this.form.type && this.form.subtype)) return;
const param = { const param = {
orgId: this.$store.state.user.companyId, orgId: this.$store.state.user.companyId,
groupType: this.form.type, groupType: this.form.type,
subType: this.form.subtype, subType: this.form.subtype,
mapId: this.examData.mapId, mapId: this.examData.mapId,
} trainingClient: this.form.trainingClient || null
};
if (this.form.tags !== '') { if (this.form.tags !== '') {
param.tags = this.form.tags param.tags = this.form.tags;
} }
if (this.form.subtype === 5) { 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) getPublishTrainingListInOrg(data)
.then(response => { .then(response => {
if (response.data && response.data.length) { if (response.data && response.data.length) {
@ -254,50 +294,50 @@ export default {
check: false, check: false,
name: scene.name, name: scene.name,
playerIdList: JSON.parse(scene.playerIdJson), playerIdList: JSON.parse(scene.playerIdJson),
cosplayId: '', cosplayId: ''
}) });
}) });
this.sceneInfo && this.sceneInfo &&
this.sceneInfo.forEach(scene => { this.sceneInfo.forEach(scene => {
this.sceneTrainMap[scene.publishTrainId].check = true this.sceneTrainMap[scene.publishTrainId].check = true;
this.sceneTrainMap[scene.publishTrainId].cosplayId = scene.cosplayId this.sceneTrainMap[scene.publishTrainId].cosplayId = scene.cosplayId;
}) });
} }
}) })
.catch(() => { .catch(() => {
this.$message.error('获取场景实训列表失败!') this.$message.error('获取场景实训列表失败!');
}) });
} else { } else {
getQuestionAmount(param).then(resp => { getQuestionAmount(param).then(resp => {
this.topicNum = resp.data this.topicNum = resp.data;
}) });
} }
}, },
clearSubtype() { clearSubtype() {
this.form.subtype = '' this.form.subtype = '';
this.form.tags = '' this.form.tags = '';
this.labels = [{ label: '无', value: '' }] this.labels = [{ label: '无', value: '' }];
}, },
handleSceneData() { handleSceneData() {
let validFlag = true let validFlag = true;
if (this.form.subtype === 5) { if (this.form.subtype === 5) {
this.sceneInfo = [] this.sceneInfo = [];
for (const sceneId in this.sceneTrainMap) { for (const sceneId in this.sceneTrainMap) {
const scene = this.sceneTrainMap[sceneId] const scene = this.sceneTrainMap[sceneId];
if (scene.check && scene.cosplayId) { 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) { } else if (scene.check && !scene.cosplayId) {
validFlag = false validFlag = false;
} }
} }
this.form.amount = this.sceneInfo.length this.form.amount = this.sceneInfo.length;
} }
if (!validFlag) { if (!validFlag) {
this.$message.warning('请选择场景实训的扮演角色!') this.$message.warning('请选择场景实训的扮演角色!');
} else if (!this.form.amount) { } else if (!this.form.amount) {
this.$message.warning('请选择场景实训!') this.$message.warning('请选择场景实训!');
} }
return validFlag return validFlag;
}, },
handleOk() { handleOk() {
this.handleSceneData() && this.handleSceneData() &&
@ -305,25 +345,25 @@ export default {
if (valid) { if (valid) {
if (this.ruleList.length > 0 && !this.isEditMode) { if (this.ruleList.length > 0 && !this.isEditMode) {
if (this.isDuplicated()) { if (this.isDuplicated()) {
this.$message.warning('与已有规则重复, 请重新选择') this.$message.warning('与已有规则重复, 请重新选择');
return return;
} }
} }
this.$emit( this.$emit(
'submit', 'submit',
{ ...this.form, sceneInfo: this.sceneInfo, topicNum: this.topicNum }, { ...this.form, sceneInfo: this.sceneInfo, topicNum: this.topicNum },
this.isEditMode this.isEditMode
) );
this.handleCancel() this.handleCancel();
} }
}) });
}, },
handleCancel() { handleCancel() {
this.topicNum = 0 this.topicNum = 0;
this.dialogShow = false this.dialogShow = false;
}, }
}, }
} };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
/deep/ { /deep/ {

View File

@ -8,7 +8,7 @@
:key="option.value" :key="option.value"
:label="option.label" :label="option.label"
:value="option.value" :value="option.value"
></el-option> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="$t('publish.testName')" prop="name"> <el-form-item :label="$t('publish.testName')" prop="name">
@ -24,9 +24,9 @@
style="float: left; width: calc(100% - 80px);" style="float: left; width: calc(100% - 80px);"
:min="1" :min="1"
/> />
<span style="width:80px; display: block;float: left; text-align: center;" <span
>&nbsp;{{ $t('publish.durationMinutes') }}</span style="width:80px; display: block;float: left; text-align: center;"
> >&nbsp;{{ $t('publish.durationMinutes') }}</span>
</el-form-item> </el-form-item>
<el-form-item label="开放时间要求" prop="haveDate"> <el-form-item label="开放时间要求" prop="haveDate">
<el-switch v-model="haveDate" /> <el-switch v-model="haveDate" />
@ -69,46 +69,51 @@
</template> </template>
<script> <script>
import { queryMapListByUser } from '@/api/jmap/map'
export default { export default {
name: 'ExamFrom', name: 'ExamFrom',
props: { props: {
examData: { examData: {
type: Object, type: Object,
default() { default() {
return {} return {};
}, }
}, },
mapOptionList: {
type: Array,
default() {
return [];
}
}
}, },
data() { data() {
var checkendTime = (rule, value, message) => { var checkendTime = (rule, value, message) => {
if (this.examData.startTime && value) { if (this.examData.startTime && value) {
const startTime = new Date(this.examData.startTime).getTime() const startTime = new Date(this.examData.startTime).getTime();
const endTime = new Date(value).getTime() const endTime = new Date(value).getTime();
if (startTime > endTime) { if (startTime > endTime) {
message(new Error('开始时间必须小于截止时间')) message(new Error('开始时间必须小于截止时间'));
} else { } else {
message() message();
} }
} else { } else {
message() message();
}
} }
};
var checkPassScore = (rule, value, message) => { var checkPassScore = (rule, value, message) => {
if (value > this.examData.fullScore) { if (value > this.examData.fullScore) {
message(new Error('及格分必须小于等于满分')) message(new Error('及格分必须小于等于满分'));
} else { } else {
message() message();
}
} }
};
return { return {
pickerOptions: { pickerOptions: {
disabledDate(time) { disabledDate(time) {
return time.getTime() < new Date(new Date().toLocaleDateString()).getTime() return time.getTime() < new Date(new Date().toLocaleDateString()).getTime();
}, }
}, },
haveDate: false, haveDate: false,
mapOptionList: [],
selectDisable: false, selectDisable: false,
rules: { rules: {
mapId: [{ required: true, message: '请选择线路', trigger: 'blur' }], mapId: [{ required: true, message: '请选择线路', trigger: 'blur' }],
@ -117,32 +122,27 @@ export default {
fullScore: [{ required: true, message: this.$t('publish.inputFullScore'), trigger: 'blur' }], fullScore: [{ required: true, message: this.$t('publish.inputFullScore'), trigger: 'blur' }],
passScore: [ passScore: [
{ required: true, message: this.$t('publish.inputPassingScore'), trigger: 'blur' }, { required: true, message: this.$t('publish.inputPassingScore'), trigger: 'blur' },
{ validator: checkPassScore, trigger: 'blur' }, { validator: checkPassScore, trigger: 'blur' }
], ],
endTime: [{ validator: checkendTime, trigger: 'change' }], endTime: [{ validator: checkendTime, trigger: 'change' }]
},
} }
};
}, },
computed: { computed: {
isEdit() { isEdit() {
return this.$route.params.mode === 'edit' return this.$route.params.mode === 'edit';
}, }
},
created() {
queryMapListByUser().then(resp => {
this.mapOptionList = resp.data.map(item => ({ label: item.name, value: Number(item.id) }))
})
}, },
mounted() {}, mounted() {},
methods: { methods: {
checkForm() { checkForm() {
return this.$refs['form'].validate() return this.$refs['form'].validate();
}, },
fullScoreChange() { fullScoreChange() {
this.$refs.form.validateField('passScore') this.$refs.form.validateField('passScore');
}, }
}, }
} };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
.exam-rule { .exam-rule {

View File

@ -6,11 +6,12 @@
<el-step :title="$t('publish.examRuleMaking')" icon="el-icon-setting" /> <el-step :title="$t('publish.examRuleMaking')" icon="el-icon-setting" />
</el-steps> </el-steps>
<div class="joylink-card forms"> <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 <rule-from
v-show="currentStep === 2" v-show="currentStep === 2"
ref="rule" ref="rule"
:is-edit-mode="isEditMode" :is-edit-mode="isEditMode"
:map-option-list="mapOptionList"
:rule-list="ruleList" :rule-list="ruleList"
:exam-data="examData" :exam-data="examData"
/> />
@ -35,7 +36,7 @@
import RuleFrom from './rule'; import RuleFrom from './rule';
import ExamFrom from './examFrom'; import ExamFrom from './examFrom';
import { getPaperDetail } from '@/api/management/exam'; import { getPaperDetail } from '@/api/management/exam';
import { queryMapListByUser } from '@/api/jmap/map';
import { createPaper, editPaper } from '@/api/management/exam'; import { createPaper, editPaper } from '@/api/management/exam';
export default { export default {
@ -57,7 +58,8 @@ export default {
passScore: 60, passScore: 60,
mapId: '' mapId: ''
}, },
ruleList: [] ruleList: [],
mapOptionList: []
}; };
}, },
computed: { computed: {
@ -93,6 +95,9 @@ export default {
}); });
}); });
} }
queryMapListByUser().then(resp => {
this.mapOptionList = resp.data.map(item => ({ label: item.name, value: Number(item.id) }));
});
}, },
methods: { methods: {
prevStep() { prevStep() {

View File

@ -52,7 +52,14 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </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> </div>
</template> </template>
@ -77,6 +84,12 @@ export default {
}, },
isEditMode: { isEditMode: {
type: Boolean type: Boolean
},
mapOptionList: {
type: Array,
default() {
return [];
}
} }
}, },
data() { data() {
@ -132,7 +145,10 @@ export default {
amount: formData.amount, amount: formData.amount,
score: formData.score, score: formData.score,
topicNum: formData.topicNum, topicNum: formData.topicNum,
tags: [formData.tags] tags: [formData.tags],
subTypeParam: {
client: formData.trainingClient
}
}; };
if (formData.subtype === 5 && formData.sceneInfo && formData.sceneInfo.length) { if (formData.subtype === 5 && formData.sceneInfo && formData.sceneInfo.length) {
data.sceneInfo = formData.sceneInfo; data.sceneInfo = formData.sceneInfo;
@ -142,7 +158,6 @@ export default {
} else { } else {
this.ruleList.push(data); this.ruleList.push(data);
} }
console.log(this.ruleList, '333333333333');
}, },
deleteRule(data) { deleteRule(data) {
const index = data.$index; const index = data.$index;

View File

@ -114,7 +114,6 @@ export default {
getRelatedFunctionList(mapId) { getRelatedFunctionList(mapId) {
queryMapFunctionList({mapId: mapId, detail: true}).then(resp => { queryMapFunctionList({mapId: mapId, detail: true}).then(resp => {
this.functionList = resp.data; this.functionList = resp.data;
console.log(resp);
}).catch(() => { }).catch(() => {
this.$message.error('获取地图功能列表失败!'); this.$message.error('获取地图功能列表失败!');
}); });