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
0c1868b2
Commit
0c1868b2
authored
Feb 19, 2020
by
liujiaxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
输入修改,老师全部静音的时候学生无权开启
parent
e9179cd5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
36 additions
and
24 deletions
+36
-24
form-input.tsx
src/components/form-input.tsx
+2
-2
nav.tsx
src/components/nav.tsx
+1
-1
room-tools-bar.tsx
src/components/room-tools-bar.tsx
+13
-8
root-container.tsx
src/containers/root-container.tsx
+1
-1
use-streams.ts
src/hooks/use-streams.ts
+11
-3
home.tsx
src/pages/home.tsx
+7
-8
room.ts
src/stores/room.ts
+1
-1
No files found.
src/components/form-input.tsx
View file @
0c1868b2
...
@@ -17,7 +17,7 @@ const useStyles = makeStyles ((theme: Theme) => ({
...
@@ -17,7 +17,7 @@ const useStyles = makeStyles ((theme: Theme) => ({
}
}
}));
}));
const
ALPHABETICAL
=
/^
[
a-zA-Z0-9
]
*/
const
ALPHABETICAL
=
/^
[
a-zA-Z0-9
_
]
*/
export
default
function
(
props
:
any
)
{
export
default
function
(
props
:
any
)
{
const
classes
=
useStyles
();
const
classes
=
useStyles
();
...
@@ -35,4 +35,4 @@ export default function (props: any) {
...
@@ -35,4 +35,4 @@ export default function (props: any) {
{
props
.
requiredText
?
<
Typography
className=
{
classes
.
required
}
>
{
props
.
requiredText
}
</
Typography
>
:
null
}
{
props
.
requiredText
?
<
Typography
className=
{
classes
.
required
}
>
{
props
.
requiredText
}
</
Typography
>
:
null
}
</>
</>
);
);
}
}
\ No newline at end of file
src/components/nav.tsx
View file @
0c1868b2
...
@@ -70,8 +70,8 @@ export function Nav ({
...
@@ -70,8 +70,8 @@ export function Nav ({
<
span
className=
"time"
>
{
moment
.
utc
(
time
).
format
(
'
HH:mm:ss
'
)
}
</
span
>
<
span
className=
"time"
>
{
moment
.
utc
(
time
).
format
(
'
HH:mm:ss
'
)
}
</
span
>
</
div
>
</
div
>
<
span
className=
"menu-split"
/>
<
span
className=
"menu-split"
/>
<
RoomToolsBar
onClick=
{
handleClick
}
/>
{
roomStore
.
state
.
me
.
role
==
'
teacher
'
?
<
RoomToolsBar
onClick=
{
handleClick
}
/>
:
null
}
{
/*<div className={platform === 'web' ? "btn-group" : 'electron-btn-group' }>
{
/*<div className={platform === 'web' ? "btn-group" : 'electron-btn-group' }>
{platform === 'web' ? <Icon className="icon-setting" onClick={(evt: any) => {
{platform === 'web' ? <Icon className="icon-setting" onClick={(evt: any) => {
handleClick("setting");
handleClick("setting");
...
...
src/components/room-tools-bar.tsx
View file @
0c1868b2
...
@@ -59,15 +59,20 @@ export default function RoomToolsBar (props: any) {
...
@@ -59,15 +59,20 @@ export default function RoomToolsBar (props: any) {
<>
<>
<
div
className=
{
'
room-tool-box
'
}
>
<
div
className=
{
'
room-tool-box
'
}
>
{
roomStore
.
state
.
me
.
role
==
'
teacher
'
?
<>
{
muteAudio
?
<
div
className=
"tool-btn"
onClick=
{
audioOn
}
><
VoiceOverOffIcon
/></
div
>
:
<
div
onClick=
{
audioOff
}
className=
"tool-btn"
><
RecordVoiceOverIcon
/></
div
>
}
{
currentTool
==
TOOL_TYPE
.
WHITEBOARD
?
<
div
className=
"tool-btn"
onClick=
{
changeTool
}
><
ImportContacts
/></
div
>
:
<
div
onClick=
{
changeTool
}
className=
"tool-btn"
><
Category
/></
div
>
}
</>:
null
}
{
muteAudio
?
<
div
className=
"tool-btn"
onClick=
{
audioOn
}
><
VoiceOverOffIcon
/></
div
>
:
<
div
onClick=
{
audioOff
}
className=
"tool-btn"
><
RecordVoiceOverIcon
/></
div
>
}
{
currentTool
==
TOOL_TYPE
.
WHITEBOARD
?
<
div
className=
"tool-btn"
onClick=
{
changeTool
}
><
ImportContacts
/></
div
>
:
<
div
onClick=
{
changeTool
}
className=
"tool-btn"
><
Category
/></
div
>
}
<
div
className=
"tool-btn"
onClick=
{
(
evt
:
any
)
=>
{
<
div
className=
"tool-btn"
onClick=
{
(
evt
:
any
)
=>
{
props
.
onClick
(
"
setting
"
);
props
.
onClick
(
"
setting
"
);
}
}
><
SettingsApplicationsIcon
/></
div
>
}
}
><
SettingsApplicationsIcon
/></
div
>
...
...
src/containers/root-container.tsx
View file @
0c1868b2
...
@@ -80,7 +80,7 @@ export const RootProvider: React.FC<any> = ({children}) => {
...
@@ -80,7 +80,7 @@ export const RootProvider: React.FC<any> = ({children}) => {
if
(
!
roomStore
.
state
.
rtm
.
joined
)
return
;
if
(
!
roomStore
.
state
.
rtm
.
joined
)
return
;
const
rtmClient
=
roomStore
.
rtmClient
;
const
rtmClient
=
roomStore
.
rtmClient
;
rtmClient
.
on
(
'
ConnectionStateChanged
'
,
({
newState
,
reason
}:
{
newState
:
string
,
reason
:
string
})
=>
{
rtmClient
.
on
(
'
ConnectionStateChanged
'
,
({
newState
,
reason
}:
{
newState
:
string
,
reason
:
string
})
=>
{
console
.
log
(
`newState:
${
newState
}
reason:
${
reason
}
`
);
console
.
log
(
`
[ConnectionStateChanged]
newState:
${
newState
}
reason:
${
reason
}
`
);
if
(
reason
===
'
LOGIN_FAILURE
'
)
{
if
(
reason
===
'
LOGIN_FAILURE
'
)
{
globalStore
.
showToast
({
globalStore
.
showToast
({
type
:
'
rtmClient
'
,
type
:
'
rtmClient
'
,
...
...
src/hooks/use-streams.ts
View file @
0c1868b2
...
@@ -149,6 +149,7 @@ export default function useStream () {
...
@@ -149,6 +149,7 @@ export default function useStream () {
// return studentsOrder.indexOf(+a) - studentsOrder.indexOf(+b);
// return studentsOrder.indexOf(+a) - studentsOrder.indexOf(+b);
// });
// });
const
sids
:
any
=
[];
const
sids
:
any
=
[];
let
orderIdx
=
0
;
for
(
const
ouid
of
studentsOrder
)
{
for
(
const
ouid
of
studentsOrder
)
{
if
(
ouid
==
0
)
{
if
(
ouid
==
0
)
{
sids
.
push
(
0
)
sids
.
push
(
0
)
...
@@ -159,15 +160,19 @@ export default function useStream () {
...
@@ -159,15 +160,19 @@ export default function useStream () {
sids
.
push
(
uid
);
sids
.
push
(
uid
);
}
else
{
}
else
{
// find in channel
// find in channel
const
usr
=
userAttrs
.
get
(
`
${
uid
}
`
)
const
usr
=
userAttrs
.
get
(
`
${
ouid
}
`
)
console
.
log
(
'
channel has
'
,
ouid
,
usr
)
if
(
usr
)
{
if
(
usr
)
{
sids
.
push
(
+
usr
.
uid
);
sids
.
push
(
-
1
/*+usr.uid*/
);
}
else
{
}
else
{
sids
.
push
(
-
1
);
// sids.push(-1);
sids
[
orderIdx
]
=
0
;
studentsOrder
[
orderIdx
]
=
0
}
}
}
}
}
}
orderIdx
++
}
}
console
.
log
(
222222
,
userAttrs
.
toArray
());
console
.
log
(
222222
,
userAttrs
.
toArray
());
console
.
log
(
333333
,
sids
);
console
.
log
(
333333
,
sids
);
...
@@ -432,6 +437,9 @@ export default function useStream () {
...
@@ -432,6 +437,9 @@ export default function useStream () {
if
(
audio
)
{
if
(
audio
)
{
await
roomStore
.
mute
(
targetUid
,
'
audio
'
);
await
roomStore
.
mute
(
targetUid
,
'
audio
'
);
}
else
{
}
else
{
if
(
me
.
role
==
'
student
'
&&
roomStore
.
state
.
course
.
muteAudio
)
{
return
}
await
roomStore
.
unmute
(
targetUid
,
'
audio
'
);
await
roomStore
.
unmute
(
targetUid
,
'
audio
'
);
}
}
return
;
return
;
...
...
src/pages/home.tsx
View file @
0c1868b2
...
@@ -82,7 +82,7 @@ function HomePage() {
...
@@ -82,7 +82,7 @@ function HomePage() {
///////////////////////////////
///////////////////////////////
if
(
window
.
location
.
origin
.
includes
(
'
://127.0.0.1
'
)
||
window
.
location
.
origin
.
includes
(
'
://localhost
'
))
{
session
.
roomName
=
"
test_01__123
"
;
// userInfo["class_id"];
session
.
roomName
=
"
test_01__123
"
;
// userInfo["class_id"];
// session.yourName = userInfo["nick_name"];
// session.yourName = userInfo["nick_name"];
session
.
role
=
`
${
session
.
yourName
}
`
===
"
1
"
?
"
teacher
"
:
"
student
"
;
session
.
role
=
`
${
session
.
yourName
}
`
===
"
1
"
?
"
teacher
"
:
"
student
"
;
...
@@ -123,15 +123,12 @@ function HomePage() {
...
@@ -123,15 +123,12 @@ function HomePage() {
})
})
}
}
console
.
warn
(
err
);
console
.
warn
(
err
);
})
}).
finally
(()
=>
{
.
finally
(()
=>
{
ref
.
current
=
false
;
ref
.
current
=
false
;
globalStore
.
stopLoading
();
globalStore
.
stopLoading
();
})
})
}
else
{
///////////////////////////////
/*
endPoint
.
login
({
username
:
session
.
yourName
,
password
:
session
.
yourPass
}).
then
((
userInfo
:
any
)
=>
{
endPoint
.
login
({
username
:
session
.
yourName
,
password
:
session
.
yourPass
}).
then
((
userInfo
:
any
)
=>
{
console
.
log
(
userInfo
);
console
.
log
(
userInfo
);
session
.
roomName
=
userInfo
[
"
class_id
"
];
// userInfo["class_id"];
session
.
roomName
=
userInfo
[
"
class_id
"
];
// userInfo["class_id"];
...
@@ -142,7 +139,7 @@ function HomePage() {
...
@@ -142,7 +139,7 @@ function HomePage() {
if
(
!
roomTypes
[
session
.
roomType
])
return
;
if
(
!
roomTypes
[
session
.
roomType
])
return
;
const
path
=
roomTypes
[
session
.
roomType
].
path
const
path
=
roomTypes
[
session
.
roomType
].
path
const
payload
=
{
const
payload
=
{
uid: userInfo["classRole"]==="tea"?"100":`${session.yourName.substr(-2)}`, // `${userInfo["id"]}`, // genUid(),
uid
:
`
${
userInfo
[
"
id
"
]}
`
,
//
userInfo["classRole"]==="tea"?"100":`${session.yourName.substr(-2)}`, // `${userInfo["id"]}`, // genUid(),
rid
:
`
${
session
.
roomName
}
`
,
// `${session.roomType}${MD5(session.roomName)}`,
rid
:
`
${
session
.
roomName
}
`
,
// `${session.roomType}${MD5(session.roomName)}`,
role
:
session
.
role
,
role
:
session
.
role
,
roomName
:
session
.
roomName
,
roomName
:
session
.
roomName
,
...
@@ -186,7 +183,9 @@ function HomePage() {
...
@@ -186,7 +183,9 @@ function HomePage() {
message
:
err
message
:
err
})
})
});
});
*/
}
}
}
...
...
src/stores/room.ts
View file @
0c1868b2
...
@@ -547,7 +547,7 @@ export class RoomStore {
...
@@ -547,7 +547,7 @@ export class RoomStore {
}
}
addRemoteStream
(
stream
:
AgoraStream
)
{
addRemoteStream
(
stream
:
AgoraStream
)
{
console
.
log
(
'
remoteStreams added
'
,
5
,
stream
.
streamID
)
console
.
log
(
'
remoteStreams added
'
,
5
,
stream
.
streamID
,
this
.
state
.
users
)
this
.
state
=
{
this
.
state
=
{
...
this
.
state
,
...
this
.
state
,
rtc
:
{
rtc
:
{
...
...
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