678 lines
28 KiB
JavaScript
678 lines
28 KiB
JavaScript
|
|
"use strict";
|
||
|
|
const common_vendor = require("../../../../common/vendor.js");
|
||
|
|
require("../../../adapter-vue.js");
|
||
|
|
const common_assets = require("../../../../common/assets.js");
|
||
|
|
const TUIKit_components_common_Toast_index = require("../../common/Toast/index.js");
|
||
|
|
const TUIKit_utils_env = require("../../../utils/env.js");
|
||
|
|
const TUIKit_components_TUIGroup_server = require("../server.js");
|
||
|
|
const TUIKit_utils_enableSampleTaskStatus = require("../../../utils/enableSampleTaskStatus.js");
|
||
|
|
const TUIKit_components_common_Toast_type = require("../../common/Toast/type.js");
|
||
|
|
if (!Math) {
|
||
|
|
(Icon + ManageName + ManageMember + ManageProfile + ManageNotification + ManageAdmin + Transfer + MaskLayer + Dialog)();
|
||
|
|
}
|
||
|
|
const MaskLayer = () => "../../common/MaskLayer/index.js";
|
||
|
|
const Dialog = () => "../../common/Dialog/index.js";
|
||
|
|
const Transfer = () => "../../common/Transfer/index.js";
|
||
|
|
const ManageName = () => "./manage-name.js";
|
||
|
|
const ManageNotification = () => "./manage-notification.js";
|
||
|
|
const ManageMember = () => "./manage-member.js";
|
||
|
|
const ManageProfile = () => "./manage-profile.js";
|
||
|
|
const ManageAdmin = () => "./manage-admin.js";
|
||
|
|
const Icon = () => "../../common/Icon.js";
|
||
|
|
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||
|
|
__name: "index",
|
||
|
|
props: {
|
||
|
|
groupID: {
|
||
|
|
type: String,
|
||
|
|
default: ""
|
||
|
|
},
|
||
|
|
groupCurrentTab: {
|
||
|
|
type: String,
|
||
|
|
default: ""
|
||
|
|
}
|
||
|
|
},
|
||
|
|
setup(__props) {
|
||
|
|
const TUIGroupServer = TUIKit_components_TUIGroup_server.TUIGroupServer.getInstance();
|
||
|
|
const TUIConstants = TUIGroupServer.constants;
|
||
|
|
const props = __props;
|
||
|
|
const manageRef = common_vendor.ref(void 0);
|
||
|
|
const currentTab = common_vendor.ref("");
|
||
|
|
const editLableName = common_vendor.ref("");
|
||
|
|
const transferType = common_vendor.ref("");
|
||
|
|
const mask = common_vendor.ref(false);
|
||
|
|
const currentGroupID = common_vendor.ref("");
|
||
|
|
const userInfo = common_vendor.ref({
|
||
|
|
list: []
|
||
|
|
});
|
||
|
|
const currentMember = common_vendor.ref({});
|
||
|
|
const typeName = common_vendor.ref({
|
||
|
|
[common_vendor.qt.TYPES.GRP_WORK]: "好友工作群",
|
||
|
|
[common_vendor.qt.TYPES.GRP_PUBLIC]: "陌生人社交群",
|
||
|
|
[common_vendor.qt.TYPES.GRP_MEETING]: "临时会议群",
|
||
|
|
[common_vendor.qt.TYPES.GRP_AVCHATROOM]: "直播群",
|
||
|
|
[common_vendor.qt.TYPES.GRP_COMMUNITY]: "社群",
|
||
|
|
[common_vendor.qt.TYPES.JOIN_OPTIONS_FREE_ACCESS]: "自由加入",
|
||
|
|
[common_vendor.qt.TYPES.JOIN_OPTIONS_NEED_PERMISSION]: "需要验证",
|
||
|
|
[common_vendor.qt.TYPES.JOIN_OPTIONS_DISABLE_APPLY]: "禁止加群"
|
||
|
|
});
|
||
|
|
const member = common_vendor.ref({
|
||
|
|
admin: [],
|
||
|
|
member: [],
|
||
|
|
muteMember: []
|
||
|
|
});
|
||
|
|
const transferList = common_vendor.ref([]);
|
||
|
|
const transferTitle = common_vendor.ref("");
|
||
|
|
const isSearch = common_vendor.ref(false);
|
||
|
|
const isRadio = common_vendor.ref(false);
|
||
|
|
const selectedList = common_vendor.ref([]);
|
||
|
|
const delDialogShow = common_vendor.ref(false);
|
||
|
|
const groupMemberList = common_vendor.ref([]);
|
||
|
|
const deletedUserList = common_vendor.ref([]);
|
||
|
|
const currentGroup = common_vendor.ref();
|
||
|
|
const currentSelfRole = common_vendor.ref("");
|
||
|
|
const groupIDValue = common_vendor.ref("");
|
||
|
|
common_vendor.onMounted(() => {
|
||
|
|
common_vendor.nextTick$1(() => {
|
||
|
|
if (manageRef.value && !TUIKit_utils_env.isUniFrameWork) {
|
||
|
|
common_vendor.O.listen({
|
||
|
|
domRefs: manageRef.value,
|
||
|
|
handler: handleCompleteManage
|
||
|
|
});
|
||
|
|
}
|
||
|
|
});
|
||
|
|
});
|
||
|
|
common_vendor.Jt.watch(common_vendor.o.GRP, {
|
||
|
|
currentGroup: (group) => {
|
||
|
|
var _a, _b;
|
||
|
|
if (group) {
|
||
|
|
currentGroup.value = group;
|
||
|
|
currentSelfRole.value = (_b = (_a = currentGroup.value) == null ? void 0 : _a.selfInfo) == null ? void 0 : _b.role;
|
||
|
|
}
|
||
|
|
},
|
||
|
|
currentGroupMemberList: (memberList) => {
|
||
|
|
groupMemberList.value = memberList;
|
||
|
|
member.value = {
|
||
|
|
admin: [],
|
||
|
|
member: [],
|
||
|
|
muteMember: []
|
||
|
|
};
|
||
|
|
Array.from(memberList).map((item) => {
|
||
|
|
switch (item == null ? void 0 : item.role) {
|
||
|
|
case common_vendor.qt.TYPES.GRP_MBR_ROLE_ADMIN:
|
||
|
|
member.value.admin.push(item);
|
||
|
|
break;
|
||
|
|
case common_vendor.qt.TYPES.GRP_MBR_ROLE_MEMBER:
|
||
|
|
member.value.member.push(item);
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
return item;
|
||
|
|
});
|
||
|
|
const time = (/* @__PURE__ */ new Date()).getTime();
|
||
|
|
member.value.muteMember = Array.from(memberList).filter(
|
||
|
|
(item) => (item == null ? void 0 : item.muteUntil) * 1e3 - time > 0
|
||
|
|
);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
common_vendor.Jt.watch(common_vendor.o.CONV, {
|
||
|
|
currentConversation: (conversation) => {
|
||
|
|
var _a;
|
||
|
|
groupIDValue.value = (_a = conversation == null ? void 0 : conversation.groupProfile) == null ? void 0 : _a.groupID;
|
||
|
|
}
|
||
|
|
});
|
||
|
|
common_vendor.watchEffect(() => {
|
||
|
|
const params = TUIGroupServer.getOnCallParams(TUIConstants.TUIGroup.SERVICE.METHOD.OPEN_GROUP_MANAGEMENT);
|
||
|
|
currentGroupID.value = (params == null ? void 0 : params.groupID) || groupIDValue.value;
|
||
|
|
currentTab.value = props.groupCurrentTab;
|
||
|
|
});
|
||
|
|
const TabName = common_vendor.computed(() => {
|
||
|
|
let name = "";
|
||
|
|
switch (currentTab.value) {
|
||
|
|
case "notification":
|
||
|
|
name = "群公告";
|
||
|
|
break;
|
||
|
|
case "member":
|
||
|
|
name = "群成员";
|
||
|
|
break;
|
||
|
|
case "profile":
|
||
|
|
name = "群成员";
|
||
|
|
break;
|
||
|
|
default:
|
||
|
|
name = "群管理";
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
return name;
|
||
|
|
});
|
||
|
|
const isOwner = common_vendor.computed(() => {
|
||
|
|
var _a, _b;
|
||
|
|
const userRole = (_b = (_a = currentGroup.value) == null ? void 0 : _a.selfInfo) == null ? void 0 : _b.role;
|
||
|
|
return userRole === common_vendor.qt.TYPES.GRP_MBR_ROLE_OWNER;
|
||
|
|
});
|
||
|
|
const isAdmin = common_vendor.computed(() => {
|
||
|
|
var _a, _b;
|
||
|
|
const userRole = (_b = (_a = currentGroup.value) == null ? void 0 : _a.selfInfo) == null ? void 0 : _b.role;
|
||
|
|
return userRole === common_vendor.qt.TYPES.GRP_MBR_ROLE_OWNER;
|
||
|
|
});
|
||
|
|
const isWorkGroup = common_vendor.computed(() => {
|
||
|
|
var _a;
|
||
|
|
return ((_a = currentGroup.value) == null ? void 0 : _a.type) === common_vendor.qt.TYPES.GRP_WORK;
|
||
|
|
});
|
||
|
|
const isSetMuteTime = common_vendor.computed(() => {
|
||
|
|
if (isWorkGroup.value || !(isOwner.value || isAdmin.value)) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
return true;
|
||
|
|
});
|
||
|
|
const canDelMember = common_vendor.computed(() => {
|
||
|
|
var _a;
|
||
|
|
const groupType = (_a = currentGroup == null ? void 0 : currentGroup.value) == null ? void 0 : _a.type;
|
||
|
|
const isAVChatRoom = groupType === common_vendor.qt.TYPES.GRP_AVCHATROOM;
|
||
|
|
if (isAVChatRoom) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
return true;
|
||
|
|
});
|
||
|
|
const updateProfile = async (newGroupProfile) => {
|
||
|
|
const { key, value } = newGroupProfile;
|
||
|
|
const options = {
|
||
|
|
groupID: currentGroup.value.groupID,
|
||
|
|
[key]: value
|
||
|
|
};
|
||
|
|
common_vendor.es.updateGroupProfile(options).then((res) => {
|
||
|
|
currentGroup.value = res.data.group;
|
||
|
|
editLableName.value = "";
|
||
|
|
}).catch((error) => {
|
||
|
|
TUIKit_components_common_Toast_index.Toast({
|
||
|
|
message: error == null ? void 0 : error.message,
|
||
|
|
type: TUIKit_components_common_Toast_type.TOAST_TYPE.ERROR
|
||
|
|
});
|
||
|
|
});
|
||
|
|
};
|
||
|
|
const setCurrentTab = (tabName) => {
|
||
|
|
currentTab.value = tabName;
|
||
|
|
editLableName.value = "";
|
||
|
|
if (currentTab.value === "member") {
|
||
|
|
transferType.value = "remove";
|
||
|
|
}
|
||
|
|
if (!currentTab.value) {
|
||
|
|
transferType.value = "";
|
||
|
|
}
|
||
|
|
};
|
||
|
|
const cancel = () => {
|
||
|
|
toggleMask();
|
||
|
|
};
|
||
|
|
const toggleMask = async (type) => {
|
||
|
|
var _a;
|
||
|
|
selectedList.value = [];
|
||
|
|
let memberUserIDList = [];
|
||
|
|
switch (type) {
|
||
|
|
case "add":
|
||
|
|
isRadio.value = false;
|
||
|
|
memberUserIDList = [...member.value.admin, ...member.value.member].map((item) => item.userID);
|
||
|
|
transferList.value = (await friendList()).filter((item) => {
|
||
|
|
return item.userID && memberUserIDList.indexOf(item.userID) < 0;
|
||
|
|
});
|
||
|
|
transferTitle.value = "添加成员";
|
||
|
|
break;
|
||
|
|
case "remove":
|
||
|
|
isRadio.value = false;
|
||
|
|
transferList.value = groupMemberList.value.filter(
|
||
|
|
(item) => {
|
||
|
|
var _a2, _b;
|
||
|
|
return item.userID !== ((_b = (_a2 = currentGroup == null ? void 0 : currentGroup.value) == null ? void 0 : _a2.selfInfo) == null ? void 0 : _b.userID);
|
||
|
|
}
|
||
|
|
);
|
||
|
|
transferTitle.value = "删除成员";
|
||
|
|
break;
|
||
|
|
case "addAdmin":
|
||
|
|
isRadio.value = true;
|
||
|
|
transferList.value = member.value.member;
|
||
|
|
transferTitle.value = "新增管理员";
|
||
|
|
break;
|
||
|
|
case "removeAdmin":
|
||
|
|
isRadio.value = true;
|
||
|
|
transferList.value = member.value.admin;
|
||
|
|
transferTitle.value = "移除管理员";
|
||
|
|
break;
|
||
|
|
case "changeOwner":
|
||
|
|
isRadio.value = true;
|
||
|
|
transferList.value = [...member.value.admin, ...member.value.member];
|
||
|
|
transferTitle.value = "转让群组";
|
||
|
|
break;
|
||
|
|
case "addMute":
|
||
|
|
isRadio.value = true;
|
||
|
|
transferList.value = member.value.member;
|
||
|
|
if (currentGroup.value.selfInfo.role === "Owner") {
|
||
|
|
transferList.value = [...member.value.admin, ...member.value.member];
|
||
|
|
}
|
||
|
|
transferList.value = (_a = transferList == null ? void 0 : transferList.value) == null ? void 0 : _a.filter((item) => {
|
||
|
|
var _a2, _b;
|
||
|
|
return ((_b = (_a2 = member == null ? void 0 : member.value) == null ? void 0 : _a2.muteMember) == null ? void 0 : _b.indexOf(item)) < 0;
|
||
|
|
});
|
||
|
|
transferTitle.value = "新增禁言用户";
|
||
|
|
break;
|
||
|
|
case "removeMute":
|
||
|
|
isRadio.value = true;
|
||
|
|
transferList.value = member.value.muteMember;
|
||
|
|
transferTitle.value = "移除禁言用户";
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
type && (transferType.value = type);
|
||
|
|
mask.value = !mask.value;
|
||
|
|
};
|
||
|
|
const friendList = async () => {
|
||
|
|
const imResponse = await common_vendor.ts.getFriendList();
|
||
|
|
const friendList2 = imResponse.data.map((item) => item == null ? void 0 : item.profile);
|
||
|
|
return friendList2.filter(
|
||
|
|
(item) => !userInfo.value.list.some(
|
||
|
|
(infoItem) => infoItem.userID === item.userID
|
||
|
|
)
|
||
|
|
);
|
||
|
|
};
|
||
|
|
const canIDissmissGroup = common_vendor.computed(() => {
|
||
|
|
var _a, _b, _c;
|
||
|
|
const userRole = (_b = (_a = currentGroup == null ? void 0 : currentGroup.value) == null ? void 0 : _a.selfInfo) == null ? void 0 : _b.role;
|
||
|
|
const groupType = (_c = currentGroup == null ? void 0 : currentGroup.value) == null ? void 0 : _c.type;
|
||
|
|
return userRole === common_vendor.qt.TYPES.GRP_MBR_ROLE_OWNER && groupType !== common_vendor.qt.TYPES.GRP_WORK;
|
||
|
|
});
|
||
|
|
const isShowAddMember = common_vendor.computed(() => {
|
||
|
|
var _a;
|
||
|
|
const groupType = (_a = currentGroup == null ? void 0 : currentGroup.value) == null ? void 0 : _a.type;
|
||
|
|
return groupType === common_vendor.qt.TYPES.GRP_WORK;
|
||
|
|
});
|
||
|
|
const showUserNum = common_vendor.computed(() => {
|
||
|
|
var _a, _b;
|
||
|
|
let num = 3;
|
||
|
|
if (!isShowAddMember.value) {
|
||
|
|
num += 1;
|
||
|
|
}
|
||
|
|
if (((_b = (_a = currentGroup == null ? void 0 : currentGroup.value) == null ? void 0 : _a.selfInfo) == null ? void 0 : _b.role) !== "Owner") {
|
||
|
|
num += 1;
|
||
|
|
}
|
||
|
|
return num;
|
||
|
|
});
|
||
|
|
const getMember = async (type) => {
|
||
|
|
const groupID = currentGroupID.value;
|
||
|
|
const options = {
|
||
|
|
groupID,
|
||
|
|
count: 100,
|
||
|
|
offset: type && type === "more" ? userInfo.value.list.length : 0
|
||
|
|
};
|
||
|
|
await common_vendor.es.getGroupMemberList(options).then((res) => {
|
||
|
|
if (type && type === "more") {
|
||
|
|
userInfo.value.list = [...userInfo.value.list, ...res.data.memberList];
|
||
|
|
} else {
|
||
|
|
userInfo.value.list = res.data.memberList;
|
||
|
|
}
|
||
|
|
});
|
||
|
|
};
|
||
|
|
const handleMemberProfileShow = (user) => {
|
||
|
|
currentMember.value = user;
|
||
|
|
setCurrentTab("profile");
|
||
|
|
};
|
||
|
|
const submit = (userList) => {
|
||
|
|
if (transferType.value === "remove") {
|
||
|
|
deletedUserList.value = userList;
|
||
|
|
delDialogShow.value = !delDialogShow.value;
|
||
|
|
} else {
|
||
|
|
handleManage(userList, transferType.value);
|
||
|
|
}
|
||
|
|
mask.value = false;
|
||
|
|
};
|
||
|
|
const dismissGroup = async (group) => {
|
||
|
|
await common_vendor.es.dismissGroup(group.groupID);
|
||
|
|
TUIKit_utils_enableSampleTaskStatus.enableSampleTaskStatus("dismissGroup");
|
||
|
|
TUIKit_components_common_Toast_index.Toast({
|
||
|
|
message: common_vendor.Wt.t("TUIGroup.群组解散成功"),
|
||
|
|
type: TUIKit_components_common_Toast_type.TOAST_TYPE.SUCCESS
|
||
|
|
});
|
||
|
|
clearGroupInfo();
|
||
|
|
};
|
||
|
|
const clearGroupInfo = () => {
|
||
|
|
var _a;
|
||
|
|
if (TUIKit_utils_env.isUniFrameWork) {
|
||
|
|
(_a = common_vendor.i) == null ? void 0 : _a.switchTab({
|
||
|
|
url: "/TUIKit/components/TUIConversation/index"
|
||
|
|
});
|
||
|
|
} else {
|
||
|
|
handleCompleteManage();
|
||
|
|
common_vendor.Xt.switchConversation();
|
||
|
|
}
|
||
|
|
};
|
||
|
|
const setAllMuteTime = (value) => {
|
||
|
|
updateProfile({ key: "muteAllMembers", value });
|
||
|
|
if (value) {
|
||
|
|
TUIKit_utils_enableSampleTaskStatus.enableSampleTaskStatus("muteGroup");
|
||
|
|
TUIKit_components_common_Toast_index.Toast({
|
||
|
|
message: common_vendor.Wt.t("TUIGroup.禁言设置成功"),
|
||
|
|
type: TUIKit_components_common_Toast_type.TOAST_TYPE.SUCCESS
|
||
|
|
});
|
||
|
|
} else {
|
||
|
|
TUIKit_components_common_Toast_index.Toast({
|
||
|
|
message: common_vendor.Wt.t("TUIGroup.取消禁言成功"),
|
||
|
|
type: TUIKit_components_common_Toast_type.TOAST_TYPE.SUCCESS
|
||
|
|
});
|
||
|
|
}
|
||
|
|
};
|
||
|
|
const handleSearchMember = async (value) => {
|
||
|
|
var _a, _b;
|
||
|
|
let imResponse = {};
|
||
|
|
let imMemberResponse = {};
|
||
|
|
const options = {
|
||
|
|
groupID: currentGroupID.value,
|
||
|
|
userIDList: [value]
|
||
|
|
};
|
||
|
|
switch (transferType.value) {
|
||
|
|
case "add":
|
||
|
|
try {
|
||
|
|
imMemberResponse = await common_vendor.es.getGroupMemberProfile(options);
|
||
|
|
transferList.value = transferList.value.filter(
|
||
|
|
(item) => {
|
||
|
|
var _a2;
|
||
|
|
return item.userID !== ((_a2 = imResponse.data[0]) == null ? void 0 : _a2.userID);
|
||
|
|
}
|
||
|
|
);
|
||
|
|
transferList.value = [...transferList.value, ...imResponse.data];
|
||
|
|
if (((_a = imMemberResponse == null ? void 0 : imMemberResponse.data) == null ? void 0 : _a.memberList.length) > 0) {
|
||
|
|
transferList.value = transferList.value.map((item) => {
|
||
|
|
var _a2;
|
||
|
|
if (item.userID === ((_a2 = imMemberResponse == null ? void 0 : imMemberResponse.data) == null ? void 0 : _a2.memberList[0].userID)) {
|
||
|
|
item.isDisabled = true;
|
||
|
|
}
|
||
|
|
return item;
|
||
|
|
});
|
||
|
|
}
|
||
|
|
} catch (error) {
|
||
|
|
const message = common_vendor.Wt.t("TUIGroup.该用户不存在");
|
||
|
|
TUIKit_components_common_Toast_index.Toast({
|
||
|
|
message,
|
||
|
|
type: TUIKit_components_common_Toast_type.TOAST_TYPE.ERROR
|
||
|
|
});
|
||
|
|
}
|
||
|
|
break;
|
||
|
|
case "remove":
|
||
|
|
try {
|
||
|
|
imResponse = await common_vendor.es.getGroupMemberProfile(options);
|
||
|
|
if (imResponse.data.memberList.length === 0) {
|
||
|
|
const message = common_vendor.Wt.t("TUIGroup.该用户不在群组内");
|
||
|
|
TUIKit_components_common_Toast_index.Toast({
|
||
|
|
message,
|
||
|
|
type: TUIKit_components_common_Toast_type.TOAST_TYPE.ERROR
|
||
|
|
});
|
||
|
|
}
|
||
|
|
transferList.value = transferList.value.filter(
|
||
|
|
(item) => {
|
||
|
|
var _a2, _b2;
|
||
|
|
return item.userID !== ((_b2 = (_a2 = imResponse == null ? void 0 : imResponse.data) == null ? void 0 : _a2.memberList[0]) == null ? void 0 : _b2.userID);
|
||
|
|
}
|
||
|
|
);
|
||
|
|
if ((_b = imResponse == null ? void 0 : imResponse.data) == null ? void 0 : _b.memberList.length) {
|
||
|
|
transferList.value = [
|
||
|
|
...transferList.value,
|
||
|
|
...imResponse.data.memberList
|
||
|
|
];
|
||
|
|
}
|
||
|
|
} catch (error) {
|
||
|
|
const message = common_vendor.Wt.t("TUIGroup.该用户不存在");
|
||
|
|
TUIKit_components_common_Toast_index.Toast({
|
||
|
|
message,
|
||
|
|
type: TUIKit_components_common_Toast_type.TOAST_TYPE.ERROR
|
||
|
|
});
|
||
|
|
}
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
};
|
||
|
|
const handleManage = (userList, type) => {
|
||
|
|
const userIDList = [];
|
||
|
|
userList.map((item) => {
|
||
|
|
userIDList.push(item.userID);
|
||
|
|
return item;
|
||
|
|
});
|
||
|
|
switch (type) {
|
||
|
|
case "add":
|
||
|
|
addMember(userIDList);
|
||
|
|
break;
|
||
|
|
case "remove":
|
||
|
|
deleteGroupMember(userIDList);
|
||
|
|
break;
|
||
|
|
case "addAdmin":
|
||
|
|
handleAdmin(userList[0]);
|
||
|
|
break;
|
||
|
|
case "removeAdmin":
|
||
|
|
handleAdmin(userList[0]);
|
||
|
|
break;
|
||
|
|
case "changeOwner":
|
||
|
|
changeOwner(userIDList[0]);
|
||
|
|
break;
|
||
|
|
case "addMute":
|
||
|
|
setMemberMuteTime(userIDList[0], "add");
|
||
|
|
break;
|
||
|
|
case "removeMute":
|
||
|
|
setMemberMuteTime(userIDList[0], "remove");
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
};
|
||
|
|
const addMember = async (userIDList) => {
|
||
|
|
const options = {
|
||
|
|
groupID: currentGroupID.value,
|
||
|
|
userIDList
|
||
|
|
};
|
||
|
|
await common_vendor.es.addGroupMember(options);
|
||
|
|
};
|
||
|
|
const changeOwner = async (userID) => {
|
||
|
|
const options = {
|
||
|
|
groupID: currentGroupID.value,
|
||
|
|
newOwnerID: userID
|
||
|
|
};
|
||
|
|
const imResponse = await common_vendor.es.changeGroupOwner(options);
|
||
|
|
currentGroup.value = {};
|
||
|
|
currentGroup.value = imResponse.data.group;
|
||
|
|
};
|
||
|
|
const setMemberMuteTime = async (userID, type) => {
|
||
|
|
const options = {
|
||
|
|
groupID: currentGroupID.value,
|
||
|
|
userID,
|
||
|
|
muteTime: type === "add" ? 60 * 60 * 24 * 30 : 0
|
||
|
|
};
|
||
|
|
await common_vendor.es.setGroupMemberMuteTime(options);
|
||
|
|
};
|
||
|
|
const handleAdmin = async (user) => {
|
||
|
|
let role = "";
|
||
|
|
switch (user.role) {
|
||
|
|
case common_vendor.qt.TYPES.GRP_MBR_ROLE_ADMIN:
|
||
|
|
role = common_vendor.qt.TYPES.GRP_MBR_ROLE_MEMBER;
|
||
|
|
break;
|
||
|
|
case common_vendor.qt.TYPES.GRP_MBR_ROLE_MEMBER:
|
||
|
|
role = common_vendor.qt.TYPES.GRP_MBR_ROLE_ADMIN;
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
const options = {
|
||
|
|
groupID: currentGroupID.value,
|
||
|
|
userID: user.userID,
|
||
|
|
role
|
||
|
|
};
|
||
|
|
await common_vendor.es.setGroupMemberRole(options);
|
||
|
|
};
|
||
|
|
const deleteGroupMember = async (userIDList) => {
|
||
|
|
const options = {
|
||
|
|
groupID: currentGroupID.value,
|
||
|
|
userIDList,
|
||
|
|
reason: ""
|
||
|
|
};
|
||
|
|
await common_vendor.es.deleteGroupMember(options);
|
||
|
|
};
|
||
|
|
const quitGroup = async (group) => {
|
||
|
|
await common_vendor.es.quitGroup(group.groupID);
|
||
|
|
clearGroupInfo();
|
||
|
|
};
|
||
|
|
const back = () => {
|
||
|
|
if (currentTab.value) {
|
||
|
|
setCurrentTab("");
|
||
|
|
} else {
|
||
|
|
handleCompleteManage();
|
||
|
|
}
|
||
|
|
};
|
||
|
|
const handleCompleteManage = () => {
|
||
|
|
common_vendor.Jt.update(common_vendor.o.GRP, "isShowManageComponent", false);
|
||
|
|
const callback = TUIGroupServer.getOnCallCallback(TUIConstants.TUIGroup.SERVICE.METHOD.OPEN_GROUP_MANAGEMENT);
|
||
|
|
callback && callback();
|
||
|
|
};
|
||
|
|
return (_ctx, _cache) => {
|
||
|
|
return common_vendor.e({
|
||
|
|
a: !common_vendor.unref(TUIKit_utils_env.isUniFrameWork) || common_vendor.unref(currentTab) === "admin"
|
||
|
|
}, !common_vendor.unref(TUIKit_utils_env.isUniFrameWork) || common_vendor.unref(currentTab) === "admin" ? {
|
||
|
|
b: common_vendor.o$1(back),
|
||
|
|
c: common_vendor.p({
|
||
|
|
file: common_vendor.unref(common_assets.backIcon)
|
||
|
|
}),
|
||
|
|
d: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.${common_vendor.unref(TabName)}`))
|
||
|
|
} : {}, {
|
||
|
|
e: !common_vendor.unref(currentTab) || common_vendor.unref(TUIKit_utils_env.isUniFrameWork) && common_vendor.unref(currentTab) != "admin"
|
||
|
|
}, !common_vendor.unref(currentTab) || common_vendor.unref(TUIKit_utils_env.isUniFrameWork) && common_vendor.unref(currentTab) != "admin" ? common_vendor.e({
|
||
|
|
f: common_vendor.o$1(updateProfile),
|
||
|
|
g: common_vendor.p({
|
||
|
|
isAuthor: common_vendor.unref(isOwner) || common_vendor.unref(isAdmin) || common_vendor.unref(isWorkGroup),
|
||
|
|
data: common_vendor.unref(currentGroup)
|
||
|
|
}),
|
||
|
|
h: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.群成员`)),
|
||
|
|
i: common_vendor.t(common_vendor.unref(currentGroup).memberCount || common_vendor.unref(groupMemberList).length),
|
||
|
|
j: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.人`)),
|
||
|
|
k: common_vendor.p({
|
||
|
|
file: common_vendor.unref(common_assets.rightIcon)
|
||
|
|
}),
|
||
|
|
l: common_vendor.o$1(($event) => setCurrentTab("member")),
|
||
|
|
m: common_vendor.f(common_vendor.unref(groupMemberList).slice(0, common_vendor.unref(showUserNum)), (item, index, i0) => {
|
||
|
|
return {
|
||
|
|
a: item.avatar || "https://web.sdk.qcloud.com/component/TUIKit/assets/avatar_21.png",
|
||
|
|
b: common_vendor.o$1(($event) => handleMemberProfileShow(item), index),
|
||
|
|
c: common_vendor.t(item.nick || item.userID),
|
||
|
|
d: index
|
||
|
|
};
|
||
|
|
}),
|
||
|
|
n: common_vendor.unref(isShowAddMember)
|
||
|
|
}, common_vendor.unref(isShowAddMember) ? {
|
||
|
|
o: common_vendor.o$1(($event) => toggleMask("add"))
|
||
|
|
} : {}, {
|
||
|
|
p: common_vendor.unref(currentSelfRole) === "Owner"
|
||
|
|
}, common_vendor.unref(currentSelfRole) === "Owner" ? {
|
||
|
|
q: common_vendor.o$1(($event) => toggleMask("remove"))
|
||
|
|
} : {}, {
|
||
|
|
r: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.群公告`)),
|
||
|
|
s: common_vendor.t(common_vendor.unref(currentGroup).notification),
|
||
|
|
t: common_vendor.p({
|
||
|
|
file: common_vendor.unref(common_assets.rightIcon)
|
||
|
|
}),
|
||
|
|
v: common_vendor.o$1(($event) => setCurrentTab("notification")),
|
||
|
|
w: (common_vendor.unref(isAdmin) || common_vendor.unref(isOwner)) && common_vendor.unref(isSetMuteTime)
|
||
|
|
}, (common_vendor.unref(isAdmin) || common_vendor.unref(isOwner)) && common_vendor.unref(isSetMuteTime) ? {
|
||
|
|
x: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.群管理`)),
|
||
|
|
y: common_vendor.p({
|
||
|
|
file: common_vendor.unref(common_assets.rightIcon)
|
||
|
|
}),
|
||
|
|
z: common_vendor.o$1(($event) => setCurrentTab("admin"))
|
||
|
|
} : {}, {
|
||
|
|
A: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.群ID`)),
|
||
|
|
B: common_vendor.t(common_vendor.unref(currentGroupID)),
|
||
|
|
C: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.群头像`)),
|
||
|
|
D: common_vendor.unref(currentGroup).avatar || "https://web.sdk.qcloud.com/im/demo/TUIkit/web/img/constomer.svg",
|
||
|
|
E: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.群类型`)),
|
||
|
|
F: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.${common_vendor.unref(typeName)[common_vendor.unref(currentGroup).type]}`)),
|
||
|
|
G: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.加群方式`)),
|
||
|
|
H: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.${common_vendor.unref(typeName)[common_vendor.unref(currentGroup).joinOption]}`)),
|
||
|
|
I: common_vendor.o$1(($event) => editLableName.value = ""),
|
||
|
|
J: common_vendor.unref(currentSelfRole) === "Owner" && common_vendor.unref(groupMemberList).length > 1
|
||
|
|
}, common_vendor.unref(currentSelfRole) === "Owner" && common_vendor.unref(groupMemberList).length > 1 ? {
|
||
|
|
K: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.转让群组`)),
|
||
|
|
L: common_vendor.o$1(($event) => toggleMask("changeOwner"))
|
||
|
|
} : {}, {
|
||
|
|
M: common_vendor.unref(canIDissmissGroup)
|
||
|
|
}, common_vendor.unref(canIDissmissGroup) ? {
|
||
|
|
N: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.解散群聊`)),
|
||
|
|
O: common_vendor.o$1(($event) => dismissGroup(common_vendor.unref(currentGroup)))
|
||
|
|
} : {
|
||
|
|
P: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.退出群组`)),
|
||
|
|
Q: common_vendor.o$1(($event) => quitGroup(common_vendor.unref(currentGroup)))
|
||
|
|
}) : {}, {
|
||
|
|
R: common_vendor.unref(currentTab) === "member"
|
||
|
|
}, common_vendor.unref(currentTab) === "member" ? {
|
||
|
|
S: common_vendor.o$1(($event) => getMember("more")),
|
||
|
|
T: common_vendor.o$1(submit),
|
||
|
|
U: common_vendor.o$1(handleMemberProfileShow),
|
||
|
|
V: common_vendor.o$1(($event) => setCurrentTab("")),
|
||
|
|
W: common_vendor.p({
|
||
|
|
self: common_vendor.unref(currentGroup).selfInfo,
|
||
|
|
list: common_vendor.unref(groupMemberList),
|
||
|
|
total: ~~common_vendor.unref(currentGroup).memberCount,
|
||
|
|
isShowDel: common_vendor.unref(currentSelfRole) === "Owner" && common_vendor.unref(canDelMember)
|
||
|
|
})
|
||
|
|
} : {}, {
|
||
|
|
X: common_vendor.unref(currentTab) === "profile"
|
||
|
|
}, common_vendor.unref(currentTab) === "profile" ? {
|
||
|
|
Y: common_vendor.o$1(($event) => setCurrentTab("")),
|
||
|
|
Z: common_vendor.p({
|
||
|
|
userInfo: common_vendor.unref(currentMember)
|
||
|
|
})
|
||
|
|
} : {}, {
|
||
|
|
aa: common_vendor.unref(currentTab) === "notification"
|
||
|
|
}, common_vendor.unref(currentTab) === "notification" ? {
|
||
|
|
ab: common_vendor.o$1(updateProfile),
|
||
|
|
ac: common_vendor.o$1(($event) => setCurrentTab("")),
|
||
|
|
ad: common_vendor.p({
|
||
|
|
isAuthor: common_vendor.unref(isOwner) || common_vendor.unref(isAdmin) || common_vendor.unref(isWorkGroup),
|
||
|
|
data: common_vendor.unref(currentGroup)
|
||
|
|
})
|
||
|
|
} : {}, {
|
||
|
|
ae: common_vendor.unref(currentTab) === "admin"
|
||
|
|
}, common_vendor.unref(currentTab) === "admin" ? {
|
||
|
|
af: common_vendor.unref(isAdmin),
|
||
|
|
ag: common_vendor.o$1(($event) => toggleMask("addAdmin")),
|
||
|
|
ah: common_vendor.o$1(($event) => toggleMask("removeAdmin")),
|
||
|
|
ai: common_vendor.o$1(setAllMuteTime),
|
||
|
|
aj: common_vendor.o$1(($event) => toggleMask("addMute")),
|
||
|
|
ak: common_vendor.o$1(($event) => toggleMask("removeMute")),
|
||
|
|
al: common_vendor.o$1(($event) => setCurrentTab("")),
|
||
|
|
am: common_vendor.p({
|
||
|
|
isSetMuteTime: common_vendor.unref(isSetMuteTime),
|
||
|
|
member: common_vendor.unref(member),
|
||
|
|
currentGroup: common_vendor.unref(currentGroup)
|
||
|
|
})
|
||
|
|
} : {}, {
|
||
|
|
an: common_vendor.o$1(submit),
|
||
|
|
ao: common_vendor.o$1(cancel),
|
||
|
|
ap: common_vendor.o$1(handleSearchMember),
|
||
|
|
aq: common_vendor.p({
|
||
|
|
title: common_vendor.unref(common_vendor.Wt).t(`TUIGroup.${common_vendor.unref(transferTitle)}`),
|
||
|
|
list: common_vendor.unref(transferList),
|
||
|
|
isSearch: common_vendor.unref(isSearch),
|
||
|
|
isRadio: common_vendor.unref(isRadio),
|
||
|
|
selectedList: common_vendor.unref(selectedList),
|
||
|
|
isH5: !common_vendor.unref(TUIKit_utils_env.isPC)
|
||
|
|
}),
|
||
|
|
ar: common_vendor.o$1((e) => mask.value = e),
|
||
|
|
as: common_vendor.p({
|
||
|
|
show: common_vendor.unref(mask)
|
||
|
|
}),
|
||
|
|
at: common_vendor.unref(deletedUserList).length === 1
|
||
|
|
}, common_vendor.unref(deletedUserList).length === 1 ? {
|
||
|
|
av: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.确定从群聊中删除该成员?`))
|
||
|
|
} : {}, {
|
||
|
|
aw: common_vendor.unref(deletedUserList).length > 1
|
||
|
|
}, common_vendor.unref(deletedUserList).length > 1 ? {
|
||
|
|
ax: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIGroup.确定从群聊中删除所选成员?`))
|
||
|
|
} : {}, {
|
||
|
|
ay: common_vendor.o$1(($event) => handleManage(common_vendor.unref(deletedUserList), "remove")),
|
||
|
|
az: common_vendor.o$1((e) => delDialogShow.value = e),
|
||
|
|
aA: common_vendor.p({
|
||
|
|
title: common_vendor.unref(common_vendor.Wt).t(`TUIGroup.删除成员`),
|
||
|
|
show: common_vendor.unref(delDialogShow),
|
||
|
|
isH5: !common_vendor.unref(TUIKit_utils_env.isPC),
|
||
|
|
center: true,
|
||
|
|
isHeaderShow: common_vendor.unref(TUIKit_utils_env.isPC)
|
||
|
|
})
|
||
|
|
});
|
||
|
|
};
|
||
|
|
}
|
||
|
|
});
|
||
|
|
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-e56d1843"]]);
|
||
|
|
wx.createComponent(Component);
|
||
|
|
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/TUIKit/components/TUIGroup/manage-group/index.js.map
|