This commit is contained in:
cansnow
2025-12-05 16:10:52 +08:00
parent 29be534f22
commit 69a61178e1
64 changed files with 2575 additions and 1141 deletions
@@ -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();
+116 -10
View File
@@ -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;
},