|
@@ -246,9 +246,16 @@ onMounted(() => {
|
|
|
if (activeElementIdList.value.length) {
|
|
|
nextTick(() => mainStore.setActiveElementIdList([]))
|
|
|
}
|
|
|
+ // 优化:避免重复代码,统一设置 window.pptLoading
|
|
|
+ if (typeof window !== 'undefined') {
|
|
|
+ (window as any).pptLoading = 1
|
|
|
+ }
|
|
|
if (props.courseid) {
|
|
|
getCourseDetail()
|
|
|
}
|
|
|
+ else {
|
|
|
+ (window as any).pptLoading = 2
|
|
|
+ }
|
|
|
})
|
|
|
|
|
|
const getCourseDetail = async () => {
|
|
@@ -273,10 +280,24 @@ const getCourseDetail = async () => {
|
|
|
try {
|
|
|
const jsonObj = JSON.parse(jsonStr)
|
|
|
readJSON(jsonObj, true)
|
|
|
+ if (typeof window !== 'undefined') {
|
|
|
+ const win = window as any
|
|
|
+ win.pptLoading = 2
|
|
|
+ }
|
|
|
}
|
|
|
catch (e) {
|
|
|
console.error('解析pptdata.data失败:', e)
|
|
|
message.error('解析PPT数据失败')
|
|
|
+ if (typeof window !== 'undefined') {
|
|
|
+ const win = window as any
|
|
|
+ win.pptLoading = 2
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if (typeof window !== 'undefined') {
|
|
|
+ const win = window as any
|
|
|
+ win.pptLoading = 2
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -285,10 +306,18 @@ const getCourseDetail = async () => {
|
|
|
console.error('获取课程详情失败:', error)
|
|
|
message.error('获取课程详情失败')
|
|
|
isCourseLoading.value = false
|
|
|
+ if (typeof window !== 'undefined') {
|
|
|
+ const win = window as any
|
|
|
+ win.pptLoading = 2
|
|
|
+ }
|
|
|
}
|
|
|
finally {
|
|
|
// 隐藏loading
|
|
|
isCourseLoading.value = false
|
|
|
+ if (typeof window !== 'undefined') {
|
|
|
+ const win = window as any
|
|
|
+ win.pptLoading = 2
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|