Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
465248872f
@ -239,4 +239,19 @@ export function getTheroyCompetitionResult(competitionId, raceUserId) {
|
||||
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
|
||||
});
|
||||
}
|
||||
|
@ -296,9 +296,16 @@ deviceRender[deviceType.IscsImage] = {
|
||||
zlevel: 1,
|
||||
z: 5
|
||||
};
|
||||
// 福州iscs扇门
|
||||
deviceRender[deviceType.OrdinaryDoor] = {
|
||||
_type: deviceType.OrdinaryDoor,
|
||||
zlevel: 1,
|
||||
z: 4
|
||||
};
|
||||
// 福州门禁
|
||||
deviceRender[deviceType.FuzhouDoor] = {
|
||||
_type: deviceType.FuzhouDoor,
|
||||
zlevel: 1,
|
||||
z: 4
|
||||
};
|
||||
export default deviceRender;
|
||||
|
@ -46,7 +46,8 @@ const deviceType = {
|
||||
Elevator: 'Elevator',
|
||||
Draught: 'Draught',
|
||||
IscsImage: 'IscsImage',
|
||||
OrdinaryDoor: 'ordinaryDoor'
|
||||
OrdinaryDoor: 'OrdinaryDoor',
|
||||
FuzhouDoor: 'FuzhouDoor'
|
||||
};
|
||||
|
||||
export default deviceType;
|
||||
|
@ -47,6 +47,7 @@ import Elevator from './bas/elevator';
|
||||
import Draught from './bas/draught';
|
||||
import IscsImage from './iscsImage';
|
||||
import OrdinaryDoor from './ordinaryDoor';
|
||||
import FuzhouDoor from './fuzhouDoor';
|
||||
|
||||
const iscsShape = {};
|
||||
iscsShape[deviceType.ManualAlarmButton] = ManualAlarmButton;
|
||||
@ -98,6 +99,7 @@ iscsShape[deviceType.Elevator] = Elevator;
|
||||
iscsShape[deviceType.Draught] = Draught;
|
||||
iscsShape[deviceType.IscsImage] = IscsImage;
|
||||
iscsShape[deviceType.OrdinaryDoor] = OrdinaryDoor;
|
||||
iscsShape[deviceType.FuzhouDoor] = FuzhouDoor;
|
||||
|
||||
function shapefactory(device, iscs) {
|
||||
const type = device.model._type;
|
||||
|
137
src/iscs/shape/fuzhouDoor.js
Normal file
137
src/iscs/shape/fuzhouDoor.js
Normal 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;
|
||||
}
|
||||
}
|
@ -22,11 +22,11 @@ export default class OrdinaryDoor extends Group {
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
shape: {
|
||||
cx: this.model.point.x,
|
||||
cy: this.model.point.y - this.model.r,
|
||||
cx: 0,
|
||||
cy: this.model.r,
|
||||
r: this.model.r,
|
||||
startAngle: Math.PI / 2,
|
||||
endAngle: Math.PI
|
||||
startAngle: Math.PI / 2 * 3,
|
||||
endAngle: 2 * Math.PI
|
||||
},
|
||||
style: {
|
||||
fill: 'rgba(0, 0, 0, 0)',
|
||||
@ -34,6 +34,7 @@ export default class OrdinaryDoor extends Group {
|
||||
lineWidth: 1
|
||||
}
|
||||
});
|
||||
this.grouper.add(this.sector1);
|
||||
if (this.model.doorType === '1') {
|
||||
this.createLine(this.model.r);
|
||||
} else if (this.model.doorType === '2') {
|
||||
@ -47,17 +48,20 @@ export default class OrdinaryDoor extends Group {
|
||||
this.createRect(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() {
|
||||
this.sector2 = new Sector({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
shape: {
|
||||
cx: this.model.point.x + this.model.r * 2,
|
||||
cy: this.model.point.y,
|
||||
cx: this.model.r * 2,
|
||||
cy: this.model.r,
|
||||
r: this.model.r,
|
||||
startAngle: 0,
|
||||
endAngle: Math.PI / 2
|
||||
startAngle: Math.PI,
|
||||
endAngle: Math.PI / 2 * 3
|
||||
},
|
||||
style: {
|
||||
fill: 'rgba(0,0,0,0)',
|
||||
@ -72,10 +76,10 @@ export default class OrdinaryDoor extends Group {
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
shape: {
|
||||
x1: this.model.point.x,
|
||||
y1: this.model.point.y - this.model.r,
|
||||
x2: this.model.point.x + length,
|
||||
y2: this.model.point.y - this.model.r
|
||||
x1: 1,
|
||||
y1: this.model.r,
|
||||
x2: length - 1,
|
||||
y2: this.model.r
|
||||
},
|
||||
style: {
|
||||
stroke: '#45607B',
|
||||
@ -89,8 +93,8 @@ export default class OrdinaryDoor extends Group {
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
shape: {
|
||||
x: this.model.point.x,
|
||||
y: this.model.point.y - this.model.r,
|
||||
x: 0,
|
||||
y: this.model.r,
|
||||
width: length,
|
||||
height: this.model.r
|
||||
},
|
||||
@ -102,4 +106,8 @@ export default class OrdinaryDoor extends Group {
|
||||
});
|
||||
this.grouper.add(this.bottomRect);
|
||||
}
|
||||
setModel(dx, dy) {
|
||||
this.model.point.x += dx;
|
||||
this.model.point.y += dy;
|
||||
}
|
||||
}
|
||||
|
@ -187,6 +187,9 @@ export function parser(data) {
|
||||
zrUtil.each(data.ordinaryDoorList || [], elem => {
|
||||
iscsDevice[elem.code] = deviceFactory(deviceType.OrdinaryDoor, elem);
|
||||
});
|
||||
zrUtil.each(data.fuzhoudoorList || [], elem => {
|
||||
iscsDevice[elem.code] = deviceFactory(deviceType.FuzhouDoor, elem);
|
||||
});
|
||||
}
|
||||
|
||||
return iscsDevice;
|
||||
|
@ -161,7 +161,6 @@ const iscs = {
|
||||
if (!(models instanceof Array)) {
|
||||
models = [models];
|
||||
}
|
||||
|
||||
commit('iscsRender', models);
|
||||
resolve(models);
|
||||
});
|
||||
|
@ -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'; // 张赛
|
||||
|
@ -50,14 +50,14 @@
|
||||
@deleteDataModel="deleteDataModel"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-table-column label="扇门" name="ordinaryDoor">
|
||||
<el-tab-pane label="扇门" name="ordinaryDoor">
|
||||
<ordinary-door
|
||||
ref="ordinaryDoor"
|
||||
style="width: 100%;height: 100%;"
|
||||
@createDataModel="createDataModel"
|
||||
@deleteDataModel="deleteDataModel"
|
||||
/>
|
||||
</el-table-column>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-card>
|
||||
</div>
|
||||
|
118
src/views/iscs/iscsDraw/iscsCommonElem/fuzhouDoor.vue
Normal file
118
src/views/iscs/iscsDraw/iscsCommonElem/fuzhouDoor.vue
Normal 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>
|
@ -53,6 +53,7 @@ export default {
|
||||
{label: '单扇有矩形', value: '3'},
|
||||
{label: '双扇有矩形', value: '4'}
|
||||
],
|
||||
rules: {},
|
||||
isUpdate: false,
|
||||
buttonText: '立即创建',
|
||||
showDeleteButton: false
|
||||
@ -74,6 +75,7 @@ export default {
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -85,16 +87,14 @@ export default {
|
||||
if (valid) {
|
||||
const model = {
|
||||
point: {
|
||||
x: this.form.x1,
|
||||
y: this.form.y1
|
||||
x: this.form.x,
|
||||
y: this.form.y
|
||||
},
|
||||
code: this.isUpdate ? this.form.code : getUID('OrdinaryDoor', this.iscs.ordinaryDoorList),
|
||||
_type: 'OrdinaryDoor',
|
||||
lineWidth: this.form.lineWidth,
|
||||
fillColor: this.form.fillColor,
|
||||
classify: this.form.classify,
|
||||
arrowShow: this.form.arrowShow,
|
||||
arrowSize: this.form.arrowSize
|
||||
rotationAngle: this.form.rotationAngle,
|
||||
r: this.form.r,
|
||||
doorType: this.form.doorType
|
||||
};
|
||||
this.$emit('createDataModel', model);
|
||||
this.initPage();
|
||||
@ -105,21 +105,15 @@ export default {
|
||||
},
|
||||
deleteDevice() {
|
||||
const lineModel = {
|
||||
point1: {
|
||||
x: this.form.x1,
|
||||
y: this.form.y1
|
||||
},
|
||||
point2: {
|
||||
x: this.form.x2,
|
||||
y: this.form.y2
|
||||
point: {
|
||||
x: this.form.x,
|
||||
y: this.form.y
|
||||
},
|
||||
code: this.form.code,
|
||||
_type: 'IscsLine',
|
||||
lineWidth: this.form.lineWidth,
|
||||
fillColor: this.form.fillColor,
|
||||
classify: this.form.classify,
|
||||
arrowShow: this.form.arrowShow,
|
||||
arrowSize: this.form.arrowSize
|
||||
_type: 'OrdinaryDoor',
|
||||
rotationAngle: this.form.rotationAngle,
|
||||
r: this.form.r,
|
||||
doorType: this.form.doorType
|
||||
};
|
||||
this.$emit('deleteDataModel', lineModel);
|
||||
},
|
||||
@ -129,15 +123,11 @@ export default {
|
||||
this.showDeleteButton = false;
|
||||
this.form = {
|
||||
code: '',
|
||||
lineWidth: '',
|
||||
fillColor: '#fff',
|
||||
arrowShow: 'none',
|
||||
arrowSize: 5,
|
||||
x1: 10,
|
||||
y1: 10,
|
||||
x2: 20,
|
||||
y2: 10,
|
||||
classify:'solid'
|
||||
doorType: '1',
|
||||
r: 1,
|
||||
rotationAngle: 0,
|
||||
x: 10,
|
||||
y: 10
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,8 @@
|
||||
|
||||
<set-time ref="setTime" @ConfirmSelectBeginTime="start" />
|
||||
<scene-list ref="sceneList" @selectQuest="selectQuest" />
|
||||
<theory-quiz ref="theoryQuiz" />
|
||||
<theory-quiz ref="theoryQuiz" @commitResult="commitResult" />
|
||||
<throry-result ref="theoryResult" @restart="goTheoryQuiz" />
|
||||
</div>
|
||||
|
||||
</template>
|
||||
@ -66,6 +67,7 @@ import DemonChat from '../demonChat';
|
||||
import SceneList from './sceneList';
|
||||
import MenuSchema from '@/views/newMap/displayNew/menuSchema';
|
||||
import TheoryQuiz from './quiz';
|
||||
import ThroryResult from './result';
|
||||
import { getGoodsTryUse } from '@/api/management/goods';
|
||||
import { ranAsPlan, exitRunPlan, clearSimulation, getSimulationInfoNew } from '@/api/simulation';
|
||||
import { PermissionType } from '@/scripts/ConstDic';
|
||||
@ -87,7 +89,8 @@ export default {
|
||||
MenuSchema,
|
||||
DemonMenu,
|
||||
SceneList,
|
||||
TheoryQuiz
|
||||
TheoryQuiz,
|
||||
ThroryResult
|
||||
},
|
||||
props: {
|
||||
offset: {
|
||||
@ -450,6 +453,9 @@ export default {
|
||||
},
|
||||
goTheoryQuiz() {
|
||||
this.$refs.theoryQuiz.doShow();
|
||||
},
|
||||
commitResult(result) {
|
||||
this.$refs.theoryResult.doShow(result);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -27,19 +27,17 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import { commitExam, getExamInfo, getUserExam, saveExamAnswer } from '@/api/exam.js';
|
||||
// import WindowResizeHandler from '@/mixin/WindowResizeHandler';
|
||||
import Question from './question';
|
||||
import localStore from 'storejs';
|
||||
import { postCompetitionTheory, getTheoryQuestion, quitCurrentRace } from '@/api/competition';
|
||||
import { getItemListByProjectCode, commitProjectTestPaper } from '@/api/competition';
|
||||
import { computationTime } from '@/utils/date';
|
||||
import { getSessionStorage } from '@/utils/auth';
|
||||
import { ProjectCode } from '@/scripts/ProjectConfig';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Question
|
||||
},
|
||||
mixins: [
|
||||
// WindowResizeHandler
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
@ -60,39 +58,7 @@ export default {
|
||||
theoryExamTime: 0,
|
||||
countdown: null,
|
||||
dialogVisible: false,
|
||||
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
|
||||
}
|
||||
]
|
||||
}
|
||||
data: {}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -105,6 +71,9 @@ export default {
|
||||
question() {
|
||||
return this.examQuestions[this.index] || {};
|
||||
},
|
||||
project() {
|
||||
return getSessionStorage('project');
|
||||
},
|
||||
index2UnicodeList() {
|
||||
return ['一', '二', '三', '四'];
|
||||
},
|
||||
@ -122,63 +91,41 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'$router': function() {
|
||||
this.loadInitData();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.loadInitData();
|
||||
},
|
||||
beforeDestroy() {
|
||||
quitCurrentRace(this.$route.query.raceId, {}).then(res=>{
|
||||
});
|
||||
if (this.countdown) {
|
||||
clearInterval(this.countdown);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
doShow() {
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
loadInitData() {
|
||||
// this.theoryAnswers = [];
|
||||
this.theoryAnswersMap = {};
|
||||
// getTheoryQuestion(this.$route.query.raceId).then((resp)=>{
|
||||
// const storeAnswersKey = this.$store.state.user.id + '' + this.$route.query.raceId + 'theoryAnswers';
|
||||
// const storeAnswers = localStore.get(storeAnswersKey);
|
||||
// if (storeAnswers) {
|
||||
// this.theoryAnswersMap = storeAnswers;
|
||||
// }
|
||||
if (this.data) {
|
||||
this.examQuestions = this.data.questions.map((el, i) => {
|
||||
el.index = i;
|
||||
el.answer = this.theoryAnswersMap[el.id];
|
||||
return el;
|
||||
});
|
||||
const storeKey = this.$store.state.user.id + '' + this.$route.query.raceId + 'theory';
|
||||
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.countdown = setInterval(() => {
|
||||
if (this.theoryExamTime <= 0) {
|
||||
if (this.countdown) {
|
||||
clearInterval(this.countdown);
|
||||
}
|
||||
this.commit();
|
||||
}
|
||||
this.theoryExamTime--;
|
||||
this.dialogVisible = true;
|
||||
getItemListByProjectCode(ProjectCode[this.project]).then(resp => {
|
||||
if (resp.data) {
|
||||
this.examQuestions = resp.data.map((el, i) => {
|
||||
el.index = i;
|
||||
el.answer = this.theoryAnswersMap[el.id];
|
||||
return el;
|
||||
});
|
||||
this.theoryExamTime = 3600;
|
||||
this.countdownTime = computationTime(this.theoryExamTime);
|
||||
}, 1000);
|
||||
}
|
||||
// }).catch(error => { this.$message.error(`加载考试详情失败:${error.message}`); });
|
||||
this.countdown = setInterval(() => {
|
||||
if (this.theoryExamTime <= 0) {
|
||||
if (this.countdown) {
|
||||
clearInterval(this.countdown);
|
||||
}
|
||||
this.commit();
|
||||
}
|
||||
this.theoryExamTime--;
|
||||
this.countdownTime = computationTime(this.theoryExamTime);
|
||||
}, 1000);
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$message.error('获取试题列表失败!');
|
||||
});
|
||||
},
|
||||
resizeHandler() {
|
||||
this.height = this._clientHeight;
|
||||
@ -219,25 +166,15 @@ export default {
|
||||
for (const key in this.theoryAnswersMap) {
|
||||
theoryAnswers.push({questionId: key, answerOptionId: this.theoryAnswersMap[key]});
|
||||
}
|
||||
const params = {
|
||||
competitionId: this.$route.query.raceId,
|
||||
theoryAnswers: theoryAnswers
|
||||
};
|
||||
// postCompetitionTheory(params).then(()=>{
|
||||
// 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}` });
|
||||
// });
|
||||
commitProjectTestPaper(ProjectCode[this.project], theoryAnswers).then(resp => {
|
||||
this.$emit('commitResult', resp.data);
|
||||
this.dialogVisible = false;
|
||||
}).catch(() => {
|
||||
this.$message.error('提示试卷失败');
|
||||
});
|
||||
},
|
||||
onSave(data) {
|
||||
// this.theoryAnswers.push({
|
||||
// answerOptionId: data.answer,
|
||||
// questionId: data.userExamQuestionId
|
||||
// });
|
||||
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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
109
src/views/newMap/displayNew/dispatherContest/result.vue
Normal file
109
src/views/newMap/displayNew/dispatherContest/result.vue
Normal 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>
|
Loading…
Reference in New Issue
Block a user