|
@@ -31,15 +31,19 @@ Component({
|
|
classData: [{ 'id': '' }],
|
|
classData: [{ 'id': '' }],
|
|
classId: '',
|
|
classId: '',
|
|
initFirst: true,
|
|
initFirst: true,
|
|
- deviceId: '6f7aea71-3ed6-3919-ad36-8b94f768b8c1',
|
|
|
|
|
|
+ deviceId: '',
|
|
//0=未上课 1=正在上课
|
|
//0=未上课 1=正在上课
|
|
pageState: 0,
|
|
pageState: 0,
|
|
|
|
|
|
- //开始上课用到的数据
|
|
|
|
|
|
+ //#region 开始上课用到的数据
|
|
|
|
|
|
//0是正常,1是error
|
|
//0是正常,1是error
|
|
- videostatus: 0
|
|
|
|
-
|
|
|
|
|
|
+ videostatus: 0,
|
|
|
|
+ videoUrl: '',
|
|
|
|
+ lessId: '',
|
|
|
|
+ hasGetFile: false,
|
|
|
|
+ imgList: [],
|
|
|
|
+ //#endregion
|
|
},
|
|
},
|
|
|
|
|
|
lifetimes: {
|
|
lifetimes: {
|
|
@@ -240,6 +244,36 @@ Component({
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+
|
|
|
|
+ //根据地区,学校,班级获取deviceId
|
|
|
|
+ getDeviceByRSC: function () {
|
|
|
|
+ let params = {
|
|
|
|
+ city: this.data.cityValue,
|
|
|
|
+ classId: this.data.classId,
|
|
|
|
+ province: this.data.provinceValue,//省份
|
|
|
|
+ region: this.data.regionValue,//地区
|
|
|
|
+ schoolId: this.data.schoolId,
|
|
|
|
+ }
|
|
|
|
+ httpUtil.wxGet(httpUtil.interfaces.getDevideIdByRSC, params).then((res: any) => {
|
|
|
|
+ console.log("根据省市学校班级获取deviceId成功:", res)
|
|
|
|
+ if (res.data.success) {
|
|
|
|
+ this.setData({
|
|
|
|
+ deviceId: res.data.data.deviceId
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ this.setData({
|
|
|
|
+ deviceId: ''
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }).catch((res) => {
|
|
|
|
+ console.log("根据省市学校班级获取deviceId失败:", res)
|
|
|
|
+ this.setData({
|
|
|
|
+ deviceId: '暂无设备'
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+
|
|
bindMultiPickerColumnChange: function (event: any) {
|
|
bindMultiPickerColumnChange: function (event: any) {
|
|
|
|
|
|
//
|
|
//
|
|
@@ -288,6 +322,7 @@ Component({
|
|
classIndex: event.detail.value,
|
|
classIndex: event.detail.value,
|
|
classId: this.data.classData[event.detail.value].id
|
|
classId: this.data.classData[event.detail.value].id
|
|
})
|
|
})
|
|
|
|
+ this.getDeviceByRSC()
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
@@ -336,32 +371,35 @@ Component({
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
let params = {
|
|
let params = {
|
|
- address: this.data.region[0] + "--" + this.data.region[1] + "--" + this.data.region[2],
|
|
|
|
- school: this.data.schoolArray[this.data.schoolIndex],
|
|
|
|
- class: this.data.classArray[this.data.classIndex],
|
|
|
|
- deviceId: this.data.deviceId
|
|
|
|
|
|
+ deviceId: this.data.deviceId,
|
|
|
|
+ teacherId: httpUtil.httpData.userId,
|
|
|
|
+ // title: ''
|
|
}
|
|
}
|
|
console.log("params:", params)
|
|
console.log("params:", params)
|
|
|
|
|
|
- httpUtil.wxGet(httpUtil.interfaces.getDeviceById + this.data.deviceId, null).then((res: any) => {
|
|
|
|
- console.log("根据ID获取设备信息成功:", res)
|
|
|
|
|
|
+ httpUtil.wxPost(httpUtil.interfaces.createLess, params).then((res: any) => {
|
|
|
|
+ console.log("创建文件成功(开始上课):", res)
|
|
|
|
+ //开始上课
|
|
if (res.data.success) {
|
|
if (res.data.success) {
|
|
- //开始上课
|
|
|
|
this.setData({
|
|
this.setData({
|
|
- pageState: 1
|
|
|
|
|
|
+ pageState: 1,
|
|
|
|
+ videoUrl: res.data.data.liveUrl,
|
|
|
|
+ lessId: res.data.data.id,
|
|
|
|
+ hasGetFile: true
|
|
})
|
|
})
|
|
|
|
+ this.triggerEvent('canChangeIndex', { canChange: false })
|
|
|
|
+ this.getDocumentFile()
|
|
}
|
|
}
|
|
}).catch((res) => {
|
|
}).catch((res) => {
|
|
- console.log("根据ID获取设备信息失败:", res)
|
|
|
|
|
|
+ console.log("创建文件失败(开始上课):", res)
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- //上课之后的方法
|
|
|
|
|
|
+ //#region 上课之后的方法
|
|
//下课
|
|
//下课
|
|
classOver: function () {
|
|
classOver: function () {
|
|
//下课
|
|
//下课
|
|
@@ -373,8 +411,10 @@ Component({
|
|
if (res.confirm) {
|
|
if (res.confirm) {
|
|
console.log('点击确认回调')
|
|
console.log('点击确认回调')
|
|
that.setData({
|
|
that.setData({
|
|
- pageState: 0
|
|
|
|
|
|
+ pageState: 0,
|
|
|
|
+ hasGetFile: false
|
|
})
|
|
})
|
|
|
|
+ that.triggerEvent('canChangeIndex', { canChange: true })
|
|
} else {
|
|
} else {
|
|
console.log('点击取消回调')
|
|
console.log('点击取消回调')
|
|
}
|
|
}
|
|
@@ -382,7 +422,48 @@ Component({
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ //心跳获取文件库所有文件
|
|
|
|
+ getDocumentFile: function () {
|
|
|
|
+ let that = this;
|
|
|
|
+ let params = {
|
|
|
|
+ lessId: that.data.lessId,
|
|
|
|
+ deviceId: that.data.deviceId,
|
|
|
|
+ userId: httpUtil.httpData.userId,
|
|
|
|
+ pageNo: 1,
|
|
|
|
+ pageSize: 100000,
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ httpUtil.wxGet(httpUtil.interfaces.getDocumentFile, params).then((res: any) => {
|
|
|
|
+ console.log("获取所有文件成功:", res)
|
|
|
|
+ that.setData({
|
|
|
|
+ imgList: res.data.data.list
|
|
|
|
+ })
|
|
|
|
+ let getfile = setInterval(function () {
|
|
|
|
+ if (that.data.hasGetFile) {
|
|
|
|
+ httpUtil.wxGet(httpUtil.interfaces.getDocumentFile, params).then((res: any) => {
|
|
|
|
+ console.log("获取所有文件成功:", res)
|
|
|
|
+ that.setData({
|
|
|
|
+ imgList: res.data.data.list
|
|
|
|
+ })
|
|
|
|
+ }).catch((res) => {
|
|
|
|
+ console.log("获取所有文件失败:", res)
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ clearInterval(getfile)
|
|
|
|
+ }
|
|
|
|
+ }, 5000)
|
|
|
|
+ }).catch((res) => {
|
|
|
|
+ console.log("获取所有文件失败:", res)
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ ////#endregion
|
|
}
|
|
}
|
|
|
|
|
|
})
|
|
})
|