Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gk-online-teacher
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
huanglu
gk-online-teacher
Commits
8aff9e91
Commit
8aff9e91
authored
Dec 16, 2020
by
huanglu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 直播
parent
0079538c
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
75 additions
and
36 deletions
+75
-36
index.js
config/index.js
+1
-1
main.js
src/main.js
+0
-2
socket.js
src/utils/socket.js
+1
-1
index.vue
src/views/big-screen/index.vue
+4
-11
index.vue
src/views/home/index.vue
+8
-4
index.vue
src/views/online/index.vue
+5
-4
index.vue
src/views/paint-screen/index.vue
+54
-11
yarn.lock
yarn.lock
+2
-2
No files found.
config/index.js
View file @
8aff9e91
...
...
@@ -10,6 +10,6 @@ module.exports = {
proxy
:
{
...
agentList
},
publicPath
:
'
/gk-online
'
,
publicPath
:
'
./
'
,
outputDir
:
'gk-online'
}
src/main.js
View file @
8aff9e91
...
...
@@ -15,5 +15,3 @@ new Vue({
store
,
render
:
(
h
)
=>
h
(
App
),
}).
$mount
(
'#app'
)
console
.
log
(
'===== main console'
)
src/utils/socket.js
View file @
8aff9e91
import
io
from
'socket.io-client'
import
axios
from
'axios'
const
socketUrl
=
'
http://172.10.1.201:7001/
'
const
socketUrl
=
'
ws://payx.jkwljy.com/socket.io
'
const
http
=
axios
.
create
({
baseURL
:
socketUrl
,
...
...
src/views/big-screen/index.vue
View file @
8aff9e91
...
...
@@ -21,21 +21,14 @@ export default {
methods
:
{
},
async
mounted
()
{
const
{
userId
}
=
this
.
$route
.
query
console
.
log
(
'mounted'
)
// eslint-disable-next-line no-underscore-dangle
const
ok
=
await
HWRTC
.
getAuthUserMedia
()
if
(
!
ok
)
{
this
.
$alert
(
'无摄像头和和麦克风权限'
);
return
;
}
const
{
userId
,
roomId
}
=
this
.
$route
.
query
this
.
rtc
=
new
HWRTC
(
userId
||
(
new
Date
().
getTime
()
/
1000
).
toFixed
(
0
));
await
this
.
rtc
.
joinRoom
(
'123'
)
await
this
.
rtc
.
joinRoom
(
roomId
)
this
.
rtc
.
subscribedStreamCb
((
streams
)
=>
{
const
stream
=
streams
.
find
((
itm
)
=>
itm
.
getUserId
().
includes
(
'teacher'
))
console
.
log
(
'subscribedStreamCb: '
,
streams
)
const
stream
=
streams
.
reverse
().
find
((
itm
)
=>
itm
.
getUserId
().
includes
(
'teacher'
))
if
(
stream
)
this
.
playStream
=
stream
;
})
}
}
</
script
>
...
...
src/views/home/index.vue
View file @
8aff9e91
...
...
@@ -9,11 +9,11 @@
<el-input
class=
"input"
v-model=
"username"
placeholder=
"请输入用户名"
></el-input>
</el-form-item>
</el-col>
<
!--
<
el-col
:span=
"24"
>
<el-col
:span=
"24"
>
<el-form-item
label=
"输入房间号"
>
<el-input
class=
"input"
v-model=
"roomId"
placeholder=
"请输入房间号"
type=
"number"
></el-input>
<el-input
class=
"input"
v-model=
"roomId"
placeholder=
"请输入房间号"
></el-input>
</el-form-item>
</el-col>
-->
</el-col>
<!--
<el-col
:span=
"24"
>
<el-form-item
label=
"房间名"
>
<el-input
class=
"input"
v-model=
"roomName"
placeholder=
"请输入房间名"
></el-input>
...
...
@@ -63,6 +63,10 @@ export default {
},
methods
:
{
join
()
{
if
(
!
this
.
roomId
)
{
this
.
$alert
(
'请填写房间号'
)
return
}
const
joinObj
=
this
.
joinTypes
.
find
((
itm
)
=>
itm
.
title
===
this
.
joinType
)
let
userId
=
null
if
(
joinObj
.
value
.
includes
(
'teacher'
))
{
...
...
@@ -72,7 +76,7 @@ export default {
}
const
routeName
=
joinObj
.
path
socket
.
connect
(
userId
,
()
=>
{
this
.
$router
.
push
({
name
:
routeName
,
query
:
{
userId
}})
this
.
$router
.
push
({
name
:
routeName
,
query
:
{
userId
,
roomId
:
this
.
roomId
}})
})
}
},
...
...
src/views/online/index.vue
View file @
8aff9e91
...
...
@@ -7,13 +7,13 @@
</div>
<div
class=
"side"
>
<el-form
ref=
"form"
label-width=
"80px"
style=
"margin-top: 30px"
>
<el-row
:gutter=
"8"
>
<
!--
<
el-row
:gutter=
"8"
>
<el-col
:span=
"24"
>
<el-form-item
label=
"房间号"
>
<el-input
v-model=
"roomId"
placeholder=
"Please input roomid"
type=
'number'
></el-input>
</el-form-item>
</el-col>
</el-row>
</el-row>
-->
<el-row
:gutter=
"8"
>
<el-col
:span=
"24"
>
<el-form-item
label=
"麦克风"
>
...
...
@@ -59,7 +59,7 @@ export default {
rtc
:
null
,
roomId
:
null
,
micro
:
[],
microId
:
''
,
microId
:
'
123
'
,
cameras
:
[],
camerId
:
''
,
streams
:
[],
...
...
@@ -100,6 +100,8 @@ export default {
},
async
mounted
()
{
console
.
log
(
'mounted'
)
const
{
roomId
}
=
this
.
$route
.
query
this
.
roomId
=
roomId
// eslint-disable-next-line no-underscore-dangle
const
ok
=
await
HWRTC
.
getAuthUserMedia
()
if
(
!
ok
)
{
...
...
@@ -112,7 +114,6 @@ export default {
console
.
log
(
this
.
cameras
,
this
.
micro
)
this
.
rtc
.
subscribedStreamCb
((
streams
)
=>
{
this
.
streams
=
streams
console
.
log
(
'******: '
,
streams
)
})
},
beforeDestroy
()
{
...
...
src/views/paint-screen/index.vue
View file @
8aff9e91
<
template
>
<div
class=
"paint-main"
ref=
"pain_main"
>
<img
:src=
"
videoB
g"
class=
"bg"
/>
<geek-draw-board
ref=
"draw
"
:paintType=
"paintType"
class=
"draw-board"
/>
<img
:src=
"
currentIm
g"
class=
"bg"
/>
<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>
...
...
@@ -16,7 +16,6 @@
<span
class=
"itm"
v-for=
"(itm, index) in replyList"
:key=
"index"
>
{{
JSON
.
stringify
(
itm
)
}}
</span>
</div>
<el-dialog
title=
"推流设置"
width=
"400px"
:visible
.
sync=
"modal"
>
...
...
@@ -38,12 +37,14 @@
<el-button
type=
"primary"
@
click=
"modal = false"
>
确定
</el-button>
</p>
</el-dialog>
<el-button
type=
"text"
@
click=
"preAction"
class=
"pre"
>
上一页
</el-button>
<el-button
type=
"text"
@
click=
"nextAction"
class=
"next"
>
下一页
</el-button>
</div>
</
template
>
<
script
>
import
{
GeekDrawBoard
}
from
'@geek/geekui'
import
Vue
from
'vue'
import
{
videoBg
}
from
'@/assets/images/index'
import
{
videoBg
,
bg
}
from
'@/assets/images/index'
import
HWRTC
from
'@/utils/hwrtc'
import
socket
from
'@/utils/socket'
...
...
@@ -62,6 +63,10 @@ const streamTypes = [
{
title
:
'full'
,
name
:
'全屏'
},
]
const
imgs
=
[
bg
,
videoBg
]
Vue
.
use
(
GeekDrawBoard
)
export
default
{
...
...
@@ -80,9 +85,21 @@ export default {
modal
:
false
,
rtc
:
null
,
replyList
:
[],
paints
:
[]
paints
:
[],
imgs
,
currentIndex
:
0
};
},
computed
:
{
currentImg
()
{
return
imgs
[
this
.
currentIndex
];
},
currentPaintData
()
{
const
nn
=
this
.
points
?
this
.
points
[
this
.
currentIndex
]
:
[];
console
.
log
(
nn
)
return
nn
}
},
methods
:
{
changeTool
(
title
)
{
if
(
title
===
'redo'
||
title
===
'clear'
)
{
...
...
@@ -97,7 +114,7 @@ export default {
this
.
modal
=
true
}
if
(
action
===
'publish'
)
{
this
.
rtc
.
createS
creenShareStream
(
)
this
.
rtc
.
createS
tream
(
this
.
mico
,
this
.
camera
)
}
if
(
action
===
'ans'
)
{
this
.
sendAnswerTag
();
...
...
@@ -121,10 +138,23 @@ export default {
socket
.
onMsg
((
data
)
=>
{
this
.
replyList
.
push
(
data
);
})
}
},
preAction
()
{
const
paintData
=
this
.
$refs
.
draw
.
getData
()
this
.
paints
[
this
.
currentIndex
]
=
paintData
;
if
(
this
.
currentIndex
===
0
)
this
.
currentIndex
=
0
;
else
this
.
currentIndex
-=
1
;
},
nextAction
()
{
const
paintData
=
this
.
$refs
.
draw
.
getData
()
this
.
paints
[
this
.
currentIndex
]
=
paintData
;
if
(
this
.
currentIndex
===
this
.
imgs
.
length
-
1
)
this
.
currentIndex
=
this
.
imgs
.
length
-
1
;
else
this
.
currentIndex
+=
1
;
},
},
async
mounted
()
{
this
.
paintType
=
'pencil'
const
{
roomId
}
=
this
.
$route
.
query
const
ok
=
await
HWRTC
.
getAuthUserMedia
()
if
(
!
ok
)
{
this
.
$alert
(
'无摄像头和和麦克风权限'
);
...
...
@@ -134,7 +164,7 @@ export default {
this
.
cameras
=
await
this
.
rtc
.
getCameras
()
this
.
camera
=
(
this
.
cameras
[
0
]
||
{}).
deviceId
this
.
micros
=
await
this
.
rtc
.
getMicrophones
()
await
this
.
rtc
.
joinRoom
(
'123'
)
await
this
.
rtc
.
joinRoom
(
roomId
)
this
.
isJoin
=
true
this
.
mico
=
(
this
.
micros
[
0
]
||
{}).
deviceId
this
.
registerMsgReceived
()
...
...
@@ -147,6 +177,16 @@ export default {
height
:
100vh
;
width
:
100vw
;
position
:
relative
;
.pre
{
position
:
absolute
;
top
:
50%
;
left
:
10px
;
transform
:
translateY
(
-50%
);
}
.next
{
position
:
absolute
;
top
:
50%
;
right
:
10px
;
transform
:
translateY
(
-50%
);
}
.bg
{
height
:
100vh
;
width
:
100vw
;
}
...
...
@@ -160,8 +200,8 @@ export default {
.tools-wrap
{
position
:
fixed
;
left
:
20px
;
top
:
50%
;
transform
:
translateY
(
-50%
);
top
:
10px
;
//
transform: translateY(-50%);
display
:
flex
;
flex-flow
:
column
;
align-items
:
center
;
...
...
@@ -188,6 +228,9 @@ export default {
animation
:
reply
1
.2s
linear
;
}
}
::v-deep
.el-button--text
{
color
:
white
;
}
}
@keyframes
reply
{
...
...
yarn.lock
View file @
8aff9e91
...
...
@@ -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#
b743e50c382121813660574fcd0fa7e7bee2f12
4"
integrity sha512-
VyiXuzLEN7g+B43SnFm8k4GGH9CShN+cPx6MftVjpLM9Ha4Axgv1rBNgJ2HTmdnGECyXqBYgYVs/trQVLel64A
==
resolved "http://git.jksxb.cn:8081/repository/geek/@geek/geekui/-/geekui-1.1.2.tgz#
346611159cc7e8bd37784e5d24310a56adb6943
4"
integrity sha512-
wR4K6iz4HG1f937HAvloiS4dHp7GdvWBJnr+C8f7OxmLynDUqZGFAulYhQCwHfPodI3kUpRYkPxxM53oZiMtlg
==
dependencies:
"@geek/geek-editor" "^1.0.7"
cos-js-sdk-v5 "^0.5.27"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment