Commit 376de221 authored by huanglu's avatar huanglu

feat: update

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