10
This commit is contained in:
@@ -3,10 +3,8 @@
|
||||
<view>
|
||||
<view class="chat_footer">
|
||||
<!-- 语音信息 -->
|
||||
<image v-if="1==2" v-show="!isAudio" @click.prevent="isAudio=!isAudio"
|
||||
src="@/static/images/chating_footer_audio.png" alt="" srcset="" />
|
||||
<image v-if="1==2" v-show="isAudio" @click.prevent="isAudio=!isAudio"
|
||||
src="@/static/images/chating_footer_audio_recording.png" alt="" srcset="" />
|
||||
<image v-if="1==2" v-show="!isAudio" @click.prevent="isAudio=!isAudio" src="@/static/images/chating_footer_audio.png" alt="" srcset="" />
|
||||
<image v-if="1==2" v-show="isAudio" @click.prevent="isAudio=!isAudio" src="@/static/images/chating_footer_audio_recording.png" alt="" srcset="" />
|
||||
<view class="input_content">
|
||||
<!-- #ifdef APP-PLUS -->
|
||||
<view v-if="isAudio" class="voice_title" @touchstart.stop.prevent="startVoice"
|
||||
@@ -20,14 +18,12 @@
|
||||
</view>
|
||||
|
||||
<view class="footer_action_area" v-show="!isAudio">
|
||||
<image class="emoji_action" @click.prevent="updateActionBar(true)"
|
||||
src="@/static/images/chating_footer_emoji.png" alt="" srcset="" />
|
||||
<image v-show="!hasContent" @click.prevent="updateActionBar"
|
||||
src="@/static/images/chating_footer_add.png" alt="" srcset="" />
|
||||
<image class="emoji_action" @click.prevent="updateActionBar(true)" src="@/static/images/chating_footer_emoji.png" alt="" srcset="" />
|
||||
<image v-show="!hasContent" @click.prevent="updateActionBar(false)" src="@/static/images/chating_footer_add.png" alt="" srcset="" />
|
||||
<button class="send_btn" type="primary" v-show="hasContent" @touchend.prevent="sendTextMessage">发送</button>
|
||||
</view>
|
||||
</view>
|
||||
<chating-action-bar :isEmoji="isEmoji" @sendMessage="sendMessage" @prepareMediaMessage="prepareMediaMessage"
|
||||
<chating-action-bar :isEmoji="isEmoji" @sendMessage="sendMessage($event,storeCurrentConversation.userID,storeCurrentConversation.groupID)" @prepareMediaMessage="prepareMediaMessage"
|
||||
v-show="actionBarVisible" />
|
||||
<u-action-sheet :safeAreaInsetBottom="true" round="12" :actions="actionSheetMenu" @select="selectClick"
|
||||
:closeOnClickOverlay="true" :closeOnClickAction="true" :show="showActionSheet"
|
||||
@@ -142,17 +138,17 @@
|
||||
async sendTextMessage() {
|
||||
if (!this.hasContent) return;
|
||||
const message = await this.createTextMessage();
|
||||
this.sendMessage(message);
|
||||
this.sendMessage(message,this.storeCurrentConversation.userID,this.storeCurrentConversation.groupID);
|
||||
},
|
||||
sendMessage(message) {
|
||||
sendMessage(message,user_id,group_id) {
|
||||
this.pushNewMessage(message);
|
||||
if (needClearTypes.includes(message.contentType)) {
|
||||
this.customEditorCtx.clear();
|
||||
}
|
||||
this.$emit("scrollToBottom");
|
||||
IMSDK.asyncApi(IMMethods.SendMessage, IMSDK.uuid(), {
|
||||
recvID: this.storeCurrentConversation.userID,
|
||||
groupID: this.storeCurrentConversation.groupID,
|
||||
recvID: user_id,
|
||||
groupID: group_id,
|
||||
message,
|
||||
offlinePushInfo,
|
||||
})
|
||||
@@ -289,7 +285,7 @@
|
||||
IMSDK.uuid(),
|
||||
getPurePath(path)
|
||||
);
|
||||
this.sendMessage(message);
|
||||
this.sendMessage(message,this.storeCurrentConversation.userID,this.storeCurrentConversation.groupID);
|
||||
});
|
||||
},
|
||||
selectClick({idx}) {
|
||||
|
||||
@@ -5,13 +5,18 @@
|
||||
upper-threshold="250" @scrolltoupper="scrolltoupper">
|
||||
<view id="scroll_wrap">
|
||||
<u-loadmore nomoreText="" :status="loadMoreStatus" />
|
||||
<view v-for="item in storeHistoryMessageList" :key="item.clientMsgID">
|
||||
<view class="msg_item" v-for="item in storeHistoryMessageList" :key="item.clientMsgID" @click="onUserMessageEvent({type:'selected'},item)">
|
||||
<template v-if="selectFlag">
|
||||
<uni-icons class="selectedIcon" size="30" color="#07c160" type="checkbox-filled" v-if="selectClientMsgIDItems.indexOf(item.clientMsgID)>-1"></uni-icons>
|
||||
<uni-icons class="selectedIcon" size="30" color="#ccc" type="circle" v-else></uni-icons>
|
||||
</template>
|
||||
<message-item-render
|
||||
@messageItemRender="messageItemRender"
|
||||
@longpress="onLongPressMessageItem(item)"
|
||||
@userEvent="onUserMessageEvent"
|
||||
:source="item"
|
||||
:isSender="item.sendID === storeCurrentUserID"
|
||||
/>
|
||||
<!-- :isActive="selectClientMsgIDItems.indexOf(item.clientMsgID)>-1" -->
|
||||
</view>
|
||||
<view style="visibility: hidden; height: 12px" id="auchormessage_bottom_item"></view>
|
||||
</view>
|
||||
@@ -19,10 +24,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapGetters,
|
||||
mapActions
|
||||
} from "vuex";
|
||||
import {mapGetters,mapActions} from "vuex";
|
||||
import MessageItemRender from "./MessageItem/index.vue";
|
||||
|
||||
export default {
|
||||
@@ -30,7 +32,18 @@
|
||||
components: {
|
||||
MessageItemRender,
|
||||
},
|
||||
props: {},
|
||||
props: {
|
||||
selectFlag:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
},
|
||||
selectItems:{
|
||||
type:Array,
|
||||
default(){
|
||||
return [];
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
scrollIntoView: "",
|
||||
@@ -45,7 +58,7 @@
|
||||
withAnimation: false,
|
||||
messageLoadState: {
|
||||
loading: false,
|
||||
},
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -62,6 +75,13 @@
|
||||
}
|
||||
return this.messageLoadState.loading ? "loading" : "loadmore";
|
||||
},
|
||||
selectClientMsgIDItems(){
|
||||
let arr = [];
|
||||
this.selectItems.forEach((v,k)=>{
|
||||
arr.push(v.clientMsgID);
|
||||
});
|
||||
return arr;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.loadMessageList();
|
||||
@@ -90,10 +110,7 @@
|
||||
viewType: 0,
|
||||
};
|
||||
try {
|
||||
const {
|
||||
emptyFlag
|
||||
} =
|
||||
await this.getHistoryMesageList(options);
|
||||
const {emptyFlag} =await this.getHistoryMesageList(options);
|
||||
if (emptyFlag) {
|
||||
this.$emit("initSuccess");
|
||||
}
|
||||
@@ -112,10 +129,7 @@
|
||||
this.$emit("click", e);
|
||||
},
|
||||
onScroll(event) {
|
||||
const {
|
||||
scrollHeight,
|
||||
scrollTop
|
||||
} = event.target;
|
||||
const {scrollHeight,scrollTop} = event.target;
|
||||
this.old.scrollTop = scrollTop
|
||||
this.needScoll =
|
||||
scrollHeight - scrollTop < uni.getWindowInfo().windowHeight * 1.2;
|
||||
@@ -162,9 +176,7 @@
|
||||
});
|
||||
},
|
||||
checkInitHeight() {
|
||||
this.getEl("#scroll_view").then(({
|
||||
height
|
||||
}) => {
|
||||
this.getEl("#scroll_view").then(({height}) => {
|
||||
this.bgHeight = `${height}px`;
|
||||
});
|
||||
},
|
||||
@@ -179,9 +191,10 @@
|
||||
.exec();
|
||||
});
|
||||
},
|
||||
onLongPressMessageItem(msg){
|
||||
|
||||
}
|
||||
onUserMessageEvent(e,data){
|
||||
this.$emit('userEvent',e,data)
|
||||
},
|
||||
empty(){}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -255,4 +268,16 @@
|
||||
.fade-enter {
|
||||
opacity: 0;
|
||||
}
|
||||
.msg_item{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: flex-start;
|
||||
width: 100%;
|
||||
.message_item{
|
||||
flex:1;
|
||||
}
|
||||
.selectedIcon{
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -15,7 +15,7 @@
|
||||
<image v-if="isFailedMessage && !isPreview" src="@/static/images/chating_message_failed.png" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="message_content_wrap message_content_wrap_shadow" @longtap="longtap($event)">
|
||||
<view class="message_content_wrap message_content_wrap_shadow" :id="`message_content_wrap_${source.clientMsgID}`" @longtap.stop.prevent="longtapEvent($event)">
|
||||
<text-message-render v-if="showTextRender" :message="source" />
|
||||
<media-message-render v-else-if="showMediaRender" :message="source" />
|
||||
<error-message-render v-else />
|
||||
@@ -26,11 +26,12 @@
|
||||
<!-- 长按菜单 -->
|
||||
<chunLei-popups v-model="toolTipFlag" :popData="toolTipData" @tapPopup="tapPopup"
|
||||
:x="toolTipX" :y="toolTipY" :placement="popPostion"
|
||||
:triangle="false"
|
||||
direction="row" theme="dark" :dynamic="true">
|
||||
</chunLei-popups>
|
||||
</view>
|
||||
|
||||
<view v-else class="notice_message_container" :id="`auchor${source.clientMsgID}`">
|
||||
<view v-else class="notice_message_container" style="margin: 0 auto;" :id="`auchor${source.clientMsgID}`">
|
||||
<text>{{ getNoticeContent }}</text>
|
||||
</view>
|
||||
</template>
|
||||
@@ -74,7 +75,6 @@
|
||||
toolTipFlag: false,
|
||||
popPostion:"default",
|
||||
toolTipData: [],
|
||||
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -137,9 +137,17 @@
|
||||
}, 2000);
|
||||
}
|
||||
},
|
||||
longtap(e){
|
||||
console.log(e.target,e.currentTarget);
|
||||
this.showToolTip(e);
|
||||
longtapEvent(e){
|
||||
console.log('longtapEvent');
|
||||
// console.log("#"+e.currentTarget.id,e);
|
||||
// let view = uni.createSelectorQuery().in(this).select("#"+e.currentTarget.id.replace('message_content_wrap_','auchor'));
|
||||
// console.log(e.touches[0].clientX,e.touches[0].clientY);
|
||||
// view.boundingClientRect((data) => {
|
||||
// console.log(data.left,data.top);
|
||||
// //console.log("得到布局位置信息" + JSON.stringify(data));
|
||||
// }).exec();
|
||||
this.$emit('userEvent',{type:"longtapMsgContent"},this.source);
|
||||
//this.showToolTip(e);
|
||||
},
|
||||
//操作项
|
||||
showToolTip: function(e) {
|
||||
@@ -158,11 +166,23 @@
|
||||
disabled: false
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
icon: '/static/images/chat/longTipIcon/tag.png',
|
||||
title: '编辑',
|
||||
id: 6,
|
||||
icon: '/static/images/chat/longTipIcon/select.png',
|
||||
title: '多选',
|
||||
disabled: false
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
icon: '/static/images/chat/longTipIcon/delete.png',
|
||||
title: '删除',
|
||||
disabled: false
|
||||
},
|
||||
// {
|
||||
// id: 5,
|
||||
// icon: '/static/images/chat/longTipIcon/tag.png',
|
||||
// title: '编辑',
|
||||
// disabled: false
|
||||
// }
|
||||
];
|
||||
that.toolTipX =e.touches[0].clientX;
|
||||
that.toolTipY = e.touches[0].clientY-20;
|
||||
@@ -184,18 +204,19 @@
|
||||
tapPopup(e) {
|
||||
let that = this;
|
||||
let currentHandleMsg=that.source;
|
||||
console.log(currentHandleMsg);
|
||||
if (e.title == "撤回") {
|
||||
let editMessage=JSON.parse(JSON.stringify(currentHandleMsg));
|
||||
that.$emit("revertMsg",editMessage)
|
||||
that.toolTipFlag = false;
|
||||
that.$emit('userEvent',{type:'revokeMessage'},that.source);
|
||||
}
|
||||
if (e.title == "复制") {
|
||||
let content = currentHandleMsg.content;
|
||||
let content = currentHandleMsg.textElem?.content;
|
||||
if (content) {
|
||||
let copyContent =content.text;
|
||||
let formatStr = this.replaceReseverEmoji(copyContent);
|
||||
that.globalUtil.uniCopy({
|
||||
content: formatStr,
|
||||
let formatStr = copyContent;
|
||||
//let formatStr = this.replaceReseverEmoji(copyContent);
|
||||
uni.setClipboardData({
|
||||
data:formatStr,
|
||||
success: (res) => {
|
||||
uni.showToast({
|
||||
title: res,
|
||||
@@ -215,15 +236,8 @@
|
||||
return;
|
||||
}
|
||||
if (e.title == "转发") {
|
||||
that.$emit('userEvent',{type:'forward'},that.source);
|
||||
that.toolTipFlag = false;
|
||||
/* that.$u.route({
|
||||
url: '/pages/chat/chatGroup/msgForward',
|
||||
params: {
|
||||
msgList:encodeURIComponent(JSON.stringify([currentHandleMsg])),
|
||||
sendType: 1, //1 单条转发 2多条转发
|
||||
fromChatGroupId: currentHandleMsg.groupId
|
||||
}
|
||||
}) */
|
||||
return
|
||||
}
|
||||
if(e.title=="调换"){
|
||||
@@ -231,24 +245,16 @@
|
||||
return;
|
||||
}
|
||||
if (e.title == "多选") {
|
||||
that.$emit('userEvent',{type:'select'},that.source);
|
||||
that.toolTipFlag = false;
|
||||
/* that.$u.route({
|
||||
url: '/pages/chat/chatting/chatting-checkbox',
|
||||
params: {
|
||||
groupId:currentHandleMsg.groupId,
|
||||
pageNum:1,
|
||||
selectMsgId: currentHandleMsg.id,
|
||||
}
|
||||
}) */
|
||||
return
|
||||
}
|
||||
if(e.title=="编辑"){
|
||||
let editMessage=JSON.parse(JSON.stringify(currentHandleMsg));
|
||||
editMessage.formatTimeStr=currentHandleMsg.createTime;
|
||||
that.$emit("showUpdateMsg",editMessage)
|
||||
if (e.title == "删除") {
|
||||
that.toolTipFlag = false;
|
||||
return;
|
||||
that.$emit('userEvent',{type:'deleteMsg'},that.source);
|
||||
return
|
||||
}
|
||||
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -289,7 +295,7 @@
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
margin-left: 20rpx;
|
||||
// text-align: start;
|
||||
// text-align: flex-start;
|
||||
max-width: 80%;
|
||||
position: relative;
|
||||
|
||||
@@ -307,7 +313,7 @@
|
||||
}
|
||||
.message_content_wrap {
|
||||
@include vCenterBox();
|
||||
text-align: start;
|
||||
text-align: flex-start;
|
||||
// font-size: 14px;
|
||||
color: $uni-text-color;
|
||||
width: fit-content;
|
||||
@@ -316,7 +322,7 @@
|
||||
|
||||
.bg_container {
|
||||
padding: 16rpx 24rpx;
|
||||
border-radius: 0rpx 12rpx 12rpx 12rpx;
|
||||
border-radius: 12rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<template>
|
||||
<view class="chat_footer">
|
||||
<uni-icons type="redo" size="30" color="#000" @click.prevent="forwardMsg"></uni-icons>
|
||||
<uni-icons type="trash" size="30" color="#000" @click.prevent="deleteMsg"></uni-icons>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
forwardMsg() {
|
||||
this.$emit('userEvent',{type:'forward'});
|
||||
},
|
||||
deleteMsg(e) {
|
||||
this.$emit('userEvent',{type:'deleteMsg'});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.chat_footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
background: #f6f6f6;
|
||||
// height: 50px;
|
||||
max-height: 120px;
|
||||
padding: 24rpx 20rpx;
|
||||
image {
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,64 @@
|
||||
<template>
|
||||
<u-navbar placeholder class="chating_header" bgColor="transparent">
|
||||
<view @click="leftClick" class="u-nav-slot" slot="left">
|
||||
取消
|
||||
</view>
|
||||
<view class="u-nav-slot" slot="center">
|
||||
<view class="chating_info">
|
||||
<view class="conversation_info">
|
||||
<view class="title">已选择{{ count }}条消息</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-nav-slot" slot="right">
|
||||
</view>
|
||||
</u-navbar>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "SelectHeader",
|
||||
props: {
|
||||
count:{
|
||||
type:Number,
|
||||
default(){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
methods: {
|
||||
leftClick(e) {
|
||||
this.$emit("leftClick", e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.chating_header {
|
||||
border: 2rpx solid #e1e1e1;
|
||||
.u-nav-slot {
|
||||
padding: 24rpx;
|
||||
}
|
||||
|
||||
.chating_info {
|
||||
@include vCenterBox();
|
||||
flex-direction: column;
|
||||
.conversation_info {
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
@include vCenterBox();
|
||||
|
||||
.title {
|
||||
@include nomalEllipsis();
|
||||
max-width: 280rpx;
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,32 +1,40 @@
|
||||
<template>
|
||||
<view class="chating_container">
|
||||
<chating-header @click="pageClick" ref="chatingHeaderRef" />
|
||||
<chating-list @click="pageClick" ref="chatingListRef" @initSuccess="initSuccess" />
|
||||
<chating-footer ref="chatingFooterRef" :footerOutsideFlag="footerOutsideFlag"
|
||||
<SelectHeader v-if="selectFlag" :count="selectItems.length" @leftClick="onUserMessageEvent({type:'cancelSelect'})" ref="selectHeaderRef" />
|
||||
<chating-header v-else @click="pageClick" ref="chatingHeaderRef" />
|
||||
<chating-list
|
||||
@userEvent="onUserMessageEvent"
|
||||
@click="pageClick"
|
||||
:selectItems="selectItems"
|
||||
:selectFlag="selectFlag"
|
||||
ref="chatingListRef"
|
||||
@initSuccess="initSuccess" />
|
||||
<SelectFooter v-if="selectFlag" ref="selectFooterRef" @userEvent="onUserMessageEvent" />
|
||||
<chating-footer v-else ref="chatingFooterRef" :footerOutsideFlag="footerOutsideFlag"
|
||||
@scrollToBottom="scrollToBottom" />
|
||||
<u-loading-page :loading="initLoading"></u-loading-page>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapActions
|
||||
} from "vuex";
|
||||
import {
|
||||
PageEvents,
|
||||
} from "@/constant";
|
||||
import {mapActions,mapGetters} from "vuex";
|
||||
import {offlinePushInfo} from "@/util/imCommon";
|
||||
import {PageEvents,ContactChooseTypes} from "@/constant";
|
||||
import ChatingHeader from "./components/ChatingHeader.vue";
|
||||
import ChatingFooter from "./components/ChatingFooter/index.vue";
|
||||
import ChatingList from "./components/ChatingList.vue";
|
||||
import {
|
||||
markConversationAsRead
|
||||
} from "@/util/imCommon";
|
||||
import SelectHeader from "./components/SelectHeader.vue";
|
||||
import SelectFooter from "./components/SelectFooter.vue";
|
||||
import {markConversationAsRead} from "@/util/imCommon";
|
||||
import IMSDK,{MessageType} from "openim-uniapp-polyfill";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
ChatingHeader,
|
||||
ChatingFooter,
|
||||
ChatingList,
|
||||
SelectHeader,
|
||||
SelectFooter
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -34,17 +42,26 @@
|
||||
footerOutsideFlag: 0,
|
||||
initLoading: true,
|
||||
back2Tab: false,
|
||||
selectFlag:false,
|
||||
selectItems:[],
|
||||
forwardItems:[],
|
||||
forwardMerge:false
|
||||
};
|
||||
},
|
||||
computed:{
|
||||
...mapGetters([
|
||||
"storeCurrentConversation",
|
||||
]),
|
||||
},
|
||||
onLoad(options) {
|
||||
console.log("onload");
|
||||
//console.log("onload");
|
||||
this.setPageListener();
|
||||
if (options?.back2Tab) {
|
||||
this.back2Tab = JSON.parse(options.back2Tab);
|
||||
}
|
||||
},
|
||||
onUnload() {
|
||||
console.log("unload");
|
||||
//console.log("unload");
|
||||
this.disposePageListener();
|
||||
markConversationAsRead({
|
||||
...this.$store.getters.storeCurrentConversation,
|
||||
@@ -55,7 +72,7 @@
|
||||
this.resetMessageState();
|
||||
},
|
||||
methods: {
|
||||
...mapActions("message", ["resetMessageState", "deleteMessages"]),
|
||||
...mapActions("message", ["resetMessageState", "deleteMessages","pushNewMessage", "updateOneMessage"]),
|
||||
...mapActions("conversation", ["resetConversationState"]),
|
||||
scrollToBottom(isRecv = false) {
|
||||
this.$refs.chatingListRef.scrollToBottom(false, isRecv);
|
||||
@@ -64,7 +81,6 @@
|
||||
this.footerOutsideFlag += 1;
|
||||
},
|
||||
initSuccess() {
|
||||
console.log("initSuccess");
|
||||
this.initLoading = false;
|
||||
},
|
||||
|
||||
@@ -75,6 +91,236 @@
|
||||
disposePageListener() {
|
||||
uni.$off(PageEvents.ScrollToBottom, this.scrollToBottom);
|
||||
},
|
||||
//选择会话列表的回调
|
||||
async onForwardTargetSelected(userList,groupList){
|
||||
const _this = this;
|
||||
//console.log(userList,groupList);
|
||||
if(this.forwardItems.length === 0){
|
||||
return false;
|
||||
}
|
||||
if(this.forwardMerge && this.forwardItems.length>1){
|
||||
const res = await IMSDK.asyncApi(IMSDK.IMMethods.CreateMergerMessage, IMSDK.uuid(), {
|
||||
messageList: _this.forwardItems,
|
||||
title: "转发的消息",
|
||||
summaryList: ["summaryList","summaryList"]
|
||||
});
|
||||
//console.log(res );
|
||||
if(res){
|
||||
await _this.doForwarMsg(userList,groupList,res);
|
||||
}
|
||||
}else{
|
||||
for (var mi = 0; mi < this.forwardItems.length; mi++) {
|
||||
var msg = this.forwardItems[mi];
|
||||
const res = await IMSDK.asyncApi(IMSDK.IMMethods.CreateForwardMessage, IMSDK.uuid(), msg);
|
||||
//console.log(res );
|
||||
if(res){
|
||||
await _this.doForwarMsg(userList,groupList,res);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.onUserMessageEvent({type:'cancelSelect'});
|
||||
},
|
||||
async doForwarMsg(userList,groupList,msgiem)
|
||||
{
|
||||
//console.log(userList,groupList);
|
||||
const _this = this;
|
||||
for (var i = 0; i < userList.length; i++) {
|
||||
this.sendMessage(msgiem,userList[i].userID,"");
|
||||
}
|
||||
for (var i = 0; i < groupList.length; i++) {
|
||||
this.sendMessage(msgiem,"",groupList[i].groupID);
|
||||
}
|
||||
},
|
||||
sendMessage(message,user_id,group_id) {
|
||||
//this.scrollToBottom();
|
||||
//console.log(message);
|
||||
//console.log(user_id,group_id);
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.SendMessage, IMSDK.uuid(), {
|
||||
recvID: user_id,
|
||||
groupID: group_id,
|
||||
message,
|
||||
offlinePushInfo,
|
||||
})
|
||||
.then(({data}) => {
|
||||
console.log(data);
|
||||
this.pushNewMessage(message);
|
||||
})
|
||||
.catch((res={data,errCode,errMsg}) => {
|
||||
console.log(res);
|
||||
uni.$u.toast(errMsg);
|
||||
});
|
||||
},
|
||||
onUserMessageEvent(e,data){
|
||||
const _this = this;
|
||||
if(e.type == 'select'){
|
||||
this.selectFlag = true;
|
||||
this.selectItems = [data];
|
||||
this.$refs.chatingListRef.scrollToAnchor(`auchor${data.clientMsgID}`);
|
||||
return ;
|
||||
}
|
||||
if(e.type == 'cancelSelect'){
|
||||
this.selectFlag = false;
|
||||
this.selectItems = [];
|
||||
return ;
|
||||
}
|
||||
if(e.type == 'selected'){
|
||||
if(this.selectFlag == true){
|
||||
let founded = false;
|
||||
let arr = [];
|
||||
for (var index = 0; index < this.selectItems.length; index++) {
|
||||
var v = this.selectItems[index];
|
||||
if(v.clientMsgID == data.clientMsgID){
|
||||
founded = true;
|
||||
}else{
|
||||
arr.push(v);
|
||||
}
|
||||
}
|
||||
if(!founded){
|
||||
arr.push(data);
|
||||
}
|
||||
console.log(arr.length);
|
||||
this.selectItems = [...arr];
|
||||
}
|
||||
return ;
|
||||
}
|
||||
if(e.type == 'deleteMsg'){
|
||||
let deleteMsgs = [];
|
||||
if(!data){
|
||||
deleteMsgs = [...this.selectItems];
|
||||
}else{
|
||||
deleteMsgs = [{...data}];
|
||||
}
|
||||
for (let i = 0; i < deleteMsgs.length; i++) {
|
||||
let element = deleteMsgs[i];
|
||||
IMSDK.asyncApi('deleteMessageFromLocalStorage',IMSDK.uuid(), {
|
||||
conversationID: _this.storeCurrentConversation.conversationID,
|
||||
clientMsgID: element.clientMsgID
|
||||
}).then(res=>{
|
||||
//console.log(res);
|
||||
}).catch(res=>{
|
||||
//console.log(res);
|
||||
}).finally(()=>{
|
||||
//console.log(arguments);
|
||||
})
|
||||
}
|
||||
this.selectItems = [];
|
||||
this.$refs.chatingListRef.loadMessageList();
|
||||
return ;
|
||||
}
|
||||
if(e.type == 'forward'){
|
||||
if(!data){
|
||||
this.forwardItems = [...this.selectItems];
|
||||
let menu = ['逐条转发','合并转发'];
|
||||
uni.showActionSheet({
|
||||
itemList:menu,
|
||||
success({tapIndex}){
|
||||
if(menu[tapIndex] == '逐条转发'){
|
||||
this.forwardMerge = false;
|
||||
}
|
||||
if(menu[tapIndex] == '合并转发'){
|
||||
this.forwardMerge = true;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/contactChoose/choose?type=${ContactChooseTypes.GetList}&checkedUserIDList=[]`,
|
||||
events:{
|
||||
onSelectedConfirm(userList,groupList){
|
||||
//console.log(userList,groupList);
|
||||
_this.onForwardTargetSelected(userList,groupList)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}else{
|
||||
this.forwardItems = [{...data}];
|
||||
this.forwardMerge = false;
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/contactChoose/choose?type=${ContactChooseTypes.GetList}&checkedUserIDList=[]`,
|
||||
events:{
|
||||
onSelectedConfirm(userList,groupList){
|
||||
//console.log(userList,groupList);
|
||||
_this.onForwardTargetSelected(userList,groupList)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return ;
|
||||
}
|
||||
if(e.type == 'revokeMessage'){
|
||||
IMSDK.asyncApi('revokeMessage', IMSDK.uuid(), {
|
||||
conversationID: _this.storeCurrentConversation.conversationID,
|
||||
clientMsgID: data.clientMsgID
|
||||
}).then(res=>{
|
||||
console.log(res);
|
||||
}).catch(res=>{
|
||||
console.log(res);
|
||||
}).finally(()=>{
|
||||
console.log(arguments);
|
||||
})
|
||||
return ;
|
||||
}
|
||||
|
||||
if(e.type == 'longtapMsgContent'){
|
||||
let menu = [];
|
||||
if(data.contentType == MessageType.TextMessage){
|
||||
menu.push('复制')
|
||||
}
|
||||
menu.push('转发');
|
||||
menu.push('多选');
|
||||
menu.push('删除');
|
||||
let nowTime=new Date().getTime();
|
||||
let msgTime=data.createTime;
|
||||
let diff= nowTime-msgTime;
|
||||
if(this.isSender&&diff<120000){
|
||||
menu.push('撤回')
|
||||
}
|
||||
uni.showActionSheet({
|
||||
itemList:menu,
|
||||
success({tapIndex}){
|
||||
const title = menu[tapIndex];
|
||||
switch (title) {
|
||||
case "撤回":
|
||||
_this.onUserMessageEvent({type:'revokeMessage'},data);
|
||||
break;
|
||||
case "复制":
|
||||
let content = data.textElem?.content;
|
||||
if (content) {
|
||||
//let formatStr = this.replaceReseverEmoji(copyContent);
|
||||
uni.setClipboardData({
|
||||
data:content,
|
||||
success: (res) => {
|
||||
uni.showToast({
|
||||
title: res,
|
||||
icon: 'none'
|
||||
})
|
||||
},
|
||||
error: (e) => {
|
||||
uni.showToast({
|
||||
title: e,
|
||||
icon: 'none',
|
||||
duration: 3000,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
break;
|
||||
case "转发":
|
||||
_this.onUserMessageEvent({type:'forward'},data);
|
||||
break;
|
||||
case "多选":
|
||||
_this.onUserMessageEvent({type:'select'},data);
|
||||
break;
|
||||
case "删除":
|
||||
_this.onUserMessageEvent({type:'deleteMsg'},data);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
})
|
||||
return ;
|
||||
}
|
||||
}
|
||||
},
|
||||
onBackPress() {
|
||||
uni.switchTab({
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
backgroundColor="transparent"
|
||||
>
|
||||
<template #right>
|
||||
<uni-icons type="plus" size="26" class="more_icon"></uni-icons>
|
||||
<uni-icons @click="showMore" type="plus" size="26" class="more_icon"></uni-icons>
|
||||
</template>
|
||||
</uni-nav-bar>
|
||||
<view class="right_action">
|
||||
@@ -147,7 +147,7 @@
|
||||
break;
|
||||
case 'addFriend':
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/searchUserOrGroup/index?isSearchGroup=${idx === 2}`,
|
||||
url: `/pages/common/searchUserOrGroup/index?isSearchGroup=false`,
|
||||
});
|
||||
break;
|
||||
case 'scan':
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
<template>
|
||||
<view @tap.prevent="clickConversationItem" :class="['conversation_item',source.isPinned?'pinned' : '']">
|
||||
<view @longtap.prevent="longtapConversationItem" @tap.prevent="clickConversationItem" :class="['conversation_item',source.isPinned?'pinned' : '']">
|
||||
<view class="left_info">
|
||||
<my-avatar :isGroup="isGroup" :isNotify="isNotify" :src="source.faceURL" :desc="source.showName"
|
||||
size="46" />
|
||||
<my-avatar :isGroup="isGroup" :isNotify="isNotify" :src="source.faceURL" :desc="source.showName" size="46" />
|
||||
<view class="details">
|
||||
<view class="title">
|
||||
<text class="conversation_name">
|
||||
@@ -38,9 +37,6 @@
|
||||
default: () => {},
|
||||
},
|
||||
},
|
||||
created() {
|
||||
console.log(this.source)
|
||||
},
|
||||
computed: {
|
||||
latestMessage() {
|
||||
if (this.source.latestMsg === "") return "";
|
||||
@@ -71,6 +67,10 @@
|
||||
//console.log(this.source);
|
||||
prepareConversationState(this.source);
|
||||
},
|
||||
longtapConversationItem() {
|
||||
//console.log(this.source);
|
||||
this.$emit('longtapEvent',this.source);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -78,9 +78,17 @@
|
||||
<style lang="scss" scoped>
|
||||
.conversation_item {
|
||||
@include btwBox();
|
||||
flex-direction: row;
|
||||
padding: 12rpx 44rpx 20rpx;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
&::after {
|
||||
content: " ";
|
||||
border-bottom: 1px solid #eee;
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
left: 140rpx;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
}
|
||||
&.pinned{
|
||||
background-color: #ededed;
|
||||
}
|
||||
@@ -91,6 +99,9 @@
|
||||
|
||||
.left_info {
|
||||
@include btwBox();
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 12rpx 44rpx 20rpx;
|
||||
flex:1;
|
||||
|
||||
.details {
|
||||
@@ -99,7 +110,6 @@
|
||||
margin-left: 24rpx;
|
||||
height: 46px;
|
||||
color: $uni-text-color;
|
||||
border-bottom: 1px solid #eee;
|
||||
padding-bottom:20rpx;
|
||||
.title{
|
||||
@include btwBox();
|
||||
|
||||
@@ -4,8 +4,11 @@
|
||||
<scroll-view class="scroll-view" scroll-y="true" refresher-enabled="true" :refresher-triggered="triggered"
|
||||
:scroll-top="scrollTop" :scroll-with-animation="true" @scroll="scroll" @refresherrefresh="onRefresh"
|
||||
@refresherrestore="onRestore" @scrolltolower="scrolltolower">
|
||||
<conversation-item v-for="item in storeConversationList" :key="item.conversationID" :source="item"
|
||||
ref="conversationItem" />
|
||||
<uni-swipe-action ref="swipe_action">
|
||||
<uni-swipe-action-item :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>
|
||||
</uni-swipe-action>
|
||||
</scroll-view>
|
||||
<view class="loading_wrap" v-if="storeProgress > 0 && storeProgress < 100">
|
||||
<u-loading-icon :vertical="true" :text="storeProgress + '%'"></u-loading-icon>
|
||||
@@ -14,9 +17,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapGetters
|
||||
} from "vuex";
|
||||
import {mapGetters} from "vuex";
|
||||
import IMSDK from "openim-uniapp-polyfill";
|
||||
import ChatHeader from "./components/ChatHeader.vue";
|
||||
import ConversationItem from "./components/ConversationItem.vue";
|
||||
|
||||
@@ -31,7 +33,26 @@
|
||||
old: {
|
||||
scrollTop: 0,
|
||||
},
|
||||
doubleClick: 0,
|
||||
swipe_actions: [
|
||||
{
|
||||
text: '取消',
|
||||
style: {
|
||||
backgroundColor: '#1184ed'
|
||||
}
|
||||
},
|
||||
{
|
||||
text: '隐藏',
|
||||
style: {
|
||||
backgroundColor: '#fa9d3a'
|
||||
}
|
||||
},
|
||||
{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#f85050'
|
||||
}
|
||||
}
|
||||
],
|
||||
triggered: false,
|
||||
refreshing: false,
|
||||
};
|
||||
@@ -40,13 +61,101 @@
|
||||
...mapGetters(["storeConversationList", "storeIsSyncing", "storeProgress"]),
|
||||
},
|
||||
onReady() {
|
||||
// #ifdef APP
|
||||
this.$nextTick(() => plus.navigator.closeSplashscreen());
|
||||
// #endif
|
||||
},
|
||||
onLoad() {
|
||||
//console.log(this.storeConversationList);
|
||||
this._freshing = false;
|
||||
this.triggered = true;
|
||||
setTimeout(()=>{
|
||||
uni.navigateTo({
|
||||
url:'/pages/workbench/friend-circle/friend-circle',
|
||||
})
|
||||
},1000)
|
||||
},
|
||||
methods: {
|
||||
test(){
|
||||
console.log(11);
|
||||
},
|
||||
showExtendMenu(item){
|
||||
const _this = this;
|
||||
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,
|
||||
recvMsgOpt: 2
|
||||
})
|
||||
break;
|
||||
case '关闭免打扰':
|
||||
IMSDK.asyncApi('setConversation', IMSDK.uuid(), {
|
||||
conversationID: conversationId,
|
||||
recvMsgOpt: 0
|
||||
})
|
||||
break;
|
||||
case '开启阅后即焚':
|
||||
IMSDK.asyncApi('setConversation', IMSDK.uuid(), {
|
||||
conversationID: conversationId,
|
||||
isPrivateChat: true,
|
||||
burnDuration:60
|
||||
})
|
||||
break;
|
||||
case '关闭阅后即焚':
|
||||
IMSDK.asyncApi('setConversation', IMSDK.uuid(), {
|
||||
conversationID: conversationId,
|
||||
isPrivateChat: false
|
||||
})
|
||||
break;
|
||||
case '隐藏':
|
||||
IMSDK.asyncApi('hideConversation', IMSDK.uuid(), item.conversationID)
|
||||
break;
|
||||
case '置顶':
|
||||
_this.setPinConversation(item.conversationID,true);
|
||||
break;
|
||||
case '取消置顶':
|
||||
_this.setPinConversation(item.conversationID,false);
|
||||
break;
|
||||
case '删除':
|
||||
_this.deleteConversation(item.conversationID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
actionClick(e,item){
|
||||
const _this = this;
|
||||
this.$refs.swipe_action.closeAll();
|
||||
switch(e.index){
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
IMSDK.asyncApi('hideConversation', IMSDK.uuid(), item.conversationID)
|
||||
break;
|
||||
case 2:
|
||||
_this.deleteConversation(item.conversationID);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
deleteConversation(conversationID){
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.DeleteConversationAndDeleteAllMsg, IMSDK.uuid(), conversationID).then(res=>{
|
||||
console.log('删除成功');
|
||||
}).catch(e=>{
|
||||
|
||||
})
|
||||
},
|
||||
setPinConversation(conversationId,status){
|
||||
IMSDK.asyncApi('setConversation', IMSDK.uuid(), {
|
||||
conversationID: conversationId,
|
||||
isPinned: status
|
||||
})
|
||||
},
|
||||
|
||||
scroll(e) {
|
||||
this.old.scrollTop = e.detail.scrollTop;
|
||||
},
|
||||
@@ -63,10 +172,7 @@
|
||||
this.queryList();
|
||||
},
|
||||
async queryList(isFirstPage = false) {
|
||||
await this.$store.dispatch(
|
||||
"conversation/getConversationList",
|
||||
isFirstPage
|
||||
);
|
||||
await this.$store.dispatch("conversation/getConversationList",isFirstPage);
|
||||
this.triggered = false;
|
||||
this._freshing = false;
|
||||
},
|
||||
|
||||
@@ -1,57 +1,87 @@
|
||||
<template>
|
||||
<view class="group_settings_container">
|
||||
<custom-nav-bar title="群管理" />
|
||||
<view class="setting_row">
|
||||
<setting-item
|
||||
@click="toTransfer"
|
||||
title="群主管理权转让"
|
||||
:border="false"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<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 { GroupMemberListTypes } from "@/constant";
|
||||
import CustomNavBar from "@/components/CustomNavBar/index.vue";
|
||||
import SettingItem from "@/components/SettingItem/index.vue";
|
||||
export default {
|
||||
components: {
|
||||
CustomNavBar,
|
||||
SettingItem,
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
"storeCurrentConversation",
|
||||
"storeCurrentMemberInGroup",
|
||||
"storeCurrentGroup",
|
||||
]),
|
||||
},
|
||||
methods: {
|
||||
toTransfer() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/conversation/groupMemberList/index?type=${GroupMemberListTypes.Transfer}&groupID=${this.storeCurrentGroup.groupID}`,
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
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;
|
||||
.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>
|
||||
.setting_row {
|
||||
background-color: #fff;
|
||||
margin: 24rpx 24rpx 0;
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,67 @@
|
||||
<template>
|
||||
<view style="display: flex;flex-direction: column;width: 100vw;height: 100vh;">
|
||||
<u-navbar
|
||||
:autoBack="true"
|
||||
title="群公告"
|
||||
safeAreaInsetTop
|
||||
placeholder
|
||||
fixed
|
||||
>
|
||||
<view class="u-nav-slot" slot="right" v-if="isOwner || isAdmin">
|
||||
<u-button type="primary" size="mini" @click="save">确定</u-button>
|
||||
</view>
|
||||
</u-navbar>
|
||||
<u--textarea :disabled="!isOwner && !isAdmin" count confirmType="done" focus autoHeight maxlength="-1" border="none" v-model="announcement"></u--textarea >
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapGetters} from "vuex";
|
||||
import IMSDK,{GroupMemberRole,} from "openim-uniapp-polyfill";
|
||||
export default {
|
||||
computed: {
|
||||
...mapGetters([
|
||||
"storeCurrentConversation",
|
||||
"storeCurrentMemberInGroup",
|
||||
"storeCurrentGroup",
|
||||
]),
|
||||
isOwner() {
|
||||
return this.storeCurrentMemberInGroup.roleLevel === GroupMemberRole.Owner;
|
||||
},
|
||||
isAdmin() {
|
||||
return this.storeCurrentMemberInGroup.roleLevel === GroupMemberRole.Admin;
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
announcement:"",
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.announcement = this.storeCurrentGroup.notification;
|
||||
},
|
||||
methods: {
|
||||
back(){
|
||||
uni.navigateBack();
|
||||
},
|
||||
save(){
|
||||
if(!isOwner && !isAdmin){
|
||||
return ;
|
||||
}
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.SetGroupInfo, IMSDK.uuid(), {
|
||||
groupID: this.storeCurrentGroup.groupID,
|
||||
notification: this.announcement
|
||||
}).then(res=>{
|
||||
console.log(res);
|
||||
uni.navigateBack();
|
||||
}).catch(e=>{
|
||||
console.log(e);
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
@@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<view @click="toMemberList" class="member_row">
|
||||
<!-- <view class="member_title">
|
||||
<text>群成员</text>
|
||||
<view class="member_desc">
|
||||
<text>{{ `${memberCount}人` }}</text>
|
||||
<u-icon name="arrow-right" color="#999" size="16" />
|
||||
</view>
|
||||
</view> -->
|
||||
<text>群成员</text>
|
||||
<view class="member_desc">
|
||||
<text>{{ `${memberCount}人` }}</text>
|
||||
<u-icon name="arrow-right" color="#999" size="16" />
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="member_list">
|
||||
<view class="member_item" v-for="(member, index) in groupMemberList">
|
||||
<my-avatar :src="member.faceURL" :desc="member.nickname" :key="member.userID" size="48" />
|
||||
@@ -34,18 +34,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapGetters
|
||||
} from "vuex";
|
||||
import IMSDK, {
|
||||
GroupMemberRole
|
||||
} from "openim-uniapp-polyfill";
|
||||
import {mapGetters} from "vuex";
|
||||
import IMSDK, {GroupMemberRole} from "openim-uniapp-polyfill";
|
||||
import MyAvatar from "@/components/MyAvatar/index.vue";
|
||||
import SettingItem from "@/components/SettingItem/index.vue";
|
||||
import {
|
||||
ContactChooseTypes,
|
||||
GroupMemberListTypes
|
||||
} from "@/constant";
|
||||
import {ContactChooseTypes,GroupMemberListTypes} from "@/constant";
|
||||
export default {
|
||||
name: "",
|
||||
components: {
|
||||
@@ -82,7 +75,7 @@
|
||||
},
|
||||
inviteMember() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/contactChoose/index?type=${ContactChooseTypes.Invite}&groupID=${this.groupID}`,
|
||||
url: `/pages/common/contactChoose/choose?type=${ContactChooseTypes.Invite}&groupID=${this.groupID}`,
|
||||
});
|
||||
},
|
||||
kickMember() {
|
||||
@@ -98,7 +91,7 @@
|
||||
.member_row {
|
||||
@include colBox(false);
|
||||
padding: 36rpx 36rpx 0;
|
||||
margin: 24rpx;
|
||||
margin-bottom: 24rpx;
|
||||
background-color: #fff;
|
||||
color: $uni-text-color;
|
||||
border-radius: 6px;
|
||||
@@ -154,7 +147,7 @@
|
||||
.more {
|
||||
@include btwBox();
|
||||
margin-top: 20rpx;
|
||||
padding: 20rpx 0rpx 20rpx;
|
||||
padding: 30rpx 0rpx 30rpx;
|
||||
border-top: 1px solid rgba(153, 153, 153, 0.2);
|
||||
|
||||
.more_right {
|
||||
|
||||
@@ -1,357 +1,422 @@
|
||||
<template>
|
||||
<view class="group_settings_container">
|
||||
<custom-nav-bar title="群聊设置" />
|
||||
<view class="group_settings_content">
|
||||
<view class="setting_row info_row">
|
||||
<view class="group_avatar" @click="updateGroupAvatar">
|
||||
<my-avatar
|
||||
:src="storeCurrentConversation.faceURL"
|
||||
:isGroup="true"
|
||||
size="46"
|
||||
/>
|
||||
<image
|
||||
v-if="isOwner"
|
||||
class="edit_icon"
|
||||
src="@/static/images/group_setting_edit.png"
|
||||
alt=""
|
||||
/>
|
||||
</view>
|
||||
<view class="group_info">
|
||||
<view class="group_info_name">
|
||||
<text class="group_name">{{ storeCurrentConversation.showName }}({{storeCurrentGroup.memberCount}})</text>
|
||||
<image
|
||||
v-if="isOwner || isAdmin"
|
||||
@click="toUpdateGroupName"
|
||||
style="width: 24rpx; height: 24rpx"
|
||||
src="@/static/images/group_edit.png"
|
||||
alt=""
|
||||
/>
|
||||
</view>
|
||||
<view class="group_settings_container">
|
||||
<u-navbar :autoBack="true" bgColor="#ECECEC" :title="'群聊设置('+storeCurrentGroup.memberCount+')'" safeAreaInsetTop placeholder fixed></u-navbar>
|
||||
|
||||
<text @click="copyGroupID" class="sub_title">{{
|
||||
storeCurrentConversation.groupID
|
||||
}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="group_settings_content">
|
||||
<view class="setting_row info_row" v-if="1==2">
|
||||
<view class="group_avatar" @click="updateGroupAvatar">
|
||||
<my-avatar :src="storeCurrentConversation.faceURL" :isGroup="true" size="46" />
|
||||
<image v-if="isOwner" class="edit_icon" src="@/static/images/group_setting_edit.png" alt="" />
|
||||
</view>
|
||||
<view class="group_info">
|
||||
<view class="group_info_name">
|
||||
<text class="group_name">{{ storeCurrentConversation.showName }}({{storeCurrentGroup.memberCount}})</text>
|
||||
<image v-if="isOwner || isAdmin" @click="toUpdateGroupName" style="width: 24rpx; height: 24rpx" src="@/static/images/group_edit.png" alt="" />
|
||||
</view>
|
||||
|
||||
<group-member-row
|
||||
v-if="isJoinGroup"
|
||||
:isNomal="!isAdmin && !isOwner"
|
||||
:groupID="storeCurrentConversation.groupID"
|
||||
:memberCount="storeCurrentGroup.memberCount"
|
||||
:groupMemberList="groupMemberList"
|
||||
/>
|
||||
<view v-if="isJoinGroup" class="setting_row">
|
||||
<setting-item
|
||||
v-if="isOwner || isAdmin"
|
||||
@click="toGroupManage"
|
||||
title="群管理"
|
||||
:border="false"
|
||||
/>
|
||||
</view>
|
||||
<text @click="copyGroupID" class="sub_title">{{storeCurrentConversation.groupID}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="setting_row">
|
||||
<setting-item
|
||||
v-if="isJoinGroup"
|
||||
danger
|
||||
@click="() => (confirmType = isOwner ? 'Dismiss' : 'Quit')"
|
||||
:title="isOwner ? '解散群聊' : '退出群聊'"
|
||||
:border="false"
|
||||
/>
|
||||
</view>
|
||||
<group-member-row v-if="isJoinGroup" :isNomal="!isAdmin && !isOwner"
|
||||
:groupID="storeCurrentConversation.groupID" :memberCount="storeCurrentGroup.memberCount"
|
||||
:groupMemberList="groupMemberList" />
|
||||
|
||||
<uni-list>
|
||||
<uni-list-item title="群聊名称" :rightText="storeCurrentConversation.showName" @click="editGroupName" :clickable="isOwner || isAdmin" :showArrow="isOwner || isAdmin"></uni-list-item>
|
||||
<uni-list-item title="群公告" to="/pages/conversation/groupSettings/announcement" clickable showArrow></uni-list-item>
|
||||
<uni-list-item title="群二维码" :to="'/pages/common/userOrGroupQrCode?groupID='+storeCurrentConversation.groupID" clickable showArrow></uni-list-item>
|
||||
<uni-list-item v-if="isOwner || isAdmin" title="群管理" to="/pages/conversation/groupManage/index" clickable showArrow></uni-list-item>
|
||||
<uni-list-item v-if="1==2" title="备注" :rightText="storeCurrentConversation.showName" @click="editGroupName" :clickable="isOwner || isAdmin" :showArrow="isOwner || isAdmin"></uni-list-item>
|
||||
</uni-list>
|
||||
<u-gap></u-gap>
|
||||
<uni-list>
|
||||
<uni-list-item title="查找聊天内容" to=""></uni-list-item>
|
||||
</uni-list>
|
||||
<u-gap></u-gap>
|
||||
<uni-list>
|
||||
<uni-list-item title="消息免打扰" @switchChange="updateCoversation('recvMsgOpt',storeCurrentConversation.recvMsgOpt==0 ? 2: 0)" showSwitch :switchChecked="storeCurrentConversation.recvMsgOpt !== 0"></uni-list-item>
|
||||
<uni-list-item title="置顶聊天" @switchChange="updateCoversation('isPinned',!storeCurrentConversation.isPinned)" showSwitch :switchChecked="storeCurrentConversation.isPinned"></uni-list-item>
|
||||
</uni-list>
|
||||
<u-gap></u-gap>
|
||||
<uni-list>
|
||||
<uni-list-item v-if="1==2" title="我在本群的昵称"></uni-list-item>
|
||||
<uni-list-item title="删除聊天记录" @click="clearMsg" clickable></uni-list-item>
|
||||
</uni-list>
|
||||
<u-gap></u-gap>
|
||||
<uni-list v-if="isJoinGroup">
|
||||
<uni-list-item :border="false">
|
||||
<view slot="body" class="uni-list-item__content" @click="confirm">
|
||||
<text class="uni-list-item__content-title" style="color: red;">{{isOwner ? '解散群聊' : '退出群聊'}}</text>
|
||||
</view>
|
||||
</uni-list-item>
|
||||
</uni-list>
|
||||
<u-gap></u-gap>
|
||||
<u-gap></u-gap>
|
||||
</view>
|
||||
|
||||
<u-modal
|
||||
:content="getConfirmContent"
|
||||
asyncClose
|
||||
:show="confirmType !== null"
|
||||
showCancelButton
|
||||
@confirm="confirm"
|
||||
@cancel="() => (confirmType = null)"
|
||||
></u-modal>
|
||||
</view>
|
||||
|
||||
<u-toast ref="uToast"></u-toast>
|
||||
<action-sheet
|
||||
:groupID="storeCurrentConversation.groupID"
|
||||
:visible.sync="actionSheetVisible"
|
||||
/>
|
||||
</view>
|
||||
<u-toast ref="uToast"></u-toast>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from "vuex";
|
||||
import { GroupMemberListTypes } from "@/constant";
|
||||
import IMSDK, {
|
||||
GroupMemberRole,
|
||||
GroupStatus,
|
||||
GroupVerificationType,
|
||||
IMMethods,
|
||||
MessageReceiveOptType,
|
||||
} from "openim-uniapp-polyfill";
|
||||
import CustomNavBar from "@/components/CustomNavBar/index.vue";
|
||||
import MyAvatar from "@/components/MyAvatar/index.vue";
|
||||
import SettingItem from "@/components/SettingItem/index.vue";
|
||||
import GroupMemberRow from "./components/GroupMemberRow.vue";
|
||||
import ActionSheet from "./components/ActionSheet.vue";
|
||||
import { getPurePath } from "@/util/common";
|
||||
import {mapGetters} from "vuex";
|
||||
import {GroupMemberListTypes} from "@/constant";
|
||||
import IMSDK, {
|
||||
GroupMemberRole,
|
||||
GroupStatus,
|
||||
GroupVerificationType,
|
||||
IMMethods,
|
||||
MessageReceiveOptType,
|
||||
} from "openim-uniapp-polyfill";
|
||||
import CustomNavBar from "@/components/CustomNavBar/index.vue";
|
||||
import MyAvatar from "@/components/MyAvatar/index.vue";
|
||||
import SettingItem from "@/components/SettingItem/index.vue";
|
||||
import GroupMemberRow from "./components/GroupMemberRow.vue";
|
||||
import {getPurePath} from "@/util/common";
|
||||
|
||||
const ConfirmTypes = {
|
||||
Dismiss: "Dismiss",
|
||||
Quit: "Quit",
|
||||
};
|
||||
const ConfirmTypes = {
|
||||
Dismiss: "Dismiss",
|
||||
Quit: "Quit",
|
||||
};
|
||||
|
||||
export default {
|
||||
components: {
|
||||
CustomNavBar,
|
||||
MyAvatar,
|
||||
SettingItem,
|
||||
GroupMemberRow,
|
||||
ActionSheet,
|
||||
},
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
actionSheetVisible: false,
|
||||
confirmType: null,
|
||||
switchLoading: {
|
||||
pin: false,
|
||||
opt: false,
|
||||
mute: false,
|
||||
},
|
||||
groupMemberList: [],
|
||||
isJoinGroup: true
|
||||
};
|
||||
},
|
||||
onShow() {
|
||||
this.getGroupMemberList();
|
||||
if (this.storeCurrentConversation.groupID) {
|
||||
IMSDK.asyncApi(
|
||||
IMMethods.IsJoinGroup,
|
||||
IMSDK.uuid(),
|
||||
this.storeCurrentConversation.groupID
|
||||
).then((res) => {
|
||||
this.isJoinGroup = res.data
|
||||
});
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
"storeCurrentGroup.memberCount"() {
|
||||
this.getGroupMemberList();
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
"storeCurrentConversation",
|
||||
"storeCurrentMemberInGroup",
|
||||
"storeCurrentGroup",
|
||||
]),
|
||||
getConfirmContent() {
|
||||
if (this.confirmType === ConfirmTypes.Quit) {
|
||||
return "确定要退出当前群聊吗?";
|
||||
}
|
||||
if (this.confirmType === ConfirmTypes.Dismiss) {
|
||||
return "确定要解散当前群聊吗?";
|
||||
}
|
||||
return "";
|
||||
},
|
||||
isOwner() {
|
||||
return this.storeCurrentMemberInGroup.roleLevel === GroupMemberRole.Owner;
|
||||
},
|
||||
isAdmin() {
|
||||
return this.storeCurrentMemberInGroup.roleLevel === GroupMemberRole.Admin;
|
||||
},
|
||||
getGroupVerStr() {
|
||||
if (
|
||||
this.storeCurrentGroup.needVerification ===
|
||||
GroupVerificationType.ApplyNeedInviteNot
|
||||
) {
|
||||
return "群成员邀请无需验证";
|
||||
}
|
||||
if (
|
||||
this.storeCurrentGroup.needVerification === GroupVerificationType.AllNot
|
||||
) {
|
||||
return "允许所有人加群";
|
||||
}
|
||||
return "需要发送验证消息";
|
||||
},
|
||||
isAllMuted() {
|
||||
return this.storeCurrentGroup.status === GroupStatus.Muted;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
getGroupMemberList() {
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.GetGroupMemberList, IMSDK.uuid(), {
|
||||
groupID: this.storeCurrentConversation.groupID,
|
||||
filter: 0,
|
||||
offset: 0,
|
||||
count: !this.isAdmin && !this.isOwner ? 9 : 8,
|
||||
})
|
||||
.then(({ data }) => {
|
||||
console.log(data);
|
||||
this.groupMemberList = [...data];
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
},
|
||||
toGroupManage() {
|
||||
uni.navigateTo({
|
||||
url: "/pages/conversation/groupManage/index",
|
||||
});
|
||||
},
|
||||
toUpdateGroupName() {
|
||||
if (!this.isAdmin && !this.isOwner) {
|
||||
return;
|
||||
}
|
||||
export default {
|
||||
components: {
|
||||
CustomNavBar,
|
||||
MyAvatar,
|
||||
SettingItem,
|
||||
GroupMemberRow
|
||||
},
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
switchLoading: {
|
||||
pin: false,
|
||||
opt: false,
|
||||
mute: false,
|
||||
},
|
||||
groupMemberList: [],
|
||||
isJoinGroup: true
|
||||
};
|
||||
},
|
||||
onShow() {
|
||||
console.log(this.storeCurrentConversation);
|
||||
/*
|
||||
this.$store.commit("conversation/SET_CURRENT_CONVERSATION", {
|
||||
"conversationID": "sg_1793688611",
|
||||
"conversationType": 3,
|
||||
"userID": "",
|
||||
"groupID": "1793688611",
|
||||
"showName": "5676uy",
|
||||
"faceURL": "",
|
||||
"recvMsgOpt": 0,
|
||||
"unreadCount": 0,
|
||||
"groupAtType": 0,
|
||||
"latestMsg": "{\"clientMsgID\":\"e6274af29366f9097615cc373bc9139d\",\"serverMsgID\":\"ba783d50f2853d5588c913529c08b790\",\"createTime\":1764803528981,\"sendTime\":1764803525434,\"sessionType\":3,\"sendID\":\"100004\",\"recvID\":\"100003\",\"msgFrom\":100,\"contentType\":101,\"senderPlatformID\":2,\"senderNickname\":\"131****1111\",\"senderFaceUrl\":\"/static/img/avatar.png\",\"groupID\":\"1793688611\",\"seq\":10,\"isRead\":false,\"status\":2,\"textElem\":{\"content\":\"2222222222222222222222222222222222\"},\"attachedInfoElem\":{\"groupHasReadInfo\":{\"hasReadCount\":0,\"groupMemberCount\":3},\"isPrivateChat\":false,\"burnDuration\":0,\"hasReadTime\":0,\"isEncryption\":false,\"inEncryptStatus\":false}}",
|
||||
"latestMsgSendTime": 1764803525434,
|
||||
"draftText": "",
|
||||
"draftTextTime": 0,
|
||||
"isPinned": false,
|
||||
"isPrivateChat": false,
|
||||
"burnDuration": 0,
|
||||
"isNotInGroup": false,
|
||||
"updateUnreadCountTime": 0,
|
||||
"attachedInfo": "",
|
||||
"ex": "",
|
||||
"maxSeq": 0,
|
||||
"minSeq": 0,
|
||||
"msgDestructTime": 0,
|
||||
"isMsgDestruct": false
|
||||
});
|
||||
this.$store.commit("conversation/SET_CURRENT_MEMBER_IN_GROUP", {
|
||||
"groupID": "1793688611",
|
||||
"userID": "100004",
|
||||
"nickname": "131****1111",
|
||||
"faceURL": "/static/img/avatar.png",
|
||||
"roleLevel": 20,
|
||||
"joinTime": 1764103081761,
|
||||
"joinSource": 2,
|
||||
"inviterUserID": "100003",
|
||||
"muteEndTime": 0,
|
||||
"operatorUserID": "100003",
|
||||
"ex": "",
|
||||
"attachedInfo": ""
|
||||
});
|
||||
this.$store.commit("conversation/SET_CURRENT_GROUP", {
|
||||
"groupID": "1793688611",
|
||||
"groupName": "5676uy",
|
||||
"notification": "",
|
||||
"introduction": "",
|
||||
"faceURL": "",
|
||||
"createTime": 1764103081757,
|
||||
"status": 0,
|
||||
"creatorUserID": "100003",
|
||||
"groupType": 2,
|
||||
"ownerUserID": "100003",
|
||||
"memberCount": 3,
|
||||
"ex": "",
|
||||
"attachedInfo": "",
|
||||
"needVerification": 0,
|
||||
"lookMemberInfo": 0,
|
||||
"applyMemberFriend": 0,
|
||||
"notificationUpdateTime": 0,
|
||||
"notificationUserID": ""
|
||||
});
|
||||
*/
|
||||
//console.log(this.storeCurrentGroup,this.storeCurrentConversation,this.storeCurrentMemberInGroup)
|
||||
this.getGroupMemberList();
|
||||
if (this.storeCurrentConversation.groupID) {
|
||||
IMSDK.asyncApi(
|
||||
IMMethods.IsJoinGroup,
|
||||
IMSDK.uuid(),
|
||||
this.storeCurrentConversation.groupID
|
||||
).then((res) => {
|
||||
this.isJoinGroup = res.data
|
||||
});
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
"storeCurrentGroup.memberCount"() {
|
||||
this.getGroupMemberList();
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
"storeCurrentConversation",
|
||||
"storeCurrentMemberInGroup",
|
||||
"storeCurrentGroup",
|
||||
]),
|
||||
isOwner() {
|
||||
return this.storeCurrentMemberInGroup.roleLevel === GroupMemberRole.Owner;
|
||||
},
|
||||
isAdmin() {
|
||||
return this.storeCurrentMemberInGroup.roleLevel === GroupMemberRole.Admin;
|
||||
},
|
||||
getGroupVerStr() {
|
||||
if (
|
||||
this.storeCurrentGroup.needVerification ===
|
||||
GroupVerificationType.ApplyNeedInviteNot
|
||||
) {
|
||||
return "群成员邀请无需验证";
|
||||
}
|
||||
if (
|
||||
this.storeCurrentGroup.needVerification === GroupVerificationType.AllNot
|
||||
) {
|
||||
return "允许所有人加群";
|
||||
}
|
||||
return "需要发送验证消息";
|
||||
},
|
||||
isAllMuted() {
|
||||
return this.storeCurrentGroup.status === GroupStatus.Muted;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
editGroupName(){
|
||||
if(this.isOwner || this.isAdmin){
|
||||
this.toUpdateGroupName();
|
||||
}
|
||||
},
|
||||
getGroupMemberList() {
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.GetGroupMemberList, IMSDK.uuid(), {
|
||||
groupID: this.storeCurrentConversation.groupID,
|
||||
filter: 0,
|
||||
offset: 0,
|
||||
count: !this.isAdmin && !this.isOwner ? 9 : 8,
|
||||
})
|
||||
.then(({
|
||||
data
|
||||
}) => {
|
||||
//console.log(data);
|
||||
this.groupMemberList = [...data];
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
},
|
||||
toGroupManage() {
|
||||
uni.navigateTo({
|
||||
url: "/pages/conversation/groupManage/index",
|
||||
});
|
||||
},
|
||||
toUpdateGroupName() {
|
||||
if (!this.isAdmin && !this.isOwner) {
|
||||
return;
|
||||
}
|
||||
|
||||
uni.navigateTo({
|
||||
url: `/pages/conversation/updateGroupOrNickname/index?sourceInfo=${JSON.stringify(
|
||||
this.storeCurrentGroup,
|
||||
)}`,
|
||||
});
|
||||
},
|
||||
copyGroupID() {
|
||||
uni.setClipboardData({
|
||||
data: this.storeCurrentGroup.groupID,
|
||||
success: () => {
|
||||
uni.hideToast();
|
||||
this.$nextTick(() => {
|
||||
uni.$u.toast("复制成功");
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
showActionSheet() {
|
||||
if (!this.isAdmin && !this.isOwner) {
|
||||
return;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: `/pages/conversation/updateGroupOrNickname/index?sourceInfo=${JSON.stringify(this.storeCurrentGroup,)}`,
|
||||
});
|
||||
},
|
||||
copyGroupID() {
|
||||
uni.setClipboardData({
|
||||
data: this.storeCurrentGroup.groupID,
|
||||
success: () => {
|
||||
uni.hideToast();
|
||||
this.$nextTick(() => {
|
||||
uni.$u.toast("复制成功");
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
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);
|
||||
})
|
||||
},
|
||||
updateCoversation(field,value1){
|
||||
const data = {conversationID:this.storeCurrentConversation.conversationID};
|
||||
data[field] = value1;
|
||||
IMSDK.asyncApi('setConversation', IMSDK.uuid(),data).then(res=>{
|
||||
console.log(res);
|
||||
}).catch(e=>{
|
||||
console.log(e);
|
||||
})
|
||||
},
|
||||
updateGroupAvatar() {
|
||||
if (!this.isAdmin && !this.isOwner) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.actionSheetVisible = true;
|
||||
},
|
||||
updateGroupAvatar() {
|
||||
if (!this.isAdmin && !this.isOwner) {
|
||||
return;
|
||||
}
|
||||
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ["compressed"],
|
||||
success: async ({ tempFilePaths }) => {
|
||||
const path = tempFilePaths[0];
|
||||
const nameIdx = path.lastIndexOf("/") + 1;
|
||||
const typeIdx = path.lastIndexOf(".") + 1;
|
||||
const fileName = path.slice(nameIdx);
|
||||
const fileType = path.slice(typeIdx);
|
||||
try {
|
||||
const {
|
||||
data: { url },
|
||||
} = await IMSDK.asyncApi(IMMethods.UploadFile, IMSDK.uuid(), {
|
||||
filepath: getPurePath(tempFilePaths[0]),
|
||||
name: fileName,
|
||||
contentType: fileType,
|
||||
uuid: IMSDK.uuid(),
|
||||
});
|
||||
await IMSDK.asyncApi(IMSDK.IMMethods.SetGroupInfo, IMSDK.uuid(), {
|
||||
groupID: this.storeCurrentConversation.groupID,
|
||||
faceURL: url,
|
||||
});
|
||||
uni.$u.toast("修改成功");
|
||||
} catch (error) {
|
||||
uni.$u.toast("修改失败");
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
confirm() {
|
||||
let funcName = "";
|
||||
let sourceID = this.storeCurrentConversation.groupID;
|
||||
if (this.confirmType === ConfirmTypes.Quit) {
|
||||
funcName = IMSDK.IMMethods.QuitGroup;
|
||||
}
|
||||
if (this.confirmType === ConfirmTypes.Dismiss) {
|
||||
funcName = IMSDK.IMMethods.DismissGroup;
|
||||
}
|
||||
IMSDK.asyncApi(funcName, IMSDK.uuid(), sourceID)
|
||||
.then(() => {
|
||||
uni.$u.toast("操作成功");
|
||||
setTimeout(
|
||||
() =>
|
||||
uni.switchTab({
|
||||
url: "/pages/conversation/conversationList/index",
|
||||
}),
|
||||
250,
|
||||
);
|
||||
})
|
||||
.catch(() => uni.$u.toast("操作失败"))
|
||||
.finally(() => (this.confirmType = null));
|
||||
},
|
||||
},
|
||||
};
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ["compressed"],
|
||||
success: async ({
|
||||
tempFilePaths
|
||||
}) => {
|
||||
const path = tempFilePaths[0];
|
||||
const nameIdx = path.lastIndexOf("/") + 1;
|
||||
const typeIdx = path.lastIndexOf(".") + 1;
|
||||
const fileName = path.slice(nameIdx);
|
||||
const fileType = path.slice(typeIdx);
|
||||
try {
|
||||
const {
|
||||
data: {
|
||||
url
|
||||
},
|
||||
} = await IMSDK.asyncApi(IMMethods.UploadFile, IMSDK.uuid(), {
|
||||
filepath: getPurePath(tempFilePaths[0]),
|
||||
name: fileName,
|
||||
contentType: fileType,
|
||||
uuid: IMSDK.uuid(),
|
||||
});
|
||||
await IMSDK.asyncApi(IMSDK.IMMethods.SetGroupInfo, IMSDK.uuid(), {
|
||||
groupID: this.storeCurrentConversation.groupID,
|
||||
faceURL: url,
|
||||
});
|
||||
uni.$u.toast("修改成功");
|
||||
} catch (error) {
|
||||
uni.$u.toast("修改失败");
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
confirm() {
|
||||
const _this = this;
|
||||
uni.showModal({
|
||||
content:this.isOwner ? '确定要解散当前群聊吗?' : '确定要退出当前群聊吗?',
|
||||
success(res){
|
||||
if (res.confirm) {
|
||||
let funcName = "";
|
||||
let sourceID = _this.storeCurrentConversation.groupID;
|
||||
if (this.isOwner) {
|
||||
funcName = IMSDK.IMMethods.DismissGroup;
|
||||
}else{
|
||||
funcName = IMSDK.IMMethods.QuitGroup;
|
||||
}
|
||||
IMSDK.asyncApi(funcName, IMSDK.uuid(), sourceID)
|
||||
.then(() => {
|
||||
uni.$u.toast("操作成功");
|
||||
setTimeout(
|
||||
() =>
|
||||
uni.switchTab({
|
||||
url: "/pages/conversation/conversationList/index",
|
||||
}),
|
||||
250,
|
||||
);
|
||||
})
|
||||
.catch(() => uni.$u.toast("操作失败"));
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
clearMsg(){
|
||||
IMSDK.asyncApi('clearConversationAndDeleteAllMsg',IMSDK.uuid(), this.storeCurrentConversation.conversationID).then(res=>{
|
||||
uni.navigateBack();
|
||||
}).catch(e=>{
|
||||
console.log(e);
|
||||
})
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.group_settings_container {
|
||||
@include colBox(false);
|
||||
height: 100vh;
|
||||
background-color: #f6f6f6;
|
||||
.group_settings_container {
|
||||
@include colBox(false);
|
||||
height: 100vh;
|
||||
background-color: #f6f6f6;
|
||||
|
||||
.group_settings_content {
|
||||
overflow-y: auto;
|
||||
}
|
||||
.group_settings_content {
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.setting_row {
|
||||
background-color: #fff;
|
||||
margin: 24rpx;
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.setting_row {
|
||||
background-color: #fff;
|
||||
margin: 24rpx;
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.info_row {
|
||||
@include vCenterBox();
|
||||
padding: 36rpx 44rpx;
|
||||
.info_row {
|
||||
@include vCenterBox();
|
||||
padding: 36rpx 44rpx;
|
||||
|
||||
.group_avatar {
|
||||
margin-right: 16rpx;
|
||||
position: relative;
|
||||
.group_avatar {
|
||||
margin-right: 16rpx;
|
||||
position: relative;
|
||||
|
||||
.edit_icon {
|
||||
position: absolute;
|
||||
right: -6rpx;
|
||||
bottom: -6rpx;
|
||||
width: 11px;
|
||||
height: 11px;
|
||||
}
|
||||
}
|
||||
.edit_icon {
|
||||
position: absolute;
|
||||
right: -6rpx;
|
||||
bottom: -6rpx;
|
||||
width: 11px;
|
||||
height: 11px;
|
||||
}
|
||||
}
|
||||
|
||||
.group_info {
|
||||
min-height: 46px;
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
.group_info {
|
||||
min-height: 46px;
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
|
||||
&_name {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
&_name {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.group_name {
|
||||
// @include nomalEllipsis();
|
||||
font-size: 34rpx;
|
||||
max-width: 380rpx;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
}
|
||||
.group_name {
|
||||
// @include nomalEllipsis();
|
||||
font-size: 34rpx;
|
||||
max-width: 380rpx;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.sub_title {
|
||||
@include nomalEllipsis();
|
||||
margin-bottom: 0;
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
.sub_title {
|
||||
@include nomalEllipsis();
|
||||
margin-bottom: 0;
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,22 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,22 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
@@ -2,27 +2,37 @@
|
||||
<view class="single_settings_container">
|
||||
<custom-nav-bar title="好友设置" />
|
||||
|
||||
<view class="row_wrap">
|
||||
<view class="setting_row info_row">
|
||||
<view @click="toUserCard" class="user_info">
|
||||
<my-avatar :src="storeCurrentConversation.faceURL" :desc="storeCurrentConversation.showName"
|
||||
size="46" />
|
||||
</view>
|
||||
<view @click="invite2group" class="action">
|
||||
<image style="width: 46px; height: 46px" src="@/static/images/single_setting_add.png" alt="" />
|
||||
</view>
|
||||
<view class="setting_row info_row">
|
||||
<view @click="toUserCard" class="user_info">
|
||||
<my-avatar :src="storeCurrentConversation.faceURL" :desc="storeCurrentConversation.showName"
|
||||
size="46" />
|
||||
</view>
|
||||
<view @click="invite2group" class="action">
|
||||
<image style="width: 46px; height: 46px" src="@/static/images/single_setting_add.png" alt="" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<uni-list>
|
||||
<uni-list-item title="查找聊天内容" to=""></uni-list-item>
|
||||
</uni-list>
|
||||
<u-gap></u-gap>
|
||||
<uni-list>
|
||||
<uni-list-item title="消息免打扰" @switchChange="updateCoversation('recvMsgOpt',storeCurrentConversation.recvMsgOpt==0 ? 2: 0)" showSwitch :switchChecked="storeCurrentConversation.recvMsgOpt !== 0"></uni-list-item>
|
||||
<uni-list-item title="置顶聊天" @switchChange="updateCoversation('isPinned',!storeCurrentConversation.isPinned)" showSwitch :switchChecked="storeCurrentConversation.isPinned"></uni-list-item>
|
||||
</uni-list>
|
||||
<u-gap></u-gap>
|
||||
<uni-list>
|
||||
<uni-list-item title="删除聊天记录" @click="clearMsg" clickable></uni-list-item>
|
||||
</uni-list>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapGetters
|
||||
} from "vuex";
|
||||
import {mapGetters} from "vuex";
|
||||
import CustomNavBar from "@/components/CustomNavBar/index.vue";
|
||||
import MyAvatar from "@/components/MyAvatar/index.vue";
|
||||
import SettingItem from "@/components/SettingItem/index.vue";
|
||||
import IMSDK from "openim-uniapp-polyfill";
|
||||
export default {
|
||||
components: {
|
||||
CustomNavBar,
|
||||
@@ -61,6 +71,22 @@
|
||||
url: `/pages/common/createGroup/index?checkedMemberList=${checkedMemberList}`,
|
||||
});
|
||||
},
|
||||
clearMsg(){
|
||||
IMSDK.asyncApi('clearConversationAndDeleteAllMsg',IMSDK.uuid(), this.storeCurrentConversation.conversationID).then(res=>{
|
||||
uni.navigateBack();
|
||||
}).catch(e=>{
|
||||
console.log(e);
|
||||
})
|
||||
},
|
||||
updateCoversation(field,value1){
|
||||
const data = {conversationID:this.storeCurrentConversation.conversationID};
|
||||
data[field] = value1;
|
||||
IMSDK.asyncApi('setConversation', IMSDK.uuid(),data).then(res=>{
|
||||
console.log(res);
|
||||
}).catch(e=>{
|
||||
console.log(e);
|
||||
})
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<view class="page_container">
|
||||
<custom-nav-bar :title="getTitle">
|
||||
<view class="nav_right_action" slot="more">
|
||||
<text v-show="!updateLoading" @click="comfirmUpdate">保存</text>
|
||||
<u-button type="primary" v-show="!updateLoading" @click="comfirmUpdate">保存</u-button>
|
||||
<u-loading-icon v-show="updateLoading" />
|
||||
</view>
|
||||
</custom-nav-bar>
|
||||
|
||||
Reference in New Issue
Block a user