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