10
This commit is contained in:
@@ -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;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user