diff --git a/src/pages/course/study.vue b/src/pages/course/study.vue index 7ae7e1d7..5d5e9996 100644 --- a/src/pages/course/study.vue +++ b/src/pages/course/study.vue @@ -182,7 +182,7 @@ const getData = async (flag) => { // return // } try{ - await initsocketTask() + initsocketTask() const { body } = await getCourseStudyInfoApi({crsId: crsId.value}) teacherList.value = body.teacheList.map(t=>({ ...t, @@ -192,16 +192,18 @@ const getData = async (flag) => { if(body.stdyProgressFlag === 'N'){ step.value = 1 }else{ + choiceTeacher.value = body.choiceTeacher if(startPgrphId.value){ - choiceTeacher.value = body.choiceTeacher - sendMessage({ - "commond" : 'STDY', - "body" : { - crsId: crsId.value, - teacherNo: choiceTeacher.value - } + setTimeout(() => { + sendMessage({ + "commond" : 'STDY', + "body" : { + crsId: crsId.value, + teacherNo: choiceTeacher.value + } + },300) + step.value = 2 }) - step.value = 2 return } common.show('提示', '系统检测到您已存在学习记录,要继续学习吗?',true, '重新学习','继续学习').then((res) => { @@ -209,7 +211,6 @@ const getData = async (flag) => { // 继续学习 , 获取学习历史接口 // 滚动到最下面 scrollToBottomNow() - choiceTeacher.value = body.choiceTeacher sendMessage({ "commond" : 'STDY', "body" : { @@ -587,8 +588,8 @@ const stdyId = ref('') const stdyBatch = ref('') const logId = ref('') // ws 初始化逻辑 -const initsocketTask = async () => { - await socketStore.creatSocket() +const initsocketTask = () => { + socketStore.creatSocket() unref(SocketObj).on('message', (res)=>{ const { rtnCode, body, commond } = JSON.parse(res.data) if(rtnCode === '0000'){ diff --git a/src/pages/index/dialog.vue b/src/pages/index/dialog.vue index f1562bdd..a1f5b782 100644 --- a/src/pages/index/dialog.vue +++ b/src/pages/index/dialog.vue @@ -415,6 +415,13 @@ import { onShow(()=>{ if(watchFlag.value === 1) return socketStore?.createSocket?.() + sendMessage({ + "commond" : 'ASK-START', + "body" : { + mascotId: mascotId.value, + deviceImei: '' + } + }) }) onUnload(()=>{ watchFlag.value = 1