Browse Source

一些优化

master
xsx 2 years ago
parent
commit
ddffa7d0fc
  1. 25
      im-uniapp/components/chat-item/chat-item.vue
  2. 6
      im-uniapp/pages/chat/chat-group-video.vue
  3. 8
      im-uniapp/pages/chat/chat-private-video.vue
  4. 9
      im-uniapp/store/friendStore.js

25
im-uniapp/components/chat-item/chat-item.vue

@ -4,16 +4,14 @@
<view class="mask" @tap="showChatBox()"></view>
<view class="left">
<head-image :url="chat.headImage" :name="chat.showName" :size="90"></head-image>
<view v-if="chat.unreadCount>0" class="unread-text">{{chat.unreadCount}}</view>
</view>
<view class="chat-right">
<view class="chat-name">
<view class="chat-tag" v-if="chat.type=='GROUP'">
<uni-tag circle text="群" size="mini" type="primary"></uni-tag>
<uni-tag disabled text="群" size="mini" type="primary"></uni-tag>
</view>
<view class="chat-name-text">
{{chat.showName}}
</view>
<view class="chat-time">{{$date.toTimeText(chat.lastSendTime,true)}}</view>
</view>
@ -21,6 +19,7 @@
<view class="chat-at-text">{{atText}}</view>
<view class="chat-send-name" v-show="chat.sendNickName">{{chat.sendNickName+':&nbsp;'}}</view>
<rich-text class="chat-content-text" :nodes="$emo.transform(chat.lastContent)"></rich-text>
<uni-badge v-if="chat.unreadCount>0" size="small" :max-num="99" :text="chat.unreadCount" />
</view>
</view>
</view>
@ -98,18 +97,7 @@
width: 100rpx;
height: 100rpx;
.unread-text {
position: absolute;
background-color: red;
right: -12rpx;
top: -12rpx;
color: white;
border-radius: 16rpx;
padding: 4rpx 12rpx;
font-size: 20rpx;
text-align: center;
white-space: nowrap;
}
}
.chat-right {
@ -124,13 +112,13 @@
display: flex;
line-height: 44rpx;
height: 44rpx;
.chat-tag {
display: flex;
align-items: center;
margin-right: 3rpx;
margin-right: 5rpx;
}
.chat-name-text {
flex: 1;
font-size: 30rpx;
@ -169,6 +157,7 @@
overflow: hidden;
text-overflow: ellipsis;
}
}
}
}

6
im-uniapp/pages/chat/chat-group-video.vue

@ -1,9 +1,5 @@
<template>
<view class="page chat-group-video">
<view>
<web-view id="chat-video-wv" @message="onMessage" :src="url"></web-view>
</view>
</view>
<web-view class="page chat-group-video" id="chat-video-wv" @message="onMessage" :src="url"></web-view>
</template>
<script>

8
im-uniapp/pages/chat/chat-private-video.vue

@ -1,7 +1,5 @@
<template>
<view class="page chat-private-video">
<web-view id="chat-video-wv" @message="onMessage" :src="url"></web-view>
</view>
<web-view class="page chat-private-video" id="chat-video-wv" @message="onMessage" :src="url"></web-view>
</template>
<script>
@ -98,4 +96,8 @@
</script>
<style lang="scss" scoped>
.chat-web-view{
}
</style>

9
im-uniapp/store/friendStore.js

@ -9,6 +9,11 @@ export default {
},
mutations: {
setFriends(state, friends) {
friends.forEach((f)=>{
f.online = false;
f.onlineWeb = false;
f.onlineApp = false;
})
state.friends = friends;
},
updateFriend(state, friend) {
@ -41,12 +46,10 @@ export default {
let userTerminal = onlineTerminals.find((o)=> f.id==o.userId);
if(userTerminal){
f.online = true;
f.onlineTerminals = userTerminal.terminals;
f.onlineWeb = userTerminal.terminals.indexOf(TERMINAL_TYPE.WEB)>=0
f.onlineApp = userTerminal.terminals.indexOf(TERMINAL_TYPE.APP)>=0
}else{
f.online = false;
f.onlineTerminals = [];
f.onlineWeb = false;
f.onlineApp = false;
}
@ -80,6 +83,7 @@ export default {
},
actions: {
loadFriend(context) {
console.log("loadFriend")
return new Promise((resolve, reject) => {
http({
url: '/friend/list',
@ -88,6 +92,7 @@ export default {
context.commit("setFriends", friends);
context.commit("refreshOnlineStatus");
resolve()
console.log("loadFriend ok")
}).catch((res) => {
reject();
})

Loading…
Cancel
Save