|
@@ -180,8 +180,12 @@ export default {
|
|
|
async getUserInfo() {
|
|
|
let userInfo = wx.getStorageSync('userInfo');
|
|
|
let token = wx.getStorageSync('token');
|
|
|
+
|
|
|
if (userInfo && userInfo.userId && token) {
|
|
|
let info = await this.agetUserInfo()
|
|
|
+ if (info.avatar == "" || !info.avatar ) {
|
|
|
+ info.avatar = 'static/img/avatar_default.jpg'
|
|
|
+ }
|
|
|
return {
|
|
|
...userInfo,
|
|
|
...info,
|
|
@@ -247,8 +251,7 @@ export default {
|
|
|
// this.setData({
|
|
|
// userInfoa: userInfo.nickname.split('').join(' ')
|
|
|
// })
|
|
|
-
|
|
|
- userInfo.nickname = userInfo.nickname.replace(/[^\u4E00-\u9FA5A-Za-z0-9]/g, '')
|
|
|
+ // userInfo.nickname = userInfo.nickname.replace(/[^\u4E00-\u9FA5A-Za-z0-9]/g, '')
|
|
|
if (userInfo.nickname == "") {
|
|
|
userInfo.nickname = "口"
|
|
|
}
|
|
@@ -259,13 +262,12 @@ export default {
|
|
|
if (this.options.roomId) {
|
|
|
this.role = 'leader'
|
|
|
}
|
|
|
- console.log('**************')
|
|
|
console.log(this.options)
|
|
|
}
|
|
|
// wx.showToast({
|
|
|
// title: this.data.peopleCount.toString(),
|
|
|
// })
|
|
|
-
|
|
|
+ console.error('avatar', userInfo)
|
|
|
return {
|
|
|
role: this.role || 'leader',
|
|
|
userId: userInfo.userId,
|
|
@@ -507,7 +509,7 @@ export default {
|
|
|
if (!data) return;
|
|
|
|
|
|
this.setData({
|
|
|
- surplus: this.data.peopleCount - data.roomsPerson.length
|
|
|
+ surplus: data.roomsPerson.length > 0 ? this.data.peopleCount - data.roomsPerson.length : this.data.peopleCount - 1
|
|
|
})
|
|
|
//限制只有主持人才可以开麦
|
|
|
if (this.role == 'leader') {
|
|
@@ -571,7 +573,7 @@ export default {
|
|
|
// this.stopCall()
|
|
|
}
|
|
|
this.setData({
|
|
|
- surplus: this.data.peopleCount - data.roomsPerson.length
|
|
|
+ surplus: data.roomsPerson.length > 0 ? this.data.peopleCount - data.roomsPerson.length : this.data.peopleCount - 1
|
|
|
})
|
|
|
},
|
|
|
async newRoom(data) {
|