Commit 6e4df758 authored by 刘阳's avatar 刘阳

fix: 图片替换

parent 1214891f
This diff is collapsed.
This diff is collapsed.
import videoPlay from './video_play.png'
import videoBg from './video_bg.png'
import nocontent from './nocontent.png'
import bg from './bg.png'
import one from './1.PNG'
import two from './2.PNG'
import thr from './3.PNG'
import four from './4.PNG'
import five from './5.PNG'
import six from './6.PNG'
import siven from './7.PNG'
import eight from './8.PNG'
import nine from './9.PNG'
export {
videoPlay,
videoBg,
nocontent,
bg
one,
two,
thr,
four,
five,
six,
siven,
eight,
nine
}
import io from 'socket.io-client'
import axios from 'axios'
const socketUrl = 'ws://payx.jkwljy.com/socket.io'
// const socketUrl = 'ws://payx.jkwljy.com/socket.io'
const socketUrl = 'http://172.10.1.201:7001/'
const http = axios.create({
baseURL: socketUrl,
......
<template>
<div class="gk-screen-std">
<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 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"
......@@ -9,9 +19,11 @@
{{itm.title}}
</el-button>
</div>
</div>
<el-button type="primary"
@click="sendChoose"
:disabled="currentAns.length <= 0"
:disabled="false"
class="ans-commit">
提交
</el-button>
......@@ -19,7 +31,7 @@
</template>
<script>
import { GeekDrawBoard } from '@geek/geekui'
import socket from '../../utils/socket'
const Answers = [
......@@ -28,27 +40,51 @@ const Answers = [
{ 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: '清空' },
]
export default {
components: {
GeekDrawBoard
},
data() {
return {
Answers,
currentAns: '',
disabled: true
disabled: true,
paints: [],
paintType: '',
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
}
this.paintType = title
},
chooseAnswer(value) {
console.log(value)
this.currentAns = value
},
sendChoose() {
console.log('currentPaintData',this.$refs.draw.getImg())
socket.sendGroupMsg({
type: 'answer',
message: this.currentAns
message: this.currentAns,
questionType: '',
},(data) => {
console.log('回执',data);
// this.disabled = true
this.disabled = true
})
},
dealMsg(msg) {
......@@ -56,24 +92,59 @@ export default {
if (msg && msg.from && msg.from.indexOf('teacher') > -1 && msg.type === 'question') {
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)
},
mounted() {
this.paintType = 'pencil'
socket.onMsg(this.dealMsg)
}
document.addEventListener('DOMMouseScroll', this.scrollFunc, false);
document.addEventListener('mousewheel',this.scrollFunc,false);
},
}
</script>
<style lang="scss" scoped>
.gk-screen-std {
height: 100vh;
width: 100vw;
flex: 1;
display: flex;
flex-flow: column;
align-items: center;
.tools-wrap {
position: fixed;
left: 20px;
top: 10px;
display: flex;
flex-flow: column;
align-items: center;
.itm {
display: inline-block;
font-size: 12px;
width: 70px;
margin-top: 10px;
margin-left: 0;
}
}
.draw-board{
height: 80vh;
width: 100vw;
background:#f5f5f5
}
.ans-wrap {
margin-top: 20vh;
width: 100%;
......@@ -90,7 +161,7 @@ export default {
}
.ans-commit {
font-size: 40px;
margin-top: 20vh;
margin-top: 5vh;
}
}
</style>
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