扫码加好友修复
This commit is contained in:
@@ -105,6 +105,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
|
console.log(e);
|
||||||
this.targetId = e.targetId
|
this.targetId = e.targetId
|
||||||
getFriendInfo(e.targetId).then(res => {
|
getFriendInfo(e.targetId).then(res => {
|
||||||
this.userInfo = res
|
this.userInfo = res
|
||||||
@@ -243,16 +244,14 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
singleCall(e) {
|
singleCall(e) {
|
||||||
CallLib.startSingleCall(this.targetId, e.type, '');
|
uni.showToast({
|
||||||
uni.redirectTo({
|
icon: 'none',
|
||||||
url: '/pages/im/private/call?targetId=' + this.targetId + '&mediaType=' + e.type,
|
title: '功能正在开发中'
|
||||||
success: (err) => {
|
|
||||||
console.log('跳转视频通话成功');
|
|
||||||
},
|
|
||||||
fail: (err) => {
|
|
||||||
console.log('跳转视频页失败', err);
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
// CallLib.startSingleCall(this.targetId, e.type, '');
|
||||||
|
// uni.redirectTo({
|
||||||
|
// url: '/pages/im/private/call?targetId=' + this.targetId + '&mediaType=' + e.type
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,7 @@
|
|||||||
<view class="content">
|
<view class="content">
|
||||||
<!-- 用户信息 -->
|
<!-- 用户信息 -->
|
||||||
<view class="info-flex">
|
<view class="info-flex">
|
||||||
<u-avatar
|
<u-avatar :src="infoObj.portraitUrl" shape="square" size="50" bg-color="#fff"></u-avatar>
|
||||||
:src="infoObj.portraitUrl"
|
|
||||||
shape="square"
|
|
||||||
size="50"
|
|
||||||
bg-color="#fff"
|
|
||||||
></u-avatar>
|
|
||||||
<view class="info-text">
|
<view class="info-text">
|
||||||
<view class="nickname">{{infoObj.name}}</view>
|
<view class="nickname">{{infoObj.name}}</view>
|
||||||
<view class="address">地址:{{infoObj.address}}</view>
|
<view class="address">地址:{{infoObj.address}}</view>
|
||||||
@@ -28,7 +23,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<!-- 二维码 -->
|
<!-- 二维码 -->
|
||||||
<view class="info-code">
|
<view class="info-code">
|
||||||
<uqrcode class="info-code-src" :size="198" ref="uQRCode" text="qrContent" />
|
<uqrcode class="info-code-src" :size="198" ref="uQRCode" :text="qrContent" />
|
||||||
<view class="info-code-text">
|
<view class="info-code-text">
|
||||||
<view>ZH-HEALTH扫一扫上面的二维码</view>
|
<view>ZH-HEALTH扫一扫上面的二维码</view>
|
||||||
<view>添加我的好友</view>
|
<view>添加我的好友</view>
|
||||||
@@ -38,55 +33,56 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getUserInfo } from '@/apis/interfaces/im'
|
import {
|
||||||
export default{
|
getUserInfo
|
||||||
data(){
|
} from '@/apis/interfaces/im'
|
||||||
return{
|
export default {
|
||||||
infoObj: {
|
data() {
|
||||||
userId : '',
|
return {
|
||||||
username : '',
|
infoObj: {
|
||||||
name : '',
|
userId: '',
|
||||||
address : '',
|
username: '',
|
||||||
portraitUrl : '',
|
name: '',
|
||||||
gender : 0,
|
address: '',
|
||||||
hash : ''
|
portraitUrl: '',
|
||||||
|
gender: 0,
|
||||||
|
hash: ''
|
||||||
},
|
},
|
||||||
qrContent: 'ADDFRIEND|'
|
qrContent: 'ADDFRIEND|'
|
||||||
}
|
}
|
||||||
},
|
|
||||||
onLoad(e){
|
|
||||||
console.log(e)
|
|
||||||
|
|
||||||
},
|
},
|
||||||
mounted() {
|
onLoad(e) {},
|
||||||
getUserInfo(this.$Route.query.targetId).then(res => {
|
mounted() {
|
||||||
|
getUserInfo(this.$Route.query.targetId).then(res => {
|
||||||
this.infoObj = res
|
this.infoObj = res
|
||||||
this.qrContent += res.userId
|
this.qrContent += res.userId
|
||||||
console.log(this.infoObj)
|
})
|
||||||
})
|
},
|
||||||
},
|
methods: {
|
||||||
methods: {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.content{
|
.content {
|
||||||
background: $window-color;
|
background: $window-color;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
padding-top: $padding;
|
padding-top: $padding;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
.info-code{
|
|
||||||
|
.info-code {
|
||||||
background: white;
|
background: white;
|
||||||
margin: 0 $margin;
|
margin: 0 $margin;
|
||||||
border-radius: $radius;
|
border-radius: $radius;
|
||||||
padding: $padding*3 $padding $padding;
|
padding: $padding*3 $padding $padding;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
&-src{
|
|
||||||
|
&-src {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
&-text{
|
|
||||||
|
&-text {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: $text-gray;
|
color: $text-gray;
|
||||||
font-size: $title-size-sm;
|
font-size: $title-size-sm;
|
||||||
@@ -94,24 +90,28 @@
|
|||||||
padding: $padding 0;
|
padding: $padding 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用户信息
|
// 用户信息
|
||||||
.info-flex{
|
.info-flex {
|
||||||
padding: $padding;
|
padding: $padding;
|
||||||
margin: 0 $margin;
|
margin: 0 $margin;
|
||||||
display: flex;
|
display: flex;
|
||||||
background: white;
|
background: white;
|
||||||
border-radius: $radius;
|
border-radius: $radius;
|
||||||
.info-text{
|
|
||||||
|
.info-text {
|
||||||
width: calc(100% - 50px);
|
width: calc(100% - 50px);
|
||||||
padding-left: $padding;
|
padding-left: $padding;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
.nickname{
|
|
||||||
|
.nickname {
|
||||||
line-height: 30px;
|
line-height: 30px;
|
||||||
font-size: $title-size + 6;
|
font-size: $title-size + 6;
|
||||||
color: $text-color;
|
color: $text-color;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
.address{
|
|
||||||
|
.address {
|
||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
font-size: $title-size-sm;
|
font-size: $title-size-sm;
|
||||||
color: $text-gray;
|
color: $text-gray;
|
||||||
@@ -122,7 +122,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// footer
|
// footer
|
||||||
.footer{
|
.footer {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
@@ -130,21 +130,25 @@
|
|||||||
padding: $padding*2 $padding;
|
padding: $padding*2 $padding;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
.footer-item{
|
|
||||||
|
.footer-item {
|
||||||
margin: 0 $margin/2;
|
margin: 0 $margin/2;
|
||||||
.icon{
|
|
||||||
|
.icon {
|
||||||
background: $main-color;
|
background: $main-color;
|
||||||
width: 88rpx;
|
width: 88rpx;
|
||||||
height: 88rpx;
|
height: 88rpx;
|
||||||
line-height: 88rpx;
|
line-height: 88rpx;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
.icon-u{
|
|
||||||
|
.icon-u {
|
||||||
margin-top: calc((88rpx/2) - 13px);
|
margin-top: calc((88rpx/2) - 13px);
|
||||||
margin-left: calc((88rpx/2) - 13px);
|
margin-left: calc((88rpx/2) - 13px);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.text{
|
|
||||||
|
.text {
|
||||||
color: $main-color;
|
color: $main-color;
|
||||||
font-size: $title-size-m;
|
font-size: $title-size-m;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -154,24 +158,28 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// btns
|
// btns
|
||||||
.info-btns{
|
.info-btns {
|
||||||
background: white;
|
background: white;
|
||||||
margin: $margin;
|
margin: $margin;
|
||||||
border-radius: $radius;
|
border-radius: $radius;
|
||||||
.item{
|
|
||||||
|
.item {
|
||||||
line-height: 100rpx;
|
line-height: 100rpx;
|
||||||
border-bottom: solid 1rpx $border-color;
|
border-bottom: solid 1rpx $border-color;
|
||||||
display: flex;
|
display: flex;
|
||||||
padding: 0 $padding;
|
padding: 0 $padding;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
font-size: $title-size-lg;
|
font-size: $title-size-lg;
|
||||||
&:last-child{
|
|
||||||
|
&:last-child {
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
label{
|
|
||||||
|
label {
|
||||||
width: 200rpx;
|
width: 200rpx;
|
||||||
}
|
}
|
||||||
.text{
|
|
||||||
|
.text {
|
||||||
width: calc(100% - 200rpx);
|
width: calc(100% - 200rpx);
|
||||||
color: $text-gray-m;
|
color: $text-gray-m;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
|
|||||||
@@ -74,7 +74,9 @@
|
|||||||
import * as RongIMLib from "@/uni_modules/RongCloud-IMWrapper/js_sdk/index"
|
import * as RongIMLib from "@/uni_modules/RongCloud-IMWrapper/js_sdk/index"
|
||||||
import im from '@/utils/im/index.js'
|
import im from '@/utils/im/index.js'
|
||||||
import userAuth from '@/public/userAuth'
|
import userAuth from '@/public/userAuth'
|
||||||
import { getImToken } from '@/apis/interfaces/im.js'
|
import {
|
||||||
|
getImToken
|
||||||
|
} from '@/apis/interfaces/im.js'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -202,9 +204,6 @@
|
|||||||
// 进入聊天的详情页面,清理未读消息数量
|
// 进入聊天的详情页面,清理未读消息数量
|
||||||
toDetail(item) {
|
toDetail(item) {
|
||||||
this.hidePop()
|
this.hidePop()
|
||||||
// uni.navigateTo({
|
|
||||||
// url: '/pages/im/private/call?targetId=' + item.targetId + '&mediaType=1'
|
|
||||||
// })
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/im/private/index?targetId=' + item.targetId + '&conversationType=' + item
|
url: '/pages/im/private/index?targetId=' + item.targetId + '&conversationType=' + item
|
||||||
.conversationType
|
.conversationType
|
||||||
@@ -229,10 +228,8 @@
|
|||||||
scanQrCode() {
|
scanQrCode() {
|
||||||
uni.scanCode({
|
uni.scanCode({
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
// "result": "ADDFRIEND|10010",
|
|
||||||
if (res.scanType == 'QR_CODE') {
|
if (res.scanType == 'QR_CODE') {
|
||||||
res.result.substr(0, 10) == 'ADDFRIEND|'
|
res.result.substr(0, 10) == 'ADDFRIEND|'
|
||||||
// 跳转到添加好友页面
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/im/friends/info?targetId=' + res.result.substr(10)
|
url: '/pages/im/friends/info?targetId=' + res.result.substr(10)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
|
|
||||||
const initIm = (KEY) => {
|
const initIm = (KEY) => {
|
||||||
RongIMLib.init(KEY)
|
RongIMLib.init(KEY)
|
||||||
CallLib.init({})
|
CallLib.init()
|
||||||
addListeners()
|
addListeners()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ function inArray(search, array) {
|
|||||||
const addListeners = () => {
|
const addListeners = () => {
|
||||||
// 添加连接状态监听函数
|
// 添加连接状态监听函数
|
||||||
RongIMLib.addConnectionStatusListener((res) => {
|
RongIMLib.addConnectionStatusListener((res) => {
|
||||||
console.log('连接状态监', res.data.status);
|
console.log('连接状态监听', res.data.status);
|
||||||
store.dispatch('updateConnectionStatus', res.data.status)
|
store.dispatch('updateConnectionStatus', res.data.status)
|
||||||
})
|
})
|
||||||
// 添加消息监听函数
|
// 添加消息监听函数
|
||||||
@@ -104,7 +104,8 @@ const addListeners = () => {
|
|||||||
CallLib.onCallReceived(({
|
CallLib.onCallReceived(({
|
||||||
data
|
data
|
||||||
}) => {
|
}) => {
|
||||||
console.log('onCallReceived');
|
console.log('onCallReceived', data)
|
||||||
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/im/private/call?targetId=' + data.targetId + '&mediaType=' +
|
url: '/pages/im/private/call?targetId=' + data.targetId + '&mediaType=' +
|
||||||
data.mediaType
|
data.mediaType
|
||||||
|
|||||||
Reference in New Issue
Block a user