This commit is contained in:
2022-02-08 14:11:15 +08:00
parent 4020f1f6eb
commit 784483cc47
2 changed files with 46 additions and 38 deletions

View File

@@ -62,7 +62,7 @@
} }
</script> </script>
<style scoped lang="less"> <style scoped lang="scss">
.sent--text { .sent--text {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@@ -77,17 +77,17 @@
padding: 0 20rpx; padding: 0 20rpx;
} }
.button { // .button {
border: none; // border: none;
background: #34CE98; // background: #34CE98;
color: white; // color: white;
width: 120rpx; // width: 120rpx;
line-height: 70rpx; // line-height: 70rpx;
text-align: center; // text-align: center;
border-radius: 10rpx; // border-radius: 10rpx;
font-size: 30rpx; // font-size: 30rpx;
font-weight: bold; // font-weight: bold;
} // }
// .button[disabled] { // .button[disabled] {
// background-color: #555555; // background-color: #555555;
// } // }

View File

@@ -5,19 +5,24 @@
<view class="custom-header"> <view class="custom-header">
<view class="header-flex"> <view class="header-flex">
<view class="tabs"> <view class="tabs">
<view class="item show">私聊</view> <view class="item show">
<view class="item" @click="onNav('', {})">群聊</view> 私聊
<u-badge absolute max="99" shape="horn" :offset="[-7, -7]" :value="5" />
</view>
<view class="item" @click="onNav('', {})">
群聊
<u-badge absolute max="99" shape="horn" :offset="[-7, -7]" :value="10" />
</view>
</view> </view>
<view class="btns">
<view class="item" @click="scanQrCode"> <view class="btns">
<uni-icons color="#555" type="scan" size="22"></uni-icons> <view class="item" @click="scanQrCode">
<uni-icons color="#555" type="scan" size="22" />
</view> </view>
<view class="item" @click="onNav('imFriends', {})"> <view class="item" @click="onNav('imFriends', {})">
<uni-icons color="#555" custom-prefix="iconfont" type="icon-tuandui" size="22"></uni-icons> <u-badge absolute max="99" isDot :offset="[0, 0]" :show="hasNewFriends" />
<uni-icons color="#555" custom-prefix="iconfont" type="icon-tuandui" size="22" />
</view> </view>
<!-- <view class="item" @click="onNav('', {})">
<uni-icons color="#555" custom-prefix="iconfont" type="icon-gengduo2" size="22"></uni-icons>
</view> -->
</view> </view>
</view> </view>
</view> </view>
@@ -46,7 +51,7 @@
<message-preview class="preview" :msg="item.latestMessage" /> <message-preview class="preview" :msg="item.latestMessage" />
</view> </view>
</view> </view>
<!-- TODO 长按的弹出框怎么点击隐藏没搞明白 -->
<view class="shade" @click="hidePop" v-show="showPop"> <view class="shade" @click="hidePop" v-show="showPop">
<view class="pop" :style="popStyle" :class="{'show':showPop}"> <view class="pop" :style="popStyle" :class="{'show':showPop}">
<view v-for="(item, index) in popButton" :key="index" @click="pickerMenu" :data-index="index"> <view v-for="(item, index) in popButton" :key="index" @click="pickerMenu" :data-index="index">
@@ -89,7 +94,8 @@
popButton: ['置顶聊天', '删除该聊天'], popButton: ['置顶聊天', '删除该聊天'],
/* 弹窗定位样式 */ /* 弹窗定位样式 */
popStyle: "", popStyle: "",
pickedItem: {} pickedItem: {},
hasNewFriends: true
} }
}, },
components: { components: {
@@ -110,14 +116,14 @@
onShow() { onShow() {
if (this.$store.state.token !== '') { if (this.$store.state.token !== '') {
this.getConversationList() this.getConversationList()
} }
uni.$on('onReceiveMessage', (msg) => { uni.$on('onReceiveMessage', (msg) => {
console.log('收到消息,刷新列表'); console.log('收到消息,刷新列表');
this.getConversationList() this.getConversationList()
}) })
this.isShown = true this.isShown = true
}, },
onHide() { onHide() {
uni.$off('onReceiveMessage') uni.$off('onReceiveMessage')
this.isShown = false this.isShown = false
}, },
@@ -209,11 +215,11 @@
url: '/pages/im/private/chat?targetId=' + item.targetId + '&conversationType=' + item url: '/pages/im/private/chat?targetId=' + item.targetId + '&conversationType=' + item
.conversationType .conversationType
}) })
}, },
toFriend(targetId) { toFriend(targetId) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/im/friends/info?targetId=' + targetId url: '/pages/im/friends/info?targetId=' + targetId
}) })
}, },
// 点击按钮 // 点击按钮
onNav(name, params) { onNav(name, params) {
@@ -268,6 +274,7 @@
.tabs { .tabs {
.item { .item {
position: relative;
margin-left: $margin; margin-left: $margin;
display: inline-block; display: inline-block;
font-size: $title-size-lg; font-size: $title-size-lg;
@@ -289,6 +296,7 @@
.btns { .btns {
.item { .item {
position: relative;
display: inline-block; display: inline-block;
margin-left: $margin; margin-left: $margin;
} }
@@ -379,10 +387,10 @@
} }
/* 遮罩 */ /* 遮罩 */
.shade { .shade {
position: fixed; position: fixed;
width: 100%; width: 100%;
height: 100%; height: 100%;
.pop { .pop {
position: fixed; position: fixed;