|
@@ -280,7 +280,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
<script setup>
|
|
<script setup>
|
|
|
import { addOp3 } from '@/mixins/mixin'
|
|
import { addOp3 } from '@/mixins/mixin'
|
|
|
-import { ref, onMounted, watchEffect, inject } from 'vue';
|
|
|
|
|
|
|
+import { ref, onMounted, watch, watchEffect, inject } from 'vue';
|
|
|
import { userCurrentRole, userInfoStore, userCurrent,pageGotype } from '../../stores/counter'
|
|
import { userCurrentRole, userInfoStore, userCurrent,pageGotype } from '../../stores/counter'
|
|
|
// import JSZip from 'jszip';
|
|
// import JSZip from 'jszip';
|
|
|
// import { saveAs } from 'file-saver';
|
|
// import { saveAs } from 'file-saver';
|
|
@@ -379,7 +379,6 @@ const activeCurrentData = ref([])
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
currentData.value = courseData.value["三年级"]
|
|
currentData.value = courseData.value["三年级"]
|
|
|
- getTimeCourse(1, 1)
|
|
|
|
|
getCourseList() // 获取课程列表
|
|
getCourseList() // 获取课程列表
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -601,6 +600,9 @@ const getCourseUrl = (item) => {
|
|
|
openCourseIframe(url2)
|
|
openCourseIframe(url2)
|
|
|
}
|
|
}
|
|
|
const getTimeCourse = (id, item) => {
|
|
const getTimeCourse = (id, item) => {
|
|
|
|
|
+ // 用户信息未就绪时不执行,由下方 watch 在就绪后触发
|
|
|
|
|
+ if (!user.user?.userid) return
|
|
|
|
|
+
|
|
|
if (setIntervalNum.value) {
|
|
if (setIntervalNum.value) {
|
|
|
clearInterval(setIntervalNum.value)
|
|
clearInterval(setIntervalNum.value)
|
|
|
}
|
|
}
|
|
@@ -615,8 +617,9 @@ const getTimeCourse = (id, item) => {
|
|
|
console.log(e)
|
|
console.log(e)
|
|
|
}
|
|
}
|
|
|
let area = ''
|
|
let area = ''
|
|
|
|
|
+ const schoolDest = user.user.schooldest || ''
|
|
|
try {
|
|
try {
|
|
|
- area = areaJson.value.find(item => user.user.schooldest.includes(item.code) || user.user.schooldest.includes(item.name));
|
|
|
|
|
|
|
+ area = areaJson.value.find(a => schoolDest.includes(a.code) || schoolDest.includes(a.name));
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
|
console.log(e)
|
|
console.log(e)
|
|
|
}
|
|
}
|
|
@@ -637,7 +640,7 @@ const getTimeCourse = (id, item) => {
|
|
|
area: dest,
|
|
area: dest,
|
|
|
coursePackageName: "AI课程",
|
|
coursePackageName: "AI课程",
|
|
|
courseId: id,
|
|
courseId: id,
|
|
|
- courseName: item.title,
|
|
|
|
|
|
|
+ courseName: item?.title || 'AI课程',
|
|
|
courseGrade: selectGrand.value,
|
|
courseGrade: selectGrand.value,
|
|
|
courseTime: Math.round(middleTime),
|
|
courseTime: Math.round(middleTime),
|
|
|
startTime: new Date().toLocaleString().replace(/\//g, "-"),
|
|
startTime: new Date().toLocaleString().replace(/\//g, "-"),
|
|
@@ -657,6 +660,19 @@ const getTimeCourse = (id, item) => {
|
|
|
}, interValtTime);
|
|
}, interValtTime);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 等 App.vue 异步写入 user 后再上报,避免首次打开拿不到 user.user
|
|
|
|
|
+const hasInitTimeCourse = ref(false)
|
|
|
|
|
+watch(
|
|
|
|
|
+ () => user.user,
|
|
|
|
|
+ (val) => {
|
|
|
|
|
+ if (hasInitTimeCourse.value) return
|
|
|
|
|
+ if (!val?.userid) return
|
|
|
|
|
+ hasInitTimeCourse.value = true
|
|
|
|
|
+ getTimeCourse(1, { title: 'AI课程' })
|
|
|
|
|
+ },
|
|
|
|
|
+ { immediate: true, deep: true }
|
|
|
|
|
+)
|
|
|
|
|
+
|
|
|
const updateCourseId = (id, type) => {
|
|
const updateCourseId = (id, type) => {
|
|
|
axios.post('https://pbl.cocorobo.cn/api/pbl/copyCourseSz', {id: id +','+ user.user.userid}, {
|
|
axios.post('https://pbl.cocorobo.cn/api/pbl/copyCourseSz', {id: id +','+ user.user.userid}, {
|
|
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|