Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
live
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
liujiaxin
live
Commits
9e379994
Commit
9e379994
authored
Apr 06, 2020
by
liujiaxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify 由独立的userStars 变量改成 stars保存到用户频道属性
parent
c21f5e58
Changes
22
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
526 additions
and
242 deletions
+526
-242
index.html
public/index.html
+15
-0
redirect.html
public/redirect.html
+22
-0
courseware-frame.tsx
src/components/courseware-frame.tsx
+25
-5
room.tsx
src/components/dialog/room.tsx
+5
-4
mediaboard.tsx
src/components/mediaboard.tsx
+1
-1
room-tools-bar.tsx
src/components/room-tools-bar.tsx
+6
-2
video-player.scss
src/components/video-player.scss
+38
-1
video-player.tsx
src/components/video-player.tsx
+71
-12
video-stage-list.scss
src/components/video-stage-list.scss
+3
-3
video-stage-list.tsx
src/components/video-stage-list.tsx
+4
-3
whiteboard.tsx
src/components/whiteboard.tsx
+6
-3
root-container.tsx
src/containers/root-container.tsx
+9
-5
use-streams.ts
src/hooks/use-streams.ts
+5
-4
icons.scss
src/icons.scss
+7
-7
index.tsx
src/pages/classroom/index.tsx
+141
-6
home.tsx
src/pages/home.tsx
+34
-9
agora-end-points.ts
src/services/agora-end-points.ts
+16
-6
EventBus.ts
src/stores/EventBus.ts
+3
-0
room.ts
src/stores/room.ts
+86
-166
agora-rtc-client.ts
src/utils/agora-rtc-client.ts
+2
-2
agora-rtm-client.ts
src/utils/agora-rtm-client.ts
+14
-1
helper.ts
src/utils/helper.ts
+13
-2
No files found.
public/index.html
View file @
9e379994
...
@@ -39,5 +39,20 @@
...
@@ -39,5 +39,20 @@
To begin the development, run `npm start` or `yarn start`.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
-->
<script>
function
getQueryString
(
name
)
{
const
reg
=
new
RegExp
(
'
(^|&)
'
+
name
+
'
=([^&]*)(&|$)
'
,
'
i
'
);
const
r
=
window
.
location
.
search
.
substr
(
1
).
match
(
reg
);
if
(
r
!=
null
)
{
return
unescape
(
r
[
2
]);
}
return
null
;
}
var
token
=
getQueryString
(
'
token
'
);
if
(
token
)
{
window
.
location
.
href
=
`
${
window
.
location
.
origin
}
/#/?token=
${
token
}
`
}
</script>
</body>
</body>
</html>
</html>
public/redirect.html
0 → 100644
View file @
9e379994
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
Title
</title>
</head>
<body>
跳转中。。。
<script>
function
getQueryString
(
name
)
{
const
reg
=
new
RegExp
(
'
(^|&)
'
+
name
+
'
=([^&]*)(&|$)
'
,
'
i
'
);
const
r
=
window
.
location
.
search
.
substr
(
1
).
match
(
reg
);
if
(
r
!=
null
)
{
return
unescape
(
r
[
2
]);
}
return
null
;
}
var
token
=
getQueryString
(
'
token
'
);
</script>
</body>
</html>
src/components/courseware-frame.tsx
View file @
9e379994
...
@@ -32,22 +32,42 @@ const useStyles = makeStyles({
...
@@ -32,22 +32,42 @@ const useStyles = makeStyles({
},
},
frm
:
{
frm
:
{
flex
:
1
,
flex
:
1
,
border
:
0
border
:
0
,
},
fixParent
:{
position
:
"
absolute
"
,
left
:
0
,
right
:
0
,
top
:
0
,
bottom
:
0
}
}
});
});
const
CourseWareFrame
:
React
.
FC
=
()
=>
{
const
CourseWareFrame
:
React
.
FC
=
()
=>
{
const
classes
=
useStyles
();
const
classes
=
useStyles
();
// `${ENDPOINT}/airclass_ol?token=${this.userToken}`;
// `${ENDPOINT}/airclass_ol?token=${this.userToken}`;
let
src
=
endPoint
.
getCourseUrl
();
let
src
=
endPoint
.
getCourseUrl
();
let
refDom
:
any
=
null
;
const
saveRef
=
(
ref
:
any
)
=>
{
refDom
=
ref
};
useEffect
(()
=>
{
useEffect
(()
=>
{
const
hel
=
document
.
querySelector
(
'
.on-show
'
)
let
helh
=
0
;
if
(
hel
){
helh
=
hel
.
clientHeight
;
}
if
(
helh
&&
refDom
)
{
const
hh
=
48
+
helh
+
8
;
refDom
.
style
.
height
=
`
${
document
.
body
.
clientHeight
-
hh
}
px`
;
}
return
()
=>
{
return
()
=>
{
src
=
'
about:blank
'
src
=
'
about:blank
'
console
.
log
(
'
iframe to blank
'
);
console
.
log
(
'
iframe to blank
'
);
}
}
},
[]);
},
[]);
return
(
return
(
<
div
className=
{
classes
.
style1
}
>
<
div
ref=
{
saveRef
}
className=
{
classes
.
style1
}
>
{
/*<svg viewBox="0 0 0 0"></svg>*/
}
<
iframe
id=
"cwFrame"
src=
{
src
}
className=
{
classes
.
frm
}
></
iframe
>
<
iframe
id=
"cwFrame"
src=
{
src
}
className=
{
classes
.
frm
}
></
iframe
>
</
div
>
</
div
>
)
)
...
...
src/components/dialog/room.tsx
View file @
9e379994
...
@@ -8,7 +8,7 @@ import {roomStore, windowMonitor} from '../../stores/room';
...
@@ -8,7 +8,7 @@ import {roomStore, windowMonitor} from '../../stores/room';
import
{
globalStore
}
from
'
../../stores/global
'
;
import
{
globalStore
}
from
'
../../stores/global
'
;
import
{
useHistory
}
from
'
react-router-dom
'
;
import
{
useHistory
}
from
'
react-router-dom
'
;
import
{
RoomMessage
}
from
'
../../utils/agora-rtm-client
'
;
import
{
RoomMessage
}
from
'
../../utils/agora-rtm-client
'
;
import
{
getApiServerHost
}
from
"
../../services/agora-end-points
"
;
import
{
getApiServerHost
,
goHome
}
from
"
../../services/agora-end-points
"
;
interface
RoomProps
{
interface
RoomProps
{
onConfirm
:
(
type
:
string
)
=>
void
onConfirm
:
(
type
:
string
)
=>
void
...
@@ -71,7 +71,7 @@ const DialogContainer = () => {
...
@@ -71,7 +71,7 @@ const DialogContainer = () => {
const
onClose
=
(
type
:
string
)
=>
{
const
onClose
=
(
type
:
string
)
=>
{
if
(
type
===
'
exitRoom
'
)
{
if
(
type
===
'
exitRoom
'
)
{
globalStore
.
removeDialog
();
globalStore
.
removeDialog
();
// history.push('/')
;
;
}
}
else
if
(
type
===
'
apply
'
)
{
else
if
(
type
===
'
apply
'
)
{
roomStore
.
rtmClient
.
sendPeerMessage
(
roomStore
.
rtmClient
.
sendPeerMessage
(
...
@@ -84,7 +84,7 @@ const DialogContainer = () => {
...
@@ -84,7 +84,7 @@ const DialogContainer = () => {
const
onConfirm
=
(
type
:
string
)
=>
{
const
onConfirm
=
(
type
:
string
)
=>
{
if
(
type
===
'
exitRoom
'
)
{
if
(
type
===
'
exitRoom
'
)
{
// debugger
// const data = roomStore.getUserUsage();
// const data = roomStore.getUserUsage();
// const host = getApiServerHost();
// const host = getApiServerHost();
// var blob = new Blob([JSON.stringify(data)], {
// var blob = new Blob([JSON.stringify(data)], {
...
@@ -96,7 +96,8 @@ const DialogContainer = () => {
...
@@ -96,7 +96,8 @@ const DialogContainer = () => {
roomStore
.
exitAll
().
then
(()
=>
{
roomStore
.
exitAll
().
then
(()
=>
{
globalStore
.
stopLoading
();
globalStore
.
stopLoading
();
globalStore
.
removeDialog
();
globalStore
.
removeDialog
();
history
.
push
(
'
/
'
);
// history.push('/');
goHome
(
history
)
})
})
}
}
...
...
src/components/mediaboard.tsx
View file @
9e379994
...
@@ -376,7 +376,7 @@ const items = [
...
@@ -376,7 +376,7 @@ const items = [
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
!
rtmState
.
joined
)
return
;
if
(
!
rtmState
.
joined
)
return
;
// debugger
if
(
!
lock
.
current
&&
!
whiteboard
.
state
.
room
)
{
if
(
!
lock
.
current
&&
!
whiteboard
.
state
.
room
)
{
console
.
log
(
'
do join whiteboard room
'
);
console
.
log
(
'
do join whiteboard room
'
);
...
...
src/components/room-tools-bar.tsx
View file @
9e379994
...
@@ -13,7 +13,8 @@ import ImportContacts from "@material-ui/icons/ImportContacts";
...
@@ -13,7 +13,8 @@ import ImportContacts from "@material-ui/icons/ImportContacts";
import
SettingsApplicationsIcon
from
'
@material-ui/icons/SettingsApplications
'
;
import
SettingsApplicationsIcon
from
'
@material-ui/icons/SettingsApplications
'
;
import
SettingsPowerIcon
from
'
@material-ui/icons/SettingsPower
'
;
import
SettingsPowerIcon
from
'
@material-ui/icons/SettingsPower
'
;
import
{
TOOL_TYPE
}
from
"
../utils/types
"
;
import
{
TOOL_TYPE
}
from
"
../utils/types
"
;
import
EmojiEventsIcon
from
'
@material-ui/icons/EmojiEvents
'
;
import
{
eventBus
}
from
"
../stores/EventBus
"
;
type
Props
=
{
type
Props
=
{
// zoomScale: number
// zoomScale: number
...
@@ -51,6 +52,9 @@ export default function RoomToolsBar (props: any) {
...
@@ -51,6 +52,9 @@ export default function RoomToolsBar (props: any) {
console
.
log
(
'
allStudentMuteOff
'
);
console
.
log
(
'
allStudentMuteOff
'
);
await
roomStore
.
allStudentMuteOff
()
await
roomStore
.
allStudentMuteOff
()
}
}
const
allAddStar
=
async
()
=>
{
eventBus
.
emit
(
'
showAddStartDialog
'
,
{
uid
:
0
})
}
const
randomStageUp
=
async
()
=>
{
const
randomStageUp
=
async
()
=>
{
await
roomStore
.
randomStageUp
()
await
roomStore
.
randomStageUp
()
}
}
...
@@ -61,7 +65,7 @@ export default function RoomToolsBar (props: any) {
...
@@ -61,7 +65,7 @@ export default function RoomToolsBar (props: any) {
{
roomStore
.
state
.
me
.
role
==
'
teacher
'
?
{
roomStore
.
state
.
me
.
role
==
'
teacher
'
?
<>
<>
{
/*<div className="tool-btn" onClick={audioOn}><VoiceOverOffIcon/></div>*/
}
<
div
className=
"tool-btn"
onClick=
{
allAddStar
}
><
EmojiEventsIcon
/></
div
>
{
muteAudio
{
muteAudio
?
<
div
className=
"tool-btn"
onClick=
{
allMuteOff
}
><
RecordVoiceOverIcon
/></
div
>
?
<
div
className=
"tool-btn"
onClick=
{
allMuteOff
}
><
RecordVoiceOverIcon
/></
div
>
:
<
div
onClick=
{
allMuteOn
}
className=
"tool-btn"
><
VoiceOverOffIcon
/></
div
>
:
<
div
onClick=
{
allMuteOn
}
className=
"tool-btn"
><
VoiceOverOffIcon
/></
div
>
...
...
src/components/video-player.scss
View file @
9e379994
.media-btn
{
.media-btn
{
display
:
flex
;
display
:
flex
;
justify-content
:
space-between
;
justify-content
:
space-between
;
width
:
58
px
;
//width: 80
px;
margin-right
:
10px
;
margin-right
:
10px
;
}
}
.media-btn
>
.icon.disabled
{
.media-btn
>
.icon.disabled
{
...
@@ -17,6 +17,13 @@
...
@@ -17,6 +17,13 @@
.student-placeholder
{
.student-placeholder
{
z-index
:
9
;
z-index
:
9
;
}
}
}
.medal
{
width
:
16px
;
z-index
:
99
;
background-size
:
contain
;
background-image
:
url("data:image/png;base64,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")
;
}
}
.menu-close
{
.menu-close
{
cursor
:
pointer
;
cursor
:
pointer
;
...
@@ -42,6 +49,36 @@
...
@@ -42,6 +49,36 @@
background-image
:
url('../assets/icon-resource-menu-close.png')
;
background-image
:
url('../assets/icon-resource-menu-close.png')
;
}
}
}
}
.star
{
position
:
absolute
;
z-index
:
10
;
left
:
4px
;
top
:
4px
;
color
:
#fff
;
line-height
:
20px
;
height
:
20px
;
display
:
flex
;
flex-direction
:
row
;
//cursor: pointer;
}
.star
.medal-bg
{
position
:
absolute
;
background
:
#000
;
opacity
:
.6
;
height
:
16px
;
top
:
2px
;
left
:
6px
;
border-radius
:
0
4px
4px
0
;
padding-left
:
12px
;
padding-right
:
8px
;
}
.star
.points
{
line-height
:
16px
;
height
:
16px
;
font-size
:
14px
;
display
:
block
;
}
.video-profile
{
.video-profile
{
z-index
:
3
;
z-index
:
3
;
width
:
100%
;
width
:
100%
;
...
...
src/components/video-player.tsx
View file @
9e379994
import
React
,
{
useRef
,
useEffect
,
useMemo
}
from
'
react
'
;
import
React
,
{
useRef
,
useEffect
,
useMemo
,
useState
}
from
'
react
'
;
import
Icon
from
'
./icon
'
;
import
Icon
from
'
./icon
'
;
import
'
./video-player.scss
'
;
import
'
./video-player.scss
'
;
import
{
AgoraElectronStream
,
StreamType
,
nativeRTCClient
as
nativeClient
}
from
'
../utils/agora-electron-client
'
;
import
{
AgoraElectronStream
,
StreamType
,
nativeRTCClient
as
nativeClient
}
from
'
../utils/agora-electron-client
'
;
...
@@ -8,11 +8,16 @@ import ArrowDownwardIcon from '@material-ui/icons/ArrowDownward';
...
@@ -8,11 +8,16 @@ import ArrowDownwardIcon from '@material-ui/icons/ArrowDownward';
import
{
makeStyles
}
from
'
@material-ui/core/styles
'
;
import
{
makeStyles
}
from
'
@material-ui/core/styles
'
;
import
{
roomStore
}
from
"
../stores/room
"
;
import
{
roomStore
}
from
"
../stores/room
"
;
import
BuildIcon
from
'
@material-ui/icons/Build
'
;
import
BuildIcon
from
'
@material-ui/icons/Build
'
;
import
{
eventBus
}
from
"
../stores/EventBus
"
;
// import StarIcon from '@material-ui/icons/Star';
import
EmojiEventsOutlinedIcon
from
'
@material-ui/icons/EmojiEventsOutlined
'
;
const
useStyles
=
makeStyles
({
const
useStyles
=
makeStyles
({
stageDown
:
{
stageDown
:
{
display
:
'
flex
'
,
display
:
'
flex
'
,
width
:
18
,
marginLeft
:
2
,
marginRight
:
2
,
width
:
20
,
height
:
24
,
height
:
24
,
color
:
'
#fff
'
,
color
:
'
#fff
'
,
lineHeight
:
24
,
lineHeight
:
24
,
...
@@ -20,7 +25,23 @@ const useStyles = makeStyles({
...
@@ -20,7 +25,23 @@ const useStyles = makeStyles({
cursor
:
'
pointer
'
cursor
:
'
pointer
'
},
},
fixStream
:
{
fixStream
:
{
width
:
14
,
marginLeft
:
4
,
marginRight
:
4
,
width
:
16
,
height
:
24
,
color
:
'
#fff
'
,
lineHeight
:
24
,
opacity
:
.
8
,
cursor
:
'
pointer
'
},
star
:
{
height
:
20
,
color
:
'
#ebb445
'
},
emojiEvent
:
{
width
:
18
,
marginLeft
:
3
,
marginRight
:
3
,
height
:
24
,
height
:
24
,
color
:
'
#fff
'
,
color
:
'
#fff
'
,
lineHeight
:
24
,
lineHeight
:
24
,
...
@@ -73,6 +94,9 @@ const VideoPlayer: React.FC<VideoPlayerProps> = ({
...
@@ -73,6 +94,9 @@ const VideoPlayer: React.FC<VideoPlayerProps> = ({
const
loadAudio
=
useRef
<
boolean
>
(
false
);
const
loadAudio
=
useRef
<
boolean
>
(
false
);
const
stateError
=
useRef
<
boolean
>
(
false
);
const
stateError
=
useRef
<
boolean
>
(
false
);
const
[
star
,
setStar
]
=
useState
<
number
>
(
0
);
// const hasError = useMemo(() => {
// const hasError = useMemo(() => {
// return stateError.current;
// return stateError.current;
// }, [stateError]);
// }, [stateError]);
...
@@ -181,13 +205,13 @@ const VideoPlayer: React.FC<VideoPlayerProps> = ({
...
@@ -181,13 +205,13 @@ const VideoPlayer: React.FC<VideoPlayerProps> = ({
}
}
})
})
return
()
=>
{
return
()
=>
{
console
.
log
(
2343454567
,
local
,
streamID
,
me
)
//
console.log(2343454567,local, streamID, me)
if
(
reloadStreamTimer
)
{
if
(
reloadStreamTimer
)
{
clearTimeout
(
reloadStreamTimer
)
clearTimeout
(
reloadStreamTimer
)
reloadStreamTimer
=
null
;
reloadStreamTimer
=
null
;
}
}
if
(
stream
.
isPlaying
())
{
if
(
stream
.
isPlaying
())
{
// debugger
stream
.
stop
();
stream
.
stop
();
// stream.stop();
// stream.stop();
}
}
...
@@ -196,6 +220,16 @@ const VideoPlayer: React.FC<VideoPlayerProps> = ({
...
@@ -196,6 +220,16 @@ const VideoPlayer: React.FC<VideoPlayerProps> = ({
}
}
},
[
domId
,
stream
]);
},
[
domId
,
stream
]);
useEffect
(()
=>
{
console
.
log
(
'
roomStore.state.userStars change
'
)
if
(
id
)
{
const
u
=
roomStore
.
state
.
users
.
get
(
id
)
if
(
u
)
{
setStar
(
u
.
stars
);
}
}
// setStar()
},
[
roomStore
.
state
.
users
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
stream
&&
platform
===
'
web
'
)
{
if
(
stream
&&
platform
===
'
web
'
)
{
...
@@ -310,13 +344,20 @@ const VideoPlayer: React.FC<VideoPlayerProps> = ({
...
@@ -310,13 +344,20 @@ const VideoPlayer: React.FC<VideoPlayerProps> = ({
handleClose
(
'
close
'
,
streamID
);
handleClose
(
'
close
'
,
streamID
);
}
}
}
}
const
addStar
=
(
evt
:
any
)
=>
{
if
(
me
.
role
!=
'
teacher
'
)
{
return
}
eventBus
.
emit
(
'
showAddStartDialog
'
,
{
uid
:
id
});
}
const
resumeStream
=
(
evt
:
any
)
=>
{
const
resumeStream
=
(
evt
:
any
)
=>
{
stateError
.
current
=
false
;
stateError
.
current
=
false
;
stream
.
resume
()
stream
.
resume
()
}
}
const
me
=
useRoomState
().
me
;
const
me
=
useRoomState
().
me
;
const
teacherId
=
useRoomState
().
course
.
teacherId
;
// let stu = useRoomState().users.get(`${id}`);
return
(
return
(
<
div
className=
{
`${className ? className : (preview ? 'preview-video' : `
agora
-
video
-
view
$
{
Boolean
(
video
)
===
false
&&
stream
?
'
show-placeholder
'
:
''
}
`)}`
}
>
<
div
className=
{
`${className ? className : (preview ? 'preview-video' : `
agora
-
video
-
view
$
{
Boolean
(
video
)
===
false
&&
stream
?
'
show-placeholder
'
:
''
}
`)}`
}
>
...
@@ -324,22 +365,38 @@ return (
...
@@ -324,22 +365,38 @@ return (
{
className
!==
'
screen-sharing
'
?
<
div
className=
{
role
===
'
teacher
'
?
'
teacher-placeholder
'
:
'
student-placeholder
'
}
></
div
>
:
null
}
{
className
!==
'
screen-sharing
'
?
<
div
className=
{
role
===
'
teacher
'
?
'
teacher-placeholder
'
:
'
student-placeholder
'
}
></
div
>
:
null
}
{
preview
?
null
:
{
preview
?
null
:
account
?
account
?
<>
{
streamID
>
0
&&
id
!=
teacherId
?
<
div
className=
'star'
>
<
div
className=
"medal"
></
div
>
<
div
className=
"medal-bg"
>
<
span
className=
"points"
>
{
star
}
</
span
>
</
div
>
</
div
>:
null
}
<
div
className=
"video-profile"
>
<
div
className=
"video-profile"
>
<
span
className=
"account"
>
{
account
}
</
span
>
<
span
className=
"account"
>
{
account
}
</
span
>
{
/*{stateError.current?<span onClick={resumeStream}>恢复</span>: null}*/
}
{
/*{stateError.current?<span onClick={resumeStream}>恢复</span>: null}*/
}
{
streamID
<=
0
?
null
:
{
streamID
<=
0
?
null
:
<
div
>
<>
{
{
/*me.uid === id ||*/
me
.
role
===
'
teacher
'
/*me.uid === id ||*/
me
.
role
===
'
teacher
'
?
<
span
className=
"media-btn"
>
?
<
span
className=
"media-btn"
>
<>
<>
{
id
!=
roomStore
.
state
.
course
.
teacherId
{
id
!=
roomStore
.
state
.
course
.
teacherId
?<
ArrowDownwardIcon
onClick=
{
onStageDownClick
}
className=
{
style
.
stageDown
}
></
ArrowDownwardIcon
>
?
<>
<
EmojiEventsOutlinedIcon
onClick=
{
addStar
}
className=
{
style
.
emojiEvent
}
></
EmojiEventsOutlinedIcon
>
<
ArrowDownwardIcon
onClick=
{
onStageDownClick
}
className=
{
style
.
stageDown
}
></
ArrowDownwardIcon
>
</>
:<
BuildIcon
onClick=
{
fixUserStream
}
className=
{
style
.
fixStream
}
></
BuildIcon
>
}
:<
BuildIcon
onClick=
{
fixUserStream
}
className=
{
style
.
fixStream
}
></
BuildIcon
>
}
<
Icon
onClick=
{
onAudioClick
}
className=
{
audio
?
"
icon-speaker-on
"
:
"
icon-speaker-off
"
}
<
Icon
onClick=
{
onAudioClick
}
className=
{
audio
?
"
icon-speaker-on
"
:
"
icon-speaker-off
"
}
data=
{
"
audio
"
}
/>
data=
{
"
audio
"
}
/>
<
Icon
onClick
=
{
onVideoClick
}
className=
{
video
?
"
icons-camera-unmute-s
"
:
"
icons-camera-mute-s
"
}
<
Icon
onClick
=
{
onVideoClick
}
className=
{
video
?
"
icons-camera-unmute-s
"
:
"
icons-camera-mute-s
"
}
...
@@ -351,15 +408,17 @@ return (
...
@@ -351,15 +408,17 @@ return (
<
Icon
className=
{
video
?
"
icons-camera-unmute-s disabled
"
:
"
icons-camera-mute-s disabled
"
}
<
Icon
className=
{
video
?
"
icons-camera-unmute-s disabled
"
:
"
icons-camera-mute-s disabled
"
}
data=
{
"
video
"
}
/>
data=
{
"
video
"
}
/>
</
span
>
</
span
>
}
</
div
>
}
</>
}
}
</
div
>
</
div
>
</>
:
null
:
null
}
}
<
div
id=
{
`${domId}`
}
className=
{
`agora-rtc-video ${local && platform === 'electron' ? 'rotateY180deg' : ''}`
}
></
div
>
<
div
id=
{
`${domId}`
}
className=
{
`agora-rtc-video ${local && platform === 'electron' ? 'rotateY180deg' : ''}`
}
></
div
>
</
div
>
</
div
>
)
)
...
...
src/components/video-stage-list.scss
View file @
9e379994
...
@@ -3,15 +3,15 @@
...
@@ -3,15 +3,15 @@
display
:
flex
;
display
:
flex
;
min-width
:
990px
;
min-width
:
990px
;
background
:
#F5F7F8
;
background
:
#F5F7F8
;
max-height
:
122px
;
//
max-height: 122px;
min-height
:
122px
;
//
min-height: 122px;
align-items
:
flex-start
;
align-items
:
flex-start
;
padding-top
:
5px
;
padding-top
:
5px
;
position
:
relative
;
position
:
relative
;
z-index
:
1
;
z-index
:
1
;
.show-platform
{
.show-platform
{
width
:
100%
;
width
:
100%
;
position
:
absolute
;
//
position: absolute;
//height: 100%;
//height: 100%;
//margin-left: 3.33px;
//margin-left: 3.33px;
//margin-right: 3.33px;
//margin-right: 3.33px;
...
...
src/components/video-stage-list.tsx
View file @
9e379994
import
React
,
{
useRef
,
useEffect
,
useState
,
useLayoutEffect
}
from
'
react
'
;
import
React
,
{
useRef
,
useEffect
,
useState
,
useLayoutEffect
}
from
'
react
'
;
import
VideoPlayer
from
'
./video-player
'
;
import
VideoPlayer
from
'
./video-player
'
;
import
Icon
from
'
./icon
'
;
//
import Icon from './icon';
import
{
ExpandMore
,
ExpandLess
}
from
'
@material-ui/icons
'
;
import
{
ExpandMore
,
ExpandLess
}
from
'
@material-ui/icons
'
;
import
'
./video-stage-list.scss
'
;
import
'
./video-stage-list.scss
'
;
import
useStream
from
'
../hooks/use-streams
'
;
import
useStream
from
'
../hooks/use-streams
'
;
import
{
AgoraMediaStream
}
from
'
../utils/types
'
;
import
{
AgoraMediaStream
}
from
'
../utils/types
'
;
import
{
STAGE_NUM
}
from
"
../utils/consts
"
;
import
{
STAGE_NUM
}
from
"
../utils/consts
"
;
import
MemberHolder
from
"
./member-holder
"
;
import
MemberHolder
from
"
./member-holder
"
;
import
{
Dialog
,
Button
,
DialogContent
,
DialogActions
,
TextField
,
DialogContentText
,
DialogTitle
}
from
'
@material-ui/core
'
;
import
{
roomStore
}
from
'
../stores/room
'
;
function
VideoShowList
()
{
function
VideoShowList
()
{
...
@@ -16,7 +17,6 @@ function VideoShowList() {
...
@@ -16,7 +17,6 @@ function VideoShowList() {
const
ref
=
useRef
<
boolean
>
(
false
);
const
ref
=
useRef
<
boolean
>
(
false
);
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -38,6 +38,7 @@ function VideoShowList() {
...
@@ -38,6 +38,7 @@ function VideoShowList() {
return
(
return
(
<
div
className=
"video-show-list-container"
>
<
div
className=
"video-show-list-container"
>
<
div
className=
"show-platform"
>
<
div
className=
"show-platform"
>
<
div
className=
"on-show"
>
<
div
className=
"on-show"
>
{
teacher
?
{
teacher
?
...
...
src/components/whiteboard.tsx
View file @
9e379994
...
@@ -19,8 +19,11 @@ export default function Whiteboard ({
...
@@ -19,8 +19,11 @@ export default function Whiteboard ({
whiteboard
.
updateRoomState
();
whiteboard
.
updateRoomState
();
if
(
$whiteboard
)
{
if
(
$whiteboard
)
{
window
.
addEventListener
(
"
resize
"
,
(
evt
:
any
)
=>
{
window
.
addEventListener
(
"
resize
"
,
(
evt
:
any
)
=>
{
try
{
room
.
moveCamera
({
centerX
:
0
,
centerY
:
0
});
room
.
moveCamera
({
centerX
:
0
,
centerY
:
0
});
room
.
refreshViewSize
();
room
.
refreshViewSize
();
}
catch
(
e
){}
});
});
return
()
=>
{
return
()
=>
{
window
.
removeEventListener
(
"
resize
"
,
(
evt
:
any
)
=>
{});
window
.
removeEventListener
(
"
resize
"
,
(
evt
:
any
)
=>
{});
...
...
src/containers/root-container.tsx
View file @
9e379994
...
@@ -5,7 +5,7 @@ import { WhiteboardState, whiteboard } from '../stores/whiteboard';
...
@@ -5,7 +5,7 @@ import { WhiteboardState, whiteboard } from '../stores/whiteboard';
import
{
useHistory
,
useLocation
}
from
'
react-router-dom
'
;
import
{
useHistory
,
useLocation
}
from
'
react-router-dom
'
;
import
{
resolveMessage
,
resolvePeerMessage
,
resolveChannelAttrs
,
jsonParse
}
from
'
../utils/helper
'
;
import
{
resolveMessage
,
resolvePeerMessage
,
resolveChannelAttrs
,
jsonParse
}
from
'
../utils/helper
'
;
import
GlobalStorage
from
'
../utils/custom-storage
'
;
import
GlobalStorage
from
'
../utils/custom-storage
'
;
import
{
endPoint
}
from
"
../services/agora-end-points
"
;
import
{
endPoint
,
goHome
}
from
"
../services/agora-end-points
"
;
import
{
Map
as
immuMap
}
from
"
immutable
"
;
import
{
Map
as
immuMap
}
from
"
immutable
"
;
export
type
IRootProvider
=
{
export
type
IRootProvider
=
{
...
@@ -89,7 +89,8 @@ export const RootProvider: React.FC<any> = ({children}) => {
...
@@ -89,7 +89,8 @@ export const RootProvider: React.FC<any> = ({children}) => {
type
:
'
rtmClient
'
,
type
:
'
rtmClient
'
,
message
:
'
login failure
'
message
:
'
login failure
'
});
});
history
.
push
(
'
/
'
);
// history.push('/');
goHome
(
history
)
return
;
return
;
}
}
if
(
reason
===
'
REMOTE_LOGIN
'
||
newState
===
'
ABORTED
'
)
{
if
(
reason
===
'
REMOTE_LOGIN
'
||
newState
===
'
ABORTED
'
)
{
...
@@ -97,15 +98,17 @@ export const RootProvider: React.FC<any> = ({children}) => {
...
@@ -97,15 +98,17 @@ export const RootProvider: React.FC<any> = ({children}) => {
type
:
'
rtmClient
'
,
type
:
'
rtmClient
'
,
message
:
'
kick
'
message
:
'
kick
'
});
});
history
.
push
(
'
/
'
);
// history.push('/');
goHome
(
history
)
return
;
return
;
}
}
});
});
rtmClient
.
on
(
"
MessageFromPeer
"
,
({
message
:
{
text
},
peerId
,
props
}:
{
message
:
{
text
:
string
},
peerId
:
string
,
props
:
any
})
=>
{
rtmClient
.
on
(
"
MessageFromPeer
"
,
({
message
:
{
text
},
peerId
,
props
}:
{
message
:
{
text
:
string
},
peerId
:
string
,
props
:
any
})
=>
{
console
.
log
(
'
MessageFromPeer
'
,
text
);
console
.
log
(
'
MessageFromPeer
'
,
text
);
const
body
=
resolvePeerMessage
(
text
);
const
body
=
resolvePeerMessage
(
text
);
resolveMessage
(
peerId
,
body
);
body
.
cmd
=
+
body
.
cmd
body
.
cmd
=
+
body
.
cmd
resolveMessage
(
peerId
,
body
);
roomStore
.
handlePeerMessage
(
body
.
cmd
,
peerId
)
roomStore
.
handlePeerMessage
(
body
.
cmd
,
peerId
)
.
then
(()
=>
{
.
then
(()
=>
{
}).
catch
(
console
.
warn
);
}).
catch
(
console
.
warn
);
...
@@ -116,7 +119,8 @@ export const RootProvider: React.FC<any> = ({children}) => {
...
@@ -116,7 +119,8 @@ export const RootProvider: React.FC<any> = ({children}) => {
type
:
'
rtmClient
'
,
type
:
'
rtmClient
'
,
message
:
'
teacher close classroom
'
message
:
'
teacher close classroom
'
});
});
history
.
push
(
'
/
'
);
// history.push('/');
goHome
(
history
)
return
;
return
;
}
}
console
.
log
(
'
[rtm-client] updated origin attributes
'
,
JSON
.
parse
(
JSON
.
stringify
(
attributes
)));
console
.
log
(
'
[rtm-client] updated origin attributes
'
,
JSON
.
parse
(
JSON
.
stringify
(
attributes
)));
...
...
src/hooks/use-streams.ts
View file @
9e379994
...
@@ -140,8 +140,8 @@ export default function useStream () {
...
@@ -140,8 +140,8 @@ export default function useStream () {
const
myAttr
=
userAttrs
.
get
(
me
.
uid
);
const
myAttr
=
userAttrs
.
get
(
me
.
uid
);
console
.
log
(
100000
,
studentsOrder
);
//
console.log(100000, studentsOrder);
console
.
log
(
11111111
,
studentIds
.
toArray
());
//
console.log(11111111, studentIds.toArray());
// studentIds = studentIds.sort(function(a, b){
// studentIds = studentIds.sort(function(a, b){
// if (studentsOrder.indexOf(+a) < 0) {return 0}
// if (studentsOrder.indexOf(+a) < 0) {return 0}
// if (studentsOrder.indexOf(+b) < 0) {return 0}
// if (studentsOrder.indexOf(+b) < 0) {return 0}
...
@@ -222,7 +222,7 @@ export default function useStream () {
...
@@ -222,7 +222,7 @@ export default function useStream () {
if
(
me
.
role
===
'
student
'
&&
+
me
.
uid
==
studentId
)
{
if
(
me
.
role
===
'
student
'
&&
+
me
.
uid
==
studentId
)
{
if
(
myAttr
&&
roomState
.
rtc
.
localStream
)
{
if
(
myAttr
&&
roomState
.
rtc
.
localStream
)
{
console
.
log
(
'
use local stream
'
)
//
console.log('use local stream')
const
_tmpStream
=
{
const
_tmpStream
=
{
...
roomState
.
rtc
.
localStream
,
...
roomState
.
rtc
.
localStream
,
account
:
myAttr
.
account
,
account
:
myAttr
.
account
,
...
@@ -281,7 +281,7 @@ export default function useStream () {
...
@@ -281,7 +281,7 @@ export default function useStream () {
}
}
}
}
})
})
console
.
log
(
'
studentStreams
'
,
studentStreams
);
//
console.log('studentStreams', studentStreams);
return
studentStreams
;
return
studentStreams
;
},
[
},
[
// course,
// course,
...
@@ -496,6 +496,7 @@ export default function useStream () {
...
@@ -496,6 +496,7 @@ export default function useStream () {
await
roomStore
.
unPublishMeStream
();
await
roomStore
.
unPublishMeStream
();
await
roomStore
.
publishMeStream
();
await
roomStore
.
publishMeStream
();
}
}
}
}
}
}
return
value
;
return
value
;
...
...
src/icons.scss
View file @
9e379994
...
@@ -101,11 +101,11 @@
...
@@ -101,11 +101,11 @@
background-image
:
url('./assets/icon-speaker@2x.png')
;
background-image
:
url('./assets/icon-speaker@2x.png')
;
}
}
.icon-speaker-on
,
//
.icon-speaker-on,
.icon-speaker-off
//
.icon-speaker-off
{
//
{
width
:
37px
;
//
width: 37px;
}
//
}
.
icon-speaker-on
:
:
after
{
.
icon-speaker-on
:
:
after
{
width
:
100%
;
width
:
100%
;
...
@@ -118,7 +118,7 @@
...
@@ -118,7 +118,7 @@
}
}
.
icon-speaker-off
:
:
after
{
.
icon-speaker-off
:
:
after
{
width
:
100%
;
width
:
24px
;
height
:
100%
;
height
:
100%
;
background-position
:
center
;
background-position
:
center
;
background-repeat
:
no-repeat
;
background-repeat
:
no-repeat
;
...
...
src/pages/classroom/index.tsx
View file @
9e379994
...
@@ -11,6 +11,17 @@ import { globalStore } from '../../stores/global';
...
@@ -11,6 +11,17 @@ import { globalStore } from '../../stores/global';
import
{
platform
}
from
'
../../utils/platform
'
;
import
{
platform
}
from
'
../../utils/platform
'
;
import
AgoraWebClient
,
{
AgoraStreamSpec
,
SHARE_ID
}
from
'
../../utils/agora-rtc-client
'
;
import
AgoraWebClient
,
{
AgoraStreamSpec
,
SHARE_ID
}
from
'
../../utils/agora-rtc-client
'
;
import
{
AgoraElectronClient
}
from
'
../../utils/agora-electron-client
'
;
import
{
AgoraElectronClient
}
from
'
../../utils/agora-electron-client
'
;
import
{
eventBus
}
from
"
../../stores/EventBus
"
;
import
{
Button
,
Dialog
,
DialogActions
,
DialogContent
,
DialogContentText
,
DialogTitle
,
TextField
}
from
"
@material-ui/core
"
;
import
{
goHome
}
from
"
../../services/agora-end-points
"
;
export
const
roomTypes
=
[
export
const
roomTypes
=
[
{
value
:
0
,
text
:
'
One-on-One
'
,
path
:
'
one-to-one
'
},
{
value
:
0
,
text
:
'
One-on-One
'
,
path
:
'
one-to-one
'
},
...
@@ -18,12 +29,131 @@ export const roomTypes = [
...
@@ -18,12 +29,131 @@ export const roomTypes = [
{
value
:
2
,
text
:
'
Large Class
'
,
path
:
'
big-class
'
},
{
value
:
2
,
text
:
'
Large Class
'
,
path
:
'
big-class
'
},
];
];
export
interface
StarDialogProps
{
uid
:
number
;
keepMounted
?:
boolean
;
title
:
string
;
open
:
boolean
;
onClose
:
(
uid
:
number
,
value
:
number
)
=>
void
;
}
const
NUMBER
=
/^
[
0-9
]
*/
function
StarDialog
(
props
:
StarDialogProps
)
{
let
{
onClose
,
title
:
valueProp
,
open
,
uid
,
...
other
}
=
props
;
const
[
title
,
setTitle
]
=
React
.
useState
(
valueProp
);
const
[
value
,
setValue
]
=
React
.
useState
<
number
>
(
0
);
React
.
useEffect
(()
=>
{
if
(
!
open
)
{
setTitle
(
valueProp
);
}
},
[
valueProp
,
open
]);
const
handleChange
=
(
evt
:
any
)
=>
{
console
.
log
(
'
dialog handleChange
'
);
const
val
=
evt
.
target
.
value
.
match
(
NUMBER
)[
0
];
if
(
val
)
{
setValue
(
+
val
);
}
};
const
handleEntering
=
()
=>
{
// console.log('dialog handleEntering ');
onClose
(
uid
,
value
);
};
const
handleCancel
=
()
=>
{
console
.
log
(
'
dialog handleCancel
'
);
onClose
(
-
1
,
0
);
};
const
handleOk
=
()
=>
{
// console.log('dialog handleOk ');
onClose
(
uid
,
value
);
};
return
(
<
Dialog
disableBackdropClick
disableEscapeKeyDown
maxWidth=
"xs"
aria
-
labelledby=
"confirmation-dialog-title"
open=
{
open
}
{
...
other
}
>
<
DialogTitle
id=
"confirmation-dialog-title"
>
{
title
}
</
DialogTitle
>
<
DialogContent
>
<
TextField
autoFocus
margin=
"dense"
id=
"starNumber"
label=
"奖励值"
type=
"number"
onChange=
{
handleChange
}
fullWidth
/>
</
DialogContent
>
<
DialogActions
>
<
Button
autoFocus
onClick=
{
handleCancel
}
color=
"primary"
>
取消
</
Button
>
<
Button
onClick=
{
handleOk
}
color=
"primary"
>
确认
</
Button
>
</
DialogActions
>
</
Dialog
>
);
}
export
function
RoomPage
({
children
}:
any
)
{
export
function
RoomPage
({
children
}:
any
)
{
const
history
=
useHistory
();
const
history
=
useHistory
();
const
lock
=
useRef
<
boolean
>
(
false
);
const
lock
=
useRef
<
boolean
>
(
false
);
/////////////////////////
const
[
open
,
setOpen
]
=
React
.
useState
(
false
);
const
[
tid
,
setTid
]
=
React
.
useState
(
0
);
const
[
title
,
setTitle
]
=
React
.
useState
(
''
);
const
dialogLock
=
useRef
<
boolean
>
(
false
);
const
handleDialogClose
=
(
uid
:
number
,
val
:
number
)
=>
{
setOpen
(
false
);
dialogLock
.
current
=
false
;
if
(
uid
<
0
||
val
<=
0
)
{
return
;
}
console
.
log
(
'
handleDialogClose
'
,
uid
,
val
);
roomStore
.
addStarToUser
(
uid
,
val
);
};
const
eventNames
=
eventBus
.
eventNames
();
if
(
!
eventNames
.
includes
(
'
showAddStartDialog
'
))
{
console
.
log
(
3333333
);
eventBus
.
on
(
'
showAddStartDialog
'
,
(
data
)
=>
{
if
(
dialogLock
.
current
)
{
return
}
dialogLock
.
current
=
true
;
let
titleTxt
=
'
全部学生
'
if
(
data
.
uid
)
{
const
stu
=
roomStore
.
state
.
users
.
get
(
data
.
uid
);
titleTxt
=
`学生:
${
stu
?.
account
}
`
}
setTid(+data.uid);
setTitle(titleTxt);
console.log('addStar', data);
setTimeout(()=>setOpen(true))
})
}
///////////////////////////////////
useEffect(() => {
useEffect(() => {
...
@@ -33,7 +163,8 @@ export function RoomPage({ children }: any) {
...
@@ -33,7 +163,8 @@ export function RoomPage({ children }: any) {
const roomName = roomStore.state.course.roomName;
const roomName = roomStore.state.course.roomName;
if (!rid || !me.uid) {
if (!rid || !me.uid) {
history
.
push
(
'
/
'
);
// history.push('/');
goHome(history)
}
}
const uid = me.uid;
const uid = me.uid;
...
@@ -65,7 +196,8 @@ export function RoomPage({ children }: any) {
...
@@ -65,7 +196,8 @@ export function RoomPage({ children }: any) {
type: 'rtmClient',
type: 'rtmClient',
message: 'login failure'
message: 'login failure'
});
});
history
.
push
(
'
/
'
);
// history.push('/');
goHome(history)
console.warn(err)
console.warn(err)
}).finally(() => {
}).finally(() => {
globalStore.stopLoading();
globalStore.stopLoading();
...
@@ -76,7 +208,8 @@ export function RoomPage({ children }: any) {
...
@@ -76,7 +208,8 @@ export function RoomPage({ children }: any) {
type: 'rtmClient',
type: 'rtmClient',
message: 'login failure'
message: 'login failure'
});
});
history
.
push
(
'
/
'
);
// history.push('/');
goHome(history)
console.warn(err)
console.warn(err)
})
})
.finally(() => {
.finally(() => {
...
@@ -288,7 +421,8 @@ export function RoomPage({ children }: any) {
...
@@ -288,7 +421,8 @@ export function RoomPage({ children }: any) {
type: 'rtmClient',
type: 'rtmClient',
message: err.message
message: err.message
});
});
history
.
push
(
'
/
'
);
// history.push('/');
goHome(history)
}
}
}
}
...
@@ -310,7 +444,7 @@ export function RoomPage({ children }: any) {
...
@@ -310,7 +444,7 @@ export function RoomPage({ children }: any) {
]);
]);
useEffect(() => {
useEffect(() => {
// debugger
if (!roomState.me.uid || !roomState.course.rid) return;
if (!roomState.me.uid || !roomState.course.rid) return;
if (classroom) {
if (classroom) {
if (platform === 'web') {
if (platform === 'web') {
...
@@ -421,7 +555,7 @@ export function RoomPage({ children }: any) {
...
@@ -421,7 +555,7 @@ export function RoomPage({ children }: any) {
})
})
rtc
.
current
=
true
;
rtc
.
current
=
true
;
// debugger
// WARN: IF YOU ENABLED APP CERTIFICATE, PLEASE SIGN YOUR TOKEN IN YOUR SERVER SIDE AND OBTAIN IT FROM YOUR OWN TRUSTED SERVER API
// WARN: IF YOU ENABLED APP CERTIFICATE, PLEASE SIGN YOUR TOKEN IN YOUR SERVER SIDE AND OBTAIN IT FROM YOUR OWN TRUSTED SERVER API
console
.
info
(
1.1
,
'
rtc join
'
)
console
.
info
(
1.1
,
'
rtc join
'
)
// if (roomState.me.role == 'teacher' || roomState.studentsOrder.includes(+roomState.me.uid)) {
// if (roomState.me.role == 'teacher' || roomState.studentsOrder.includes(+roomState.me.uid)) {
...
@@ -558,6 +692,7 @@ export function RoomPage({ children }: any) {
...
@@ -558,6 +692,7 @@ export function RoomPage({ children }: any) {
return
(
return
(
<
div
className=
{
`classroom ${roomType.path}`
}
>
<
div
className=
{
`classroom ${roomType.path}`
}
>
<
StarDialog
title=
{
title
}
uid=
{
tid
}
open=
{
open
}
onClose=
{
handleDialogClose
}
></
StarDialog
>
<
NativeSharedWindow
/>
<
NativeSharedWindow
/>
<
Nav
/>
<
Nav
/>
{
children
}
{
children
}
...
...
src/pages/home.tsx
View file @
9e379994
...
@@ -13,7 +13,7 @@ import { roomStore } from '../stores/room';
...
@@ -13,7 +13,7 @@ import { roomStore } from '../stores/room';
// import { genUid } from '../utils/helper';
// import { genUid } from '../utils/helper';
// import MD5 from 'js-md5';
// import MD5 from 'js-md5';
import
{
globalStore
}
from
'
../stores/global
'
;
import
{
globalStore
}
from
'
../stores/global
'
;
import
{
endPoint
}
from
'
../services/agora-end-points
'
;
import
{
endPoint
,
goLogin
}
from
'
../services/agora-end-points
'
;
import
Select
from
"
@material-ui/core/Select
"
;
import
Select
from
"
@material-ui/core/Select
"
;
import
MenuItem
from
"
@material-ui/core/MenuItem
"
;
import
MenuItem
from
"
@material-ui/core/MenuItem
"
;
import
InputLabel
from
"
@material-ui/core/InputLabel
"
;
import
InputLabel
from
"
@material-ui/core/InputLabel
"
;
...
@@ -117,7 +117,7 @@ function HomePage() {
...
@@ -117,7 +117,7 @@ function HomePage() {
}
}
const
doCheckWithUser
=
()
=>
{
const
doCheckWithUser
=
()
=>
{
endPoint
.
login
({
username
:
session
.
yourName
,
password
:
session
.
yourPass
,
classid
:
session
.
classId
}).
then
((
userInfo
:
any
)
=>
{
endPoint
.
login
({
username
:
session
.
yourName
,
password
:
session
.
yourPass
,
classid
:
session
.
classId
}
,
isDebug
).
then
((
userInfo
:
any
)
=>
{
loginLive
(
userInfo
);
loginLive
(
userInfo
);
}).
catch
((
err
:
any
)
=>
{
}).
catch
((
err
:
any
)
=>
{
globalStore
.
showToast
({
globalStore
.
showToast
({
...
@@ -177,11 +177,16 @@ function HomePage() {
...
@@ -177,11 +177,16 @@ function HomePage() {
const
location
=
useLocation
();
const
location
=
useLocation
();
// console.log(1111111111111, location );
// console.log(1111111111111, location );
const
params
=
new
URLSearchParams
(
location
.
search
);
const
params
=
new
URLSearchParams
(
location
.
search
);
let
token
=
params
.
get
(
'
token
'
);
let
token
:
any
=
params
.
get
(
'
token
'
);
let
isDebug
=
params
.
get
(
'
debug
'
)
&&
params
.
get
(
'
debug
'
)
==
'
1
'
?
true
:
false
;
let
hasLogin
=
params
.
get
(
'
login
'
)
&&
params
.
get
(
'
login
'
)
==
'
1
'
?
true
:
false
;
let
hasLogin
=
params
.
get
(
'
login
'
)
&&
params
.
get
(
'
login
'
)
==
'
1
'
?
true
:
false
;
// console.log('params', token)
let
isLocal
=
params
.
get
(
'
isLocal
'
)
&&
params
.
get
(
'
isLocal
'
)
==
'
1
'
?
true
:
false
;
// debugger
console
.
log
(
'
token
'
,
token
)
console
.
log
(
'
isDebug
'
,
isDebug
)
console
.
log
(
'
hasLogin
'
,
hasLogin
)
console
.
log
(
'
isLocal
'
,
isLocal
)
if
(
token
)
{
if
(
token
)
{
endPoint
.
setUserToken
(
token
);
const
tokenParts
=
token
.
split
(
'
.
'
)
const
tokenParts
=
token
.
split
(
'
.
'
)
token
=
tokenParts
[
1
];
token
=
tokenParts
[
1
];
token
=
token
.
replace
(
/
[\+]
/g
,
'
-
'
);
token
=
token
.
replace
(
/
[\+]
/g
,
'
-
'
);
...
@@ -193,6 +198,7 @@ function HomePage() {
...
@@ -193,6 +198,7 @@ function HomePage() {
token
=
`
${
token
}${
Array
.
from
(
ea
).
fill
(
'
=
'
).
join
(
''
)}
`
token
=
`
${
token
}${
Array
.
from
(
ea
).
fill
(
'
=
'
).
join
(
''
)}
`
}
}
let
userInfo
=
Base64
.
decode
(
token
);
let
userInfo
=
Base64
.
decode
(
token
);
userInfo
=
JSON
.
parse
(
userInfo
)
userInfo
=
JSON
.
parse
(
userInfo
)
console
.
log
(
userInfo
)
console
.
log
(
userInfo
)
...
@@ -206,6 +212,10 @@ function HomePage() {
...
@@ -206,6 +212,10 @@ function HomePage() {
// // data.password: session.yourPass
// // data.password: session.yourPass
// };
// };
doCheckWithToken
(
userInfo
);
doCheckWithToken
(
userInfo
);
}
else
{
if
(
!
hasLogin
&&
!
isDebug
)
{
goLogin
()
}
}
}
const
handleSubmit
=
()
=>
{
const
handleSubmit
=
()
=>
{
if
(
!
session
.
yourName
)
{
if
(
!
session
.
yourName
)
{
...
@@ -373,7 +383,20 @@ function HomePage() {
...
@@ -373,7 +383,20 @@ function HomePage() {
requiredText=
{
required
.
yourName
}
requiredText=
{
required
.
yourName
}
/>
/>
</
FormControl
>
</
FormControl
>
<
FormControl
className=
{
style
.
formControl
}
>
{
isDebug
?<
FormControl
className=
{
style
.
formControl
}
>
<
FormInput
Label=
{
"
频道
"
}
value=
{
session
.
classId
}
onChange=
{
(
val
:
string
)
=>
{
setSessionInfo
({
...
session
,
classId
:
val
});
}
}
requiredText=
"请输入频道"
/>
</
FormControl
>
:<
FormControl
className=
{
style
.
formControl
}
>
<
InputLabel
>
请选择班级
</
InputLabel
>
<
InputLabel
>
请选择班级
</
InputLabel
>
<
Select
<
Select
...
@@ -394,7 +417,9 @@ function HomePage() {
...
@@ -394,7 +417,9 @@ function HomePage() {
<MenuItem value={30}>Thirty</MenuItem>*/
}
<MenuItem value={30}>Thirty</MenuItem>*/
}
</
Select
>
</
Select
>
</
FormControl
>
</
FormControl
>
}
<
FormControl
className=
{
style
.
formControl
}
>
<
FormControl
className=
{
style
.
formControl
}
>
<
FormInput
Label=
{
"
密码
"
}
type=
"password"
value=
{
session
.
yourPass
}
onChange=
{
<
FormInput
Label=
{
"
密码
"
}
type=
"password"
value=
{
session
.
yourPass
}
onChange=
{
(
val
:
string
)
=>
{
(
val
:
string
)
=>
{
...
...
src/services/agora-end-points.ts
View file @
9e379994
...
@@ -42,7 +42,15 @@ export interface RoomParams {
...
@@ -42,7 +42,15 @@ export interface RoomParams {
enableAudio
:
number
enableAudio
:
number
linkUsers
:
number
[]
linkUsers
:
number
[]
}
}
export
function
goHome
(
history
:
any
){
window
.
location
.
href
=
'
http://iteachabc.com
'
}
export
function
goLogin
(){
window
.
location
.
href
=
'
http://iteachabc.com/manage/login
'
}
export
function
getApiServerHost
(
online
=
false
)
{
export
function
getApiServerHost
(
online
=
false
)
{
// return 'http://127.0.0.1:1339'
let
host
=
`https://ac.iplayabc.com`
;
let
host
=
`https://ac.iplayabc.com`
;
if
(
window
.
location
.
host
.
includes
(
'
s-live.
'
))
{
if
(
window
.
location
.
host
.
includes
(
'
s-live.
'
))
{
host
=
'
https://staging-ac.ireadabc.com
'
;
host
=
'
https://staging-ac.ireadabc.com
'
;
...
@@ -73,7 +81,9 @@ export class EndPoint {
...
@@ -73,7 +81,9 @@ export class EndPoint {
roomId
:
string
=
''
;
roomId
:
string
=
''
;
userToken
:
string
=
''
;
userToken
:
string
=
''
;
recordId
:
string
=
''
;
recordId
:
string
=
''
;
setUserToken
(
token
:
string
)
{
this
.
userToken
=
token
}
async
sts
()
{
async
sts
()
{
let
response
=
await
AgoraFetch
(
`https://omt.iplayabc.com/api/oss/live/static`
,
{
let
response
=
await
AgoraFetch
(
`https://omt.iplayabc.com/api/oss/live/static`
,
{
method
:
'
GET
'
,
method
:
'
GET
'
,
...
@@ -97,12 +107,12 @@ export class EndPoint {
...
@@ -97,12 +107,12 @@ export class EndPoint {
}
}
return
[];
return
[];
}
}
async
login
(
data
:
any
)
{
if
(
window
.
location
.
origin
.
includes
(
'
://127.0.0.1
'
)
async
login
(
data
:
any
,
local
=
false
)
{
||
window
.
location
.
origin
.
includes
(
'
://localhost
'
)
)
{
if
(
local
)
{
return
{
return
{
id
:
`
${
data
.
username
}
`
,
id
:
`
${
data
.
username
}
`
,
class_id
:
"
test_03__123
"
,
class_id
:
`
${
data
.
classid
}
`
,
classRole
:
(
`
${
data
.
username
}
`
===
"
1
"
||
`
${
data
.
username
}
`
===
"
11
"
)?
"
tea
"
:
""
,
classRole
:
(
`
${
data
.
username
}
`
===
"
1
"
||
`
${
data
.
username
}
`
===
"
11
"
)?
"
tea
"
:
""
,
roomType
:
1
,
roomType
:
1
,
nick_name
:
`
${
data
.
username
}
`
,
nick_name
:
`
${
data
.
username
}
`
,
...
@@ -144,7 +154,7 @@ export class EndPoint {
...
@@ -144,7 +154,7 @@ export class EndPoint {
this
.
userToken
=
roomStore
.
state
.
cwLink
;
this
.
userToken
=
roomStore
.
state
.
cwLink
;
}
}
console
.
log
(
'
getCourseUrl
'
,
this
.
userToken
)
console
.
log
(
'
getCourseUrl
'
,
this
.
userToken
)
const
host
=
getApiServerHost
();
const
host
=
getApiServerHost
(
true
);
return
`
${
host
}
/airclass_ol?token=
${
this
.
userToken
}
`
;
return
`
${
host
}
/airclass_ol?token=
${
this
.
userToken
}
`
;
}
}
...
...
src/stores/EventBus.ts
0 → 100644
View file @
9e379994
import
EventEmitter
from
"
events
"
;
export
const
eventBus
=
new
EventEmitter
();
src/stores/room.ts
View file @
9e379994
...
@@ -11,7 +11,7 @@ import {isElectron} from '../utils/platform';
...
@@ -11,7 +11,7 @@ import {isElectron} from '../utils/platform';
import
GlobalStorage
from
'
../utils/custom-storage
'
;
import
GlobalStorage
from
'
../utils/custom-storage
'
;
import
{
STAGE_NUM
}
from
"
../utils/consts
"
;
import
{
STAGE_NUM
}
from
"
../utils/consts
"
;
// import {useLocation} from "react-router-dom";
// import {useLocation} from "react-router-dom";
import
{
get
Teach
ServerHost
}
from
"
../services/agora-end-points
"
;
import
{
get
Api
ServerHost
}
from
"
../services/agora-end-points
"
;
function
canJoin
({
uid
,
onlineStatus
,
roomType
,
channelCount
,
role
}:
{
uid
:
any
,
onlineStatus
:
any
,
role
:
string
,
channelCount
:
number
,
roomType
:
number
})
{
function
canJoin
({
uid
,
onlineStatus
,
roomType
,
channelCount
,
role
}:
{
uid
:
any
,
onlineStatus
:
any
,
role
:
string
,
channelCount
:
number
,
roomType
:
number
})
{
const
result
=
{
const
result
=
{
...
@@ -65,7 +65,9 @@ export interface AgoraUser {
...
@@ -65,7 +65,9 @@ export interface AgoraUser {
linkId
:
number
// link_uid
linkId
:
number
// link_uid
lockBoard
?:
number
// lock_board
lockBoard
?:
number
// lock_board
grantBoard
:
number
grantBoard
:
number
lastStageTs
:
0
lastStageTs
:
0
,
stars
:
number
}
}
export
interface
ClassState
{
export
interface
ClassState
{
...
@@ -126,6 +128,9 @@ type userClassTimeType = {
...
@@ -126,6 +128,9 @@ type userClassTimeType = {
type
userUsageType
=
{
type
userUsageType
=
{
[
key
:
string
]:
userClassTimeType
[
key
:
string
]:
userClassTimeType
}
}
type
userStarsType
=
{
[
key
:
string
]:
number
}
type
handsUpUser
=
{
type
handsUpUser
=
{
[
key
:
number
]:
any
[
key
:
number
]:
any
}
}
...
@@ -141,6 +146,7 @@ export type RoomState = {
...
@@ -141,6 +146,7 @@ export type RoomState = {
messages
:
List
<
ChatMessage
>
messages
:
List
<
ChatMessage
>
studentsOrder
:
number
[]
studentsOrder
:
number
[]
userUsage
:
userUsageType
,
userUsage
:
userUsageType
,
// userStars: userStarsType,
handsUpStudents
:
handsUpUser
,
// immuMap<number, any>
handsUpStudents
:
handsUpUser
,
// immuMap<number, any>
cwLink
:
string
,
cwLink
:
string
,
}
}
...
@@ -227,6 +233,7 @@ export class RoomStore {
...
@@ -227,6 +233,7 @@ export class RoomStore {
messages
:
List
<
ChatMessage
>
(),
messages
:
List
<
ChatMessage
>
(),
studentsOrder
:
[],
studentsOrder
:
[],
userUsage
:
{},
userUsage
:
{},
// userStars:{},
handsUpStudents
:
{},
// immuMap<number, any>(),
handsUpStudents
:
{},
// immuMap<number, any>(),
...
GlobalStorage
.
read
(
'
agora_room
'
)
...
GlobalStorage
.
read
(
'
agora_room
'
)
});
});
...
@@ -349,7 +356,40 @@ export class RoomStore {
...
@@ -349,7 +356,40 @@ export class RoomStore {
}
}
async
addStarToUser
(
uid
:
number
,
value
:
number
)
{
if
(
value
<=
0
)
{
return
;
}
console
.
log
(
'
addStarToUser
'
,
uid
,
value
);
const
stuChannelData
:
any
=
{};
// const userStars = {...this.state.userStars};
if
(
uid
!==
0
)
{
const
stu
=
this
.
state
.
users
.
get
(
`
${
uid
}
`
);
let
uStar
=
0
;
if
(
stu
)
{
uStar
=
stu
.
stars
;
stu
.
stars
=
uStar
+
value
;
stuChannelData
[
uid
]
=
stu
}
}
else
{
this
.
state
.
users
.
forEach
((
u
,
_uid
)
=>
{
u
.
stars
=
u
.
stars
+
value
;
stuChannelData
[
_uid
]
=
u
})
}
// this.state = {
// ...this.state,
// userStars
// }
console
.
log
(
stuChannelData
)
if
(
Object
.
keys
(
stuChannelData
).
length
>
0
)
{
await
this
.
rtmClient
.
addOrUpdateChannelAttributes
(
stuChannelData
);
}
}
async
cancelHandsUp
(
uid
:
number
)
{
async
cancelHandsUp
(
uid
:
number
)
{
let
handle
=
this
.
state
.
handsUpStudents
[
uid
];
let
handle
=
this
.
state
.
handsUpStudents
[
uid
];
...
@@ -429,7 +469,7 @@ export class RoomStore {
...
@@ -429,7 +469,7 @@ export class RoomStore {
await
this
.
rtmClient
.
addOrUpdateChannelAttributes
(
data
);
await
this
.
rtmClient
.
addOrUpdateChannelAttributes
(
data
);
}
}
async
stageDown
(
uid
:
string
)
{
async
stageDown
(
uid
:
string
)
{
// debugger
//把台上位置变零
//把台上位置变零
let
studentsOrder
:
any
[]
=
[...
this
.
state
.
studentsOrder
];
let
studentsOrder
:
any
[]
=
[...
this
.
state
.
studentsOrder
];
console
.
log
(
'
下台
'
,
uid
,
studentsOrder
)
console
.
log
(
'
下台
'
,
uid
,
studentsOrder
)
...
@@ -519,7 +559,7 @@ export class RoomStore {
...
@@ -519,7 +559,7 @@ export class RoomStore {
}
}
async
commit
(
state
:
RoomState
)
{
async
commit
(
state
:
RoomState
)
{
console
.
log
(
'
state changed
'
,
state
);
//
console.log('state changed', state);
return
this
.
subject
&&
this
.
subject
.
next
(
state
);
return
this
.
subject
&&
this
.
subject
.
next
(
state
);
}
}
...
@@ -549,10 +589,7 @@ export class RoomStore {
...
@@ -549,10 +589,7 @@ export class RoomStore {
}
}
async
addLocalStream
(
stream
:
AgoraStream
)
{
async
addLocalStream
(
stream
:
AgoraStream
)
{
if
(
this
.
state
.
me
.
role
==
'
teacher
'
)
{
console
.
log
(
'
add teacher usage
'
);
this
.
_userIn
(
stream
.
streamID
)
}
this
.
state
=
{
this
.
state
=
{
...
this
.
state
,
...
this
.
state
,
rtc
:
{
rtc
:
{
...
@@ -627,11 +664,10 @@ export class RoomStore {
...
@@ -627,11 +664,10 @@ export class RoomStore {
}
}
_userIn
(
uid
:
number
)
{
_userIn
(
uid
:
number
,
role
=
'
student
'
)
{
if
(
this
.
state
.
me
.
role
!=
'
teacher
'
)
{
if
(
role
!==
'
teacher
'
&&
this
.
state
.
me
.
role
!=
'
teacher
'
)
{
return
;
return
;
}
}
let
role
=
'
student
'
const
currUser
:
AgoraUser
|
undefined
=
this
.
state
.
users
.
get
(
`
${
uid
}
`
);
const
currUser
:
AgoraUser
|
undefined
=
this
.
state
.
users
.
get
(
`
${
uid
}
`
);
if
(
currUser
)
{
if
(
currUser
)
{
role
=
currUser
.
role
;
role
=
currUser
.
role
;
...
@@ -659,13 +695,12 @@ export class RoomStore {
...
@@ -659,13 +695,12 @@ export class RoomStore {
if
(
this
.
state
.
me
.
role
!=
'
teacher
'
)
{
if
(
this
.
state
.
me
.
role
!=
'
teacher
'
)
{
return
;
return
;
}
}
debugger
console
.
log
(
'
userusage _userOut
'
,
uid
);
console
.
log
(
'
userusage _userOut
'
,
uid
);
const
uc
=
this
.
state
.
userUsage
[
`
${
uid
}
`
];
const
uc
=
this
.
state
.
userUsage
[
`
${
uid
}
`
];
const
now
=
Date
.
now
();
const
now
=
Date
.
now
();
if
(
uc
)
{
if
(
uc
)
{
uc
.
out
=
now
;
uc
.
out
=
now
;
if
(
uc
.
in
<
=
uc
.
out
)
{
if
(
uc
.
in
<
uc
.
out
)
{
let
ts
=
0
;
let
ts
=
0
;
if
(
uc
.
in
!=
0
)
{
if
(
uc
.
in
!=
0
)
{
ts
=
uc
.
out
-
uc
.
in
;;
ts
=
uc
.
out
-
uc
.
in
;;
...
@@ -683,15 +718,21 @@ export class RoomStore {
...
@@ -683,15 +718,21 @@ export class RoomStore {
if
(
!
uid
)
{
if
(
!
uid
)
{
return
;
return
;
}
}
// const userStars = {...this.state.userStars}
// if (!userStars[uid]) {
// userStars[uid] = 0;
// }
this
.
state
=
{
this
.
state
=
{
...
this
.
state
,
...
this
.
state
,
rtc
:
{
rtc
:
{
...
this
.
state
.
rtc
,
...
this
.
state
.
rtc
,
users
:
this
.
state
.
rtc
.
users
.
add
(
uid
),
users
:
this
.
state
.
rtc
.
users
.
add
(
uid
),
},
// userStars
}
}
}
await
this
.
commit
(
this
.
state
);
await
this
.
commit
(
this
.
state
);
}
}
...
@@ -745,7 +786,6 @@ export class RoomStore {
...
@@ -745,7 +786,6 @@ export class RoomStore {
// sod.splice(emptyIndex, 1, stream.streamID)
// sod.splice(emptyIndex, 1, stream.streamID)
// }
// }
this
.
_userIn
(
stream
.
streamID
);
console
.
log
(
'
remoteStreams added
'
,
5
,
stream
.
streamID
,
this
.
state
.
users
)
console
.
log
(
'
remoteStreams added
'
,
5
,
stream
.
streamID
,
this
.
state
.
users
)
this
.
state
=
{
this
.
state
=
{
...
this
.
state
,
...
this
.
state
,
...
@@ -763,8 +803,6 @@ export class RoomStore {
...
@@ -763,8 +803,6 @@ export class RoomStore {
async
removeRemoteStream
(
uid
:
number
)
{
async
removeRemoteStream
(
uid
:
number
)
{
this
.
_userOut
(
uid
);
this
.
state
=
{
this
.
state
=
{
...
this
.
state
,
...
this
.
state
,
rtc
:
{
rtc
:
{
...
@@ -1084,6 +1122,11 @@ export class RoomStore {
...
@@ -1084,6 +1122,11 @@ export class RoomStore {
let
studentsOrder
:
number
[]
=
channelMeta
.
studentsOrder
||
[];
let
studentsOrder
:
number
[]
=
channelMeta
.
studentsOrder
||
[];
if
(
result
.
permitted
)
{
if
(
result
.
permitted
)
{
if
(
payload
.
role
==
'
teacher
'
)
{
if
(
payload
.
role
==
'
teacher
'
)
{
// const t = this.state.userUsage[payload.uid];
this
.
_userIn
(
payload
.
uid
,
'
teacher
'
)
// studentsOrder = channelMeta.studentsOrder || [];//this.state.studentsOrder;
// studentsOrder = channelMeta.studentsOrder || [];//this.state.studentsOrder;
if
(
studentsOrder
.
length
<
STAGE_NUM
)
{
if
(
studentsOrder
.
length
<
STAGE_NUM
)
{
Array
(
STAGE_NUM
-
studentsOrder
.
length
).
fill
(
0
).
forEach
((
zero
)
=>
{
Array
(
STAGE_NUM
-
studentsOrder
.
length
).
fill
(
0
).
forEach
((
zero
)
=>
{
...
@@ -1442,6 +1485,7 @@ export class RoomStore {
...
@@ -1442,6 +1485,7 @@ export class RoomStore {
}
}
async
rtmLeaveUser
(
memberId
:
string
)
{
async
rtmLeaveUser
(
memberId
:
string
)
{
console
.
log
(
'
学生退出
'
,
memberId
,
this
.
state
.
studentsOrder
);
console
.
log
(
'
学生退出
'
,
memberId
,
this
.
state
.
studentsOrder
);
this
.
_userOut
(
+
memberId
);
const
studentsOrder
=
[...
this
.
state
.
studentsOrder
];
const
studentsOrder
=
[...
this
.
state
.
studentsOrder
];
const
userIndex
=
studentsOrder
.
indexOf
(
+
memberId
);
const
userIndex
=
studentsOrder
.
indexOf
(
+
memberId
);
let
rtc
=
{
let
rtc
=
{
...
@@ -1497,10 +1541,12 @@ export class RoomStore {
...
@@ -1497,10 +1541,12 @@ export class RoomStore {
const
studentsOrder
=
[...
this
.
state
.
studentsOrder
];
const
studentsOrder
=
[...
this
.
state
.
studentsOrder
];
if
(
studentsOrder
.
length
!=
STAGE_NUM
)
{
if
(
studentsOrder
.
length
!=
STAGE_NUM
)
{
const
len
=
STAGE_NUM
-
studentsOrder
.
length
?
STAGE_NUM
-
studentsOrder
.
length
:
0
;
const
len
=
STAGE_NUM
-
studentsOrder
.
length
?
STAGE_NUM
-
studentsOrder
.
length
:
0
;
if
(
len
>
0
)
{
Array
(
len
).
forEach
(
_
=>
{
Array
(
len
).
forEach
(
_
=>
{
studentsOrder
.
push
(
0
)
studentsOrder
.
push
(
0
)
})
})
}
}
}
if
(
studentsOrder
.
includes
(
newUid
))
{
if
(
studentsOrder
.
includes
(
newUid
))
{
return
;
return
;
}
else
{
}
else
{
...
@@ -1524,144 +1570,9 @@ export class RoomStore {
...
@@ -1524,144 +1570,9 @@ export class RoomStore {
}
}
console
.
log
(
'
加入完登录学生后
'
,
this
.
state
.
studentsOrder
);
console
.
log
(
'
加入完登录学生后
'
,
this
.
state
.
studentsOrder
);
}
}
/*
async syncStageStudentByTeacherOrder(accounts: any[], channelStudentsOrder: number[]){
console.log('pass in channel studentsOrder', channelStudentsOrder);
console.log('teacher keep studentsOrder', this.state.studentsOrder);
const tSOrder = [...this.state.studentsOrder]
const accData: any = {};
const data: any = {};
accounts.forEach(acc => {
if (acc.role == 'student') {
console.log('account', acc.uid, acc)
accData[acc.uid] = acc
}
});
let shouldOut = channelStudentsOrder.filter(x => !tSOrder.includes(x) && x !== 0 && x !== -1);
let shouldIn = tSOrder.filter(x => !channelStudentsOrder.includes(x) && x !== 0 && x !== -1);
console.log('shouldOut', shouldOut);
shouldOut.forEach(o => {
const oi = tSOrder.indexOf(o);
if (oi > -1) {
tSOrder.splice(oi, 1, 0)
}
})
console.log('after shouldOut', tSOrder);
console.log('shouldIn', shouldIn);
shouldIn.forEach(o => {
const user = accData[o];
if (user) {
user.audio = 1;
user.video = 1;
data[o] = user;
}
if(!tSOrder.includes(o)) {
const ii = tSOrder.indexOf(0);
if (ii > -1) {
tSOrder.splice(ii, 1, o)
}
}
})
console.log('after shouldIn', tSOrder);
if (shouldIn.length || shouldOut.length) {
data['studentsOrder'] = [...tSOrder];
return data
}
return
//不在直播间的学生过滤出来
const exitUsers = tSOrder.filter(uid => {
return !accData[uid];
})
let localSync = false;
console.log('不在直播间的学生',exitUsers, tSOrder);
exitUsers.forEach(uid => {
const idx1 = channelStudentsOrder.indexOf(+uid);
if (idx1 > -1){
channelStudentsOrder.splice(idx1, 1 ,0)
}
const idx2 = tSOrder.indexOf(+uid);
if (idx2 > -1){
localSync = true;
tSOrder.splice(idx2, 1 ,0)
}
})
console.log('移除不在直播间的学生后', channelStudentsOrder, tSOrder);
if (tSOrder.length < STAGE_NUM) {
Array(STAGE_NUM - tSOrder.length).fill(0).forEach((zero) => {
tSOrder.push(zero)
})
}
let shouldDown = channelStudentsOrder.filter(x => !tSOrder.includes(x) && x !== 0);
let shouldUp = tSOrder.filter(x => !channelStudentsOrder.includes(x) && x !== 0);
console.log('shouldDown', shouldDown);
console.log('shouldUp', shouldUp);
shouldDown.forEach(d => {
const user = accData[d];
if (user) {
user.audio = 0;
user.video = 0;
data[d] = user;
}
})
shouldUp.forEach(u => {
const user = accData[u];
if (user) {
user.audio = 1;
user.video = 1;
data[u] = user;
}
})
// studentsOrder.forEach(uid => {
// if (uid != 0) {
// const user = accData[uid];
// if (!user.audio ) {
// this.rtmClient.sendPeerMessage(`${uid}`, {cmd: RoomMessage.unmuteAudio});
// }
// if (!user.video) {
// this.rtmClient.sendPeerMessage(`${uid}`, {cmd: RoomMessage.unmuteVideo});
// }
// }
// })
if (localSync){
console.log('同步教师sorders', tSOrder);
this.state = {
...this.state,
studentsOrder: tSOrder
}
await this.commit(this.state)
}
if (Object.keys(data).length) {
data['studentsOrder'] = [...tSOrder];
return data
}
}
*/
async
syncStageStudentByTeacherOrder2
(
newUsers
:
any
[],
oldUsers
:
any
[]){
async
syncStageStudentByTeacherOrder2
(
newUsers
:
any
[],
oldUsers
:
any
[]){
// debugger
console
.
log
(
'
new users
'
,
newUsers
);
console
.
log
(
'
new users
'
,
newUsers
);
console
.
log
(
'
current users
'
,
oldUsers
);
console
.
log
(
'
current users
'
,
oldUsers
);
console
.
log
(
'
teacher keep studentsOrder
'
,
this
.
state
.
studentsOrder
);
console
.
log
(
'
teacher keep studentsOrder
'
,
this
.
state
.
studentsOrder
);
...
@@ -1690,8 +1601,8 @@ export class RoomStore {
...
@@ -1690,8 +1601,8 @@ export class RoomStore {
let
shouldIn
=
newUids
.
filter
(
x
=>
!
oldUids
.
includes
(
x
)
&&
x
>
0
);
let
shouldIn
=
newUids
.
filter
(
x
=>
!
oldUids
.
includes
(
x
)
&&
x
>
0
);
console
.
log
(
'
shouldOut
'
,
shouldOut
);
console
.
log
(
'
shouldOut
'
,
shouldOut
);
console
.
log
(
'
shouldIn
'
,
shouldIn
);
console
.
log
(
'
shouldIn
'
,
shouldIn
);
shouldOut
.
forEach
(
o
=>
{
shouldOut
.
forEach
(
o
=>
{
this
.
_userOut
(
+
o
);
const
oi
=
tSOrder
.
indexOf
(
o
);
const
oi
=
tSOrder
.
indexOf
(
o
);
if
(
oi
>
-
1
)
{
if
(
oi
>
-
1
)
{
tSOrder
.
splice
(
oi
,
1
,
0
);
tSOrder
.
splice
(
oi
,
1
,
0
);
...
@@ -1699,6 +1610,7 @@ export class RoomStore {
...
@@ -1699,6 +1610,7 @@ export class RoomStore {
}
}
})
})
shouldIn
.
forEach
(
o
=>
{
shouldIn
.
forEach
(
o
=>
{
this
.
_userIn
(
+
o
);
if
(
!
tSOrder
.
includes
(
o
))
{
if
(
!
tSOrder
.
includes
(
o
))
{
const
ii
=
tSOrder
.
indexOf
(
0
);
const
ii
=
tSOrder
.
indexOf
(
0
);
if
(
ii
>
-
1
)
{
if
(
ii
>
-
1
)
{
...
@@ -1729,7 +1641,7 @@ export class RoomStore {
...
@@ -1729,7 +1641,7 @@ export class RoomStore {
}
}
async
updateRoomAttrs
({
teacher
,
accounts
,
room
,
studentsOrder
}:
{
teacher
:
any
,
accounts
:
any
,
room
:
any
,
studentsOrder
:
number
[]
})
{
async
updateRoomAttrs
({
teacher
,
accounts
,
room
,
studentsOrder
,
userStars
}:
{
teacher
:
any
,
accounts
:
any
,
room
:
any
,
studentsOrder
:
number
[],
userStars
:
any
})
{
console
.
log
(
"
[agora-board], room:
"
,
teacher
,
accounts
,
room
,
studentsOrder
);
console
.
log
(
"
[agora-board], room:
"
,
teacher
,
accounts
,
room
,
studentsOrder
);
const
currentRoomUsers
=
this
.
state
.
users
.
toArray
();
const
currentRoomUsers
=
this
.
state
.
users
.
toArray
();
const
exitUserIds
=
[];
const
exitUserIds
=
[];
...
@@ -1747,7 +1659,8 @@ export class RoomStore {
...
@@ -1747,7 +1659,8 @@ export class RoomStore {
linkId
:
it
.
link_uid
,
linkId
:
it
.
link_uid
,
lockBoard
:
it
.
lock_board
,
lockBoard
:
it
.
lock_board
,
grantBoard
:
it
.
grant_board
,
grantBoard
:
it
.
grant_board
,
lastStageTs
:
it
.
last_stage_ts
lastStageTs
:
it
.
last_stage_ts
,
stars
:
it
.
stars
});
});
},
OrderedMap
<
string
,
AgoraUser
>
());
},
OrderedMap
<
string
,
AgoraUser
>
());
if
(
this
.
state
.
studentsOrder
.
length
==
0
)
{
if
(
this
.
state
.
studentsOrder
.
length
==
0
)
{
...
@@ -1827,7 +1740,7 @@ export class RoomStore {
...
@@ -1827,7 +1740,7 @@ export class RoomStore {
const
newInfo
:
any
=
await
this
.
syncStageStudentByTeacherOrder2
(
users
.
toArray
(),
currentRoomUsers
);
const
newInfo
:
any
=
await
this
.
syncStageStudentByTeacherOrder2
(
users
.
toArray
(),
currentRoomUsers
);
console
.
log
(
'
newInfo
'
,
newInfo
)
console
.
log
(
'
newInfo
'
,
newInfo
)
// debugger
if
(
newInfo
)
{
if
(
newInfo
)
{
updateOrders
=
true
;
updateOrders
=
true
;
newStudentsOrder
=
newInfo
[
'
studentsOrder
'
];
newStudentsOrder
=
newInfo
[
'
studentsOrder
'
];
...
@@ -1869,6 +1782,7 @@ export class RoomStore {
...
@@ -1869,6 +1782,7 @@ export class RoomStore {
...
newClassState
...
newClassState
},
},
// studentsOrder: newStudentsOrder
// studentsOrder: newStudentsOrder
// userStars
}
}
console
.
log
(
'
update orders?
'
,
cos
,
uos
)
console
.
log
(
'
update orders?
'
,
cos
,
uos
)
if
(
cos
!=
uos
)
{
if
(
cos
!=
uos
)
{
...
@@ -1877,6 +1791,12 @@ export class RoomStore {
...
@@ -1877,6 +1791,12 @@ export class RoomStore {
studentsOrder
:
newStudentsOrder
studentsOrder
:
newStudentsOrder
}
}
}
}
// if (me.role !== 'teacher') {
// this.state = {
// ...this.state,
// userStars
// }
// }
await
this
.
commit
(
this
.
state
);
await
this
.
commit
(
this
.
state
);
}
}
...
@@ -1976,7 +1896,7 @@ export class RoomStore {
...
@@ -1976,7 +1896,7 @@ export class RoomStore {
// await this.rtcClient.exit();
// await this.rtcClient.exit();
}
catch
(
err
)
{
}
catch
(
err
)
{
// debugger
console
.
warn
(
'
exitAll
'
,
err
);
console
.
warn
(
'
exitAll
'
,
err
);
}
finally
{
}
finally
{
...
@@ -2052,17 +1972,17 @@ class WindowMonitor {
...
@@ -2052,17 +1972,17 @@ class WindowMonitor {
})
})
}
else
if
(
u
.
role
==
'
teacher
'
)
{
}
else
if
(
u
.
role
==
'
teacher
'
)
{
data
.
time
=
time
;
data
.
time
=
time
;
data
.
uid
=
u
.
ui
d
;
data
.
uid
=
+
this
.
roomStore
.
state
.
course
.
teacherI
d
;
}
}
})
})
data
.
students
=
students
;
data
.
students
=
students
;
console
.
log
(
data
);
console
.
log
(
data
);
// debugger
const
host
=
get
TeachServerHost
(
);
const
host
=
get
ApiServerHost
(
true
);
var
blob
=
new
Blob
([
JSON
.
stringify
(
data
)],
{
var
blob
=
new
Blob
([
JSON
.
stringify
(
data
)],
{
type
:
'
text/plain
'
type
:
'
text/plain
'
});
});
navigator
.
sendBeacon
(
`
${
host
}
/
live_management/
api/classroom/finish`
,
blob
);
navigator
.
sendBeacon
(
`
${
host
}
/api/classroom/finish`
,
blob
);
/*try{
/*try{
console.log(11111)
console.log(11111)
roomStore.exitAll()
roomStore.exitAll()
...
...
src/utils/agora-rtc-client.ts
View file @
9e379994
...
@@ -46,7 +46,7 @@ const clientEvents: string[] = [
...
@@ -46,7 +46,7 @@ const clientEvents: string[] = [
export
const
APP_ID
=
process
.
env
.
REACT_APP_AGORA_APP_ID
as
string
;
export
const
APP_ID
=
process
.
env
.
REACT_APP_AGORA_APP_ID
as
string
;
export
const
APP_TOKEN
=
process
.
env
.
REACT_APP_AGORA_APP_TOKEN
as
string
;
export
const
APP_TOKEN
=
process
.
env
.
REACT_APP_AGORA_APP_TOKEN
as
string
;
export
const
ENABLE_LOG
=
process
.
env
.
REACT_APP_AGORA_LOG
as
string
===
"
true
"
;
export
const
ENABLE_LOG
=
process
.
env
.
REACT_APP_AGORA_LOG
as
string
===
"
true
"
;
export
const
SHARE_ID
=
9999999999999
;
export
const
SHARE_ID
=
65535
;
const
BindEventMap
:
any
=
{};
const
BindEventMap
:
any
=
{};
class
AgoraRTCClient
{
class
AgoraRTCClient
{
...
@@ -232,7 +232,7 @@ class AgoraRTCClient {
...
@@ -232,7 +232,7 @@ class AgoraRTCClient {
this
.
_localStream
.
init
(
async
()
=>
{
this
.
_localStream
.
init
(
async
()
=>
{
this
.
streamID
=
data
.
streamID
;
this
.
streamID
=
data
.
streamID
;
// debugger
/*
/*
if (roomStore.state.me.role == 'teacher') {
if (roomStore.state.me.role == 'teacher') {
const result = await this._localStream.setBeautyEffectOptions(true, {
const result = await this._localStream.setBeautyEffectOptions(true, {
...
...
src/utils/agora-rtm-client.ts
View file @
9e379994
...
@@ -37,9 +37,10 @@ export type SessionProps = {
...
@@ -37,9 +37,10 @@ export type SessionProps = {
room
:
string
,
room
:
string
,
token
:
string
token
:
string
}
}
let
_channelAttrCallCounterTimer
:
any
=
null
;
let
_channelAttrCallCounter
=
0
;
export
default
class
AgoraRTMClient
{
export
default
class
AgoraRTMClient
{
private
_bus
:
EventEmitter
;
private
_bus
:
EventEmitter
;
public
_currentChannel
:
any
;
public
_currentChannel
:
any
;
public
_currentChannelName
:
string
|
any
;
public
_currentChannelName
:
string
|
any
;
...
@@ -50,6 +51,7 @@ export default class AgoraRTMClient {
...
@@ -50,6 +51,7 @@ export default class AgoraRTMClient {
private
_joined
:
boolean
=
false
;
private
_joined
:
boolean
=
false
;
constructor
()
{
constructor
()
{
this
.
_bus
=
new
EventEmitter
();
this
.
_bus
=
new
EventEmitter
();
this
.
_channels
=
{};
this
.
_channels
=
{};
this
.
_currentChannel
=
null
;
this
.
_currentChannel
=
null
;
...
@@ -58,6 +60,17 @@ export default class AgoraRTMClient {
...
@@ -58,6 +60,17 @@ export default class AgoraRTMClient {
this
.
_client
=
AgoraRTM
.
createInstance
(
APP_ID
,
{
enableLogUpload
:
false
,
logFilter
});
this
.
_client
=
AgoraRTM
.
createInstance
(
APP_ID
,
{
enableLogUpload
:
false
,
logFilter
});
}
}
async
addOrUpdateChannelAttributes
(
data
:
any
,
enableNotificationToChannelMembers
=
true
):
Promise
<
string
>
{
async
addOrUpdateChannelAttributes
(
data
:
any
,
enableNotificationToChannelMembers
=
true
):
Promise
<
string
>
{
if
(
!
_channelAttrCallCounterTimer
)
{
_channelAttrCallCounterTimer
=
setTimeout
(()
=>
{
console
.
log
(
'
current 10s call
'
,
_channelAttrCallCounter
);
_channelAttrCallCounter
=
0
;
clearTimeout
(
_channelAttrCallCounterTimer
)
_channelAttrCallCounterTimer
=
null
;
},
10
*
1000
);
}
_channelAttrCallCounter
++
;
const
channelAttributes
:
{[
key
:
string
]:
string
}
=
{};
const
channelAttributes
:
{[
key
:
string
]:
string
}
=
{};
for
(
const
k
of
Object
.
keys
(
data
))
{
for
(
const
k
of
Object
.
keys
(
data
))
{
channelAttributes
[
k
]
=
typeof
(
data
[
k
])
!=
'
string
'
?
JSON
.
stringify
(
data
[
k
])
:
data
[
k
];
channelAttributes
[
k
]
=
typeof
(
data
[
k
])
!=
'
string
'
?
JSON
.
stringify
(
data
[
k
])
:
data
[
k
];
...
...
src/utils/helper.ts
View file @
9e379994
...
@@ -266,6 +266,15 @@ export function resolveChannelAttrs(json: object) {
...
@@ -266,6 +266,15 @@ export function resolveChannelAttrs(json: object) {
}
}
delete
(
json
as
any
).
studentsOrder
;
delete
(
json
as
any
).
studentsOrder
;
// let userStars: any = {};
// if ((json as any).userStars && (json as any).userStars.value) {
// userStars = JSON.parse((json as any).userStars.value) || [];
// Object.keys(userStars).forEach(k => {
// userStars[k] = +userStars[k];
// })
// }
// delete (json as any).userStars;
const
teacherJson
=
jsonParse
(
_
.
get
(
json
,
'
teacher.value
'
));
const
teacherJson
=
jsonParse
(
_
.
get
(
json
,
'
teacher.value
'
));
const
room
:
any
=
{
const
room
:
any
=
{
...
@@ -343,7 +352,8 @@ export function resolveChannelAttrs(json: object) {
...
@@ -343,7 +352,8 @@ export function resolveChannelAttrs(json: object) {
shared_uid
:
student
.
shared_uid
,
shared_uid
:
student
.
shared_uid
,
whiteboard_uid
:
student
.
whiteboard_uid
,
whiteboard_uid
:
student
.
whiteboard_uid
,
grant_board
:
+
student
.
grant_board
,
grant_board
:
+
student
.
grant_board
,
last_stage_ts
:
+
student
.
last_stage_ts
last_stage_ts
:
+
student
.
last_stage_ts
,
stars
:
+
student
.
stars
});
});
}
}
// console.log('resolveChannelAttrs 3', accounts);
// console.log('resolveChannelAttrs 3', accounts);
...
@@ -354,7 +364,8 @@ export function resolveChannelAttrs(json: object) {
...
@@ -354,7 +364,8 @@ export function resolveChannelAttrs(json: object) {
students
:
students
,
students
:
students
,
accounts
,
accounts
,
room
,
room
,
studentsOrder
studentsOrder
,
// userStars
};
};
}
}
...
...
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