Commit 59ab0dbd authored by 甘瑞文's avatar 甘瑞文

学生

parent 2fdc170a
......@@ -3,4 +3,4 @@
/config/
/dist
/node_modules/
/*.js
/*.js
\ No newline at end of file
......@@ -46,10 +46,9 @@ export default {
GeekDrawBoard
},
props: {
// 检测类型 + 其他验证
// 检测类型 + 其他验证
eventId: {
type: String,
default: 0,
required: true
}
},
......@@ -72,13 +71,13 @@ export default {
this.paintType = title;
},
handleSubmit() {
let msg = this.$refs.draw.getImg()
const msg = this.$refs.draw.getImg()
this.submitting = true
socket.sendGroupMsg(
{
type: 'answer',
payload: {
type: 1,//简答题1 选择题3 抢答2
type: 1,// 简答题1 选择题3 抢答2
answer: msg,
eventId: this.eventId,
username: this.$route.query.username || ''
......
......@@ -6,7 +6,6 @@
<script>
export default {
name: 'locker',
data() {
......
......@@ -36,8 +36,8 @@ export default {
};
},
computed: {
countingText: function(){
return this.counttimes > 4 ? "Ready~" : (this.counttimes > 3 ? "Go!" : this.counttimes)
countingText() {
return this.counttimes > 4 ? 'Ready~' : (this.counttimes > 3 ? 'Go!' : this.counttimes)
}
},
methods: {
......@@ -45,22 +45,21 @@ export default {
console.log('===handleSubmit===');
this.submitting = true
socket.sendGroupMsg({
type: 'answer',
payload: {
type: 1,
answer: '',
eventId: this.eventId,
username: this.$route.query.username || ''
}
},
(data) => {
this.stage = 'submitted'
console.log('回执', data);
type: 'answer',
payload: {
type: 1,
answer: '',
eventId: this.eventId,
username: this.$route.query.username || ''
}
);
},
(data) => {
this.stage = 'submitted'
console.log('回执', data);
});
},
startCountdown() {
if(this.intervalId){
if (this.intervalId) {
clearInterval(this.intervalId)
}
this.intervalId = 0
......@@ -69,8 +68,8 @@ export default {
this.intervalId = setInterval(this.countdown, 1000)
},
countdown() {
if(this.counttimes <= 1){
if(this.intervalId){
if (this.counttimes <= 1) {
if (this.intervalId) {
clearInterval(this.intervalId)
}
this.stage = 'racing'
......
......@@ -61,30 +61,29 @@ export default {
// }
// return 'active'
// },
countingText: function(){
return this.counttimes > 4 ? "Ready" : (this.counttimes > 3 ? "Go!" : this.counttimes)
countingText() {
return this.counttimes > 4 ? 'Ready' : (this.counttimes > 3 ? 'Go!' : this.counttimes)
}
},
methods: {
handleSubmit() {
console.log('===handleSelect===');
console.log('answer: ' + this.answer)
console.log(`answer: ${this.answer}`)
this.submitting = true
socket.sendGroupMsg({
type: 'answer',
payload: {
type: 1,
answer: this.answer,
eventId: this.eventId,
username: this.$route.query.username || ''
}
},
(data) => {
this.stage = 'submitted'
this.submitting = false
console.log('回执', data)
type: 'answer',
payload: {
type: 1,
answer: this.answer,
eventId: this.eventId,
username: this.$route.query.username || ''
}
);
},
(data) => {
this.stage = 'submitted'
this.submitting = false
console.log('回执', data)
});
},
},
beforeDestroy() {
......
<template>
<div class="board-container">
<quick-response eventId="1234" v-if="this.currentComponment === 'quick-response'"/>
<locker eventId="1234" v-if="this.currentComponment === 'locker'"/>
<select-question eventId="1234" v-if="this.currentComponment === 'select-question'"/>
<drawing-board eventId="1234" v-if="this.currentComponment === 'drawing-board'"/>
<quick-response :eventId="eventId" v-if="this.currentComponment === 'quick-response'"/>
<locker :eventId="eventId" v-if="this.currentComponment === 'locker'"/>
<select-question :eventId="eventId" v-if="this.currentComponment === 'select-question'"/>
<drawing-board :eventId="eventId" v-if="this.currentComponment === 'drawing-board'"/>
</div>
</template>
......@@ -15,6 +15,7 @@ import Locker from './cmps/locker';
import QuickResponse from './cmps/quick-response';
import SelectQuestion from './cmps/select-question';
import DrawingBoard from './cmps/drawing-board';
export default {
name: 'vd',
components: {
......@@ -25,7 +26,8 @@ export default {
},
data() {
return {
currentComponment: 'locker'
currentComponment: 'locker',
eventId: 0
};
},
methods: {
......@@ -54,14 +56,14 @@ export default {
},
onMsg(msg) {
console.log('msg', msg);
if(!msg || !msg.from || !msg.from.indexOf('teacher') || !msg.payload){
if (!msg || !msg.from || !msg.from.indexOf('teacher') || !msg.payload) {
return
}
if(!msg.payload.eventId || msg.payload.type < 0 || !msg.payload.questionType){
if (!msg.payload.eventId || msg.payload.type < 0 || !msg.payload.questionType) {
return
}
this.eventId = msg.payload.eventId;
const questionType = msg.payload.questionType;
const {questionType} = msg.payload;
if (questionType === 3) {
this.currentComponment = 'select-question'
} else if (questionType === 1) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment