This commit is contained in:
cansnow
2026-01-15 22:50:35 +08:00
parent dd16348558
commit db99bebcb4
26 changed files with 433 additions and 284 deletions
@@ -5,6 +5,11 @@
<view class="mute_tip" v-else>您被禁言至{{date(storeCurrentMemberInGroup.muteEndTime)}}</view>
</view>
</view>
<view v-else-if="!isSingle && !storeCurrentMemberInGroup.userID">
<view class="forbidden_footer">
<view class="mute_tip">您不是群成员</view>
</view>
</view>
<view v-else>
<view class="chat_footer">
<!-- 语音信息 -->
@@ -57,7 +62,7 @@
import {getPurePath,html2Text,getVideoCover,getVideoInfo} from "@/util/common";
import {offlinePushInfo,date} from "@/util/imCommon";
import {ChatingFooterActionTypes,UpdateMessageTypes,} from "@/constant";
import IMSDK, {IMMethods,MessageStatus,MessageType,} from "openim-uniapp-polyfill";
import IMSDK, {IMMethods,MessageStatus,MessageType,SessionType} from "openim-uniapp-polyfill";
import CustomEditor from "./CustomEditor";
import SimpleEditor from "./SimpleEditor";
import ChatingActionBar from "./ChatingActionBar";
@@ -111,6 +116,11 @@
"storeCurrentUserID",
"storeCurrentMemberInGroup"
]),
isSingle() {
return (
this.storeCurrentConversation.conversationType === SessionType.Single
);
},
hasContent() {
return html2Text(this.inputHtml) !== "";
},
@@ -118,6 +128,9 @@
return this.storeCurrentMemberInGroup && this.storeCurrentMemberInGroup?.roleLevel>20;
},
isMute(){
if(this.isSingle){
return false;
}
if(this.storeCurrentGroup && this.storeCurrentGroup.status === 3 && !this.isAdminOrOwner){
return true;
}
@@ -193,12 +193,7 @@
},
methods: {
viewDetail(){
if(this.isSender){
}else{
uni.navigateTo({
url:"/pages/common/userCard/index?sourceID="+this.source.sendID
})
}
this.$emit('userEvent',{type:"avatarClick"},this.source);
},
toAnnouncement(){
uni.navigateTo({
+20 -1
View File
@@ -26,7 +26,7 @@
import SelectHeader from "./components/SelectHeader";
import SelectFooter from "./components/SelectFooter";
import {markConversationAsRead} from "@/util/imCommon";
import IMSDK, {MessageType,GroupMemberRole} from "openim-uniapp-polyfill";
import IMSDK, {MessageType,GroupMemberRole,SessionType} from "openim-uniapp-polyfill";
import util from "@/util/index.js"
export default {
components: {
@@ -59,6 +59,11 @@
"storeCurrentGroup",
"storeCurrentMemberInGroup"
]),
isSingle() {
return (
this.storeCurrentConversation.conversationType === SessionType.Single
);
},
isOwner() {
return this.storeCurrentMemberInGroup.roleLevel === GroupMemberRole.Owner;
},
@@ -398,6 +403,20 @@
})
return;
}
if (e.type == 'avatarClick'){
if(data.sendID == this.storeCurrentUserID){
return ;
}
if(!_this.isSingle){
if(this.storeCurrentMemberInGroup.roleLevel < 60 && this.storeCurrentGroup.lookMemberInfo!=0){
return ;
}
}
uni.navigateTo({
url:"/pages/common/userCard/index?sourceID="+data.sendID
})
return ;
}
}
},
onBackPress() {
@@ -16,6 +16,7 @@
</view>
<view class="lastest_msg_wrap">
<text class="lastest_msg_content">{{ latestMessage }}</text>
<uni-icons v-if="source.recvMsgOpt===2" custom-prefix="imfont" type="im-bell-off" size="16" color="#ddd"></uni-icons>
</view>
</view>
</view>
@@ -47,6 +48,7 @@
parsedMessage = JSON.parse(this.source.latestMsg);
} catch (e) {}
if (!parsedMessage) return "";
//console.log(parsedMessage);
return getConversationContent(parsedMessage);
},
latestMessageTime() {
@@ -64,7 +66,7 @@
},
methods: {
clickConversationItem() {
console.log(this.source);
//console.log(this.source);
prepareConversationState(this.source);
},
longtapConversationItem() {
@@ -148,6 +150,7 @@
.lastest_msg_wrap {
display: flex;
align-items: center;
font-size: 24rpx;
margin: 10rpx 0;
color: #666;
+29 -18
View File
@@ -2,13 +2,15 @@
<view class="conversation_container">
<chat-header ref="chatHeaderRef" />
<uni-swipe-action ref="swipe_action">
<template v-for="item in storeConversationList" >
<uni-swipe-action-item
v-if="item.sendID !='system1'"
:right-options="swipe_actions"
@click="actionClick($event,item)"
v-for="item in storeConversationList"
:key="item.conversationID" >
<conversation-item @longtapEvent="showExtendMenu(item)" :source="item"/>
</uni-swipe-action-item>
</template>
</uni-swipe-action>
<view class="loading_wrap" v-if="storeProgress > 0 && storeProgress < 100">
<u-loading-icon :vertical="true" :text="storeProgress + '%'"></u-loading-icon>
@@ -59,7 +61,12 @@
};
},
computed: {
...mapGetters(["storeConversationList", "storeIsSyncing", "storeProgress",'storeCurrentUserID']),
...mapGetters([
"storeConversationList",
"storeIsSyncing",
"storeProgress",
'storeCurrentUserID'
]),
},
onReady() {
// #ifdef APP
@@ -87,33 +94,33 @@
},
showExtendMenu(item){
const _this = this;
const menu = [item.recvMsgOpt===0 ? '关闭免打扰':'免打扰',item.isPrivateChat? '关闭阅后即焚':'开启阅后即焚','隐藏',item.isPinned ? '取消置顶':'置顶','删除'];
const menu = [item.recvMsgOpt===0 ? '免打扰':'关闭免打扰',item.isPrivateChat? '关闭阅后即焚':'开启阅后即焚','隐藏',item.isPinned ? '取消置顶':'置顶','删除'];
uni.showActionSheet({
itemList:menu,
success(e) {
switch(menu[e.tapIndex]){
case '免打扰':
IMSDK.asyncApi('setConversation', IMSDK.uuid(), {
conversationID: conversationId,
_this.setConversation({
conversationID: item.conversationID,
recvMsgOpt: 2
})
break;
case '关闭免打扰':
IMSDK.asyncApi('setConversation', IMSDK.uuid(), {
conversationID: conversationId,
_this.setConversation({
conversationID: item.conversationID,
recvMsgOpt: 0
})
break;
case '开启阅后即焚':
IMSDK.asyncApi('setConversation', IMSDK.uuid(), {
conversationID: conversationId,
_this.setConversation({
conversationID: item.conversationID,
isPrivateChat: true,
burnDuration:60
})
break;
case '关闭阅后即焚':
IMSDK.asyncApi('setConversation', IMSDK.uuid(), {
conversationID: conversationId,
_this.setConversation({
conversationID: item.conversationID,
isPrivateChat: false
})
break;
@@ -121,10 +128,16 @@
IMSDK.asyncApi('hideConversation', IMSDK.uuid(), item.conversationID)
break;
case '置顶':
_this.setPinConversation(item.conversationID,true);
_this.setConversation({
conversationID: item.conversationID,
isPinned: true
});
break;
case '取消置顶':
_this.setPinConversation(item.conversationID,false);
_this.setConversation({
conversationID: item.conversationID,
isPinned: false
})
break;
case '删除':
_this.deleteConversation(item.conversationID);
@@ -155,11 +168,9 @@
})
},
setPinConversation(conversationId,status){
IMSDK.asyncApi('setConversation', IMSDK.uuid(), {
conversationID: conversationId,
isPinned: status
})
async setConversation(data){
await IMSDK.asyncApi('setConversation', IMSDK.uuid(), data);
},
onRefresh() {
+3 -3
View File
@@ -6,8 +6,8 @@
<uni-list-item title="设置管理员" @click="setAdmin" 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="进群验证" :rightText="verifyTypeText" @click="changeVerify" clickable></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="允许查看成员资料" @switchChange="updateGroupInfo('lookMemberInfo',storeCurrentGroup.lookMemberInfo == 1 ? 0 : 1)" showSwitch :switchChecked="storeCurrentGroup.lookMemberInfo==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="全员禁言" @switchChange="updateMute" showSwitch :switchChecked="isMute"></uni-list-item>
</uni-list>
@@ -42,7 +42,7 @@
},
onLoad() {
this.isMute = this.storeCurrentGroup.status == 3;
//console.log(this.storeCurrentGroup);
console.log(this.storeCurrentGroup);
// IMSDK.asyncApi('getSpecifiedGroupsInfo', IMSDK.uuid(), [this.storeCurrentGroup.groupID]).then(res=>{
// console.log(res);
// }).catch(e=>{
+20 -9
View File
@@ -53,6 +53,7 @@
<script>
let moreActionArea;
import {mapActions,mapGetters} from "vuex";
import {GroupMemberListTypes} from "@/constant";
import IMSDK, {GroupMemberRole} from "openim-uniapp-polyfill";
import UserItem from "@/components/UserItem/index.vue";
@@ -86,6 +87,11 @@
};
},
computed: {
...mapGetters([
'storeCurrentUserID',
'storeCurrentGroup',
"storeCurrentMemberInGroup"
]),
getChoosedData() {
const tmpList = [...this.choosedMemberIDList];
return this.groupMemberList.filter(
@@ -112,13 +118,13 @@
},
isOwner() {
return (
this.$store.getters.storeCurrentMemberInGroup.roleLevel ===
this.storeCurrentMemberInGroup.roleLevel ===
GroupMemberRole.Owner
);
},
isAdmin() {
return (
this.$store.getters.storeCurrentMemberInGroup.roleLevel === GroupMemberRole.Admin
this.storeCurrentMemberInGroup.roleLevel === GroupMemberRole.Admin
);
},
canCheck() {
@@ -128,17 +134,16 @@
}) => {
if (this.type === GroupMemberListTypes.Kickout) {
return (
(this.isOwner ||
(this.isAdmin && roleLevel !== GroupMemberRole.Owner)) &&
userID !== this.$store.getters.storeCurrentUserID
(this.isOwner || (this.isAdmin && roleLevel !== GroupMemberRole.Owner)) &&
userID !== this.$store.storeCurrentUserID
);
}
return userID !== this.$store.getters.storeCurrentUserID;
return userID !== this.$store.storeCurrentUserID;
};
},
groupMemberLength() {
return this.$store.getters.storeCurrentGroup?.memberCount ?? 0;
return this.storeCurrentGroup?.memberCount ?? 0;
},
},
@@ -284,10 +289,16 @@
},
userClick(member) {
if (this.type === GroupMemberListTypes.Transfer) {
if (member.userID === this.$store.getters.storeCurrentUserID) return;
if (member.userID === this.storeCurrentUserID) return;
this.choosedTransferMember = member;
this.showConfirmModal = true;
} else {
if(member.userID == this.storeCurrentUserID){
return ;
}
if(this.storeCurrentMemberInGroup.roleLevel < 60 && this.storeCurrentGroup.lookMemberInfo!=0){
return ;
}
const s = util.aesencode(member);
uni.$u.route("/pages/common/userCard/index", {
sourceID: member.userID,
@@ -334,7 +345,7 @@
if(!this.isOwner&&!this.isAdmin){
return ;
}
if(this.$store.getters.storeCurrentMemberInGroup.roleLevel <= member.roleLevel ){
if(this.storeCurrentMemberInGroup.roleLevel <= member.roleLevel ){
return ;
}
let itemList = [];