|
@@ -41,10 +41,12 @@ Page({
|
|
const scene = decodeURIComponent(options.scene)
|
|
const scene = decodeURIComponent(options.scene)
|
|
|
|
|
|
let arr = scene.split('_')
|
|
let arr = scene.split('_')
|
|
- this.options.id = options.id
|
|
|
|
- this.options.type = options.type
|
|
|
|
|
|
+
|
|
|
|
+ console.log('分拆的', arr)
|
|
|
|
+ this.options.id = options.id || arr[0]
|
|
|
|
+ this.options.type = options.type || arr[1]
|
|
this.options.join = "true"
|
|
this.options.join = "true"
|
|
- this.options.roomId = options.roomId
|
|
|
|
|
|
+ this.options.roomId = options.roomId || arr[3]
|
|
this.options.many = "true"
|
|
this.options.many = "true"
|
|
}
|
|
}
|
|
// debugger
|
|
// debugger
|
|
@@ -117,52 +119,71 @@ Page({
|
|
// })
|
|
// })
|
|
// },
|
|
// },
|
|
async init() {
|
|
async init() {
|
|
- let options = this.options
|
|
|
|
- console.log('webview-option', options)
|
|
|
|
-
|
|
|
|
- let {
|
|
|
|
- url: base,
|
|
|
|
- obj: m
|
|
|
|
- } = await new Promise(r => this.getBrandDetail(options.id, options.type, (url, obj) => r({
|
|
|
|
- url,
|
|
|
|
- obj
|
|
|
|
- })))
|
|
|
|
-
|
|
|
|
- this.getBrand(options.id, m)
|
|
|
|
- this.mcode = m
|
|
|
|
- //TODO 有问题, 其他模式的房间号如何处理?
|
|
|
|
- let socketOptions = await this.socketStart({
|
|
|
|
- sceneId: this.mcode,
|
|
|
|
- roomId: options.roomId || '888888'
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- let url = this.getUrl(base, socketOptions, this.data.join) + this.urlPj
|
|
|
|
|
|
+ try {
|
|
|
|
+ let options = this.options
|
|
|
|
+ console.log('webview-option', options)
|
|
|
|
+
|
|
|
|
+ let {
|
|
|
|
+ url: base,
|
|
|
|
+ obj: m
|
|
|
|
+ } = await new Promise(r => this.getBrandDetail(options.id, options.type, (url, obj) => r({
|
|
|
|
+ url,
|
|
|
|
+ obj
|
|
|
|
+ })))
|
|
|
|
+
|
|
|
|
+ this.getBrand(options.id, m)
|
|
|
|
+ this.mcode = m
|
|
|
|
+ //TODO 有问题, 其他模式的房间号如何处理?
|
|
|
|
+ let socketOptions = await this.socketStart({
|
|
|
|
+ sceneId: this.mcode,
|
|
|
|
+ roomId: options.roomId || '888888'
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ let url = this.getUrl(base, socketOptions, this.data.join) + this.urlPj
|
|
|
|
+
|
|
|
|
+ this.base = base
|
|
|
|
+ // socketOptions.nickname = socketOptions.nickname.replace(/[^\u4E00-\u9FA5A-Za-z0-9]/g, '')
|
|
|
|
+ this.setData({
|
|
|
|
+ urlTemp: url.split('').join(' ')
|
|
|
|
+ })
|
|
|
|
+ this.setData({
|
|
|
|
+ url,
|
|
|
|
+ loadUrl: true,
|
|
|
|
+ socketOptions,
|
|
|
|
+ reload: true,
|
|
|
|
+ hideWebView: false,
|
|
|
|
+ // debugerInfo: JSON.stringify({
|
|
|
|
+ // userId: socketOptions.userId,
|
|
|
|
+ // roomId: socketOptions.roomId,
|
|
|
|
+ // num: socketOptions.sceneNumber,
|
|
|
|
+ // userLimitNum: socketOptions.userLimitNum,
|
|
|
|
+ // isAssistant: socketOptions.isAssistant,
|
|
|
|
+ // role: socketOptions.role,
|
|
|
|
+ // assistantId: socketOptions.assistantId
|
|
|
|
+ // })
|
|
|
|
+ })
|
|
|
|
+ this.recorderManager = wx.getRecorderManager()
|
|
|
|
+ this.brandId = options.id
|
|
|
|
+ this.joinUrl()
|
|
|
|
+
|
|
|
|
+ } catch (error) {
|
|
|
|
+ this.setData({
|
|
|
|
+ hideWebView: true,
|
|
|
|
+ })
|
|
|
|
+ wx.showModal({
|
|
|
|
+ title: '提示',
|
|
|
|
+ content: '场景初始化有误,请稍后重试',
|
|
|
|
+ showCancel: false,
|
|
|
|
+ confirmColor: '#0075DC',
|
|
|
|
+ success: function (res) {
|
|
|
|
+ wx.switchTab({
|
|
|
|
+ url: '/pages/index/index'
|
|
|
|
+ });
|
|
|
|
|
|
- this.base = base
|
|
|
|
- // socketOptions.nickname = socketOptions.nickname.replace(/[^\u4E00-\u9FA5A-Za-z0-9]/g, '')
|
|
|
|
- this.setData({
|
|
|
|
- urlTemp: url.split('').join(' ')
|
|
|
|
- })
|
|
|
|
- this.setData({
|
|
|
|
- url,
|
|
|
|
- loadUrl: true,
|
|
|
|
- socketOptions,
|
|
|
|
- reload: true,
|
|
|
|
- hideWebView: false,
|
|
|
|
- // debugerInfo: JSON.stringify({
|
|
|
|
- // userId: socketOptions.userId,
|
|
|
|
- // roomId: socketOptions.roomId,
|
|
|
|
- // num: socketOptions.sceneNumber,
|
|
|
|
- // userLimitNum: socketOptions.userLimitNum,
|
|
|
|
- // isAssistant: socketOptions.isAssistant,
|
|
|
|
- // role: socketOptions.role,
|
|
|
|
- // assistantId: socketOptions.assistantId
|
|
|
|
- // })
|
|
|
|
- })
|
|
|
|
- this.recorderManager = wx.getRecorderManager()
|
|
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
|
|
- this.brandId = options.id
|
|
|
|
- this.joinUrl()
|
|
|
|
// this.mic()
|
|
// this.mic()
|
|
},
|
|
},
|
|
|
|
|