|
|
@@ -297,6 +297,8 @@ import auto from "@/assets/icon/auto_awesome.png";
|
|
|
|
|
|
import { ClassType } from "@/api/class.js";
|
|
|
import { Message } from "@/utils/message/Message.js";
|
|
|
+// import { saveRecord } from '@/api/personalized/index.js'
|
|
|
+
|
|
|
|
|
|
import DefaultMessage from "@/components/DefaultMessage/index.vue";
|
|
|
import { CreateDialogue, sendChatMessageStream } from "@/api/questions.js";
|
|
|
@@ -333,7 +335,9 @@ const course = ref({});
|
|
|
// 菜单数据
|
|
|
const menuItems = ref([]);
|
|
|
// 课程集合数据
|
|
|
-const videoPathMap = ref({});
|
|
|
+const videoPathMap = ref({})
|
|
|
+// 已观看课程ID列表
|
|
|
+const watchedCourseIds = ref([]);
|
|
|
|
|
|
//课程小节字典(需要新加接口调取字典)
|
|
|
const menuDict = ref({
|
|
|
@@ -349,10 +353,21 @@ onMounted(async () => {
|
|
|
const typeId = router.currentRoute.value.query.typeId;
|
|
|
if (typeId) {
|
|
|
try {
|
|
|
+ // 存储typeId到localStorage
|
|
|
+ localStorage.setItem('typeId', typeId);
|
|
|
+
|
|
|
// 取接口课程数据
|
|
|
const res = await ClassType(typeId);
|
|
|
console.log(res);
|
|
|
courseList.value = res.data;
|
|
|
+
|
|
|
+ // 初始化已观看课程ID
|
|
|
+ const savedWatchedIds = localStorage.getItem('watchedCourseIds');
|
|
|
+ if (savedWatchedIds) {
|
|
|
+ watchedCourseIds.value = JSON.parse(savedWatchedIds);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//课程数据
|
|
|
courseList.value.forEach((courseTemp, index) => {
|
|
|
let menuIndex = courseTemp.courseLabel + "-" + (index + 1);
|
|
|
@@ -411,6 +426,22 @@ onMounted(async () => {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+
|
|
|
+// 保存记录
|
|
|
+// onMounted(()=>{
|
|
|
+// let as = {
|
|
|
+// "brpNjId": 1,
|
|
|
+// "brpCtId": 1,
|
|
|
+// "brpCourseId": 1,
|
|
|
+// "brpType": "course",
|
|
|
+// "brpProgress": 30
|
|
|
+// }
|
|
|
+// console.log(as);
|
|
|
+// saveRecord(as).then(res=>{
|
|
|
+// console.log(res);
|
|
|
+// })
|
|
|
+// })
|
|
|
+
|
|
|
// 菜单打开和关闭的处理函数
|
|
|
const handleOpen = () => {};
|
|
|
const handleClose = () => {};
|
|
|
@@ -469,6 +500,12 @@ const playNextVideo = () => {
|
|
|
//测试账号禁用视频
|
|
|
if (disableVideo()) return;
|
|
|
|
|
|
+ // 记录当前视频ID为已观看
|
|
|
+ if (course.value && course.value.id && !watchedCourseIds.value.includes(course.value.id)) {
|
|
|
+ watchedCourseIds.value.push(course.value.id);
|
|
|
+ localStorage.setItem('watchedCourseIds', JSON.stringify(watchedCourseIds.value));
|
|
|
+ }
|
|
|
+
|
|
|
const allIndices = flattenMenuItems();
|
|
|
const currentIndexInList = allIndices.indexOf(course.value.key);
|
|
|
if (currentIndexInList !== -1 && currentIndexInList < allIndices.length - 1) {
|