分包医生

This commit is contained in:
zoujiandong
2024-01-16 14:59:06 +08:00
parent 562d4e9691
commit d5a9339ddd
1060 changed files with 3177 additions and 44707 deletions
@@ -0,0 +1,9 @@
var includes = function() {
var show = false;
if(arguments[0].indexOf(arguments[1]) !== -1) {
return show = true;
}
}
module.exports = {
includes: includes
};
@@ -0,0 +1,363 @@
import logger from '../../utils/logger';
// eslint-disable-next-line no-undef
Component({
/**
* 组件的属性列表
*/
properties: {
conversation: {
type: Object,
value: '',
observer(newVal) {
if (newVal.type === 'GROUP');
this.setData({
conversation: newVal,
});
},
},
count: {
type: Number,
value: '',
observer(newVal) {
this.setData({
memberCount: newVal,
});
},
},
},
/**
* 组件的初始数据
*/
data: {
personalProfile: {
},
getMemberCount: 30,
count: '',
userID: '',
conversation: {},
memberCount: '',
groupMemberProfile: [],
groupMemberAvatar: [],
groupMemberNick: [],
hidden: true,
notShow: true,
isShow: false,
showMore: false,
addShow: false,
popupToggle: false,
quitPopupToggle: false,
addPopupToggle: false,
showText: '退出群聊',
showOwner: false,
noRepateOwner: [],
showOwnerName: {},
showGetMore: false,
offsetNumber: 0,
selectedUserIDList: [],
showGroupCall: false,
type: 0,
Profile: {},
callStatus: false,
list: [],
currentUserID: '',
callGroupMemberProfile: [],
},
lifetimes: {
attached() {
wx.$TUIKit.getGroupProfile({
groupID: this.data.conversation.groupProfile.groupID,
}).then((imResponse) => {
this.setData({
Profile: imResponse,
});
});
this.setData({
currentUserID: wx.$chat_userID,
memberCount: this.data.conversation.groupProfile.memberCount,
});
},
},
/**
* 组件的方法列表
*/
methods: {
// 展示更多群成员
showMore() {
const { group } = this.data.Profile.data;
const currentMemberCount = group.memberCount;
this.setData({
showGetMore: currentMemberCount > this.data.getMemberCount,
showText: group.selfInfo.role === 'Owner' ? '解散群聊' : '',
});
wx.$TUIKit.getGroupMemberList({
groupID: this.data.conversation.groupProfile.groupID,
count: this.data.getMemberCount, offset: 0,
})
.then((imResponse) => {
logger.log(`| TUI-group-profile | getGroupMemberList | getGroupMemberList-length: ${imResponse.data.memberList.length}`);
if (this.data.conversation.groupProfile.type === 'Private') {
this.setData({
addShow: true,
});
}
if (imResponse.data.memberList.length > 3) {
this.setData({
showMore: true,
});
}
this.setData({
groupMemberProfile: imResponse.data.memberList,
hidden: !this.data.hidden,
notShow: !this.data.notShow,
isShow: !this.data.isShow,
});
});
},
// 拉取更多成员进行展示
getMoreMember() {
const offset = this.data.offsetNumber + this.data.getMemberCount;
this.setData({
offsetNumber: offset,
});
wx.$TUIKit.getGroupMemberList({
groupID: this.data.conversation.groupProfile.groupID,
count: this.data.getMemberCount, offset,
}).then((imResponse) => {
this.setData({
groupMemberProfile: this.data.groupMemberProfile.concat(imResponse.data.memberList),
});
if (this.data.groupMemberProfile.length === this.data.memberCount) {
this.setData({
showGetMore: false,
});
}
});
},
// 关闭显示showmore
showLess() {
this.setData({
isShow: false,
notShow: true,
hidden: true,
});
},
// 展示更多群成员弹窗
showMoreMember() {
this.setData({
popupToggle: true,
callStatus: false,
});
},
// 通话展示更多群成员
callShowMoreMember(event) {
if (this.data.groupMemberProfile.length === 0) {
wx.$TUIKit.getGroupMemberList({
groupID: this.data.conversation.groupProfile.groupID,
count: this.data.getMemberCount,
offset: 0,
})
.then((imResponse) => {
const index = imResponse.data.memberList.findIndex((member) => member.userID === this.data.currentUserID);
imResponse.data.memberList.splice(index, 1);
this.setData({
callGroupMemberProfile: imResponse.data.memberList,
showGetMore: this.data.Profile.data.group.memberCount > this.data.getMemberCount,
});
});
} else {
const currentGroupMemberProfile = this.data.groupMemberProfile;
const index = currentGroupMemberProfile.findIndex((member)=> member.userID === this.data.currentUserID);
currentGroupMemberProfile.splice(index, 1);
this.setData({
callGroupMemberProfile: currentGroupMemberProfile,
});
}
this.setData({
type: event.detail.type,
popupToggle: true,
callStatus: true,
});
},
// 关闭显示弹窗
close() {
this.setData({
selectedUserIDList: [],
showGroupCall: false,
popupToggle: false,
addPopupToggle: false,
quitPopupToggle: false,
});
},
quitGroup() {
if (this.data.showText === '退出群聊') {
this.setData({
quitPopupToggle: true,
popupToggle: false,
});
} else if (this.data.showText === '解散群聊') {
this.setData({
dismissPopupToggle: true,
popupToggle: false,
});
}
},
// 解散群聊
dismissGroupConfirm() {
wx.$TUIKit.dismissGroup(this.data.conversation.groupProfile.groupID)
.then(() => {
this.triggerEvent('showConversationList');
})
.catch((imError) => {
wx.showToast({
title: '群主不能解散好友工作群',
icon: 'none',
});
this.setData({
dismissPopupToggle: false,
});
logger.warn('dismissGroup error:', imError);
});
},
// 解散群聊的按钮提示
dismissGroupAbandon() {
this.setData({
dismissPopupToggle: false,
});
},
// 主动退群
quitGroupConfirm() {
wx.$TUIKit.quitGroup(this.data.conversation.groupProfile.groupID)
.then(() => {
this.triggerEvent('showConversationList');
})
.catch((imError) => {
wx.showToast({
title: '该群不允许群主主动退出',
icon: 'none',
});
this.setData({
quitPopupToggle: false,
});
logger.warn('quitGroup error:', imError); // 退出群组失败的相关信息
});
},
// 退出群聊的按钮显示
quitGroupAbandon() {
this.setData({
quitPopupToggle: false,
});
},
// 添加群成员按钮显示
addMember() {
this.setData({
addPopupToggle: true,
});
},
// 获取输入的用户ID
binduserIDInput(e) {
const id = e.detail.value;
this.setData({
userID: id,
});
},
// work群主动添加群成员
submit() {
wx.$TUIKit.addGroupMember({
groupID: this.data.conversation.groupProfile.groupID,
userIDList: [this.data.userID],
}).then((imResponse) => {
if (imResponse.data.successUserIDList.length > 0) {
wx.showToast({ title: '添加成功', duration: 800 });
this.userID = '';
this.addMemberModalVisible = false;
this.setData({
addPopupToggle: false,
});
}
if (imResponse.data.existedUserIDList.length > 0) {
wx.showToast({ title: '该用户已在群中', duration: 800, icon: 'none' });
}
})
.catch((imError) => {
console.warn('addGroupMember error:', imError); // 错误信息
wx.showToast({ title: '添加失败,请确保该用户存在', duration: 800, icon: 'none' });
});
},
// 实时更新群成员个数
updateMemberCount(event) {
if (event === 1) { // 1是有成员加群
wx.$TUIKit.getGroupMemberList({
groupID: this.data.conversation.groupProfile.groupID,
count: this.data.getMemberCount, offset: 0,
}).then((imResponse) => {
this.setData({
groupMemberProfile: imResponse.data.memberList,
memberCount: this.data.memberCount + 1,
});
if (this.data.memberCount > 3) {
this.setData({
showMore: true,
});
}
});
}
if (event === 2) { // 2是有成员退群
wx.$TUIKit.getGroupMemberList({
groupID: this.data.conversation.groupProfile.groupID,
count: this.data.getMemberCount, offset: 0,
}).then((imResponse) => {
this.setData({
groupMemberProfile: imResponse.data.memberList,
memberCount: this.data.memberCount - 1,
});
if (this.data.memberCount <= 3) {
this.setData({
showMore: false,
});
}
});
}
},
// 复制群ID
copyGroupID() {
wx.setClipboardData({
data: this.data.conversation.groupProfile.groupID,
success() {
wx.getClipboardData({
success(res) {
logger.log(`| TUI-chat | tui-group | copyGroupID: ${res.data} `);
},
});
},
});
},
// 获取群通话ID
handleGroupCallUserIDList(e) {
if (!this.data.callStatus) return;
const { selectedUserIDList } = this.data ;
const { userID } = e.currentTarget.dataset.value;
const index = selectedUserIDList.indexOf(userID);
if (index > -1) {
selectedUserIDList.splice(index, 1);
} else {
selectedUserIDList.push(userID);
}
this.setData({
selectedUserIDList,
showGroupCall: selectedUserIDList.length > 0,
});
},
// 父组件传值
handleGroupCall() {
const { selectedUserIDList, type } = this.data;
const { groupID } = this.data.conversation.groupProfile;
this.triggerEvent('groupCall', { selectedUserIDList, type, groupID });
this.setData({
popupToggle: false,
showGroupCall: false,
selectedUserIDList: []
});
},
},
});
@@ -0,0 +1,4 @@
{
"component":true,
"usingComponents": {}
}
@@ -0,0 +1,115 @@
<!--miniprogram/components/tui-group/group-profile/index.wxml-->
<view class="group-information-box" bindshow="getgroupProfile">
<view class="group-box">
<text class="group-ID" bind:longpress="copyGroupID">群ID:{{conversation.groupProfile.groupID}}</text>
<view bindtap="showMore" >
<text class="group-member">聊天成员:{{memberCount}}人</text>
<image wx:if="{{notShow}}"class=" icon-right" src="../../static/assets/down.svg"/>
<image wx:if="{{isShow}}" class=" icon-right" src="../../static/assets/up.svg" />
</view>
</view>
<view hidden="{{hidden}}" class="showdetail">
<view class="box" wx:for="{{groupMemberProfile}}" wx:if="{{index < 3}}" wx:key="id" data-value="{{item}}" bindtap="handleJumpPage">
<image class="profile-box" src= '{{item.avatar|| "https://sdk-web-1252463788.cos.ap-hongkong.myqcloud.com/component/TUIKit/assets/avatar_21.png"}}'/>
<view class="groupownername-box">
<text class="groupownername" wx:if="{{item.role === 'Owner'}}">(群主)</text>
<text class="nick-box">{{item.nick||item.userID}}</text>
</view>
</view>
<view class="box" wx:if="{{showMore}}">
<image class="profile-box" src="../../static/assets/show.svg" bindtap="showMoreMember"/>
<text class="nick-box">更多</text>
</view>
<view class="left-box">
<view class="box-group" wx:if="{{addShow}}">
<image class="addmember" src="../../static/assets/addgroup.svg" bindtap="addMember"/>
<text class="addmember-text">添加成员</text>
</view>
<view class="box-group-quit">
<image class="quitgroup" src="../../static/assets/quitgroup.svg" catchtap="quitGroup"/>
<text class="quitgroup-text">{{showText}}</text>
</view>
</view>
</view>
</view>
<view class="pop-container">
<view class="popup-mask" wx:if="{{popupToggle}}" >
<view class="pop-main" >
<view class="pop-main-header">
<text class="group-member-text">群成员</text>
<view class="show-group-call">
<text class="handlecall" wx:if="{{showGroupCall}}" bindtap="handleGroupCall">发起通话</text>
<text class="close" catchtap="close">关闭</text>
</view>
</view>
<view class="image-list" >
<view wx:if="{{callStatus}}" class="image-nick-box" wx:for="{{callGroupMemberProfile}}" wx:key="id" data-value="{{item}}" bindtap="handleGroupCallUserIDList">
<image class="image {{ checked.includes(selectedUserIDList, item.userID) && 'image-nick-box-active'}}" src='{{item.avatar|| "https://sdk-web-1252463788.cos.ap-hongkong.myqcloud.com/component/TUIKit/assets/avatar_21.png"}}' />
<view class="groupowner-box">
<text class="groupownername-bootom" wx:if="{{item.role==='Owner'}}">(群主)</text>
<text class="groupmembername" >{{item.nick||item.userID}}</text>
</view>
</view>
<view wx:if="{{!callStatus}}" class="image-nick-box" wx:for="{{groupMemberProfile}}" wx:key="id" data-value="{{item}}" bindtap="handleGroupCallUserIDList">
<image class="image {{ checked.includes(selectedUserIDList, item.userID) && 'image-nick-box-active'}}" src='{{item.avatar|| "https://sdk-web-1252463788.cos.ap-hongkong.myqcloud.com/component/TUIKit/assets/avatar_21.png"}}' />
<view class="groupowner-box">
<text class="groupownername-bootom" wx:if="{{item.role==='Owner'}}">(群主)</text>
<text class="groupmembername" >{{item.nick||item.userID}}</text>
</view>
</view>
<view class="moremember" wx:if="{{showGetMore}}">
<image class="image" src="../../static/assets/show.svg" bindtap="getMoreMember"/>
</view>
</view>
</view>
</view>
</view>
<view class="pop-container">
<view class="quitpop-mask" wx:if="{{quitPopupToggle}}">
<view class="quitpop">
<view class=" quit-box">
<view class="text-box">
<text class="confirmQuitgroup-text">退出群聊后会同步删除历史聊天记录,是否要退出群聊?</text>
</view>
<view class="text-box-qiut" catchtap="quitGroupConfirm">
<text class="quitgroup-confirm" >退出</text>
</view>
<view class="text-box-cancle" bindtap="quitGroupAbandon">
<text class="quitgroup-abandon" >取消</text>
</view>
</view>
</view>
</view>
</view>
<view class="quitpop-mask" wx:if="{{dismissPopupToggle}}">
<view class="quitpop">
<view class=" quit-box">
<view class="text-box">
<text class="confirmQuitgroup-text">是否解散群聊?</text>
</view>
<view class="text-box-qiut" catchtap="dismissGroupConfirm">
<text class="quitgroup-confirm" >确认</text>
</view>
<view class="text-box-cancle" bindtap="dismissGroupAbandon">
<text class="quitgroup-abandon" >取消</text>
</view>
</view>
</view>
</view>
<view class="mask" wx:if="{{addPopupToggle}}" >
<view class="popup">
<view class="popup-main">
<text>添加群成员</text>
<input class="input" type="number" placeholder="请输入userID" bindinput='binduserIDInput' placeholder-style="color:#BBBBBB;"/>
</view>
<view class="popup-footer">
<button class="submit" catch:tap="submit">确认</button>
<button class="cancel" catch:tap="close">取消</button>
</view>
</view>
</view>
<wxs src = './checked.wxs' module = 'checked'/>
@@ -0,0 +1,373 @@
.group-information-box{
width: 100vw ;
background: #006EFF;
}
.group-box{
display: inline-flex;
width: 100%;
box-sizing: border-box;
padding: 34rpx 40rpx;
}
.group-ID{
flex: 1;
max-width:50% ;
color: white;
display: inline-block;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.group-member{
padding-left: 110rpx;
color: white;
}
.icon-right{
float: right;
width: 32rpx;
height: 32rpx;
padding-top: 10rpx;
padding-left: 4rpx;
}
.showdetail{
display:flex;
width: 100vw;
height: 200rpx;
background: #006EFF;
}
.box{
width: 100rpx;
height: 130rpx;
padding-left: 35rpx;
padding-top: 10rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.left-box{
display: flex;
padding-left: 200rpx;
padding-top: 10rpx;
width: 250rpx;
}
.box-group{
position: absolute;
width: 80rpx;
height: 80rpx;
right: 160rpx;
}
.box-group-quit{
position:absolute;
right: 80rpx;
width: 80rpx;
height: 80rpx;
}
.addmember{
width: 80rpx;
height: 80rpx;
}
.quitgroup{
padding-left: 28rpx;
width: 80rpx;
height: 80rpx;
}
.profile-box{
width: 80rpx;
height: 80rpx;
flex-shrink: 0;
z-index: 8;
}
.addmember-text{
display: flex;
justify-content: center;
align-items: center;
font-family: PingFangSC-Regular;
font-size: 10px;
color: #FFFFFF;
letter-spacing: 0;
}
.quitgroup-text{
display: flex;
justify-content: center;
align-items: center;
font-family: PingFangSC-Regular;
font-size: 10px;
color: #FFFFFF;
letter-spacing: 0;
padding-left: 20rpx;
width: 100rpx;
}
.nick-box{
margin-top: 10px;
display: flex;
justify-content: center;
align-items: center;
font-family: PingFangSC-Regular;
font-size: 10px;
color: #FFFFFF;
letter-spacing: 0;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
width: 100%;
}
.popup-mask{
width: 100vw;
height: 100vh;
position: fixed;
z-index: 10;
top: 0;
right: 0;
display: flex;
align-items: flex-end;
}
.pop-main{
max-height: 35%;
width: 100%;
padding-bottom: 120rpx;
background: #FFFFFF;
overflow: auto
}
.group-member-text{
display: inline-block;
padding-left: 40rpx;
opacity: 0.8;
font-family: PingFangSC-Medium;
font-size: 18px;
letter-spacing: 0;
line-height: 25px;
}
.close{
font-family: PingFangSC-Regular;
font-size: 18px;
color: #2B8BD5;
letter-spacing: 0;
line-height: 24px;
}
.quitpop-mask{
width: 100vw;
height: 100vh;
position: fixed;
z-index: 10;
top: 0;
right: 0;
background: rgba(0,0,0,0.60);
display: flex;
align-items: flex-end;
}
.quitpop{
position: fixed;
bottom: 0;
width: 100%;
height: 25%;
background: #FFFFFF;
z-index: 99999;
}
.text-box{
display: flex;
justify-content: center;
align-items: center;
height: 112rpx;
}
.confirmQuitgroup-text{
display: inline-block;
opacity: 0.4;
font-family: PingFangSC-Regular;
font-size: 14px;
letter-spacing: 0;
text-align: center;
line-height: 18px;
}
.quitgroup-confirm{
font-family: PingFangSC-Regular;
font-size: 16px;
color: #E85454;
letter-spacing: 0;
text-align: center;
line-height: 22px;
}
.quitgroup-abandon{
opacity: 0.8;
font-family: PingFangSC-Regular;
font-size: 16px;
letter-spacing: 0;
text-align: center;
line-height: 22px;
}
.mask{
position: absolute;
top: 450rpx;
left: 100rpx;
width: 70%;
height: 20%;
background:#999999;
z-index: 999;
}
.popup {
background: #ffffff;
border: 1px solid #eeeeee;
}
.popup-main {
height: 56px;
padding: 60rpx 0;
text-align: center;
font-family: PingFangSC-Regular;
font-size: 14px;
color: #999999;
letter-spacing: 0;
text-align: center;
line-height: 18px;
}
.input{
padding-top: 30rpx;
}
.popup-footer {
display: flex;
}
.popup-footer button {
flex: 1;
}
.popup-footer .cancel {
font-family: PingFangSC-Regular;
font-size: 14px;
color: #000000;
letter-spacing: 0;
text-align: center;
line-height: 22px;
height: 44px;
border-radius: 10px ;
}
.popup-footer .submit {
font-family: PingFangSC-Regular;
font-size: 14px;
color: #E85454;
letter-spacing: 0;
text-align: center;
line-height: 22px;
height: 44px;
border-radius: 10px ;
}
.cancellation{
margin-top: 68px;
margin-left: 20px;
margin-right: 20px;
background-color:white;
width: 280px;
height: 46px;
border: 1px solid #E85454 ;
border-radius: 24px;
border-radius: 24px;
}
.confirm-cancellation{
margin-left: 110px;
margin-top: 13px;
font-family: PingFangSC-Regular;
font-size: 16px;
color: #E85454;
letter-spacing: 0;
}
.image-list{
padding-top: 40rpx;
display: flex;
flex-wrap: wrap;
}
.image-nick-box{
width: 141rpx;
height: 140rpx;
padding-left: 45rpx;
padding-top: 32rpx;
}
.image{
width: 108rpx;
height: 108rpx;
border-radius: 4px;
border-radius: 4px;
}
.groupownername-box {
display: flex
}
.groupownername {
margin-top: 10px;
display: inline-block;
font-family: PingFangSC-Regular;
font-size: 10px;
color: white;
letter-spacing: 0;
white-space: nowrap;
width: 80rpx;
}
.groupmembername{
display: inline-block;
font-family: PingFangSC-Regular;
font-size: 12px;
color: #999999;
letter-spacing: 0;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
width: 80rpx;
}
.groupowner-box {
display: flex;
}
.groupownername-bootom {
display: inline-block;
font-family: PingFangSC-Regular;
font-size: 12px;
color: #999999;
letter-spacing: 0;
white-space: nowrap;
width: 80rpx;
}
.text-box-qiut{
display: flex;
justify-content: center;
align-items: center;
height: 112rpx;
}
.text-box-cancle{
display: flex;
justify-content: center;
align-items: center;
height: 112rpx;
border-top: 16rpx solid #eeeeee ;
}
.moremember{
width: 108rpx;
height: 140rpx;
padding-left: 32rpx;
padding-top: 32rpx;
}
.call-box {
display: flex;
flex-direction: column;
}
.call-image {
width: 48px;
height: 48px;
}
.image-nick-box-active {
box-sizing: border-box;
border: 3px solid #24a528;
border-radius: 4px;
}
.pop-main-header {
display: flex;
align-items: center;
justify-items: center;
padding-top: 40rpx;
justify-content: space-between;
}
.show-group-call{
display: flex;
padding-right: 40rpx;
}
.handlecall{
padding-right: 40rpx;
}