|
|
@@ -128,31 +128,47 @@
|
|
|
@saveProgress="handleSaveProgress"
|
|
|
/>
|
|
|
<!-- 图片 -->
|
|
|
- <ImageView v-if="course.courseContentType === 'image'"
|
|
|
- :imagePath="course.courseImagePath"
|
|
|
+ <ImageView v-if="course.courseContentType === 'image'"
|
|
|
+ :imagePath="course.courseImagePath"
|
|
|
altText="课程图片"
|
|
|
:courseId="course.id"
|
|
|
@saveProgress="handleSaveProgress"
|
|
|
></ImageView>
|
|
|
|
|
|
<!-- PPT -->
|
|
|
- <PptView v-if="course.courseContentType === 'ppt'"
|
|
|
- :pptPath="course.pptPath"
|
|
|
+ <PptView v-if="course.courseContentType === 'ppt'"
|
|
|
+ :pptPath="course.pptPath"
|
|
|
:courseId="course.id"
|
|
|
@saveProgress="handleSaveProgress"
|
|
|
ref="pptRef"></PptView>
|
|
|
|
|
|
<!--文生文-->
|
|
|
- <TextToText class="contentClass" v-if="course.courseContentType === 'aiTextToText'" ref="aiTextToText"></TextToText>
|
|
|
+ <TextToText class="contentClass" v-if="course.courseContentType === 'aiTextToText'" ref="aiTextToText"
|
|
|
+ :isCourse="true"
|
|
|
+ :cacheDataKey="course.cacheDataKey"
|
|
|
+ :cacheDataHistoryKey="course.cacheDataHistoryKey"
|
|
|
+ @saveProgress="handleSaveProgress"></TextToText>
|
|
|
|
|
|
<!--文生图-->
|
|
|
- <TextToImage class="contentClass" v-if="course.courseContentType === 'aiTextToImage'" ref="aiTextToImage"></TextToImage>
|
|
|
+ <TextToImage class="contentClass" v-if="course.courseContentType === 'aiTextToImage'" ref="aiTextToImage"
|
|
|
+ :isCourse="true"
|
|
|
+ :cacheDataKey="course.cacheDataKey"
|
|
|
+ :cacheDataHistoryKey="course.cacheDataHistoryKey"
|
|
|
+ @saveProgress="handleSaveProgress"></TextToImage>
|
|
|
|
|
|
<!--图生图-->
|
|
|
- <ImageToImage class="contentClass" v-if="course.courseContentType === 'aiImageToImage'" ref="aiImageToImage"></ImageToImage>
|
|
|
+ <ImageToImage class="contentClass" v-if="course.courseContentType === 'aiImageToImage'" ref="aiImageToImage"
|
|
|
+ :isCourse="true"
|
|
|
+ :cacheDataKey="course.cacheDataKey"
|
|
|
+ :cacheDataHistoryKey="course.cacheDataHistoryKey"
|
|
|
+ @saveProgress="handleSaveProgress"></ImageToImage>
|
|
|
|
|
|
<!--图生视频-->
|
|
|
- <ImageToVideo class="contentClass" v-if="course.courseContentType === 'aiImageToVideo'" ref="aiImageToVideo"></ImageToVideo>
|
|
|
+ <ImageToVideo class="contentClass" v-if="course.courseContentType === 'aiImageToVideo'" ref="aiImageToVideo"
|
|
|
+ :isCourse="true"
|
|
|
+ :cacheDataKey="course.cacheDataKey"
|
|
|
+ :cacheDataHistoryKey="course.cacheDataHistoryKey"
|
|
|
+ @saveProgress="handleSaveProgress"></ImageToVideo>
|
|
|
</template>
|
|
|
|
|
|
<!-- 视频切换按钮 - 始终显示 -->
|
|
|
@@ -181,6 +197,7 @@
|
|
|
:courseId="course.id || ''"
|
|
|
@closeQuestionDialog="closeQuestionDialog"
|
|
|
@submitAnswer="handleSubmitAnswer"
|
|
|
+ @saveProgress="handleSaveProgress"
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
@@ -189,9 +206,7 @@
|
|
|
<script setup>
|
|
|
import { ref, onMounted, onBeforeUnmount, computed } from 'vue'
|
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
|
-import { Expand, Fold, Memo } from '@element-plus/icons-vue'
|
|
|
import { Search, ArrowLeftBold } from '@element-plus/icons-vue'
|
|
|
-import { ElMessage, ElMessageBox, ElNotification, valueEquals } from 'element-plus'
|
|
|
import isDisabledImage from '@/assets/images/permission/isDisabled.png'
|
|
|
|
|
|
import classImages from '@/assets/icon/class.png'
|
|
|
@@ -220,10 +235,7 @@ import ImageToVideo from "@/components/ai/video/ImageToVideo.vue";
|
|
|
import {DICT_TYPE} from "@/utils/dictUtils.js";
|
|
|
|
|
|
const router = useRouter() // 获取当前路由对象
|
|
|
-const route = useRoute()
|
|
|
|
|
|
-// 添加按钮显示状态
|
|
|
-const buttonVisible = ref(false)
|
|
|
// 添加抽屉显示状态
|
|
|
const drawerVisible = ref(false)
|
|
|
// 渲染页面标题
|
|
|
@@ -258,18 +270,26 @@ const isDisabled = ref(false)
|
|
|
|
|
|
// 保存视频进度接口
|
|
|
const handleSaveProgress = async (type, progress) => {
|
|
|
- try {
|
|
|
- await saveRecord({
|
|
|
- brpNjId: gradeId.value,
|
|
|
- brpCtId: typeId.value,
|
|
|
- brpCourseId: course.value.id,
|
|
|
- brpType: type,
|
|
|
- brpProgress: progress
|
|
|
- })
|
|
|
- } catch (error) {
|
|
|
- console.error('保存视频进度失败:', error)
|
|
|
- }
|
|
|
+
|
|
|
+ if (!progress) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let saveProgressData = {
|
|
|
+ brpNjId: gradeId.value,
|
|
|
+ brpType: type,
|
|
|
+ brpProgress: progress
|
|
|
}
|
|
|
+ // aiCount类型不需要添加课程大纲id和课程小节id
|
|
|
+ if (type !== "aiCount") {
|
|
|
+ saveProgressData.brpCtId = typeId.value
|
|
|
+ saveProgressData.brpCourseId = course.value.id
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ await saveRecord(saveProgressData)
|
|
|
+ } catch (error) {
|
|
|
+ console.error('保存视频进度失败:', error)
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
//课程小节字典
|
|
|
const menuDict = ref({
|
|
|
@@ -300,6 +320,7 @@ const handleSelect = index => {
|
|
|
// 根据索引切换视频
|
|
|
if (videoPathMap.value[index]) {
|
|
|
course.value = videoPathMap.value[index]
|
|
|
+ setCacheDataKey()
|
|
|
courseId.value = course.value.id
|
|
|
// 切换标题后,关闭抽屉
|
|
|
drawerVisible.value = false
|
|
|
@@ -312,6 +333,13 @@ const handleSelect = index => {
|
|
|
if (disableMsg(index)) return
|
|
|
}
|
|
|
|
|
|
+//填充阎村key
|
|
|
+const setCacheDataKey = () => {
|
|
|
+ // 设置缓存key
|
|
|
+ course.value.cacheDataKey = localStorage.getItem("token") + "_course_" + course.value.id
|
|
|
+ course.value.cacheDataHistoryKey = course.value.cacheDataKey + "_history"
|
|
|
+}
|
|
|
+
|
|
|
// 展平所有菜单项索引
|
|
|
const flattenMenuItems = () => {
|
|
|
const indices = []
|
|
|
@@ -555,6 +583,7 @@ onMounted(async () => {
|
|
|
courseId.value = courseTemp.id
|
|
|
if(!disableMsg(menuIndex)){
|
|
|
course.value = courseTemp
|
|
|
+ setCacheDataKey()
|
|
|
}else{
|
|
|
course.value.key = courseTemp.key
|
|
|
course.value.courseName = courseTemp.courseName
|