|
|
@@ -42,11 +42,11 @@
|
|
|
v-for="(courseType, index) in specificCourses"
|
|
|
:key="index"
|
|
|
class="middle-inner-box"
|
|
|
- @click="handleItemClick(courseType, index)"
|
|
|
+ @click="goToProgrammingList(courseType, index)"
|
|
|
>
|
|
|
<div class="new-white-box"
|
|
|
:class="{ 'active': activeButton === index, 'disabled': courseType.isDisabled }"
|
|
|
- @click.stop="handleItemClick(courseType, index)"
|
|
|
+ @click.stop="goToProgrammingList(courseType, index)"
|
|
|
:style="{ '--lock-image': `url(${lockImage})` }"
|
|
|
>
|
|
|
<!-- 列表封面图 -->
|
|
|
@@ -126,11 +126,6 @@ const pageTitle = ref('')
|
|
|
// 课程类别ID
|
|
|
const categoryId = ref('')
|
|
|
|
|
|
-// 课程权限
|
|
|
-const blocklyDataScope = ref([])
|
|
|
-// 测试账号禁用视频
|
|
|
-const isDisabled = ref(false)
|
|
|
-
|
|
|
// 返回上一页
|
|
|
const goBackIndex = () => {
|
|
|
router.push('/programming')
|
|
|
@@ -148,9 +143,10 @@ const currentIndex = ref(0)
|
|
|
const fetchTopicList = () => {
|
|
|
if (categoryId.value) {
|
|
|
getTypeByThemeId(categoryId.value).then(res => {
|
|
|
- console.log(categoryId.value, res);
|
|
|
+
|
|
|
// 更新课程数据,使用接口返回的数据
|
|
|
if (res && res.data && Array.isArray(res.data)) {
|
|
|
+
|
|
|
// 清空原有数据
|
|
|
specificCourses.splice(0, specificCourses.length);
|
|
|
res.data.forEach(item => {
|
|
|
@@ -160,7 +156,7 @@ const fetchTopicList = () => {
|
|
|
title: item.ctType,
|
|
|
bgImage: item.ctTypeImage,
|
|
|
progress: item.progress,
|
|
|
- isDisabled: disableBlockly(item.id)
|
|
|
+ isDisabled: item.dataReadonly
|
|
|
});
|
|
|
});
|
|
|
// 更新圆形按钮数据
|
|
|
@@ -175,7 +171,6 @@ const fetchTopicList = () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// 定义圆形按钮数据(根据课程数量动态生成)
|
|
|
const circleButtons = reactive(specificCourses.map((_, index) => ({ text: String(index + 1) })))
|
|
|
|
|
|
@@ -260,14 +255,6 @@ const handleScroll = () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-// 处理项目点击事件
|
|
|
-const handleItemClick = (courseType, index) => {
|
|
|
- // 调用原始的goToProgrammingList函数
|
|
|
- goToProgrammingList(courseType, index)
|
|
|
-}
|
|
|
-
|
|
|
// 上一页
|
|
|
const prevSlide = () => {
|
|
|
if (currentIndex.value > 0) {
|
|
|
@@ -304,10 +291,6 @@ const middleBox = ref(null)
|
|
|
// 组件挂载时获取路由参数设置标题和课程ID
|
|
|
onMounted(() => {
|
|
|
|
|
|
- if (localStorage.getItem("blocklyDataScope")) {
|
|
|
- blocklyDataScope.value = localStorage.getItem("blocklyDataScope").split(",");
|
|
|
- }
|
|
|
-
|
|
|
const title = route.query.courseTitle
|
|
|
if (title) {
|
|
|
pageTitle.value = title
|
|
|
@@ -321,8 +304,7 @@ onMounted(() => {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
-
|
|
|
-// 跳转到课程详情页面
|
|
|
+// 处理项目点击事件-跳转到课程详情页面
|
|
|
const goToProgrammingList = (courseType, index) => {
|
|
|
// 检查是否禁用
|
|
|
if (courseType.isDisabled) {
|
|
|
@@ -340,29 +322,11 @@ const goToProgrammingList = (courseType, index) => {
|
|
|
courseIndex: index,
|
|
|
typeId: courseType.id, // 当前类型的id,避免与课程ID混淆
|
|
|
originalCourseId: categoryId.value, // 原始的课程ID
|
|
|
- originalCourseTitle: pageTitle.value // 原始的课程标题
|
|
|
+ originalCourseTitle: pageTitle.value, // 原始的课程标题
|
|
|
+ isDisabled: courseType.isDisabled // 课程是否只读
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
-// 禁用视频
|
|
|
-const disableBlockly = (blocklyId = categoryId.value) => {
|
|
|
-
|
|
|
- // 未配置课程权限,不禁用视频
|
|
|
- if (!blocklyDataScope.value || blocklyDataScope.value.length === 0) {
|
|
|
- return false
|
|
|
- }
|
|
|
-
|
|
|
- //配置了课程权限,且视频id不在权限列表中
|
|
|
- isDisabled.value = !blocklyDataScope.value.some(item => Number(item) === blocklyId)
|
|
|
- // if (isDisabled.value) {
|
|
|
- // Message().notifyWarning('您的账号并未开放此课程!', true)
|
|
|
- // return isDisabled.value;
|
|
|
- // }
|
|
|
-
|
|
|
- return isDisabled.value;
|
|
|
-}
|
|
|
-
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|