扫码加好友修复

This commit is contained in:
2022-01-28 10:12:37 +08:00
parent 572066de9a
commit 8e047408e2
4 changed files with 206 additions and 201 deletions

View File

@@ -105,6 +105,7 @@
}
},
onLoad(e) {
console.log(e);
this.targetId = e.targetId
getFriendInfo(e.targetId).then(res => {
this.userInfo = res
@@ -243,16 +244,14 @@
})
},
singleCall(e) {
CallLib.startSingleCall(this.targetId, e.type, '');
uni.redirectTo({
url: '/pages/im/private/call?targetId=' + this.targetId + '&mediaType=' + e.type,
success: (err) => {
console.log('跳转视频通话成功');
},
fail: (err) => {
console.log('跳转视频页失败', err);
}
uni.showToast({
icon: 'none',
title: '功能正在开发中'
})
// CallLib.startSingleCall(this.targetId, e.type, '');
// uni.redirectTo({
// url: '/pages/im/private/call?targetId=' + this.targetId + '&mediaType=' + e.type
// })
}
}
}

View File

@@ -2,12 +2,7 @@
<view class="content">
<!-- 用户信息 -->
<view class="info-flex">
<u-avatar
:src="infoObj.portraitUrl"
shape="square"
size="50"
bg-color="#fff"
></u-avatar>
<u-avatar :src="infoObj.portraitUrl" shape="square" size="50" bg-color="#fff"></u-avatar>
<view class="info-text">
<view class="nickname">{{infoObj.name}}</view>
<view class="address">地址{{infoObj.address}}</view>
@@ -28,7 +23,7 @@
</view>
<!-- 二维码 -->
<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>ZH-HEALTH扫一扫上面的二维码</view>
<view>添加我的好友</view>
@@ -38,55 +33,56 @@
</template>
<script>
import { getUserInfo } from '@/apis/interfaces/im'
export default{
data(){
return{
infoObj: {
userId : '',
username : '',
name : '',
address : '',
portraitUrl : '',
gender : 0,
hash : ''
import {
getUserInfo
} from '@/apis/interfaces/im'
export default {
data() {
return {
infoObj: {
userId: '',
username: '',
name: '',
address: '',
portraitUrl: '',
gender: 0,
hash: ''
},
qrContent: 'ADDFRIEND|'
}
},
onLoad(e){
console.log(e)
}
},
mounted() {
getUserInfo(this.$Route.query.targetId).then(res => {
onLoad(e) {},
mounted() {
getUserInfo(this.$Route.query.targetId).then(res => {
this.infoObj = res
this.qrContent += res.userId
console.log(this.infoObj)
})
},
methods: {
})
},
methods: {
}
}
}
}
</script>
<style lang="scss" scoped>
.content{
.content {
background: $window-color;
min-height: 100vh;
padding-top: $padding;
box-sizing: border-box;
.info-code{
.info-code {
background: white;
margin: 0 $margin;
border-radius: $radius;
padding: $padding*3 $padding $padding;
text-align: center;
&-src{
&-src {
display: inline-block;
}
&-text{
&-text {
text-align: center;
color: $text-gray;
font-size: $title-size-sm;
@@ -94,24 +90,28 @@
padding: $padding 0;
}
}
// 用户信息
.info-flex{
.info-flex {
padding: $padding;
margin: 0 $margin;
display: flex;
background: white;
border-radius: $radius;
.info-text{
.info-text {
width: calc(100% - 50px);
padding-left: $padding;
box-sizing: border-box;
.nickname{
.nickname {
line-height: 30px;
font-size: $title-size + 6;
color: $text-color;
text-align: left;
}
.address{
.address {
line-height: 20px;
font-size: $title-size-sm;
color: $text-gray;
@@ -122,7 +122,7 @@
}
// footer
.footer{
.footer {
position: fixed;
bottom: 0;
left: 0;
@@ -130,21 +130,25 @@
padding: $padding*2 $padding;
display: flex;
justify-content: space-around;
.footer-item{
.footer-item {
margin: 0 $margin/2;
.icon{
.icon {
background: $main-color;
width: 88rpx;
height: 88rpx;
line-height: 88rpx;
display: inline-block;
border-radius: 50%;
.icon-u{
.icon-u {
margin-top: calc((88rpx/2) - 13px);
margin-left: calc((88rpx/2) - 13px);
}
}
.text{
.text {
color: $main-color;
font-size: $title-size-m;
text-align: center;
@@ -154,24 +158,28 @@
}
// btns
.info-btns{
.info-btns {
background: white;
margin: $margin;
border-radius: $radius;
.item{
.item {
line-height: 100rpx;
border-bottom: solid 1rpx $border-color;
display: flex;
padding: 0 $padding;
justify-content: space-between;
font-size: $title-size-lg;
&:last-child{
&:last-child {
border-bottom: none;
}
label{
label {
width: 200rpx;
}
.text{
.text {
width: calc(100% - 200rpx);
color: $text-gray-m;
text-align: right;

View File

@@ -74,7 +74,9 @@
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 {
@@ -202,9 +204,6 @@
// 进入聊天的详情页面,清理未读消息数量
toDetail(item) {
this.hidePop()
// uni.navigateTo({
// url: '/pages/im/private/call?targetId=' + item.targetId + '&mediaType=1'
// })
uni.navigateTo({
url: '/pages/im/private/index?targetId=' + item.targetId + '&conversationType=' + item
.conversationType
@@ -229,10 +228,8 @@
scanQrCode() {
uni.scanCode({
success: (res) => {
// "result": "ADDFRIEND|10010",
if (res.scanType == 'QR_CODE') {
res.result.substr(0, 10) == 'ADDFRIEND|'
// 跳转到添加好友页面
uni.navigateTo({
url: '/pages/im/friends/info?targetId=' + res.result.substr(10)
})

View File

@@ -8,7 +8,7 @@ import {
const initIm = (KEY) => {
RongIMLib.init(KEY)
CallLib.init({})
CallLib.init()
addListeners()
}
@@ -89,7 +89,7 @@ function inArray(search, array) {
const addListeners = () => {
// 添加连接状态监听函数
RongIMLib.addConnectionStatusListener((res) => {
console.log('连接状态监', res.data.status);
console.log('连接状态监', res.data.status);
store.dispatch('updateConnectionStatus', res.data.status)
})
// 添加消息监听函数
@@ -104,7 +104,8 @@ const addListeners = () => {
CallLib.onCallReceived(({
data
}) => {
console.log('onCallReceived');
console.log('onCallReceived', data)
uni.navigateTo({
url: '/pages/im/private/call?targetId=' + data.targetId + '&mediaType=' +
data.mediaType