调试
This commit is contained in:
@@ -631,6 +631,12 @@
|
||||
"navigationBarBackgroundColor": "#34CE98",
|
||||
"navigationBarTextStyle": "white"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/im/chatDemo",
|
||||
"style": {
|
||||
"navigationBarTitleText": "demo"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tabBar": {
|
||||
|
||||
28
pages/im/chatDemo.nvue
Normal file
28
pages/im/chatDemo.nvue
Normal file
@@ -0,0 +1,28 @@
|
||||
<template>
|
||||
<view class="">
|
||||
<input placeholder="输入内容" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
onShow() {
|
||||
|
||||
},
|
||||
onLoad() {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
@@ -11,8 +11,8 @@
|
||||
<sent-voice v-if="chatType === 0" :conversationType="conversationType" :targetId="targetId"
|
||||
@success="onSuccess" />
|
||||
<sent-text v-if="chatType === 1" :conversationType="conversationType" :targetId="targetId"
|
||||
@success="onSuccess" />
|
||||
<view class="msg-type msg-popups" @click="showPopups = !showPopups">
|
||||
@success="onSuccess" @focus="onHidePopus" />
|
||||
<view class="msg-type msg-popups" @click="() => { showPopups = !showPopups, onHidePopus }">
|
||||
<image class="icon" src="@/static/icon/popups-icon.png"></image>
|
||||
</view>
|
||||
</view>
|
||||
@@ -56,6 +56,12 @@
|
||||
},
|
||||
onSuccess() {
|
||||
this.$emit('onSuccess')
|
||||
},
|
||||
// 处理弹出层
|
||||
onHidePopus(){
|
||||
if(this.showPopups){
|
||||
this.showPopups = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,14 +110,14 @@
|
||||
this.callShow = true
|
||||
break;
|
||||
case 'location':
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '功能正在开发中'
|
||||
})
|
||||
// uni.showToast({
|
||||
// icon: 'none',
|
||||
// title: '功能正在开发中'
|
||||
// })
|
||||
// uni.chooseLocation({
|
||||
// success: res => {
|
||||
// console.log(res);
|
||||
// this.success()
|
||||
// // this.success()
|
||||
// }
|
||||
// })
|
||||
break;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<view class="sent--text">
|
||||
<input class="input" type="text" @focus="focus" @blur="blur" v-model="inputTxt" confirm-type="send"
|
||||
<input class="input" type="text" :auto-blur="true" @focus="focus" @blur="blur" :focus="focusState" v-model="inputTxt" confirm-type="send"
|
||||
@confirm="sent" cursor-spacing="10" />
|
||||
<!-- <button class="button" size="mini" :disabled="disabled" @click="sent">发送</button> -->
|
||||
<!-- <button class="button" size="mini" :disabled="disabled" @click="demo">{{focusState ? '失焦': '聚焦'}}</button> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -45,6 +45,11 @@
|
||||
console.log('销毁组件之前,保存草稿信息,但是没有执行', res);
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
focusState: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 发送文本消息
|
||||
sent() {
|
||||
@@ -56,10 +61,16 @@
|
||||
})
|
||||
}
|
||||
},
|
||||
demo(){
|
||||
console.log(this.focusState)
|
||||
|
||||
this.focusState = !this.focusState
|
||||
},
|
||||
focus() {
|
||||
this.$emit('focus')
|
||||
},
|
||||
blur() {
|
||||
uni.hideKeyboard()
|
||||
this.$emit('blur')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="group--chat">
|
||||
<list class="body" :show-scrollbar="false">
|
||||
<list class="body" :show-scrollbar="false" @click="onScroll">
|
||||
<cell class="cell" v-for="(item, index) in messages" :key="index">
|
||||
<view class="cell-item" :class="item.messageDirection == 1 ? 'right' : 'left'">
|
||||
<u-avatar class="avatar" @click="toUser(item)" size="36" shape="square"
|
||||
@@ -17,7 +17,7 @@
|
||||
</cell>
|
||||
<cell class="cell-footer" ref="chatBottom"></cell>
|
||||
</list>
|
||||
<sent-message-bar :conversationType="conversationType" :targetId="targetId" @onSuccess="getNewMessage()" />
|
||||
<sent-message-bar ref="messageBar" :conversationType="conversationType" :targetId="targetId" @onSuccess="getNewMessage()" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -53,7 +53,13 @@
|
||||
},
|
||||
computed: {
|
||||
latestMessage() {
|
||||
if (this.messages.length > 1) {
|
||||
return this.messages[this.messages.length - 1]
|
||||
} else {
|
||||
return {
|
||||
sentTime: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
@@ -76,6 +82,9 @@
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
onScroll(e){
|
||||
this.$refs.messageBar.onHidePopus()
|
||||
},
|
||||
toUser(item) {
|
||||
if (item.senderUserId == '__system__') {
|
||||
return
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
<u-alert type="warning" v-if="connection != 0" description="网络似乎断开了,请检查网络" :show-icon="true" />
|
||||
<!-- content -->
|
||||
<view v-if="$store.state.token !== ''">
|
||||
<view @click="onDemo">临时测试用</view>
|
||||
<conversation-list @refresh="getConversationList()" :conversations="conversations" />
|
||||
</view>
|
||||
<!-- 未登录 -->
|
||||
@@ -72,6 +73,12 @@
|
||||
uni.$off('onReceiveMessage')
|
||||
},
|
||||
methods: {
|
||||
onDemo(){
|
||||
console.log('1111')
|
||||
uni.navigateTo({
|
||||
url: '/pages/im/chatDemo'
|
||||
})
|
||||
},
|
||||
checkNewFriendPending() {
|
||||
im.getPendingList((pendings) => {
|
||||
this.hasNewFriends = pendings.length
|
||||
|
||||
@@ -62,7 +62,13 @@
|
||||
},
|
||||
computed: {
|
||||
latestMessage() {
|
||||
if (this.messages.length > 1) {
|
||||
return this.messages[this.messages.length - 1]
|
||||
} else {
|
||||
return {
|
||||
sentTime: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
@@ -103,7 +109,7 @@
|
||||
im.getMessageList(
|
||||
this.conversationType,
|
||||
this.targetId,
|
||||
this.latestMessage.sentTime,
|
||||
this.latestMessage.sentTime || 0,
|
||||
1,
|
||||
false,
|
||||
(messages) => {
|
||||
|
||||
@@ -13,6 +13,8 @@ const ROUTES = [{
|
||||
"path": "/pages/im/private/chat"
|
||||
}, {
|
||||
"path": "/pages/im/group/chat"
|
||||
}, {
|
||||
"path": "/pages/im/chatDemo"
|
||||
}];
|
||||
// #endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user