This commit is contained in:
sunzhenyu 2020-09-17 15:41:02 +08:00
commit 465248872f
15 changed files with 483 additions and 151 deletions

View File

@ -239,4 +239,19 @@ export function getTheroyCompetitionResult(competitionId, raceUserId) {
method: 'get' method: 'get'
}); });
} }
/** 项目获取试题列表 */
export function getItemListByProjectCode(projectCode, params) {
return request({
url: `api/v1/competitionTheory/project/${projectCode}`,
method: 'get',
params
});
}
/** 项目提交试卷 */
export function commitProjectTestPaper(projectCode, data, mode) {
return request({
url: `api/v1/competitionTheory/project/${projectCode}/submit?mode=${mode}`,
method: 'post',
data
});
}

View File

@ -296,9 +296,16 @@ deviceRender[deviceType.IscsImage] = {
zlevel: 1, zlevel: 1,
z: 5 z: 5
}; };
// 福州iscs扇门
deviceRender[deviceType.OrdinaryDoor] = { deviceRender[deviceType.OrdinaryDoor] = {
_type: deviceType.OrdinaryDoor, _type: deviceType.OrdinaryDoor,
zlevel: 1, zlevel: 1,
z: 4 z: 4
}; };
// 福州门禁
deviceRender[deviceType.FuzhouDoor] = {
_type: deviceType.FuzhouDoor,
zlevel: 1,
z: 4
};
export default deviceRender; export default deviceRender;

View File

@ -46,7 +46,8 @@ const deviceType = {
Elevator: 'Elevator', Elevator: 'Elevator',
Draught: 'Draught', Draught: 'Draught',
IscsImage: 'IscsImage', IscsImage: 'IscsImage',
OrdinaryDoor: 'ordinaryDoor' OrdinaryDoor: 'OrdinaryDoor',
FuzhouDoor: 'FuzhouDoor'
}; };
export default deviceType; export default deviceType;

View File

@ -47,6 +47,7 @@ import Elevator from './bas/elevator';
import Draught from './bas/draught'; import Draught from './bas/draught';
import IscsImage from './iscsImage'; import IscsImage from './iscsImage';
import OrdinaryDoor from './ordinaryDoor'; import OrdinaryDoor from './ordinaryDoor';
import FuzhouDoor from './fuzhouDoor';
const iscsShape = {}; const iscsShape = {};
iscsShape[deviceType.ManualAlarmButton] = ManualAlarmButton; iscsShape[deviceType.ManualAlarmButton] = ManualAlarmButton;
@ -98,6 +99,7 @@ iscsShape[deviceType.Elevator] = Elevator;
iscsShape[deviceType.Draught] = Draught; iscsShape[deviceType.Draught] = Draught;
iscsShape[deviceType.IscsImage] = IscsImage; iscsShape[deviceType.IscsImage] = IscsImage;
iscsShape[deviceType.OrdinaryDoor] = OrdinaryDoor; iscsShape[deviceType.OrdinaryDoor] = OrdinaryDoor;
iscsShape[deviceType.FuzhouDoor] = FuzhouDoor;
function shapefactory(device, iscs) { function shapefactory(device, iscs) {
const type = device.model._type; const type = device.model._type;

View File

@ -0,0 +1,137 @@
import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect';
import Polygon from 'zrender/src/graphic/shape/Polygon';
export default class fuzhouDoor extends Group {
constructor(device) {
super();
this.model = device.model;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this._type = device.model._type;
this._code = device.model.code;
this.create();
this.setState(this.model);
}
create() {
this.grouper = new Group({
id: this.model.code,
position: [this.model.point.x, this.model.point.y]
});
this.add(this.grouper);
this.door = new Rect({
zlevel: this.zlevel,
z: this.z,
shape: {
x: 0,
y: 0,
width: this.model.width,
height: this.model.width * 25 / 16
},
style: {
fill: '#33CC00'// D3D0C9
}
});
this.doorWindow = new Rect({
zlevel: this.zlevel,
z: this.z,
shape: {
x: this.model.width * 2 / 17,
y: this.model.width * 6 / 17,
width: this.model.width * 13 / 17,
height: this.model.width * 4 / 17
},
style: {
fill: '#000'
}
});
this.doorknob = new Rect({
zlevel: this.zlevel,
z: this.z,
shape: {
x: this.model.width * 13 / 17,
y: this.model.width * 21 / 17,
width: this.model.width / 17,
height: this.model.width / 17
},
style: {
fill: '#000'
}
});
this.polygon1 = new Polygon({
zlevel: this.zlevel,
z: this.z + 1,
shape: {
points:[
[0, 0],
[this.model.width * 3 / 4, this.model.width * 5 / 16],
[this.model.width * 3 / 4, this.model.width * 7 / 4],
[0, this.model.width * 25 / 16]
]
},
style: {
fill: '#0F0',
stroke: '#000',
lineWidth: 2
}
});
this.polygon2 = new Polygon({
zlevel: this.zlevel,
z: this.z + 2,
shape: {
points: [
[this.model.width / 6, this.model.width / 4],
[this.model.width * 2 / 3, this.model.width * 5 / 12],
[this.model.width / 6, this.model.width * 7 / 12],
[this.model.width * 2 / 3, this.model.width * 2 / 3]
]
},
style: {
fill: '#000'
}
});
this.polygon3 = new Polygon({
zlevel: this.zlevel,
z: this.z + 2,
shape: {
points: [
[this.model.width * 11 / 24, this.model.width * 55 / 48],
[this.model.width / 3, this.model.width * 29 / 24],
[this.model.width * 11 / 24, this.model.width * 5 / 4],
[this.model.width / 3, this.model.width * 21 / 16]
]
},
style: {
fill: '#000'
}
});
this.doorWindow.hide();
this.doorknob.hide();
this.polygon1.hide();
this.polygon2.hide();
this.polygon3.hide();
this.grouper.add(this.door);
this.grouper.add(this.doorWindow);
this.grouper.add(this.doorknob);
this.grouper.add(this.polygon1);
this.grouper.add(this.polygon2);
this.grouper.add(this.polygon3);
this.add(this.grouper);
}
setState(model) {
if (model.doorOpen) {
this.door.setStyle({fill: 'D3D0C9'});
this.polygon1.show();
this.polygon2.show();
this.polygon3.show();
} else {
this.door.setStyle({fill: 'D3D0C9'});
this.doorWindow.show();
this.doorknob.show();
}
}
setModel(dx, dy) {
this.model.point.x += dx;
this.model.point.y += dy;
}
}

View File

@ -22,11 +22,11 @@ export default class OrdinaryDoor extends Group {
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
shape: { shape: {
cx: this.model.point.x, cx: 0,
cy: this.model.point.y - this.model.r, cy: this.model.r,
r: this.model.r, r: this.model.r,
startAngle: Math.PI / 2, startAngle: Math.PI / 2 * 3,
endAngle: Math.PI endAngle: 2 * Math.PI
}, },
style: { style: {
fill: 'rgba(0, 0, 0, 0)', fill: 'rgba(0, 0, 0, 0)',
@ -34,6 +34,7 @@ export default class OrdinaryDoor extends Group {
lineWidth: 1 lineWidth: 1
} }
}); });
this.grouper.add(this.sector1);
if (this.model.doorType === '1') { if (this.model.doorType === '1') {
this.createLine(this.model.r); this.createLine(this.model.r);
} else if (this.model.doorType === '2') { } else if (this.model.doorType === '2') {
@ -47,17 +48,20 @@ export default class OrdinaryDoor extends Group {
this.createRect(this.model.r * 2); this.createRect(this.model.r * 2);
this.createLine(this.model.r * 2); this.createLine(this.model.r * 2);
} }
this.grouper.origin = [0, 0];
this.grouper.rotation = Math.PI / 180 * (this.model.rotationAngle || 0);
this.add(this.grouper);
} }
createSector2() { createSector2() {
this.sector2 = new Sector({ this.sector2 = new Sector({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
shape: { shape: {
cx: this.model.point.x + this.model.r * 2, cx: this.model.r * 2,
cy: this.model.point.y, cy: this.model.r,
r: this.model.r, r: this.model.r,
startAngle: 0, startAngle: Math.PI,
endAngle: Math.PI / 2 endAngle: Math.PI / 2 * 3
}, },
style: { style: {
fill: 'rgba(0,0,0,0)', fill: 'rgba(0,0,0,0)',
@ -72,10 +76,10 @@ export default class OrdinaryDoor extends Group {
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
shape: { shape: {
x1: this.model.point.x, x1: 1,
y1: this.model.point.y - this.model.r, y1: this.model.r,
x2: this.model.point.x + length, x2: length - 1,
y2: this.model.point.y - this.model.r y2: this.model.r
}, },
style: { style: {
stroke: '#45607B', stroke: '#45607B',
@ -89,8 +93,8 @@ export default class OrdinaryDoor extends Group {
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
shape: { shape: {
x: this.model.point.x, x: 0,
y: this.model.point.y - this.model.r, y: this.model.r,
width: length, width: length,
height: this.model.r height: this.model.r
}, },
@ -102,4 +106,8 @@ export default class OrdinaryDoor extends Group {
}); });
this.grouper.add(this.bottomRect); this.grouper.add(this.bottomRect);
} }
setModel(dx, dy) {
this.model.point.x += dx;
this.model.point.y += dy;
}
} }

View File

@ -187,6 +187,9 @@ export function parser(data) {
zrUtil.each(data.ordinaryDoorList || [], elem => { zrUtil.each(data.ordinaryDoorList || [], elem => {
iscsDevice[elem.code] = deviceFactory(deviceType.OrdinaryDoor, elem); iscsDevice[elem.code] = deviceFactory(deviceType.OrdinaryDoor, elem);
}); });
zrUtil.each(data.fuzhoudoorList || [], elem => {
iscsDevice[elem.code] = deviceFactory(deviceType.FuzhouDoor, elem);
});
} }
return iscsDevice; return iscsDevice;

View File

@ -161,7 +161,6 @@ const iscs = {
if (!(models instanceof Array)) { if (!(models instanceof Array)) {
models = [models]; models = [models];
} }
commit('iscsRender', models); commit('iscsRender', models);
resolve(models); resolve(models);
}); });

View File

@ -2,11 +2,11 @@ export function getBaseUrl() {
let BASE_API; let BASE_API;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// 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://192.168.3.5:9000'; // 袁琪 // BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强 // BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41: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://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康 // BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
// BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛 // BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛

View File

@ -50,14 +50,14 @@
@deleteDataModel="deleteDataModel" @deleteDataModel="deleteDataModel"
/> />
</el-tab-pane> </el-tab-pane>
<el-table-column label="扇门" name="ordinaryDoor"> <el-tab-pane label="扇门" name="ordinaryDoor">
<ordinary-door <ordinary-door
ref="ordinaryDoor" ref="ordinaryDoor"
style="width: 100%;height: 100%;" style="width: 100%;height: 100%;"
@createDataModel="createDataModel" @createDataModel="createDataModel"
@deleteDataModel="deleteDataModel" @deleteDataModel="deleteDataModel"
/> />
</el-table-column> </el-tab-pane>
</el-tabs> </el-tabs>
</el-card> </el-card>
</div> </div>

View File

@ -0,0 +1,118 @@
<template>
<div style="overflow-y: scroll;height: calc(100% - 46px); width: 100%;">
<el-form ref="form" :rules="rules" :model="form" label-width="80px" style="width: 100%;padding: 10px 50px;">
<el-form-item label="门宽:" prop="height">
<el-input-number v-model="form.width" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item label="X轴坐标:">
<el-input-number v-model="form.x" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item label="Y轴坐标:">
<el-input-number v-model="form.y" controls-position="right" :min="1" size="small" />
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" @click="onSubmit('form')">{{ buttonText }}</el-button>
<el-button v-show="showDeleteButton" size="small" type="danger" @click="deleteDevice">删除</el-button>
<el-button v-show="showDeleteButton" size="small" @click="initPage">取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import {getUID} from '@/iscs/utils/Uid';
import { mapGetters } from 'vuex';
export default {
name: 'OrdinaryDoor',
data() {
return {
form:{
code: '',
width: 1,
x: 10,
y: 10
},
rules: {},
isUpdate: false,
buttonText: '立即创建',
showDeleteButton: false
};
},
computed:{
...mapGetters('iscs', [
'iscs'
])
},
watch:{
'$store.state.iscs.rightClickCount': function (val) {
const model = this.$store.getters['iscs/updateDeviceData'];
if (model._type === 'OrdinaryDoor' ) {
this.buttonText = '修改';
this.showDeleteButton = true;
this.isUpdate = true;
this.form.code = model.code;
this.form.x = model.point.x;
this.form.y = model.point.y;
this.form.r = model.r;
this.form.doorType = model.doorType;
this.form.rotationAngle = model.rotationAngle;
}
}
},
mounted() {},
methods: {
onSubmit(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const model = {
point: {
x: this.form.x,
y: this.form.y
},
code: this.isUpdate ? this.form.code : getUID('OrdinaryDoor', this.iscs.ordinaryDoorList),
_type: 'OrdinaryDoor',
rotationAngle: this.form.rotationAngle,
r: this.form.r,
doorType: this.form.doorType
};
this.$emit('createDataModel', model);
this.initPage();
} else {
return false;
}
});
},
deleteDevice() {
const lineModel = {
point: {
x: this.form.x,
y: this.form.y
},
code: this.form.code,
_type: 'OrdinaryDoor',
rotationAngle: this.form.rotationAngle,
r: this.form.r,
doorType: this.form.doorType
};
this.$emit('deleteDataModel', lineModel);
},
initPage() {
this.isUpdate = false;
this.buttonText = '立即创建';
this.showDeleteButton = false;
this.form = {
code: '',
doorType: '1',
r: 1,
rotationAngle: 0,
x: 10,
y: 10
};
}
}
};
</script>
<style scoped>
</style>

View File

@ -53,6 +53,7 @@ export default {
{label: '单扇有矩形', value: '3'}, {label: '单扇有矩形', value: '3'},
{label: '双扇有矩形', value: '4'} {label: '双扇有矩形', value: '4'}
], ],
rules: {},
isUpdate: false, isUpdate: false,
buttonText: '立即创建', buttonText: '立即创建',
showDeleteButton: false showDeleteButton: false
@ -74,6 +75,7 @@ export default {
this.form.x = model.point.x; this.form.x = model.point.x;
this.form.y = model.point.y; this.form.y = model.point.y;
this.form.r = model.r; this.form.r = model.r;
this.form.doorType = model.doorType;
this.form.rotationAngle = model.rotationAngle; this.form.rotationAngle = model.rotationAngle;
} }
} }
@ -85,16 +87,14 @@ export default {
if (valid) { if (valid) {
const model = { const model = {
point: { point: {
x: this.form.x1, x: this.form.x,
y: this.form.y1 y: this.form.y
}, },
code: this.isUpdate ? this.form.code : getUID('OrdinaryDoor', this.iscs.ordinaryDoorList), code: this.isUpdate ? this.form.code : getUID('OrdinaryDoor', this.iscs.ordinaryDoorList),
_type: 'OrdinaryDoor', _type: 'OrdinaryDoor',
lineWidth: this.form.lineWidth, rotationAngle: this.form.rotationAngle,
fillColor: this.form.fillColor, r: this.form.r,
classify: this.form.classify, doorType: this.form.doorType
arrowShow: this.form.arrowShow,
arrowSize: this.form.arrowSize
}; };
this.$emit('createDataModel', model); this.$emit('createDataModel', model);
this.initPage(); this.initPage();
@ -105,21 +105,15 @@ export default {
}, },
deleteDevice() { deleteDevice() {
const lineModel = { const lineModel = {
point1: { point: {
x: this.form.x1, x: this.form.x,
y: this.form.y1 y: this.form.y
},
point2: {
x: this.form.x2,
y: this.form.y2
}, },
code: this.form.code, code: this.form.code,
_type: 'IscsLine', _type: 'OrdinaryDoor',
lineWidth: this.form.lineWidth, rotationAngle: this.form.rotationAngle,
fillColor: this.form.fillColor, r: this.form.r,
classify: this.form.classify, doorType: this.form.doorType
arrowShow: this.form.arrowShow,
arrowSize: this.form.arrowSize
}; };
this.$emit('deleteDataModel', lineModel); this.$emit('deleteDataModel', lineModel);
}, },
@ -129,15 +123,11 @@ export default {
this.showDeleteButton = false; this.showDeleteButton = false;
this.form = { this.form = {
code: '', code: '',
lineWidth: '', doorType: '1',
fillColor: '#fff', r: 1,
arrowShow: 'none', rotationAngle: 0,
arrowSize: 5, x: 10,
x1: 10, y: 10
y1: 10,
x2: 20,
y2: 10,
classify:'solid'
}; };
} }
} }

View File

@ -53,7 +53,8 @@
<set-time ref="setTime" @ConfirmSelectBeginTime="start" /> <set-time ref="setTime" @ConfirmSelectBeginTime="start" />
<scene-list ref="sceneList" @selectQuest="selectQuest" /> <scene-list ref="sceneList" @selectQuest="selectQuest" />
<theory-quiz ref="theoryQuiz" /> <theory-quiz ref="theoryQuiz" @commitResult="commitResult" />
<throry-result ref="theoryResult" @restart="goTheoryQuiz" />
</div> </div>
</template> </template>
@ -66,6 +67,7 @@ import DemonChat from '../demonChat';
import SceneList from './sceneList'; import SceneList from './sceneList';
import MenuSchema from '@/views/newMap/displayNew/menuSchema'; import MenuSchema from '@/views/newMap/displayNew/menuSchema';
import TheoryQuiz from './quiz'; import TheoryQuiz from './quiz';
import ThroryResult from './result';
import { getGoodsTryUse } from '@/api/management/goods'; import { getGoodsTryUse } from '@/api/management/goods';
import { ranAsPlan, exitRunPlan, clearSimulation, getSimulationInfoNew } from '@/api/simulation'; import { ranAsPlan, exitRunPlan, clearSimulation, getSimulationInfoNew } from '@/api/simulation';
import { PermissionType } from '@/scripts/ConstDic'; import { PermissionType } from '@/scripts/ConstDic';
@ -87,7 +89,8 @@ export default {
MenuSchema, MenuSchema,
DemonMenu, DemonMenu,
SceneList, SceneList,
TheoryQuiz TheoryQuiz,
ThroryResult
}, },
props: { props: {
offset: { offset: {
@ -450,6 +453,9 @@ export default {
}, },
goTheoryQuiz() { goTheoryQuiz() {
this.$refs.theoryQuiz.doShow(); this.$refs.theoryQuiz.doShow();
},
commitResult(result) {
this.$refs.theoryResult.doShow(result);
} }
} }
}; };

View File

@ -27,19 +27,17 @@
</template> </template>
<script> <script>
// import { commitExam, getExamInfo, getUserExam, saveExamAnswer } from '@/api/exam.js';
// import WindowResizeHandler from '@/mixin/WindowResizeHandler';
import Question from './question'; import Question from './question';
import localStore from 'storejs'; import { getItemListByProjectCode, commitProjectTestPaper } from '@/api/competition';
import { postCompetitionTheory, getTheoryQuestion, quitCurrentRace } from '@/api/competition';
import { computationTime } from '@/utils/date'; import { computationTime } from '@/utils/date';
import { getSessionStorage } from '@/utils/auth';
import { ProjectCode } from '@/scripts/ProjectConfig';
export default { export default {
components: { components: {
Question Question
}, },
mixins: [ mixins: [
// WindowResizeHandler
], ],
data() { data() {
return { return {
@ -60,39 +58,7 @@ export default {
theoryExamTime: 0, theoryExamTime: 0,
countdown: null, countdown: null,
dialogVisible: false, dialogVisible: false,
data: { data: {}
theoryExamTime:1,
questions:[
{
id:1,
type:'select',
topic:'。。。。。',
optionList:[
{
id:1,
questionId:1,
content:'啊'
},
{
id:2,
questionId:1,
content:'吧'
},
{
id:3,
questionId:1,
content:'从'
},
{
id:4,
questionId:1,
content:'的'
}
],
score:10
}
]
}
}; };
}, },
computed: { computed: {
@ -105,6 +71,9 @@ export default {
question() { question() {
return this.examQuestions[this.index] || {}; return this.examQuestions[this.index] || {};
}, },
project() {
return getSessionStorage('project');
},
index2UnicodeList() { index2UnicodeList() {
return ['一', '二', '三', '四']; return ['一', '二', '三', '四'];
}, },
@ -122,51 +91,27 @@ export default {
} }
}, },
watch: { watch: {
'$router': function() {
this.loadInitData();
}
}, },
created() { created() {
this.loadInitData();
}, },
beforeDestroy() { beforeDestroy() {
quitCurrentRace(this.$route.query.raceId, {}).then(res=>{
});
if (this.countdown) { if (this.countdown) {
clearInterval(this.countdown); clearInterval(this.countdown);
} }
}, },
methods: { methods: {
doShow() { doShow() {
this.dialogVisible = true;
},
loadInitData() {
// this.theoryAnswers = [];
this.theoryAnswersMap = {}; this.theoryAnswersMap = {};
// getTheoryQuestion(this.$route.query.raceId).then((resp)=>{ this.dialogVisible = true;
// const storeAnswersKey = this.$store.state.user.id + '' + this.$route.query.raceId + 'theoryAnswers'; getItemListByProjectCode(ProjectCode[this.project]).then(resp => {
// const storeAnswers = localStore.get(storeAnswersKey); if (resp.data) {
// if (storeAnswers) { this.examQuestions = resp.data.map((el, i) => {
// this.theoryAnswersMap = storeAnswers;
// }
if (this.data) {
this.examQuestions = this.data.questions.map((el, i) => {
el.index = i; el.index = i;
el.answer = this.theoryAnswersMap[el.id]; el.answer = this.theoryAnswersMap[el.id];
return el; return el;
}); });
const storeKey = this.$store.state.user.id + '' + this.$route.query.raceId + 'theory'; this.theoryExamTime = 3600;
const startTime = localStore.get(storeKey);
if (startTime) {
const dt = new Date().getTime() - startTime;
this.theoryExamTime = this.data.theoryExamTime * 60 - Math.floor(dt / 1000);
} else {
this.theoryExamTime = this.data.theoryExamTime * 60;
const storeValue = new Date().getTime();
localStore.set(storeKey, storeValue);
}
this.countdownTime = computationTime(this.theoryExamTime); this.countdownTime = computationTime(this.theoryExamTime);
this.countdown = setInterval(() => { this.countdown = setInterval(() => {
if (this.theoryExamTime <= 0) { if (this.theoryExamTime <= 0) {
if (this.countdown) { if (this.countdown) {
@ -178,7 +123,9 @@ export default {
this.countdownTime = computationTime(this.theoryExamTime); this.countdownTime = computationTime(this.theoryExamTime);
}, 1000); }, 1000);
} }
// }).catch(error => { this.$message.error(`${error.message}`); }); }).catch(() => {
this.$message.error('获取试题列表失败!');
});
}, },
resizeHandler() { resizeHandler() {
this.height = this._clientHeight; this.height = this._clientHeight;
@ -219,25 +166,15 @@ export default {
for (const key in this.theoryAnswersMap) { for (const key in this.theoryAnswersMap) {
theoryAnswers.push({questionId: key, answerOptionId: this.theoryAnswersMap[key]}); theoryAnswers.push({questionId: key, answerOptionId: this.theoryAnswersMap[key]});
} }
const params = { commitProjectTestPaper(ProjectCode[this.project], theoryAnswers).then(resp => {
competitionId: this.$route.query.raceId, this.$emit('commitResult', resp.data);
theoryAnswers: theoryAnswers this.dialogVisible = false;
}; }).catch(() => {
// postCompetitionTheory(params).then(()=>{ this.$message.error('提示试卷失败');
// const storeKey = this.$store.state.user.id + '' + this.$route.query.raceId + 'theory'; });
// localStore.remove(storeKey);
// this.$router.push({ path: `/jsxt/theory/result?raceId=${this.$route.query.raceId}` });
// });
}, },
onSave(data) { onSave(data) {
// this.theoryAnswers.push({
// answerOptionId: data.answer,
// questionId: data.userExamQuestionId
// });
this.theoryAnswersMap[data.userExamQuestionId] = data.answer; this.theoryAnswersMap[data.userExamQuestionId] = data.answer;
// console.log(data, '', this.theoryAnswers, this.theoryAnswersMap);
const storeKey = this.$store.state.user.id + '' + this.$route.query.raceId + 'theoryAnswers';
localStore.set(storeKey, this.theoryAnswersMap);
} }
} }
}; };

View File

@ -0,0 +1,109 @@
<template>
<el-dialog :visible.sync="dialogVisible" fullscreen>
<div class="joylink-card paper">
<div class="card-title">
<span style="font-weight:bold ">{{ $t('exam.examResultsDetails') }}</span>
</div>
<div class="context">
<el-table :data="operateScoreData" border style="width: 100%; min-height: 200px;" :summary-method="getSummaries" show-summary>
<el-table-column prop="questionTopic" label="题目" />
<el-table-column prop="remarks" label="描述" />
<el-table-column prop="totalScore" width="100" label="分值" />
<el-table-column prop="score" width="100" label="得分" />
</el-table>
</div>
<div class="draf_box">
<el-button type="primary " @click="restart">重新测试</el-button>
<el-button type="primary" @click="close">关闭</el-button>
</div>
</div>
</el-dialog>
</template>
<script>
export default {
name: 'ExamResult',
props: {
},
data() {
return {
resultModel: {
trainingName: '',
score: 0
},
tableData: [],
operateScoreData: [],
dialogVisible: false
};
},
computed: {
height() {
return this.$store.state.app.height - 50;
}
},
created() {
},
methods: {
doShow(result) {
this.dialogVisible = true;
this.operateScoreData = result;
},
getSummaries(param) { //
const { columns, data } = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = this.$t('exam.totalScore');
return;
}
if (column.property === 'score' || column.property === 'totalScore') {
const values = data.map(item => Number(item[column.property]));
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] += this.$t('exam.points');
} else {
sums[index] = '';
}
}
});
return sums;
},
restart() {
this.$emit('restart');
},
close() {
this.dialogVisible = false;
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.paper {
height: 100%;
overflow: hidden;
.card-title{
height: 47px;
line-height: 47px;
border-bottom: 1px solid #e6e6e6;
text-align: center;
}
.context {
padding: 30px 60px;
height: calc(100% - 107px);
overflow: auto;
}
}
.draf_box{
padding: 10px 0;
text-align: center;
}
</style>