|
@@ -189,6 +189,17 @@ export default {
|
|
|
|
|
|
return isAuth
|
|
|
},
|
|
|
+ // 获取录音权限状态
|
|
|
+ async getAuthorizeRecordStatus() {
|
|
|
+ const isAuth = await new Promise((r, j) => {
|
|
|
+ wx.authorize({
|
|
|
+ scope: 'scope.record',
|
|
|
+ success: () => r(true),
|
|
|
+ fail: () => r(false)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ return Promise.resolve(isAuth)
|
|
|
+ },
|
|
|
|
|
|
async agetUserInfo() {
|
|
|
const res = await util.request(api.UserInfo)
|
|
@@ -321,14 +332,15 @@ export default {
|
|
|
console.log('**************')
|
|
|
console.log(this.options)
|
|
|
}
|
|
|
- // wx.showToast({
|
|
|
- // title: this.data.peopleCount.toString(),
|
|
|
- // })
|
|
|
+
|
|
|
+ let isAllowMic // 真正MIC权, 房主与 授权一个 要在房间isAllowMic开启
|
|
|
|
|
|
if (Number(isAnchor) === 1) {
|
|
|
this.role = "leader"
|
|
|
+ isAllowMic = 1
|
|
|
} else {
|
|
|
this.role = 'customer'
|
|
|
+ isAllowMic = 0
|
|
|
}
|
|
|
|
|
|
if (assistant && assistant.userId && assistant.userId == userInfo.userId) {
|
|
@@ -336,15 +348,17 @@ export default {
|
|
|
}
|
|
|
console.log('进入房间角色,', this.role);
|
|
|
|
|
|
+ const isAuthMic = await this.getAuthorizeRecordStatus();
|
|
|
+ console.log('当前用户录音权限状态', isAuthMic)
|
|
|
return {
|
|
|
role: this.role,
|
|
|
userId: userInfo.userId,
|
|
|
- roomType,
|
|
|
+ // roomType,
|
|
|
avatar: userInfo.avatarUrl,
|
|
|
nickname: userInfo.nickname,
|
|
|
voiceStatus: getApp().globalData.voiceProps.noMute ? 0 : 2,
|
|
|
- isAuthMic: !!this.isAuthorizeRecord,
|
|
|
- enableTalk: this.role === 'leader' ? true : undefined,
|
|
|
+ isAuthMic: isAuthMic ? 1 : 0,
|
|
|
+ isAllowMic: isAllowMic,
|
|
|
roomId: roomId,
|
|
|
sceneNumber: sceneId,
|
|
|
onlineStatus: true,
|