|
|
@@ -1,10 +1,14 @@
|
|
|
<template>
|
|
|
<view class="tab-page">
|
|
|
- <scroll-view class="scroll-bar" scroll-with-animation="true" scroll-y="true">
|
|
|
+ <view class="chat-tip" v-if="$store.state.chatStore.chats.length==0">
|
|
|
+ 温馨提示:您现在还没有任何聊天消息,快跟您的好友发起聊天吧~
|
|
|
+ </view>
|
|
|
+ <scroll-view class="scroll-bar" v-else scroll-with-animation="true" scroll-y="true">
|
|
|
<view v-for="(chat,index) in $store.state.chatStore.chats" :key="index">
|
|
|
<chat-item :chat="chat" :index="index" @longpress.native="onShowMenu($event,index)"></chat-item>
|
|
|
</view>
|
|
|
</scroll-view>
|
|
|
+
|
|
|
<pop-menu v-show="menu.show" :menu-style="menu.style" :items="menu.items" @close="menu.show=false"
|
|
|
@select="onSelectMenu"></pop-menu>
|
|
|
</view>
|
|
|
@@ -14,7 +18,6 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
-
|
|
|
menu: {
|
|
|
show: false,
|
|
|
style: "",
|
|
|
@@ -37,14 +40,16 @@
|
|
|
onSelectMenu(item) {
|
|
|
switch (item.key) {
|
|
|
case 'DELETE':
|
|
|
- this.removeChat(this.menu.chatIdx);
|
|
|
+ this.removeChat(this.menu.chatIdx);
|
|
|
+ break;
|
|
|
case 'TOP':
|
|
|
this.moveToTop(this.menu.chatIdx);
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
},
|
|
|
- onShowMenu(e,chatIdx) {
|
|
|
+ onShowMenu(e, chatIdx) {
|
|
|
uni.getSystemInfo({
|
|
|
success: (res) => {
|
|
|
let touches = e.touches[0];
|
|
|
@@ -84,7 +89,7 @@
|
|
|
} else {
|
|
|
uni.removeTabBarBadge({
|
|
|
index: 0,
|
|
|
- complete:()=>{}
|
|
|
+ complete: () => {}
|
|
|
})
|
|
|
|
|
|
}
|
|
|
@@ -99,8 +104,8 @@
|
|
|
return count;
|
|
|
}
|
|
|
},
|
|
|
- watch:{
|
|
|
- unreadCount(newCount,oldCount){
|
|
|
+ watch: {
|
|
|
+ unreadCount(newCount, oldCount) {
|
|
|
this.refreshUnreadBadge();
|
|
|
}
|
|
|
},
|
|
|
@@ -110,6 +115,14 @@
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
-<style>
|
|
|
-
|
|
|
+<style scoped lang="scss">
|
|
|
+ .chat-tip {
|
|
|
+ position: absolute;
|
|
|
+ top: 400rpx;
|
|
|
+ padding: 50rpx;
|
|
|
+ line-height: 50rpx;
|
|
|
+ text-align: left;
|
|
|
+ color: darkblue;
|
|
|
+ font-size: 30rpx;
|
|
|
+ }
|
|
|
</style>
|