Files
im/pages/conversation/groupManage/index.vue
T
cansnow 69a61178e1 10
2025-12-05 16:10:52 +08:00

87 lines
2.7 KiB
Vue

<template>
<view class="group_settings_container">
<u-navbar :autoBack="true" bgColor="#ECECEC" title="群管理" safeAreaInsetTop placeholder fixed></u-navbar>
<uni-list>
<uni-list-item title="群主管理权转让" @click="toTransfer" showArrow clickable></uni-list-item>
<uni-list-item title="进群验证" @switchChange="updateGroupInfo('needVerification',storeCurrentGroup.needVerification==1 ? 2: 1)" showSwitch :switchChecked="!(storeCurrentGroup.needVerification != 1)"></uni-list-item>
<uni-list-item title="允许查看成员资料" @switchChange="updateGroupInfo('lookMemberInfo',storeCurrentGroup.applyMemberFriend == 1 ? 0 : 1)" showSwitch :switchChecked="storeCurrentGroup.applyMemberFriend==0"></uni-list-item>
<uni-list-item title="允许群内添加好友" @switchChange="updateGroupInfo('applyMemberFriend',storeCurrentGroup.applyMemberFriend == 1 ? 0 : 1)" showSwitch :switchChecked="storeCurrentGroup.applyMemberFriend==0"></uni-list-item>
<uni-list-item :title="isMute ? '解除禁言':'全员禁言'" @switchChange="updateMute" showSwitch :switchChecked="isMute"></uni-list-item>
</uni-list>
</view>
</template>
<script>
import {mapGetters} from "vuex";
import IMSDK, {
GroupMemberRole,
GroupStatus,
GroupVerificationType,
IMMethods,
MessageReceiveOptType,
} from "openim-uniapp-polyfill";
import {GroupMemberListTypes} from "@/constant";
export default {
data() {
return {
isMute:false,
};
},
computed: {
...mapGetters([
"storeCurrentConversation",
"storeCurrentMemberInGroup",
"storeCurrentGroup",
]),
},
onLoad() {
// IMSDK.asyncApi('getSpecifiedGroupsInfo', IMSDK.uuid(), [this.storeCurrentGroup.groupID]).then(res=>{
// console.log(res);
// }).catch(e=>{
// console.log(e);
// })
},
methods: {
toTransfer() {
uni.navigateTo({
url: `/pages/conversation/groupMemberList/index?type=${GroupMemberListTypes.Transfer}&groupID=${this.storeCurrentGroup.groupID}`,
});
},
updateMute(){
IMSDK.asyncApi('changeGroupMute', IMSDK.uuid(), {
groupID: this.storeCurrentGroup.groupID,
isMute: this.isMute
}).then(res=>{
console.log(res);
}).catch(e=>{
console.log(e);
})
},
updateGroupInfo(field,value1){
const data = {groupID:this.storeCurrentGroup.groupID};
data[field] = value1;
IMSDK.asyncApi('setGroupInfo', IMSDK.uuid(),data).then(res=>{
console.log(res);
}).catch(e=>{
console.log(e);
})
},
},
};
</script>
<style lang="scss" scoped>
.group_settings_container {
@include colBox(false);
height: 100vh;
background-color: #f6f6f6;
.setting_row {
background-color: #fff;
margin: 24rpx 24rpx 0;
border-radius: 6px;
overflow: hidden;
}
}
</style>