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

学生

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