|
@@ -126,6 +126,7 @@
|
|
|
loading: false,
|
|
|
count: '',
|
|
|
timer: null,
|
|
|
+ mqtt: {},
|
|
|
formInline: {
|
|
|
phonenumber: '',
|
|
|
codenum: '',
|
|
@@ -155,7 +156,8 @@
|
|
|
modal2: false,
|
|
|
modal3:false,
|
|
|
modal_loading: false,
|
|
|
- deviceId:'',
|
|
|
+ deviceId: '',
|
|
|
+ classnum:'',
|
|
|
ruleInline: {
|
|
|
phonenumber: [
|
|
|
{ required: true, message: '请填下正确的手机号码', trigger: 'blur' },
|
|
@@ -508,7 +510,33 @@
|
|
|
"deviceId": deviceids
|
|
|
}
|
|
|
}).then(res => {
|
|
|
- console.log(res,'创建教室成功')
|
|
|
+ console.log(res, '创建教室成功')
|
|
|
+ if (res.error === null && res.result.data !== null) {
|
|
|
+ this.classnum = res.result.data
|
|
|
+ this.joinclass()
|
|
|
+ } else {
|
|
|
+ this.$Message.error('创建教室失败,请重试');
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //加入教室
|
|
|
+ joinclass() {
|
|
|
+ let userdeviceIds = this.deviceId
|
|
|
+ let classroom = this.classnum
|
|
|
+ let mqttinfo=''
|
|
|
+ this.$api.JoinClassroom({
|
|
|
+ "method": "api/login/phoneLogin",
|
|
|
+ "params": {
|
|
|
+ "deviceId": userdeviceIds,
|
|
|
+ "groupNum": classroom
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res, '加入教室成功')
|
|
|
+ if (res.error === null && res.result.data !== null) {
|
|
|
+ this.mqtt = res.result.data
|
|
|
+ mqttinfo = res.result.data.mqtt
|
|
|
+ localStorage.setItem('mqttinfo',JSON.stringify(mqttinfo))
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
},
|