功能基本完成

This commit is contained in:
2020-11-27 11:37:44 +08:00
parent 9f03cc4e30
commit 6ebea07f93
4 changed files with 79 additions and 8 deletions

View File

@@ -1,9 +1,31 @@
let options = {
SDKAppID: 1400435767 // 接入时需要将0替换为您的即时通信 IM 应用的 SDKAppID
};
let tim = TIM.create(options);
window.tim = TIM.create(options);
tim.setLogLevel(0);
function getname(id){
return new Promise((res, rej)=>{
let promise = tim.getGroupMemberProfile({
groupID:window.roomid,
userIDList:[id],
memberCustomFieldFilter:["nick"]
})
promise.then(function(imResponse) {
console.log(imResponse.data.memberList); // 群成员列表
res(imResponse.data.memberList[0].nick)
}).catch(function(imError) {
console.warn('getGroupMemberProfile error:', imError);
setTimeout(()=>{
getname(id).then((e)=>{
res(e)
})
},1000)
});
})
}
function formatDateTime (inputTime) {
inputTime = inputTime * 1000
var date = new Date(inputTime);
var y = date.getFullYear();
var m = date.getMonth() + 1;
@@ -28,6 +50,9 @@ function formatDateTime (inputTime) {
if(!event.data[i].payload.text){
break;
}
if(event.data[i].payload.text.includes("beelinkMuteUserId") || event.data[i].payload.text.includes("inkTurnOffTheCameraUserId")){
break;
}
const list = $("#liaotianliebiao")
const html = ` <div>
<p>${formatDateTime(event.data[i].time)}</p>
@@ -204,4 +229,42 @@ function formatDateTime (inputTime) {
});
function sendjinyan(id,type){
const m = tim.createTextMessage({
to: window.roomid,
conversationType: TIM.TYPES.CONV_GROUP,
payload: {
text: `beelinkMuteUserId:${id},isClose:${type}`
}
})
const promise = tim.sendMessage(m);
promise.then(function(imResponse) {
// 发送成功
console.log(imResponse);
}).catch(function(imError) {
// 发送失败
console.warn('sendMessage error:', imError);
});
}
function sendsx(id,type){
const m = tim.createTextMessage({
to: window.roomid,
conversationType: TIM.TYPES.CONV_GROUP,
payload: {
text: `beelinkTurnOffTheCameraUserId:${id},isClose:${type}`
}
})
const promise = tim.sendMessage(m);
promise.then(function(imResponse) {
// 发送成功
console.log(imResponse);
}).catch(function(imError) {
// 发送失败
console.warn('sendMessage error:', imError);
});
}
// 开始登录