This commit is contained in:
2022-02-17 17:05:38 +08:00
parent 0270de8490
commit 77b0905895
7 changed files with 43 additions and 36 deletions

View File

@@ -2,8 +2,8 @@
"name" : "ZH-HEALTH", "name" : "ZH-HEALTH",
"appid" : "__UNI__C29473D", "appid" : "__UNI__C29473D",
"description" : "ZH-HEALTH您手上的健康管理专家", "description" : "ZH-HEALTH您手上的健康管理专家",
"versionName" : "1.0.8", "versionName" : "1.0.10",
"versionCode" : 108, "versionCode" : 110,
"transformPx" : false, "transformPx" : false,
/* 5+App */ /* 5+App */
"app-plus" : { "app-plus" : {

View File

@@ -18,9 +18,10 @@
</view> </view>
</view> </view>
<view class="loadmore"> <view class="loadmore">
<u-icon name="arrow-right" @click="loadMore" v-if="members > users.length" color="#999" labelColor="#999" label="查看更多群成员" labelPos='left' labelSize='28rpx' size="14" /> <u-icon name="arrow-right" @click="loadMore" v-if="members > users.length" color="#999" labelColor="#999"
</view> label="查看更多群成员" labelPos="left" :labelSize="labelSize" :size="iconSize" />
</view>
<u-action-sheet :actions="actionMap" :title="actionTitle" cancelText="取消" @close="hideAction" <u-action-sheet :actions="actionMap" :title="actionTitle" cancelText="取消" @close="hideAction"
@select="handleAction" :show="actionShow"> @select="handleAction" :show="actionShow">
@@ -32,12 +33,12 @@
import { import {
getGroupUsers, getGroupUsers,
getGroupBase, getGroupBase,
removeGroupUser, removeGroupUser,
setGroupAdmin, setGroupAdmin,
removeGroupAdmin, removeGroupAdmin,
transferGroupOwner transferGroupOwner
} from '@/apis/interfaces/im.js' } from '@/apis/interfaces/im.js'
import utils from '@/utils/index.js'
export default { export default {
props: { props: {
@@ -61,7 +62,9 @@
actionMap: [], actionMap: [],
actionTitle: '', actionTitle: '',
currentUser: {}, currentUser: {},
avatarSize: 40 avatarSize: 45,
labelSize: 14,
iconSize: 14
} }
}, },
computed: { computed: {
@@ -71,8 +74,10 @@
} }
} }
}, },
created() { created() {
this.avatarSize = 90 / 750 * wx.getSystemInfoSync().windowWidth this.avatarSize = utils.rpx2px(90)
this.labelSize = utils.rpx2px(24)
this.iconSize = utils.rpx2px(26)
}, },
mounted() { mounted() {
this.initGroupInfo() this.initGroupInfo()

View File

@@ -8,7 +8,7 @@
<image class="icon" src="@/static/icon/popups-icon-01.png" mode="widthFix"></image> <image class="icon" src="@/static/icon/popups-icon-01.png" mode="widthFix"></image>
<text class="text">拍摄</text> <text class="text">拍摄</text>
</view> </view>
<view class="item" @click="onPopupsItem('video')"> <view class="item" @click="onPopupsItem('video')" v-if="conversationType == 1">
<image class="icon" src="@/static/icon/popups-icon-02.png" mode="widthFix"></image> <image class="icon" src="@/static/icon/popups-icon-02.png" mode="widthFix"></image>
<text class="text">视频通话</text> <text class="text">视频通话</text>
</view> </view>
@@ -33,6 +33,7 @@
<script> <script>
import im from '@/utils/im/index.js' import im from '@/utils/im/index.js'
import * as CallLib from '@/uni_modules/RongCloud-CallWrapper/lib/index'
export default { export default {
data() { data() {
@@ -70,14 +71,9 @@
}, },
methods: { methods: {
singleCall(e) { singleCall(e) {
uni.showToast({ uni.navigateTo({
icon: 'none', url: '/pages/im/private/call?targetId=' + this.targetId + '&mediaType=' + e.type
title: '功能正在开发中'
}) })
// CallLib.startSingleCall(this.targetId, e.type, '');
// uni.redirectTo({
// url: '/pages/im/private/call?targetId=' + this.targetId + '&mediaType=' + e.type
// })
}, },
onPopupsItem(type) { onPopupsItem(type) {
switch (type) { switch (type) {

View File

@@ -10,11 +10,9 @@
<view class="status" v-if="!connected || mediaType == 0"> <view class="status" v-if="!connected || mediaType == 0">
<view class="remote"> <view class="remote">
<u-avatar v-if="userInfo.portraitUrl" :src="userInfo.portraitUrl" shape="square" size="96" <u-avatar :src="contact(targetId).portraitUrl" shape="square" size="96"
bgColor="#fff" /> bgColor="#fff" />
<u-avatar size="80" v-if="!userInfo.portraitUrl" shape="square" <view><text class="nickname">{{ contact(targetId).name }}</text></view>
:text="userInfo.name ? userInfo.name.substring(0,1) : '未'" font-size="44" randomBgColor />
<view><text class="nickname">{{userInfo.name}}</text></view>
<view v-if="remoteRinging"><text class="mediaType">等待对方接听</text></view> <view v-if="remoteRinging"><text class="mediaType">等待对方接听</text></view>
<view v-if="connected"><text class="mediaType">已接通</text></view> <view v-if="connected"><text class="mediaType">已接通</text></view>
<view v-else><text class="mediaType">{{ mediaType == 0 ? '邀请您语音通话' : '邀请您视频通话' }}</text></view> <view v-else><text class="mediaType">{{ mediaType == 0 ? '邀请您语音通话' : '邀请您视频通话' }}</text></view>
@@ -52,17 +50,14 @@
</template> </template>
<script> <script>
import {
getFriendInfo
} from '@/apis/interfaces/im.js'
import * as CallLib from '@/uni_modules/RongCloud-CallWrapper/lib/index' import * as CallLib from '@/uni_modules/RongCloud-CallWrapper/lib/index'
import * as IMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
export default { export default {
data() { data() {
return { return {
targetId: '', targetId: '',
mediaType: 0, // 0 语音 1 视频 mediaType: 0, // 0 语音 1 视频
userInfo: {},
isOut: false, isOut: false,
connected: false, connected: false,
micStatus: false, micStatus: false,
@@ -73,10 +68,10 @@
}, },
onLoad(e) { onLoad(e) {
this.targetId = e.targetId this.targetId = e.targetId
this.mediaType = e.mediaType this.mediaType = e.mediaType
getFriendInfo(this.targetId).then(res => { // 进入页面开启外呼
this.userInfo = res CallLib.startSingleCall(this.targetId, this.mediaType, '');
})
this.startRing() this.startRing()
// 监听通话链接状态 // 监听通话链接状态
uni.$once('onCallConnected', this.onCallConnected) uni.$once('onCallConnected', this.onCallConnected)
@@ -87,6 +82,9 @@
uni.$once('onRemoteUserJoined', () => { uni.$once('onRemoteUserJoined', () => {
this.remoteRinging = false this.remoteRinging = false
}) })
},
beforeDestroy() {
}, },
computed: { computed: {
windowWidth() { windowWidth() {
@@ -94,6 +92,11 @@
}, },
windowHeight() { windowHeight() {
return uni.getSystemInfoSync().windowHeight return uni.getSystemInfoSync().windowHeight
},
contact() {
return function(targetId) {
return this.$store.getters.contactInfo(targetId)
}
} }
}, },
methods: { methods: {
@@ -130,9 +133,7 @@
setTimeout(() => { setTimeout(() => {
this.downRing() this.downRing()
uni.switchTab({ uni.navigateBack()
url: '/pages/im/index'
})
}, 200); }, 200);
}, },
toHome() { toHome() {

View File

@@ -121,7 +121,7 @@ const triTone = () => {
export default { export default {
initIm, initIm,
connect, connect,
disconnect, disconnect,
setNotifyBadge, setNotifyBadge,
...message ...message

View File

@@ -39,7 +39,6 @@ const notifyMsgTypes = [
] ]
const imLibListeners = () => { const imLibListeners = () => {
console.log('添加监听');
// 添加连接状态监听函数 // 添加连接状态监听函数
IMLib.addConnectionStatusListener((res) => { IMLib.addConnectionStatusListener((res) => {
console.log('连接状态监听', res.data.status) console.log('连接状态监听', res.data.status)
@@ -76,7 +75,8 @@ const imLibListeners = () => {
} else if (message.objectName === IMLib.ObjectName.GroupNotification) { } else if (message.objectName === IMLib.ObjectName.GroupNotification) {
// 解散群 // 解散群
if (message.content.operation === 'Dismiss') { if (message.content.operation === 'Dismiss') {
IMLib.cleanHistoryMessages(message.conversationType, message.targetId, message.sentTime, false) IMLib.cleanHistoryMessages(message.conversationType, message.targetId, message.sentTime,
false)
// 解散了就删了吧 // 解散了就删了吧
IMLib.removeConversation(message.conversationType, message.targetId) IMLib.removeConversation(message.conversationType, message.targetId)
uni.$emit('onGroupDismiss', message.targetId) uni.$emit('onGroupDismiss', message.targetId)
@@ -99,6 +99,7 @@ const callLibListeners = () => {
CallLib.onCallReceived(({ CallLib.onCallReceived(({
data data
}) => { }) => {
console.log('onCallReceived');
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
@@ -110,6 +111,7 @@ const callLibListeners = () => {
}) })
// 外呼 // 外呼
CallLib.onCallOutgoing((res) => { CallLib.onCallOutgoing((res) => {
console.log('onCallOutgoing', res);
uni.$emit('onCallOutgoing') uni.$emit('onCallOutgoing')
}) })
// 远端响铃 // 远端响铃
@@ -118,6 +120,7 @@ const callLibListeners = () => {
}) })
// 远端加入 // 远端加入
CallLib.onRemoteUserJoined((res) => { CallLib.onRemoteUserJoined((res) => {
console.log('远端接听');
uni.$emit('onRemoteUserJoined') uni.$emit('onRemoteUserJoined')
}) })
// 断开链接 // 断开链接

View File

@@ -9,6 +9,9 @@ export default {
} }
return false return false
}, },
rpx2px: (rpx) => {
return rpx / 750 * uni.getSystemInfoSync().windowWidth
},
checkPhone: (phone) => { checkPhone: (phone) => {
let re = /^[0-9]+.?[0-9]*/; let re = /^[0-9]+.?[0-9]*/;
if (phone.length === 11) { if (phone.length === 11) {
@@ -81,7 +84,6 @@ export default {
let days = Math.abs(currentDate.getTime() - valDate.getTime()) / (1000 * 60 * 60 * 24); let days = Math.abs(currentDate.getTime() - valDate.getTime()) / (1000 * 60 * 60 * 24);
return Math.ceil(days) + '天前'; return Math.ceil(days) + '天前';
} }
} }
}, },
timeStamp(timestamp, formats) { timeStamp(timestamp, formats) {