Commit 3b6d5735 authored by 刘阳's avatar 刘阳

fix: 禁用滑动

parent d2636bf8
<template>
<div ref="gk_screen_std" class="gk-screen-std">
<div v-if="isChoice">
<geek-draw-board ref="draw"
:points="paints[currentIndex]" :paintType="paintType" class="draw-board" />
<div ref="gk_screen_std" class="gk-screen-std">
<div v-if="!isChoice" ref="vd">
<geek-draw-board
ref="draw"
:points="paints[currentIndex]"
:paintType="paintType"
class="draw-board"
/>
<div class="tools-wrap">
<el-button class="itm" type="info" @click="changeTool(itm.title)"
v-for="itm in paintTypes" :key="itm.title">{{ itm.name }}
</el-button>
</div>
</div>
<div v-else>
<div class="ans-wrap">
<el-button v-for="itm in Answers"
:disabled="disabled"
@click="chooseAnswer(itm.value)"
:key="itm.value" type="primary"
:class="['ans-itm', itm.value === currentAns ? 'ans-itm-select': '' ]">
{{itm.title}}
</el-button>
<el-button
class="itm"
type="info"
@click="changeTool(itm.title)"
v-for="itm in paintTypes"
:key="itm.title"
>{{ itm.name }}
</el-button>
</div>
</div>
</div>
<el-button type="primary"
@click="sendChoose"
:disabled="false"
class="ans-commit">
提交
<div v-else>
<div class="ans-wrap">
<el-button
v-for="itm in Answers"
:disabled="disabled"
@click="chooseAnswer(itm.value)"
:key="itm.value"
type="primary"
:class="['ans-itm', itm.value === currentAns ? 'ans-itm-select' : '']"
>
{{ itm.title }}
</el-button>
</div>
</div>
<el-button type="primary" @click="sendChoose" :disabled="false" class="ans-commit">
提交
</el-button>
</div>
</template>
<script>
import { GeekDrawBoard } from '@geek/geekui'
import socket from '../../utils/socket'
import { GeekDrawBoard } from '@geek/geekui';
import socket from '../../utils/socket';
const Answers = [
{ title: 'A', value: 'A' },
{ title: 'B', value: 'B' },
{ title: 'C', value: 'C' },
{ title: 'D', value: 'D' }
]
];
const paintTypes = [
{ title: 'pencil', name: '铅笔', width: 20 },
{ title: 'redo', name: '撤回' },
{ title: 'erase', name: '橡皮擦', width: 50 },
{ title: 'clear', name: '清空' },
]
{ title: 'clear', name: '清空' }
];
export default {
name: 'vd',
components: {
GeekDrawBoard
},
......@@ -61,62 +71,53 @@ export default {
currentIndex: '',
isChoice: true,
paintTypes
}
};
},
methods: {
changeTool(title) {
if (title === 'redo' || title === 'clear') {
// eslint-disable-next-line no-unused-expressions
this.$refs.draw && this.$refs.draw[title]();
return
return;
}
this.paintType = title
this.paintType = title;
},
chooseAnswer(value) {
console.log(value)
this.currentAns = value
console.log(value);
this.currentAns = value;
},
sendChoose() {
console.log('currentPaintData',this.$refs.draw.getImg())
socket.sendGroupMsg({
type: 'answer',
message: this.currentAns,
questionType: '',
},(data) => {
console.log('回执',data);
this.disabled = true
})
console.log('currentPaintData', this.$refs.draw.getImg());
socket.sendGroupMsg(
{
type: 'answer',
message: this.currentAns,
questionType: ''
},
(data) => {
console.log('回执', data);
this.disabled = true;
}
);
},
dealMsg(msg) {
console.log('msg',msg)
console.log('msg', msg);
if (msg && msg.from && msg.from.indexOf('teacher') > -1 && msg.type === 'question') {
this.disabled = false
this.disabled = false;
}
},
scrollFunc(evt) {
evt = evt || window.event;
if (evt.preventDefault) {
// Firefox
evt.preventDefault();
evt.stopPropagation();
} else {
// IE
evt.cancelBubble = true;
evt.returnValue = false;
}
return false;
}
},
beforeDestroy() {
socket.offMsg(this.dealMsg)
socket.offMsg(this.dealMsg);
},
mounted() {
this.paintType = 'pencil'
socket.onMsg(this.dealMsg)
document.addEventListener('DOMMouseScroll', this.scrollFunc, false);
document.addEventListener('mousewheel',this.scrollFunc,false);
},
}
this.paintType = 'pencil';
socket.onMsg(this.dealMsg);
document.body.addEventListener('touchmove', (e) => {
e.preventDefault();
}, { passive: false });
}
};
</script>
<style lang="scss" scoped>
......@@ -125,7 +126,7 @@ export default {
display: flex;
flex-flow: column;
align-items: center;
.tools-wrap {
.tools-wrap {
position: fixed;
left: 20px;
top: 10px;
......@@ -140,10 +141,10 @@ export default {
margin-left: 0;
}
}
.draw-board{
height: 80vh;
width: 100vw;
background:#f5f5f5
.draw-board {
height: 80vh;
width: 100vw;
background: #f5f5f5;
}
.ans-wrap {
margin-top: 20vh;
......
......@@ -186,6 +186,9 @@ export default {
this.isJoin = true
this.mico = (this.micros[0] || {}).deviceId
this.registerMsgReceived()
document.body.addEventListener('touchmove', (e) => {
e.preventDefault();
}, { passive: false });
}
}
</script>
......
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