/// <summary> /// 获取获取对应群员信息 /// </summary> /// <param name="GroupMembers"></param> /// <returns></returns> public static AntSdkGroupMember getGroupMembersUser(List <AntSdkGroupMember> GroupMembers, SDK.AntSdk.AntModels.AntSdkChatMsg.ChatBase msg) { string pathImages = ""; //获取接收者头像 var listUser = GlobalVariable.ContactHeadImage.UserHeadImages.SingleOrDefault(m => m.UserID == msg.sendUserId); //var users = GroupMembers != null && GroupMembers.Count > 0 ? GroupMembers.SingleOrDefault(m => m.userId == msg.sendUserId) : null; var users = new AntSdkGroupMember(); //if (users == null) //{ AntSdkContact_User cuss = AntSdkService.AntSdkListContactsEntity.users.SingleOrDefault(m => m.userId == msg.sendUserId); if (cuss == null) { users = new AntSdkGroupMember(); pathImages = "file:///" + (AppDomain.CurrentDomain.BaseDirectory + "Images/离职人员.png").Replace(@"\", @"/").Replace(" ", "%20"); users.picture = pathImages; users.userId = msg.sendUserId; users.userName = "******"; } else { users = new AntSdkGroupMember { userId = cuss.userId, userName = cuss.status == 0 && cuss.state == 0 ? cuss.userName + "(停用)":cuss.userName, userNum = cuss.userNum, picture = cuss.picture, position = cuss.position }; } //} return(users); }
/// <summary> /// 获取群聊个人头像 /// </summary> /// <param name="GroupMembers"></param> /// <param name="msg"></param> /// <returns></returns> public static string getPathImage(List <AntSdkGroupMember> GroupMembers, SDK.AntSdk.AntModels.AntSdkChatMsg.ChatBase msg) { //获取接收者头像 string pathImages = ""; //获取接收者头像 var listUser = GlobalVariable.ContactHeadImage.UserHeadImages.SingleOrDefault(m => m.UserID == msg.sendUserId); AntSdkGroupMember users = GroupMembers != null && GroupMembers.Count > 0 ? GroupMembers.SingleOrDefault(m => m.userId == msg.sendUserId) : null; if (listUser == null) { if (users == null) { AntSdkContact_User cuss = AntSdkService.AntSdkListContactsEntity.users.SingleOrDefault(m => m.userId == msg.sendUserId); if (cuss == null) { //users = new AntSdkGroupMember(); pathImages = "file:///" + (AppDomain.CurrentDomain.BaseDirectory + "Images/离职人员.png").Replace(@"\", @"/").Replace(" ", "%20"); //users.picture = pathImages; //users.userName = "******"; } else { if (string.IsNullOrEmpty(cuss.picture + "")) { pathImages = "file:///" + (AppDomain.CurrentDomain.BaseDirectory + "Images/默认头像.png").Replace(@"\", @"/").Replace(" ", "%20"); } else { pathImages = cuss.picture; } } } else { if (string.IsNullOrEmpty(users.picture)) { pathImages = "file:///" + (AppDomain.CurrentDomain.BaseDirectory + "Images/默认头像.png").Replace(@"\", @"/").Replace(" ", "%20"); } else { pathImages = users.picture; } } } else { if (string.IsNullOrEmpty(listUser.Url)) { pathImages = "file:///" + (AppDomain.CurrentDomain.BaseDirectory + "Images/默认头像.png").Replace(@"\", @"/").Replace(" ", "%20"); } else { pathImages = "file:///" + listUser.Url.Replace(@"\", @"/").Replace(" ", "%20"); } } return(pathImages); }
public GroupMemberListViewModel(List <AntSdkGroupMember> GroupMembers, AntSdkGroupInfo groupInfo) { this.GroupInfo = groupInfo; _groupMembers = GroupMembers; AsyncHandler.AsyncCall(System.Windows.Application.Current.Dispatcher, () => { AntSdkGroupMember groupOwner = GroupMembers.FirstOrDefault(c => c.roleLevel == (int)GlobalVariable.GroupRoleLevel.GroupOwner); GroupOwnerId = groupOwner == null ? "" : groupOwner.userId; LogHelper.WriteFatal(groupInfo.groupId + "-------" + groupInfo.groupName + "群组的群主: " + groupOwner?.userNum + groupOwner?.userName); groupAdminUser = GroupMembers.FirstOrDefault(c => c.roleLevel == (int)GlobalVariable.GroupRoleLevel.Admin && c.userId == AntSdkService.AntSdkLoginOutput.userId); adminCount = GroupMembers.Count(m => m.roleLevel == (int)GlobalVariable.GroupRoleLevel.Admin); var orderByDesGroupMembers = GroupMembers.OrderByDescending(m => m.roleLevel).ToList(); foreach (AntSdkGroupMember user in orderByDesGroupMembers) { GroupMemberViewModel groupMemberViewModel = new GroupMemberViewModel(user, GroupOwnerId, GroupInfo.groupId, this, SearchGroupName, adminCount); if (user.roleLevel == (int)GlobalVariable.GroupRoleLevel.GroupOwner) { GroupMemberControlList.Insert(0, groupMemberViewModel); } else if (user.roleLevel == (int)GlobalVariable.GroupRoleLevel.Admin) { GroupMemberControlList.Insert(GroupMemberControlList.Count > 0 ? 1 : 0, groupMemberViewModel); } else { var userinfo = AntSdkService.AntSdkListContactsEntity.users.FirstOrDefault(c => c.userId == user.userId); groupMemberViewModel.KickoutGroupVisibility = groupAdminUser != null || GroupOwnerId == AntSdkService.AntSdkLoginOutput.userId ? Visibility.Visible : Visibility.Collapsed; if (userinfo != null && userinfo.state != (int)GlobalVariable.OnLineStatus.OffLine) { var index = GroupMemberControlList.Count( m => !m.IsGroupAdminImage && !m.IsOfflineState && m.AdminImageVisibility != Visibility.Visible); GroupMemberControlList.Insert(index + adminCount + 1, groupMemberViewModel); } else { GroupMemberControlList.Add(groupMemberViewModel); } } } }); SearchGroupNameCommand = new DelegateCommand(GroupNameSearch); GoMemberSessionCommand = new DelegateCommand(goMemberSession); GroupMemberViewModel.KickoutGroupEvent += KickOutGroup; GroupMemberViewModel.ChangeManagerCompletedEvent += GroupMemberViewModel_ChangeManagerCompletedEvent; MemberCountPrompt = string.Format("群成员({0}人)", GroupMembers.Count); }
public void UpdateGroupMembers(List <AntSdkGroupMember> GroupMembers) { AsyncHandler.AsyncCall(System.Windows.Application.Current.Dispatcher, () => { GroupMemberControlList.Clear(); AntSdkGroupMember admin = GroupMembers.FirstOrDefault(c => c.roleLevel == (int)GlobalVariable.GroupRoleLevel.GroupOwner); _groupMembers = GroupMembers; groupAdminUser = GroupMembers.FirstOrDefault( c => c.roleLevel == (int)GlobalVariable.GroupRoleLevel.Admin && c.userId == AntSdkService.AntSdkLoginOutput.userId); GroupOwnerId = (admin == null ? "" : admin.userId); LogHelper.WriteFatal(this.GroupInfo.groupId + "-------" + this.GroupInfo.groupName + "群组的群主: " + admin?.userNum + admin?.userName); adminCount = GroupMembers.Count(m => m.roleLevel == (int)GlobalVariable.GroupRoleLevel.Admin); var orderByDesGroupMembers = GroupMembers.OrderByDescending(m => m.roleLevel).ToList(); foreach (AntSdkGroupMember user in orderByDesGroupMembers) { GroupMemberViewModel groupMemberViewModel = new GroupMemberViewModel(user, GroupOwnerId, GroupInfo.groupId, this, SearchGroupName, adminCount); //groupMemberViewModel.AdminCount = adminCount; if (user.userId == GroupOwnerId) { GroupMemberControlList.Insert(0, groupMemberViewModel); } else if (user.roleLevel == (int)GlobalVariable.GroupRoleLevel.Admin) { GroupMemberControlList.Insert(GroupMemberControlList.Count > 0 ? 1 : 0, groupMemberViewModel); } else { var userinfo = AntSdkService.AntSdkListContactsEntity.users.FirstOrDefault(c => c.userId == user.userId); groupMemberViewModel.KickoutGroupVisibility = groupAdminUser != null || GroupOwnerId == AntSdkService.AntSdkLoginOutput.userId ? Visibility.Visible : Visibility.Collapsed; if (userinfo != null && userinfo.state != (int)GlobalVariable.OnLineStatus.OffLine) { var index = GroupMemberControlList.Count( m => !m.IsGroupAdminImage && !m.IsOfflineState && m.AdminImageVisibility != Visibility.Visible); GroupMemberControlList.Insert(index + adminCount + 1, groupMemberViewModel); } else { GroupMemberControlList.Add(groupMemberViewModel); } } } MemberCountPrompt = string.Format("群成员({0}人)", GroupMembers.Count); }); }
private void KickoutGroup(string groupId, string userId, string picture) { if (this.GroupInfo.groupId != groupId) { return; } AntSdkGroupMember user = Members.FirstOrDefault(c => c.userId == userId); if (user != null) { Members.Remove(user); } this.GroupName = string.Format("{0}", GroupInfo.groupName); GroupMemberCount = string.Format("({0}人)", Members == null ? 0 : Members.Count()); this.GroupPicture = picture; }
public void AddNewMember(string picture, List <AntSdkContact_User> newGroupMemberList) { foreach (AntSdkContact_User user in newGroupMemberList) { AntSdkGroupMember member = new AntSdkGroupMember(); member.picture = user.picture; member.position = user.position; member.roleLevel = (int)GlobalVariable.GroupRoleLevel.Ordinary; member.userId = user.userId; member.userName = user.userName; if (!Members.Exists(m => m.userId == user.userId)) { Members.Add(member); } } this.GroupName = string.Format("{0}", GroupInfo.groupName); GroupMemberCount = string.Format("({0}人)", Members == null ? 0 : Members.Count()); this.GroupPicture = picture; }
public void AddNewMember(List <AntSdkContact_User> newGroupMemberList) { AsyncHandler.AsyncCall(System.Windows.Application.Current.Dispatcher, () => { foreach (AntSdkContact_User user in newGroupMemberList) { AntSdkGroupMember member = new AntSdkGroupMember(); member.picture = user.picture; member.position = user.position; member.roleLevel = (int)GlobalVariable.GroupRoleLevel.Ordinary; member.userId = user.userId; member.userName = user.userName; GroupMemberViewModel groupMemberViewModel = new GroupMemberViewModel(member, GroupOwnerId, GroupInfo.groupId, this, SearchGroupName, adminCount); //groupMemberViewModel.AdminCount = adminCount; var userinfo = AntSdkService.AntSdkListContactsEntity.users.FirstOrDefault(c => c.userId == user.userId); groupMemberViewModel.KickoutGroupVisibility = groupAdminUser != null || GroupOwnerId == AntSdkService.AntSdkLoginOutput.userId ? Visibility.Visible : Visibility.Collapsed; if (userinfo != null && userinfo.state != (int)GlobalVariable.OnLineStatus.OffLine) { var index = GroupMemberControlList.Count( m => !m.IsGroupAdminImage && !m.IsOfflineState && m.AdminImageVisibility != Visibility.Visible); GroupMemberControlList.Insert(index + adminCount + 1, groupMemberViewModel); } else { GroupMemberControlList.Add(groupMemberViewModel); } //groupMemberViewModel.KickoutGroupVisibility = groupAdminUser != null ? Visibility.Visible : Visibility.Collapsed; //GroupMemberControlList.Add(groupMemberViewModel); } MemberCountPrompt = string.Format("群成员({0}人)", GroupMemberControlList.Count); }); }
/// <summary> /// 群组详情 /// </summary> private void GroupDetail() { if (_groupInfoViewModel.GroupClassify == 1) { IsAdministrator = true; ManagerName = AntSdkService.AntSdkCurrentUserInfo.userName; } else { //if(_groupInfoViewModel.Members) AntSdkGroupMember adminUser = _groupInfoViewModel.Members.FirstOrDefault(c => c.roleLevel == (int)GlobalVariable.GroupRoleLevel.GroupOwner); IsAdministrator = false; if (adminUser != null) { ManagerName = adminUser.userName; } } InfoName = _groupInfoViewModel.GroupName + _groupInfoViewModel.GroupMemberCount; RemindMsg = _groupInfoViewModel.MessageNoticeIsChecked; NoRemindMsg = _groupInfoViewModel.MessageHideIsChecked; LoadLogoBitmapImage(_groupInfoViewModel.GroupPicture); }
public static void LeftGroupScrollVote(ChromiumWebBrowser cef, ChatBase msg, List <AntSdkGroupMember> GroupMembers) { AntSdkGroupMember user = PictureAndTextMixMethod.getGroupMembersUser(GroupMembers, msg); //显示内容解析 MsChatMsgCreateVote_content receive = JsonConvert.DeserializeObject <MsChatMsgCreateVote_content>(msg.sourceContent); StringBuilder sbLeft = new StringBuilder(); sbLeft.AppendLine("function myFunction()"); sbLeft.AppendLine("{ var nodeFirst=document.createElement('div');"); sbLeft.AppendLine("nodeFirst.className='leftd';"); sbLeft.AppendLine("nodeFirst.id='" + msg.messageId + "';"); //头像显示层 sbLeft.AppendLine("var second=document.createElement('div');"); sbLeft.AppendLine("second.className='leftimg';"); sbLeft.AppendLine("var img = document.createElement('img');"); sbLeft.AppendLine("img.src='" + PictureAndTextMixMethod.getPathImage(GroupMembers, msg) + "';"); sbLeft.AppendLine("img.className='divcss5Left';"); sbLeft.AppendLine("img.id='" + user.userId + "';"); sbLeft.AppendLine("img.addEventListener('click',clickImgCallUserId);"); sbLeft.AppendLine("second.appendChild(img);"); sbLeft.AppendLine("nodeFirst.appendChild(second);"); //时间显示 sbLeft.AppendLine("var timeshow = document.createElement('div');"); sbLeft.AppendLine("timeshow.className='leftTimeText';"); sbLeft.AppendLine("timeshow.innerHTML ='" + user.userNum + user.userName + " " + PictureAndTextMixMethod.timeComparison(msg.sendTime) + "';"); sbLeft.AppendLine("nodeFirst.appendChild(timeshow);"); //投票内容展示层 sbLeft.AppendLine("var node = document.createElement('div');"); sbLeft.AppendLine("node.className='speech left';"); //设置活动Id sbLeft.AppendLine("node.id='" + receive.id + "';"); //事件监听 sbLeft.AppendLine("node.addEventListener('click',clickVoteShow);"); //投票默认图片显示层 sbLeft.AppendLine("var imgVote=document.createElement('img');"); sbLeft.AppendLine("imgVote.className='baseFloatLeft';"); sbLeft.AppendLine("imgVote.src='" + PictureAndTextMixMethod.VoteImg + "';"); sbLeft.AppendLine("node.appendChild(imgVote);"); //投票title显示层 sbLeft.AppendLine("var voteTitle = document.createElement('div');"); sbLeft.AppendLine("voteTitle.className='voteTitle';"); sbLeft.AppendLine("voteTitle.innerHTML ='" + receive.title + "';"); sbLeft.AppendLine("node.appendChild(voteTitle);"); //换行1 sbLeft.AppendLine("var newLineOne= document.createElement('br');"); sbLeft.AppendLine("node.appendChild(newLineOne);"); //投票第一项 sbLeft.AppendLine("var voteFirst = document.createElement('div');"); sbLeft.AppendLine("voteFirst.className='divCircle';"); sbLeft.AppendLine("var voteInFirst = document.createElement('div');"); sbLeft.AppendLine("voteInFirst.className='voteContent';"); sbLeft.AppendLine("voteInFirst.innerHTML ='" + receive.options[0].name + "';"); sbLeft.AppendLine("voteFirst.appendChild(voteInFirst);"); sbLeft.AppendLine("node.appendChild(voteFirst);"); //换行2 sbLeft.AppendLine("var newLineTwo= document.createElement('br');"); sbLeft.AppendLine("node.appendChild(newLineTwo);"); //投票第二项 sbLeft.AppendLine("var voteSecond = document.createElement('div');"); sbLeft.AppendLine("voteSecond.className='divCircle';"); sbLeft.AppendLine("var voteInSecond = document.createElement('div');"); sbLeft.AppendLine("voteInSecond.className='voteContent';"); sbLeft.AppendLine("voteInSecond.innerHTML ='" + receive.options[1].name + "';"); sbLeft.AppendLine("voteSecond.appendChild(voteInSecond);"); sbLeft.AppendLine("node.appendChild(voteSecond);"); if (receive.options.Count > 3) { //换行3 sbLeft.AppendLine("var newLineThree= document.createElement('br');"); sbLeft.AppendLine("node.appendChild(newLineThree);"); //投票第三项 sbLeft.AppendLine("var voteThree = document.createElement('div');"); sbLeft.AppendLine("voteThree.className='divCircle';"); sbLeft.AppendLine("var voteInThree = document.createElement('div');"); sbLeft.AppendLine("voteInThree.className='voteContent';"); sbLeft.AppendLine("voteInThree.innerHTML ='" + receive.options[2].name + "';"); sbLeft.AppendLine("voteThree.appendChild(voteInThree);"); sbLeft.AppendLine("node.appendChild(voteThree);"); } //换行4 sbLeft.AppendLine("var newLineFour= document.createElement('br');"); sbLeft.AppendLine("node.appendChild(newLineFour);"); sbLeft.AppendLine("nodeFirst.appendChild(node);"); //获取body层 sbLeft.AppendLine("var listbody = document.getElementById('bodydiv');"); sbLeft.AppendLine("listbody.insertBefore(nodeFirst,listbody.childNodes[0]);}"); //sbLeft.AppendLine("document.body.appendChild(nodeFirst);"); sbLeft.AppendLine("myFunction();"); cef.ExecuteScriptAsync(sbLeft.ToString()); }
public GroupMemberViewModel(AntSdkGroupMember user, string GroupAdminId, string groupId, GroupMemberListViewModel owner, string strKey, int adminCount = 0) { TalkGroupViewModel.isShowTransferAdminMenu += TalkGroupViewModel_isShowTransferAdminMenu; this.Owner = owner; this.Member = user; this.GroupId = groupId; AdminCount = adminCount; keyword = strKey; //if (!string.IsNullOrWhiteSpace(user.picture)) //{ // this.Photo = user.picture; //} //else //{ // this.Photo = "pack://application:,,,/AntennaChat;Component/Images/27-头像.png"; //} if (string.IsNullOrEmpty(user.userNum)) { this.Name = user.userName; } else { this.Name = user.userNum + user.userName; } var cuss = AntSdkService.AntSdkListContactsEntity.users.FirstOrDefault(m => m.userId == user.userId); if (cuss != null && cuss.status == 0 && cuss.state == 0) { this.Name = this.Name + "(停用)"; } else if (cuss == null) { this.Name = "离职人员"; } this.Position = user.position; this.PromptToolTip = string.Format("{0}({1})", this.Name, this.Position); if (GroupAdminId == AntSdkService.AntSdkLoginOutput.userId && user.userId != AntSdkService.AntSdkLoginOutput.userId) { if (cuss != null && cuss.status == 2) { ChangeMangerVisibility = KickoutGroupVisibility = Visibility.Visible; IsSetGroupManager = true; } } if (GroupAdminId == user.userId && cuss != null && cuss.status == 2) { AdminImageVisibility = Visibility.Visible; IsSetGroupManager = false; } if (user.userId == AntSdkService.AntSdkLoginOutput.userId) { SendMsgVisibility = Visibility.Collapsed; } if (Member.roleLevel == (int)GlobalVariable.GroupRoleLevel.Admin) { GroupMenuContent = "解除管理员"; IsGroupAdminImage = true; if (cuss != null && cuss.status == 0) { IsSetGroupManager = true; } } if (AdminCount >= 4 && Member.roleLevel != (int)GlobalVariable.GroupRoleLevel.Admin) { IsSetGroupManager = false; } //if (AntSdkService.AntSdkCurrentUserInfo.robotId == Member?.userId) //{ // IsSetGroupManager = false; // ChangeMangerVisibility = KickoutGroupVisibility = Visibility.Collapsed; //} //if (Member.roleLevel== (int) GlobalVariable.GroupRoleLevel.Admin && // user.userId != AntSdkService.AntSdkLoginOutput.userId) //{ // KickoutGroupVisibility = Visibility.Visible; //} var userinfo = AntSdkService.AntSdkListContactsEntity.users.FirstOrDefault(c => c.userId == user.userId); if (userinfo != null) { contactUser = userinfo; if (AntSdkService.AntSdkCurrentUserInfo.robotId == userinfo.userId) { IsSetGroupManager = false; ChangeMangerVisibility = KickoutGroupVisibility = Visibility.Collapsed; userinfo.state = (int)GlobalVariable.OnLineStatus.OnLine; Name = userinfo.userName; Position = userinfo.position; this.PromptToolTip = string.Format("{0}({1})", this.Name, this.Position); // IsOfflineState = !AntSdkService.AntSdkIsConnected; } SetContactPhoto(); //else //{ // if (!AntSdkService.AntSdkIsConnected) // { // IsOfflineState = true; // } // else // { // IsOfflineState = userinfo.state == (int)GlobalVariable.OnLineStatus.OffLine; // } //} //if (!string.IsNullOrEmpty(userinfo?.state)) //{ // var state = int.Parse(userinfo.state); if (!AntSdkService.AntSdkIsConnected) { UserOnlineStateIcon = ""; } else if (!IsOfflineState) { if (GlobalVariable.UserOnlineSataeInfo.UserOnlineStateMinIconDic.ContainsKey(userinfo.state)) { UserOnlineStateIcon = GlobalVariable.UserOnlineSataeInfo.UserOnlineStateMinIconDic[userinfo.state]; } } if (AntSdkService.AntSdkCurrentUserInfo.robotId == contactUser?.userId) { IsOfflineState = !AntSdkService.AntSdkIsConnected; } else { if (!AntSdkService.AntSdkIsConnected) { IsOfflineState = true; } else { IsOfflineState = contactUser?.state == (int)GlobalVariable.OnLineStatus.OffLine; } } //} } }
public GroupMemberViewModel(AntSdkGroupMember user, string GroupAdminId, string groupId, GroupMemberListViewModel owner, string strKey, string PinYin) : this(user, GroupAdminId, groupId, owner, strKey) { pinYin = PinYin; }
public static void LeftGroupScrollActivity(ChromiumWebBrowser cef, ChatBase msg, List <AntSdkGroupMember> GroupMembers) { AntSdkGroupMember user = PictureAndTextMixMethod.getGroupMembersUser(GroupMembers, msg); //显示内容解析 Activity_content receive = JsonConvert.DeserializeObject <Activity_content>(msg.sourceContent); StringBuilder sbLeft = new StringBuilder(); sbLeft.AppendLine("function myFunction()"); sbLeft.AppendLine("{ var nodeFirst=document.createElement('div');"); sbLeft.AppendLine("nodeFirst.className='leftd';"); sbLeft.AppendLine("nodeFirst.id='" + msg.messageId + "';"); //头像显示层 sbLeft.AppendLine("var second=document.createElement('div');"); sbLeft.AppendLine("second.className='leftimg';"); sbLeft.AppendLine("var img = document.createElement('img');"); sbLeft.AppendLine("img.src='" + PictureAndTextMixMethod.getPathImage(GroupMembers, msg) + "';"); sbLeft.AppendLine("img.className='divcss5Left';"); sbLeft.AppendLine("img.id='" + user.userId + "';"); sbLeft.AppendLine("img.addEventListener('click',clickImgCallUserId);"); sbLeft.AppendLine("second.appendChild(img);"); sbLeft.AppendLine("nodeFirst.appendChild(second);"); //时间显示 sbLeft.AppendLine("var timeshow = document.createElement('div');"); sbLeft.AppendLine("timeshow.className='leftTimeText';"); sbLeft.AppendLine("timeshow.innerHTML ='" + user.userNum + user.userName + " " + PictureAndTextMixMethod.timeComparison(msg.sendTime) + "';"); sbLeft.AppendLine("nodeFirst.appendChild(timeshow);"); //活动内容展示层 sbLeft.AppendLine("var node = document.createElement('div');"); sbLeft.AppendLine("node.className='speech left';"); //设置活动Id sbLeft.AppendLine("node.id='" + receive.activityId + "';"); //事件监听 sbLeft.AppendLine("node.addEventListener('click',clickActivityShow);"); //活动默认图片显示层 sbLeft.AppendLine("var imgVote=document.createElement('img');"); sbLeft.AppendLine("imgVote.className='activityImg';"); sbLeft.AppendLine("imgVote.src='" + PictureAndTextMixMethod.ImgUrlSplit(receive.picture) + "';"); sbLeft.AppendLine("node.appendChild(imgVote);"); //活动title显示层 sbLeft.AppendLine("var voteTitle = document.createElement('div');"); sbLeft.AppendLine("voteTitle.className='voteTitle';"); sbLeft.AppendLine("voteTitle.innerHTML ='" + receive.theme + "';"); sbLeft.AppendLine("node.appendChild(voteTitle);"); //换行1 sbLeft.AppendLine("var newLineOne= document.createElement('br');"); sbLeft.AppendLine("node.appendChild(newLineOne);"); sbLeft.AppendLine("var voteInFirst = document.createElement('div');"); sbLeft.AppendLine("voteInFirst.className='activityTP';"); sbLeft.AppendLine("voteInFirst.innerHTML ='时间:" + receive.startTime + "';");; sbLeft.AppendLine("node.appendChild(voteInFirst);"); //换行2 sbLeft.AppendLine("var newLineTwo= document.createElement('br');"); sbLeft.AppendLine("node.appendChild(newLineTwo);"); //活动地点 sbLeft.AppendLine("var voteInSecond = document.createElement('div');"); sbLeft.AppendLine("voteInSecond.className='activityTP';"); sbLeft.AppendLine("voteInSecond.innerHTML ='地点:" + receive.address + "';"); sbLeft.AppendLine("node.appendChild(voteInSecond);"); //换行4 sbLeft.AppendLine("var newLineFour= document.createElement('br');"); sbLeft.AppendLine("node.appendChild(newLineFour);"); sbLeft.AppendLine("nodeFirst.appendChild(node);"); //获取body层 sbLeft.AppendLine("var listbody = document.getElementById('bodydiv');"); sbLeft.AppendLine("listbody.insertBefore(nodeFirst,listbody.childNodes[0]);}"); //sbLeft.AppendLine("document.body.appendChild(nodeFirst);"); sbLeft.AppendLine("myFunction();"); cef.ExecuteScriptAsync(sbLeft.ToString()); }
public static void LeftGroupScrollPicAndTextMix(ChromiumWebBrowser cef, ChatBase msg, List <AntSdkGroupMember> GroupMembers, List <string> imageId) { AntSdkGroupMember user = PictureAndTextMixMethod.getGroupMembersUser(GroupMembers, msg); //显示内容解析 List <MixMessageObjDto> receive = JsonConvert.DeserializeObject <List <MixMessageObjDto> >(msg.sourceContent); StringBuilder sbLeft = new StringBuilder(); sbLeft.AppendLine("function myFunction()"); sbLeft.AppendLine("{ var nodeFirst=document.createElement('div');"); sbLeft.AppendLine("nodeFirst.className='leftd';"); sbLeft.AppendLine("nodeFirst.id='" + msg.messageId + "';"); //头像显示层 sbLeft.AppendLine("var second=document.createElement('div');"); sbLeft.AppendLine("second.className='leftimg';"); sbLeft.AppendLine("var img = document.createElement('img');"); sbLeft.AppendLine("img.src='" + PictureAndTextMixMethod.getPathImage(GroupMembers, msg) + "';"); sbLeft.AppendLine("img.className='divcss5Left';"); sbLeft.AppendLine("img.id='" + user.userId + "';"); sbLeft.AppendLine("img.addEventListener('click',clickImgCallUserId);"); sbLeft.AppendLine("second.appendChild(img);"); sbLeft.AppendLine("nodeFirst.appendChild(second);"); //时间显示 sbLeft.AppendLine("var timeshow = document.createElement('div');"); sbLeft.AppendLine("timeshow.className='leftTimeText';"); sbLeft.AppendLine("timeshow.innerHTML ='" + user.userNum + user.userName + " " + PictureAndTextMixMethod.timeComparison(msg.sendTime) + "';"); sbLeft.AppendLine("nodeFirst.appendChild(timeshow);"); int i = imageId.Count(); //图文混合展示层 //sbLeft.AppendLine("var node = document.createElement('div');"); string divid = "copy" + Guid.NewGuid().ToString().Replace("-", ""); sbLeft.AppendLine(PublicTalkMothed.divLeftCopyContent(divid)); sbLeft.AppendLine("node.id='" + divid + "';"); sbLeft.AppendLine("node.className='speech left';"); //图文混合内部构造 StringBuilder sbInside = new StringBuilder(); foreach (var list in receive) { switch (list.type) { //文本 case "1001": sbInside.Append(PublicTalkMothed.talkContentReplace(list.content?.ToString())); break; //图片 case "1002": PictureAndTextMixContentDto pictureAndTextMix = JsonConvert.DeserializeObject <PictureAndTextMixContentDto>(list.content.ToString()); sbInside.Append("<img id=\"" + imageId[i - 1] + "\" src=\"" + pictureAndTextMix.picUrl + "\" class=\"imgLeftProportion\" ondblclick=\"myFunctions(event)\"/>"); i--; break; //@消息 case "1008": List <At_content> at = JsonConvert.DeserializeObject <List <At_content> >(list.content.ToString()); string strAt = ""; foreach (var atList in at) { if (atList.type == "1112") { foreach (var atName in atList.names) { strAt += "@" + atName; } sbInside.Append(strAt); } else { #region @全体成员 sbInside.Append("@全体成员"); #endregion } } break; //换行 case "0000": sbInside.Append("<br/>"); break; } } sbLeft.AppendLine("node.innerHTML ='" + sbInside.ToString() + "';"); sbLeft.AppendLine("nodeFirst.appendChild(node);"); //获取body层 sbLeft.AppendLine("var listbody = document.getElementById('bodydiv');"); sbLeft.AppendLine("listbody.insertBefore(nodeFirst,listbody.childNodes[0]);}"); //sbLeft.AppendLine("document.body.appendChild(nodeFirst);"); sbLeft.AppendLine("myFunction();"); cef.EvaluateScriptAsync(sbLeft.ToString());; }