|
|
@@ -95,10 +95,6 @@ import { ref, onMounted, computed, watch } from 'vue';
|
|
|
import { useRouter, useRoute } from 'vue-router';
|
|
|
// 根据ID获取课程列表
|
|
|
import { getBlocklyByTypeId } from '@/api/programming/index.js'
|
|
|
-// 导入图片
|
|
|
-import explanation from '@/assets/programming/explanation.png'
|
|
|
-import practice from '@/assets/programming/practice.png'
|
|
|
-import summary from '@/assets/programming/summary.png'
|
|
|
// 导入按钮图片
|
|
|
import leftbtn from '@/assets/programming/leftbtn.png'
|
|
|
import rightbtn from '@/assets/programming/rightbtn.png'
|
|
|
@@ -109,6 +105,7 @@ import Interface from './Interface.vue'
|
|
|
import star02Image from '@/assets/programming/star02.png'
|
|
|
import star01Image from '@/assets/programming/star01.png'
|
|
|
import {Message} from "@/utils/message/Message.js";
|
|
|
+import {DICT_TYPE} from "@/utils/dictUtils.js";
|
|
|
|
|
|
|
|
|
// 获取路由实例
|
|
|
@@ -142,6 +139,10 @@ const hasMoved = ref(false) // 标记是否发生了移动
|
|
|
// 获取contentBox元素的引用
|
|
|
const contentBox = ref(null)
|
|
|
|
|
|
+// 创建图片映射,根据bcLabel显示对应图片
|
|
|
+const menuDict = ref({});
|
|
|
+
|
|
|
+
|
|
|
// 根据内容类型获取星星数量
|
|
|
const getStarCount = (contentType) => {
|
|
|
if (contentType === 'video') {
|
|
|
@@ -245,21 +246,12 @@ const fetchCourseData = () => {
|
|
|
item.isDisabled = isDisabled.value
|
|
|
});
|
|
|
|
|
|
- // 创建图片映射,根据bcLabel显示对应图片
|
|
|
- const imageMap = {
|
|
|
- '1': explanation,
|
|
|
- '2': practice,
|
|
|
- '3': summary
|
|
|
- };
|
|
|
-
|
|
|
// 批量创建课程项
|
|
|
const newCourseItems = newResData.map((item, index) => {
|
|
|
- const positionIndex = (index % 3) + 1;
|
|
|
- const image = imageMap[item.bcLabel]; // 根据bcLabel获取图片
|
|
|
return {
|
|
|
id: item.id,
|
|
|
title: item.bcName,
|
|
|
- image: image,
|
|
|
+ image: menuDict.value[item.bcLabel],
|
|
|
contentType: item.bcContentType,
|
|
|
progress: item.progress, // 进度
|
|
|
isDisabled: isDisabled.value // 保存bcLabel用于图片映射
|
|
|
@@ -290,6 +282,15 @@ onMounted(() => {
|
|
|
|
|
|
// 获取到topicId后,调用函数获取课程列表
|
|
|
fetchCourseData();
|
|
|
+
|
|
|
+
|
|
|
+ //课程小节字典
|
|
|
+ let menuDictStr = localStorage.getItem(DICT_TYPE.BLOCKLY_COURSE_LABEL);
|
|
|
+ let menuDictJson = menuDictStr ? JSON.parse(menuDictStr) : [];
|
|
|
+ menuDict.value = menuDictJson.reduce((acc, item) => {
|
|
|
+ acc[item.value] = item.cssClass;
|
|
|
+ return acc;
|
|
|
+ }, {});
|
|
|
});
|
|
|
|
|
|
// 处理课程项点击事件
|