Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
b6f2de4d0f
@ -296,4 +296,9 @@ deviceRender[deviceType.IscsImage] = {
|
||||
zlevel: 1,
|
||||
z: 5
|
||||
};
|
||||
deviceRender[deviceType.OrdinaryDoor] = {
|
||||
_type: deviceType.OrdinaryDoor,
|
||||
zlevel: 1,
|
||||
z: 4
|
||||
};
|
||||
export default deviceRender;
|
||||
|
@ -45,7 +45,8 @@ const deviceType = {
|
||||
Stairs: 'Stairs',
|
||||
Elevator: 'Elevator',
|
||||
Draught: 'Draught',
|
||||
IscsImage: 'IscsImage'
|
||||
IscsImage: 'IscsImage',
|
||||
OrdinaryDoor: 'ordinaryDoor'
|
||||
};
|
||||
|
||||
export default deviceType;
|
||||
|
@ -46,6 +46,7 @@ import Stairs from './bas/stairs';
|
||||
import Elevator from './bas/elevator';
|
||||
import Draught from './bas/draught';
|
||||
import IscsImage from './iscsImage';
|
||||
import OrdinaryDoor from './ordinaryDoor';
|
||||
|
||||
const iscsShape = {};
|
||||
iscsShape[deviceType.ManualAlarmButton] = ManualAlarmButton;
|
||||
@ -96,6 +97,7 @@ iscsShape[deviceType.Stairs] = Stairs;
|
||||
iscsShape[deviceType.Elevator] = Elevator;
|
||||
iscsShape[deviceType.Draught] = Draught;
|
||||
iscsShape[deviceType.IscsImage] = IscsImage;
|
||||
iscsShape[deviceType.OrdinaryDoor] = OrdinaryDoor;
|
||||
|
||||
function shapefactory(device, iscs) {
|
||||
const type = device.model._type;
|
||||
|
105
src/iscs/shape/ordinaryDoor.js
Normal file
105
src/iscs/shape/ordinaryDoor.js
Normal file
@ -0,0 +1,105 @@
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import Rect from 'zrender/src/graphic/shape/Rect';
|
||||
import Sector from 'zrender/src/graphic/shape/Sector';
|
||||
import Line from 'zrender/src/graphic/shape/Line';
|
||||
|
||||
export default class OrdinaryDoor 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();
|
||||
}
|
||||
create() {
|
||||
this.grouper = new Group({
|
||||
id: this.model.code,
|
||||
position: [this.model.point.x, this.model.point.y]
|
||||
});
|
||||
this.sector1 = new Sector({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
shape: {
|
||||
cx: this.model.point.x,
|
||||
cy: this.model.point.y - this.model.r,
|
||||
r: this.model.r,
|
||||
startAngle: Math.PI / 2,
|
||||
endAngle: Math.PI
|
||||
},
|
||||
style: {
|
||||
fill: 'rgba(0, 0, 0, 0)',
|
||||
stroke: '#FFF',
|
||||
lineWidth: 1
|
||||
}
|
||||
});
|
||||
if (this.model.doorType === '1') {
|
||||
this.createLine(this.model.r);
|
||||
} else if (this.model.doorType === '2') {
|
||||
this.createSector2();
|
||||
this.createLine(this.model.r * 2);
|
||||
} else if (this.model.doorType === '3') {
|
||||
this.createRect(this.model.r);
|
||||
this.createLine(this.model.r);
|
||||
} else if (this.model.doorType === '4') {
|
||||
this.createSector2();
|
||||
this.createRect(this.model.r * 2);
|
||||
this.createLine(this.model.r * 2);
|
||||
}
|
||||
}
|
||||
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,
|
||||
r: this.model.r,
|
||||
startAngle: 0,
|
||||
endAngle: Math.PI / 2
|
||||
},
|
||||
style: {
|
||||
fill: 'rgba(0,0,0,0)',
|
||||
stroke: '#FFF',
|
||||
lineWidth: 1
|
||||
}
|
||||
});
|
||||
this.grouper.add(this.sector2);
|
||||
}
|
||||
createLine(length) {
|
||||
this.maskLine = new Line({
|
||||
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
|
||||
},
|
||||
style: {
|
||||
stroke: '#45607B',
|
||||
lineWidth: 2
|
||||
}
|
||||
});
|
||||
this.grouper.add(this.maskLine);
|
||||
}
|
||||
createRect(length) {
|
||||
this.bottomRect = new Rect({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
shape: {
|
||||
x: this.model.point.x,
|
||||
y: this.model.point.y - this.model.r,
|
||||
width: length,
|
||||
height: this.model.r
|
||||
},
|
||||
style: {
|
||||
stroke: '#FFF',
|
||||
lineWidth: 1,
|
||||
fill: 'rgba(0, 0, 0, 0)'
|
||||
}
|
||||
});
|
||||
this.grouper.add(this.bottomRect);
|
||||
}
|
||||
}
|
@ -184,6 +184,9 @@ export function parser(data) {
|
||||
zrUtil.each(data.iscsImageList || [], elem => {
|
||||
iscsDevice[elem.code] = deviceFactory(deviceType.IscsImage, elem);
|
||||
});
|
||||
zrUtil.each(data.ordinaryDoorList || [], elem => {
|
||||
iscsDevice[elem.code] = deviceFactory(deviceType.OrdinaryDoor, elem);
|
||||
});
|
||||
}
|
||||
|
||||
return iscsDevice;
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
<script>
|
||||
import Question from '@/views/jsxt/competition/theory/quiz/question';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Question
|
||||
|
@ -451,6 +451,102 @@ export default {
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: '自动售检票/门禁',
|
||||
mode: '',
|
||||
id: '',
|
||||
type: '',
|
||||
children: [
|
||||
{
|
||||
name: '自动售检票系统',
|
||||
mode: '',
|
||||
id: '',
|
||||
type: ''
|
||||
},
|
||||
{
|
||||
name: '门禁系统',
|
||||
mode: '',
|
||||
id: '',
|
||||
type: ''
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: '火灾报警系统',
|
||||
mode: '',
|
||||
id: '',
|
||||
type: '',
|
||||
children: [
|
||||
{
|
||||
name: '火灾报警系统-FAS联动',
|
||||
mode: '',
|
||||
id: '',
|
||||
type: ''
|
||||
},
|
||||
{
|
||||
name: '火灾报警系统-站厅层',
|
||||
mode: '',
|
||||
id: '',
|
||||
type: ''
|
||||
},
|
||||
{
|
||||
name: '火灾报警系统-站台层',
|
||||
mode: '',
|
||||
id: '',
|
||||
type: ''
|
||||
},
|
||||
{
|
||||
name: '火灾报警系统-区间',
|
||||
mode: '',
|
||||
id: '',
|
||||
type: ''
|
||||
},
|
||||
{
|
||||
name: '感温光纤探测系统',
|
||||
mode: '',
|
||||
id: '',
|
||||
type: ''
|
||||
},
|
||||
{
|
||||
name: '气体灭火系统',
|
||||
mode: '',
|
||||
id: '',
|
||||
type: ''
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: '信号系统',
|
||||
mode: '',
|
||||
id: '',
|
||||
type: '',
|
||||
children: [
|
||||
{
|
||||
name: 'TIS管理器',
|
||||
mode: '',
|
||||
id: '',
|
||||
type: ''
|
||||
},
|
||||
{
|
||||
name: '列车时刻表',
|
||||
mode: '',
|
||||
id: '',
|
||||
type: ''
|
||||
},
|
||||
{
|
||||
name: '信号系统',
|
||||
mode: '',
|
||||
id: '',
|
||||
type: ''
|
||||
},
|
||||
{
|
||||
name: '全线信号系统界面',
|
||||
mode: '',
|
||||
id: '',
|
||||
type: ''
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
},
|
||||
|
@ -50,6 +50,14 @@
|
||||
@deleteDataModel="deleteDataModel"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-table-column label="扇门" name="ordinaryDoor">
|
||||
<ordinary-door
|
||||
ref="ordinaryDoor"
|
||||
style="width: 100%;height: 100%;"
|
||||
@createDataModel="createDataModel"
|
||||
@deleteDataModel="deleteDataModel"
|
||||
/>
|
||||
</el-table-column>
|
||||
</el-tabs>
|
||||
</el-card>
|
||||
</div>
|
||||
@ -62,6 +70,7 @@ import IscsButton from '../iscsCommonElem/button';
|
||||
import IscsLine from '../iscsCommonElem/line';
|
||||
import IscsText from '../iscsCommonElem/text';
|
||||
import IscsRect from '../iscsCommonElem/rect';
|
||||
import OrdinaryDoor from '../iscsCommonElem/ordinaryDoor';
|
||||
|
||||
export default {
|
||||
name: 'IscsAcsOperate',
|
||||
@ -70,7 +79,8 @@ export default {
|
||||
IscsButton,
|
||||
IscsLine,
|
||||
IscsText,
|
||||
IscsRect
|
||||
IscsRect,
|
||||
OrdinaryDoor
|
||||
},
|
||||
mixins: [
|
||||
],
|
||||
|
149
src/views/iscs/iscsDraw/iscsCommonElem/ordinaryDoor.vue
Normal file
149
src/views/iscs/iscsDraw/iscsCommonElem/ordinaryDoor.vue
Normal file
@ -0,0 +1,149 @@
|
||||
<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="width">
|
||||
<el-select v-model="form.doorType" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="门半径:" prop="height">
|
||||
<el-input-number v-model="form.r" controls-position="right" :min="1" size="small" />
|
||||
</el-form-item>
|
||||
<el-form-item label="旋转角度:">
|
||||
<el-input-number v-model="form.rotationAngle" size="small" :min="0" :max="360" controls-position="right" />
|
||||
</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: '',
|
||||
doorType: '1',
|
||||
r: 1,
|
||||
rotationAngle: 0,
|
||||
x: 10,
|
||||
y: 10
|
||||
},
|
||||
options: [
|
||||
{label: '单扇无矩形', value: '1'},
|
||||
{label: '双扇无矩形', value: '2'},
|
||||
{label: '单扇有矩形', value: '3'},
|
||||
{label: '双扇有矩形', value: '4'}
|
||||
],
|
||||
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.rotationAngle = model.rotationAngle;
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
onSubmit(form) {
|
||||
this.$refs[form].validate((valid) => {
|
||||
if (valid) {
|
||||
const model = {
|
||||
point: {
|
||||
x: this.form.x1,
|
||||
y: this.form.y1
|
||||
},
|
||||
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
|
||||
};
|
||||
this.$emit('createDataModel', model);
|
||||
this.initPage();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
deleteDevice() {
|
||||
const lineModel = {
|
||||
point1: {
|
||||
x: this.form.x1,
|
||||
y: this.form.y1
|
||||
},
|
||||
point2: {
|
||||
x: this.form.x2,
|
||||
y: this.form.y2
|
||||
},
|
||||
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
|
||||
};
|
||||
this.$emit('deleteDataModel', lineModel);
|
||||
},
|
||||
initPage() {
|
||||
this.isUpdate = false;
|
||||
this.buttonText = '立即创建';
|
||||
this.showDeleteButton = false;
|
||||
this.form = {
|
||||
code: '',
|
||||
lineWidth: '',
|
||||
fillColor: '#fff',
|
||||
arrowShow: 'none',
|
||||
arrowSize: 5,
|
||||
x1: 10,
|
||||
y1: 10,
|
||||
x2: 20,
|
||||
y2: 10,
|
||||
classify:'solid'
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@ -21,6 +21,7 @@
|
||||
<el-button v-if="schedulePreviewShow" type="primary" size="small" @click="schedulingView">派班计划预览</el-button>
|
||||
<el-button v-if="isContest" size="small" @click="fieldPractice">实操练习</el-button>
|
||||
<el-button v-if="isContest" size="small" @click=" fieldTeach">实操教学</el-button>
|
||||
<el-button v-if="isContest" size="small" @click="goTheoryQuiz">理论考试</el-button>
|
||||
<el-button v-if="isContest" size="small" @click="viewChangeMap">切换地图</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
@ -209,6 +210,9 @@ export default {
|
||||
},
|
||||
fieldTeach() {
|
||||
this.$emit('fieldPractice', 'teach');
|
||||
},
|
||||
goTheoryQuiz() {
|
||||
this.$emit('goTheoryQuiz');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -19,6 +19,7 @@
|
||||
:all-style="'top:'+(offset+textStatusHeight)+'px'"
|
||||
@changeMap="changeMap"
|
||||
@fieldPractice="fieldPractice"
|
||||
@goTheoryQuiz="goTheoryQuiz"
|
||||
/>
|
||||
|
||||
<div class="display-draft" :class="{'haerbin_btn_box': $route.query.lineCode == '07'}" :style="{bottom: offsetBottom + 'px'}">
|
||||
@ -52,6 +53,7 @@
|
||||
|
||||
<set-time ref="setTime" @ConfirmSelectBeginTime="start" />
|
||||
<scene-list ref="sceneList" @selectQuest="selectQuest" />
|
||||
<theory-quiz ref="theoryQuiz" />
|
||||
</div>
|
||||
|
||||
</template>
|
||||
@ -63,6 +65,7 @@ import DemonMenu from '../demonMenu';
|
||||
import DemonChat from '../demonChat';
|
||||
import SceneList from './sceneList';
|
||||
import MenuSchema from '@/views/newMap/displayNew/menuSchema';
|
||||
import TheoryQuiz from './quiz';
|
||||
import { getGoodsTryUse } from '@/api/management/goods';
|
||||
import { ranAsPlan, exitRunPlan, clearSimulation, getSimulationInfoNew } from '@/api/simulation';
|
||||
import { PermissionType } from '@/scripts/ConstDic';
|
||||
@ -83,7 +86,8 @@ export default {
|
||||
DemonChat,
|
||||
MenuSchema,
|
||||
DemonMenu,
|
||||
SceneList
|
||||
SceneList,
|
||||
TheoryQuiz
|
||||
},
|
||||
props: {
|
||||
offset: {
|
||||
@ -376,7 +380,6 @@ export default {
|
||||
}
|
||||
this.userRole = userRole;
|
||||
this.$store.dispatch('scriptRecord/updateBgSet', true);
|
||||
console.log(id, '-------------');
|
||||
// this.$refs.chatbox.setMembers(id);
|
||||
const res = await loadScriptNew(row.id, id, this.group);
|
||||
if (res && res.code == 200) {
|
||||
@ -388,7 +391,6 @@ export default {
|
||||
// this.initLoadPage();
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
this.$messageBox(error.message);
|
||||
}
|
||||
// if (this.isScript) {
|
||||
@ -445,6 +447,9 @@ export default {
|
||||
},
|
||||
fieldPractice(param) {
|
||||
this.$refs.sceneList.doShow(param);
|
||||
},
|
||||
goTheoryQuiz() {
|
||||
this.$refs.theoryQuiz.doShow();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
91
src/views/newMap/displayNew/dispatherContest/question.vue
Normal file
91
src/views/newMap/displayNew/dispatherContest/question.vue
Normal file
@ -0,0 +1,91 @@
|
||||
<template>
|
||||
<div class="question">
|
||||
<div class="ql-editor" v-html="appendIndex($escapeHTML(`${option.topic}`), $vnode.key)" />
|
||||
<template v-if="checkType(option, 'judge')">
|
||||
<el-radio-group v-model="answer" @change="onChnage">
|
||||
<el-radio v-for="(el,i) in option.optionList" :key="i" :label="$str2number(el.id)" style="display: inline">
|
||||
<span>{{ el.content }}</span>
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</template>
|
||||
<template v-else-if="checkType(option, 'select')">
|
||||
<el-radio-group v-model="answer" @change="onChnage">
|
||||
<el-radio v-for="(el,i) in option.optionList" :key="i" :label="$str2number(el.id)" style="display: block">
|
||||
<span>{{ $asc2chart(i+65) }}. </span>
|
||||
<div class="ql-editor" style="display: inline; padding: 0" v-html="$escapeHTML(el.content)" />
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
props: {
|
||||
value: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
option: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
answer: 0
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
value(val) {
|
||||
this.changeValue();
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.changeValue();
|
||||
},
|
||||
methods: {
|
||||
changeValue() {
|
||||
this.answer = parseInt(this.value);
|
||||
},
|
||||
checkType(option, type) {
|
||||
return option.type == type;
|
||||
},
|
||||
appendIndex(str, index) {
|
||||
return `${index + 1}. ${str}`;
|
||||
},
|
||||
onChnage(e) {
|
||||
const answer = `${e}`;
|
||||
this.$emit('input', answer);
|
||||
this.$emit('save', {userExamQuestionId: this.option.id, answer: answer});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.rich-text {
|
||||
padding: 0;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.question {
|
||||
/deep/ {
|
||||
.ql-editor {
|
||||
line-height: 26px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.el-radio {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.el-radio__label {
|
||||
font-size: 16px;
|
||||
line-height: 26px;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
334
src/views/newMap/displayNew/dispatherContest/quiz.vue
Normal file
334
src/views/newMap/displayNew/dispatherContest/quiz.vue
Normal file
@ -0,0 +1,334 @@
|
||||
<template>
|
||||
<el-dialog :visible.sync="dialogVisible" fullscreen>
|
||||
<el-container class="quiz">
|
||||
<el-container class="quiz__container">
|
||||
<el-header class="quiz__container-header layer-center">
|
||||
<div class="title">{{ formModel.name }}</div>
|
||||
<div class="notes">{{ formModel.description }}</div>
|
||||
</el-header>
|
||||
<el-main class="quiz__container-main layer-center">
|
||||
<div v-for="(el,i) in sortedList" :id="'anchor__lst-'+i" :key="i" class="section">
|
||||
<template v-if="el.children.length">
|
||||
<div class="caption">{{ index2UnicodeList[i] }}、{{ el.title }} </div>
|
||||
<question v-for="(item,j) in el.children" :id="'anchor__lst-'+item.type+'-'+item.index" :key="j" v-model="item.answer" class="context" :option="item" @save="onSave" />
|
||||
</template>
|
||||
</div>
|
||||
</el-main>
|
||||
<el-footer class="quiz__container-footer layer-center" @click="returnTop">
|
||||
<div style="display: inline-block;position: relative;bottom: 20px;height: 40px;line-height: 40px;float: left;color:#F00;font-size: 12px;">温馨提示:考试过程中请退出或关闭本页面不会终止计时!</div>
|
||||
<div style="display: inline-block;position: relative;bottom: 20px;height: 40px;line-height: 40px;margin-right: 10px;font-weight:bold;">{{ '剩余时间:'+countdownTime }}</div>
|
||||
<el-button-group class="buttons">
|
||||
<el-button v-loading="loading" type="primary" @click="commit">提 交</el-button>
|
||||
</el-button-group>
|
||||
</el-footer>
|
||||
</el-container>
|
||||
</el-container>
|
||||
</el-dialog>
|
||||
</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 { computationTime } from '@/utils/date';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Question
|
||||
},
|
||||
mixins: [
|
||||
// WindowResizeHandler
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
index: 0,
|
||||
height: 0,
|
||||
loading: false,
|
||||
formModel: {
|
||||
description: '',
|
||||
duration: 10,
|
||||
name: '',
|
||||
status: '',
|
||||
totalScore: 0,
|
||||
passScore: 10
|
||||
},
|
||||
examQuestions: [],
|
||||
theoryAnswersMap: {},
|
||||
countdownTime: '00:00:00',
|
||||
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
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
examId() {
|
||||
return this.$route.params.examId;
|
||||
},
|
||||
userExamId() {
|
||||
return this.$route.params.userExamId;
|
||||
},
|
||||
question() {
|
||||
return this.examQuestions[this.index] || {};
|
||||
},
|
||||
index2UnicodeList() {
|
||||
return ['一', '二', '三', '四'];
|
||||
},
|
||||
sortedList() {
|
||||
return [
|
||||
{
|
||||
title: '判断题',
|
||||
children: this.examQuestions.filter(el => { return el.type === 'judge'; })
|
||||
},
|
||||
{
|
||||
title: '选择题',
|
||||
children: this.examQuestions.filter(el => { return el.type === 'select'; })
|
||||
}
|
||||
];
|
||||
}
|
||||
},
|
||||
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.countdownTime = computationTime(this.theoryExamTime);
|
||||
}, 1000);
|
||||
}
|
||||
// }).catch(error => { this.$message.error(`加载考试详情失败:${error.message}`); });
|
||||
},
|
||||
resizeHandler() {
|
||||
this.height = this._clientHeight;
|
||||
},
|
||||
appendIndex(str, index) {
|
||||
return `${index + 1}. ${str}`;
|
||||
},
|
||||
goAnchor(selector) {
|
||||
const anchor = this.$el.querySelector(selector);
|
||||
const el = this.$el.querySelector('.el-main');
|
||||
if (anchor && el) {
|
||||
el.scrollTop = anchor.offsetTop;
|
||||
}
|
||||
},
|
||||
returnTop() {
|
||||
document.querySelector('.el-header').scrollIntoView(true);
|
||||
},
|
||||
commit() {
|
||||
let isFinish = true;
|
||||
this.examQuestions.forEach(el => {
|
||||
if (!el.answer) { isFinish = false; }
|
||||
});
|
||||
|
||||
if (isFinish || this.theoryExamTime <= 0) {
|
||||
this.doEnd();
|
||||
} else {
|
||||
this.$confirm('存在试题未完成,是否继续?', '提 示', {
|
||||
confirmButtonText: '确 定',
|
||||
cancelButtonText: '取 消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.doEnd();
|
||||
}).catch( () => { });
|
||||
}
|
||||
},
|
||||
doEnd() {
|
||||
const theoryAnswers = [];
|
||||
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}` });
|
||||
// });
|
||||
},
|
||||
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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.layer-center {
|
||||
width: 900px;
|
||||
height: 100%;
|
||||
margin: auto;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.quiz {
|
||||
background: #eee;
|
||||
height: 100%;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
display:none
|
||||
}
|
||||
|
||||
&__card {
|
||||
height: 100%;
|
||||
.dir-item {
|
||||
padding-left: 25px;
|
||||
}
|
||||
|
||||
.dir-caption {
|
||||
padding-left: 10px;
|
||||
line-height: 26px;
|
||||
background: #f1f1f1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
&__container {
|
||||
height: 100%;
|
||||
|
||||
&-header {
|
||||
height: auto !important;
|
||||
|
||||
.title {
|
||||
font-size: 24px;
|
||||
line-height: 60px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.notes {
|
||||
color:#606266;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
margin: 0 20px;
|
||||
}
|
||||
}
|
||||
|
||||
&-main {
|
||||
.section {
|
||||
padding: 5px 20px;
|
||||
.caption {
|
||||
line-height: 26px;
|
||||
}
|
||||
.context {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-footer {
|
||||
text-align: right;
|
||||
position: sticky;
|
||||
bottom: 0px;
|
||||
padding: 40px ;
|
||||
.buttons {
|
||||
position: relative;
|
||||
bottom: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/deep/{
|
||||
.el-dialog__body{
|
||||
height: 100%;
|
||||
}
|
||||
.el-dialog__header{
|
||||
padding: 0;
|
||||
}
|
||||
.el-dialog__headerbtn{
|
||||
top: 7px;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
Loading…
Reference in New Issue
Block a user