merge
This commit is contained in:
1
App.vue
1
App.vue
@@ -5,7 +5,6 @@
|
||||
export default {
|
||||
onLaunch: function() {
|
||||
im.initIm('lmxuhwaglu76d')
|
||||
return
|
||||
//#ifdef APP-PLUS
|
||||
// 获取系统版本号
|
||||
getVersions({
|
||||
|
||||
20
components/im/imAUDIO.vue
Normal file
20
components/im/imAUDIO.vue
Normal file
@@ -0,0 +1,20 @@
|
||||
<template>
|
||||
<view>
|
||||
语音消息
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name:"im",
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
</style>
|
||||
20
components/im/imIMG.vue
Normal file
20
components/im/imIMG.vue
Normal file
@@ -0,0 +1,20 @@
|
||||
<template>
|
||||
<view>
|
||||
图片消息
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name:"im",
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
</style>
|
||||
20
components/im/imTXT.vue
Normal file
20
components/im/imTXT.vue
Normal file
@@ -0,0 +1,20 @@
|
||||
<template>
|
||||
<view>
|
||||
文字消息
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name:"im",
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
</style>
|
||||
@@ -573,6 +573,14 @@
|
||||
"navigationBarBackgroundColor": "#34CE98",
|
||||
"navigationBarTextStyle": "white"
|
||||
}
|
||||
},{
|
||||
"path" : "pages/im/private/chat",
|
||||
"style" : {
|
||||
"disableScroll": true,
|
||||
"navigationBarTitleText": "聊天",
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationBarBackgroundColor":"#F3F6FB"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tabBar": {
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<u-button @click="toIndex">会首页</u-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
methods: {
|
||||
toIndex() {
|
||||
uni.switchTab({
|
||||
url: '/pages/im/index'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
@@ -124,84 +124,122 @@
|
||||
if (code == 0) {
|
||||
this.isTop = conversation.isTop
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
copyAddress() {
|
||||
uni.setClipboardData({
|
||||
data: this.userInfo.address,
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '复制区块链成功'
|
||||
toPrivate() {
|
||||
uni.redirectTo({
|
||||
url: '/pages/im/private/index?conversationType=1&targetId=' + this.targetId
|
||||
});
|
||||
},
|
||||
setRemark() {
|
||||
uni.showToast({
|
||||
title: '开发中',
|
||||
icon: 'none'
|
||||
});
|
||||
},
|
||||
deleteFriend() {
|
||||
uni.showModal({
|
||||
title: '删除确认',
|
||||
content: '确认删除后不可恢复',
|
||||
success: e => {
|
||||
if (e.confirm) {
|
||||
deleteFriend(this.targetId).then(res => {
|
||||
// 删除聊天记录
|
||||
RongIMLib.deleteMessages(1, this.targetId);
|
||||
RongIMLib.removeConversation(1, this.targetId);
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '好友删除成功',
|
||||
success() {
|
||||
uni.switchTab({
|
||||
url: '/pages/im/index'
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
toPrivate() {
|
||||
uni.redirectTo({
|
||||
url: '/pages/im/private/index?conversationType=1&targetId=' + this.targetId
|
||||
})
|
||||
},
|
||||
setRemark() {
|
||||
uni.showToast({
|
||||
title: '开发中',
|
||||
icon: 'none'
|
||||
})
|
||||
},
|
||||
deleteFriend() {
|
||||
uni.showModal({
|
||||
title: '删除确认',
|
||||
content: '确认删除后不可恢复',
|
||||
success: (e) => {
|
||||
if (e.confirm) {
|
||||
deleteFriend(this.targetId).then(res => {
|
||||
// 删除聊天记录
|
||||
RongIMLib.deleteMessages(1, this.targetId)
|
||||
RongIMLib.removeConversation(1, this.targetId)
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '好友删除成功',
|
||||
success() {
|
||||
uni.switchTab({
|
||||
url: '/pages/im/index'
|
||||
})
|
||||
}
|
||||
},
|
||||
toPrivate() {
|
||||
uni.redirectTo({
|
||||
url: '/pages/im/private/index?conversationType=1&targetId=' + this.targetId
|
||||
})
|
||||
},
|
||||
setRemark() {
|
||||
uni.showToast({
|
||||
title: '开发中',
|
||||
icon: 'none'
|
||||
})
|
||||
},
|
||||
deleteFriend() {
|
||||
uni.showModal({
|
||||
title: '删除确认',
|
||||
content: '确认删除后不可恢复',
|
||||
success: (e) => {
|
||||
if (e.confirm) {
|
||||
deleteFriend(this.targetId).then(res => {
|
||||
// 删除聊天记录
|
||||
RongIMLib.deleteMessages(1, this.targetId)
|
||||
RongIMLib.removeConversation(1, this.targetId)
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '好友删除成功',
|
||||
success() {
|
||||
uni.switchTab({
|
||||
url: '/pages/im/index'
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
setStatus() {
|
||||
RongIMLib.setConversationNotificationStatus(this.conversationType, this.targetId, this.status, ({
|
||||
status
|
||||
}) => {
|
||||
this.status = !Boolean(status)
|
||||
})
|
||||
},
|
||||
setTop() {
|
||||
RongIMLib.setConversationToTop(this.conversationType, this.targetId, this.isTop, (res) => {
|
||||
RongIMLib.getConversation(this.conversationType, this.targetId, ({
|
||||
conversation
|
||||
})
|
||||
},
|
||||
setStatus() {
|
||||
RongIMLib.setConversationNotificationStatus(this.conversationType, this.targetId, this.status, ({
|
||||
status
|
||||
}) => {
|
||||
this.isTop = conversation.isTop
|
||||
this.status = !Boolean(status)
|
||||
})
|
||||
})
|
||||
},
|
||||
// 申请好友
|
||||
toBeFriend() {
|
||||
pedingFriend(this.targetId).then(res => {
|
||||
uni.showToast({
|
||||
title: '申请成功',
|
||||
icon: "none"
|
||||
},
|
||||
setTop() {
|
||||
RongIMLib.setConversationToTop(this.conversationType, this.targetId, this.isTop, (res) => {
|
||||
RongIMLib.getConversation(this.conversationType, this.targetId, ({
|
||||
conversation
|
||||
}) => {
|
||||
this.isTop = conversation.isTop
|
||||
})
|
||||
})
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
title: err.message,
|
||||
duration: 2000
|
||||
},
|
||||
// 申请好友
|
||||
toBeFriend() {
|
||||
pedingFriend(this.targetId).then(res => {
|
||||
uni.showToast({
|
||||
title: '申请成功',
|
||||
icon: 'none'
|
||||
});
|
||||
|
||||
})
|
||||
.catch(err => {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
title: err.message,
|
||||
duration: 2000
|
||||
})
|
||||
})
|
||||
},
|
||||
singleCall(e) {
|
||||
CallLib.startSingleCall(this.targetId, e.type, '');
|
||||
uni.redirectTo({
|
||||
url: '/pages/im/private/call',
|
||||
success: (err) => {
|
||||
console.log('跳转视频通话成功');
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log('跳转视频页失败', err);
|
||||
}
|
||||
})
|
||||
<<<<<<< HEAD
|
||||
})
|
||||
},
|
||||
singleCall(e) {
|
||||
@@ -216,7 +254,11 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
=======
|
||||
},
|
||||
>>>>>>> d3c351f58f900a4484c2811b73ef00ace4632e2b
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -74,10 +74,7 @@
|
||||
import * as RongIMLib from "@/uni_modules/RongCloud-IMWrapper/js_sdk/index"
|
||||
import im from '@/utils/im/index.js'
|
||||
import userAuth from '@/public/userAuth'
|
||||
import {
|
||||
getImToken
|
||||
} from '@/apis/interfaces/im.js'
|
||||
|
||||
import { getImToken } from '@/apis/interfaces/im.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
112
pages/im/private/chat.nvue
Normal file
112
pages/im/private/chat.nvue
Normal file
@@ -0,0 +1,112 @@
|
||||
<template>
|
||||
<view class="chat">
|
||||
<!-- chat -->
|
||||
<scroll-view class="chat-scroll" scroll-y="true" :scroll-into-view="toMsg" scroll-with-animation>
|
||||
<view v-for="(item, index) in msgArr" :key="index" :id="'msg'+index">{{toMsg || '-'}} / msg{{item}} - {{index}}</view>
|
||||
</scroll-view>
|
||||
<!-- chat-footer -->
|
||||
<view class="chat-footer">
|
||||
<view class="msg-type" @click="msgType">
|
||||
<image class="msg-type-icon" src="@/static/icon/key-icon.png" v-if="importTabs === 0" mode="widthFix"></image>
|
||||
<image class="msg-type-icon" src="@/static/icon/msg-icon.png" v-if="importTabs === 1" mode="widthFix"></image>
|
||||
</view>
|
||||
<block v-if="importTabs === 0">
|
||||
<view class="chat-mp3" hover-class="chat-hover" @touchstart="startAudio" @touchend="chendAudio">
|
||||
<text class="chat-mp3-text">按住说话</text>
|
||||
</view>
|
||||
</block>
|
||||
<block v-if="importTabs === 1">
|
||||
<input class="chat-input" type="text" v-model="inputTxt" confirm-type="发送" @confirm="send" cursor-spacing="10" />
|
||||
</block>
|
||||
<text class="chat-push" :disabled="disabled" size="mini" @click="send">发送</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
toMsg : '',
|
||||
msgArr : [
|
||||
"NVUE界面信息"
|
||||
],
|
||||
importTabs: 1
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
send(){
|
||||
this.msgArr.push("新消息NVUE")
|
||||
this.toMsg = 'msg' + (this.msgArr.length - 1)
|
||||
},
|
||||
msgType(){
|
||||
this.importTabs = this.importTabs === 1 ? 0 : 1
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 窗口 */
|
||||
.chat{
|
||||
background: #F3F6FB;
|
||||
flex: 1;
|
||||
}
|
||||
.chat-scroll{
|
||||
flex: 1;
|
||||
}
|
||||
/* footer */
|
||||
.chat-footer{
|
||||
background: white;
|
||||
padding: 20upx 30upx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
flex-direction: row;
|
||||
|
||||
}
|
||||
.msg-type{
|
||||
width: 70upx;
|
||||
height: 70upx;
|
||||
}
|
||||
.msg-type > .msg-type-icon{
|
||||
margin: 5upx;
|
||||
width: 60upx;
|
||||
height: 60upx;
|
||||
}
|
||||
.chat-mp3{
|
||||
background: #F3F6FB;
|
||||
height: 70upx;
|
||||
line-height: 70upx;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 460upx;
|
||||
border-radius: 10upx;
|
||||
margin-right: 15upx;
|
||||
}
|
||||
.chat-mp3-text{
|
||||
font-size: 30upx;
|
||||
color: #333;
|
||||
}
|
||||
.chat-input{
|
||||
background: #F3F6FB;
|
||||
height: 70upx;
|
||||
width: 460upx;
|
||||
border-radius: 10upx;
|
||||
margin-right: 15upx;
|
||||
padding: 0 20upx;
|
||||
}
|
||||
.chat-push{
|
||||
background: #34CE98;
|
||||
color: white;
|
||||
width: 120upx;
|
||||
line-height: 70upx;
|
||||
text-align: center;
|
||||
border-radius: 10upx;
|
||||
font-size: 30upx;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user