Commit 376de221 authored by huanglu's avatar huanglu

feat: update

parent 72337a53
<template>
<div ref="gk_screen_std" class="gk-screen-std">
<div v-if="!isChoice" ref="vd">
<div v-if="isChoice" ref="vd">
<geek-draw-board
ref="draw"
:points="paints[currentIndex]"
......@@ -108,11 +108,11 @@ export default {
}
},
beforeDestroy() {
socket.offMsg(this.dealMsg);
// socket.offMsg(this.dealMsg);
},
mounted() {
this.paintType = 'pencil';
socket.onMsg(this.dealMsg);
// socket.onMsg(this.dealMsg);
document.body.addEventListener('touchmove', (e) => {
e.preventDefault();
}, { passive: false });
......@@ -126,6 +126,7 @@ export default {
display: flex;
flex-flow: column;
align-items: center;
overflow: hidden;
.tools-wrap {
position: fixed;
left: 20px;
......
......@@ -75,9 +75,14 @@ export default {
userId = `${new Date().getTime()}`
}
const routeName = joinObj.path
// socket.connect(userId, () => {
this.$router.push({ name: routeName, query: { userId, roomId: this.roomId }})
// })
socket.connect(userId, () => {
this.$router.push({
name: routeName,
query: {
userId, roomId: this.roomId, username: this.username
}
})
})
}
},
mounted() {
......
......@@ -149,7 +149,7 @@ export default {
console.log('add: ', stream)
setTimeout(() => {
this.playStream(stream)
}, 300);
}, 100);
})
this.rtc.removeStream((stream) => {
const index = this.streams.findIndex((itm) => itm.getId() === stream.getId())
......
......@@ -2,14 +2,25 @@
<div class="paint-main" ref="pain_main">
<img :src="currentImg" class="bg"/>
<geek-draw-board ref="draw"
:points="paints[currentIndex]" :paintType="paintType" class="draw-board" />
:points="paints[currentIndex]" paintColor='#FFF' :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 class="stream-wrap">
<el-button class="itm" type="text" @click="steamAction(itm.title)"
v-for="itm in streamTypes" :key="itm.title">{{ itm.name }}</el-button>
<template v-for="itm in streamTypes">
<el-button class="itm" type="text" v-if="itm.type !== 'down'" @click="steamAction(itm.title)"
:key="itm.title">{{ itm.name }}</el-button>
<el-dropdown v-else :key="itm.title">
<span class="el-dropdown-link">
{{ itm.name }}
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="startAnswer(op)" v-for="op in itm.options"
:key="op.title">{{op.title}}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</div>
<div class="reply-wrap">
......@@ -53,7 +64,7 @@ import {
six,
siven,
eight,
nine
nine
} from '@/assets/images/index'
import HWRTC from '@/utils/hwrtc'
import socket from '@/utils/socket'
......@@ -66,10 +77,19 @@ const paintTypes = [
]
const streamTypes = [
{ title: 'ans', name: '学生答题' },
{ title: 'publish', name: '开始推流' },
{ title: 'unpublish', name: '停止推流' },
{ title: 'setting', name: '设置' },
{
title: 'ans',
name: '学生答题',
type: 'down',
options: [
{ title: '选择题', value: 0 },
{ title: '简答题', value: 1 },
{ title: '填空题', value: 2 }
]
},
// { title: 'publish', name: '开始推流' },
// { title: 'unpublish', name: '停止推流' },
// { title: 'setting', name: '设置' },
{ title: 'full', name: '全屏' },
]
......@@ -127,6 +147,9 @@ export default {
}
this.paintType = title
},
startAnswer(opt) {
this.sendAnswerTag(opt.value, opt.title)
},
async steamAction(action) {
if (action === 'setting') {
this.modal = true
......@@ -134,27 +157,27 @@ export default {
if (action === 'publish') {
this.rtc.createStream(this.mico, this.camera)
}
if (action === 'ans') {
this.sendAnswerTag();
}
if (action === 'full') {
// eslint-disable-next-line no-unused-expressions
this.$refs.pain_main && this.$refs.pain_main.requestFullscreen();
}
},
sendAnswerTag() {
sendAnswerTag(type, title) {
this.replyList = []
socket.sendGroupMsg({
type: 'question',
options: ['A', 'B', 'C', 'D'],
message: '请答题'
payload: {
type,
title,
}
}, (res) => {
console.log('teacher send success: ', res);
})
},
registerMsgReceived() {
socket.onMsg((data) => {
this.replyList.push(data);
const { type, payload } = data
if (type === 'answer') this.replyList.push(payload);
})
},
preAction() {
......@@ -209,7 +232,7 @@ export default {
transform: translateY(-50%);
}
.bg {
height: 100vh;
height: 100vh;
width: 100vw;
}
.draw-board {
......@@ -250,8 +273,14 @@ export default {
animation: reply 1.2s linear;
}
}
::v-deep .el-button--text {
color: white;
::v-deep {
.el-button--text {
color: white;
}
.el-dropdown {
margin-right: 20px;
color: white;
}
}
}
......
......@@ -881,8 +881,8 @@
"@geek/geekui@^1.1.2":
version "1.1.2"
resolved "http://git.jksxb.cn:8081/repository/geek/@geek/geekui/-/geekui-1.1.2.tgz#bbe448fbefb1487d4b5f16596458d8062b79700f"
integrity sha512-TBPYSECTJknnBs7dSNdQLM+rnoMItpC3HBILLr3YuQCUdvmJdRsbaxlMokfEKv6a3sceAPWHCsnqEl7S4N+2yw==
resolved "http://git.jksxb.cn:8081/repository/geek/@geek/geekui/-/geekui-1.1.2.tgz#8ef29a981ee01139ee73a9389058619595df2a88"
integrity sha512-bQ5lvdCZfFb8gy4iNsphljJBA/eUgJe6vzrIF+u0JXlS+7aGCvO3nOIqbkUwEEUBJHZfiz/XzISy+59gJCobgw==
dependencies:
"@geek/geek-editor" "^1.0.7"
cos-js-sdk-v5 "^0.5.27"
......
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