|
@@ -76,10 +76,6 @@ export function unSubscribeStream(stream) {
|
|
|
export function initListener(vue) {
|
|
|
rtc.on('login_success', data => {
|
|
|
console.log('登录成功', data);
|
|
|
- Message({
|
|
|
- message: '登录成功',
|
|
|
- type: 'success'
|
|
|
- });
|
|
|
vue.roomData = data;
|
|
|
});
|
|
|
|
|
@@ -94,6 +90,10 @@ export function initListener(vue) {
|
|
|
// 教师 必须在加入房间成功的事件回调里创建本地流
|
|
|
rtc.on('conference_join', () => {
|
|
|
console.log('加入房间成功');
|
|
|
+ Message({
|
|
|
+ message: '加入房间成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
createLocalStream();
|
|
|
});
|
|
|
|
|
@@ -227,13 +227,14 @@ export function initListener(vue) {
|
|
|
*/
|
|
|
rtc.on('chat_message', data => {
|
|
|
let dat = JSON.parse(data);
|
|
|
- console.log(dat);
|
|
|
// 敏感词过滤:如果发送的聊天消息被系统判定包含敏感词,则只有发送者能收到本条消息,房间内其他人都不会收到这条聊天消息。
|
|
|
// 如果返回消息中有 isFilterChat 字段(消息不包含敏感词返回数据中无isFilterChat字段),且isFilterChat的值为1,则说明该消息包含敏感字,除发送者外其他人不会收到这条消息。
|
|
|
if (dat.isFilterChat && dat.isFilterChat === 1) {
|
|
|
return;
|
|
|
}
|
|
|
- vue.chatList.push(dat);
|
|
|
+ if (vue.chatList.every(item => item.chatId !== dat.chatId)) {
|
|
|
+ vue.chatList.push(dat);
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
rtc.on('allowChatChange', function (data) {
|
|
@@ -252,10 +253,22 @@ export function downloadWebSDK(vue) {
|
|
|
'https://class.csslcloud.net/static/dist/js/classMode.js',
|
|
|
'https://class.csslcloud.net/static/dist/js/classUpdateChat.js'
|
|
|
];
|
|
|
- for (let i = 0; i < scriptArray.length; i++) {
|
|
|
- createScript(scriptArray[i]).onload = () => {
|
|
|
- vue.loadedNumber += 1;
|
|
|
- };
|
|
|
- }
|
|
|
+ scriptArray.forEach(
|
|
|
+ item =>
|
|
|
+ (createScript(item).onload = () => {
|
|
|
+ vue.loadedNumber += 1;
|
|
|
+ })
|
|
|
+ );
|
|
|
};
|
|
|
}
|
|
|
+
|
|
|
+export function removeWebSDK() {
|
|
|
+ let scriptArray = [
|
|
|
+ 'https://class.csslcloud.net/sdk/websdk/hdRtc-6.7.2.js',
|
|
|
+ 'https://class.csslcloud.net/static/dist/js/classMode.js',
|
|
|
+ 'https://class.csslcloud.net/static/dist/js/classUpdateChat.js'
|
|
|
+ ];
|
|
|
+ scriptArray.forEach(item => {
|
|
|
+ document.querySelector(`script[src='${item}']`).remove();
|
|
|
+ });
|
|
|
+}
|