Pārlūkot izejas kodu

1、更改测试账号权限
2、课程大纲和排序修复

liyanbo 10 mēneši atpakaļ
vecāks
revīzija
0621162e21
2 mainītis faili ar 38 papildinājumiem un 17 dzēšanām
  1. 17 5
      src/views/AIDevelop.vue
  2. 21 12
      src/views/AIGeneralCourse.vue

+ 17 - 5
src/views/AIDevelop.vue

@@ -325,12 +325,24 @@ const handleVideoEnded = () => {
 
 // 禁用视频
 const disableVideo = (index = course.value.key) => {
-  let dis = Number(index.substring(index.indexOf("-") + 1));
-  if (localStorage.getItem('userName') === 'aiTest' && dis > 5) {
-    //提示禁用
-    Message().notifyWarning('您的账号并未开放此课程!', true)
-    return true
+
+  if (localStorage.getItem('userName') === 'aiTest' && gradeId.value === "1") {
+      let dis = Number(index.substring(index.indexOf("-") + 1));
+      if (dis > 5) {
+        //提示禁用
+        Message().notifyWarning('您的账号并未开放此课程!', true)
+        return true
+      }
   }
+  // if (localStorage.getItem('userName') === 'aiDemo') {
+  //   let dis = Number(index.substring(index.indexOf("-") + 1));
+  //   if (dis > 4) {
+  //     //提示禁用
+  //     Message().notifyWarning('您的账号并未开放此课程!', true)
+  //     return true
+  //   }
+  // }
+
   return false
 }
 

+ 21 - 12
src/views/AIGeneralCourse.vue

@@ -123,7 +123,7 @@
             }"
           ></div>
           <div class="additional-text">
-            0{{ outlineData.ctTypeSort }} {{ outlineData.ctType }}
+            {{ outlineData.ctTypeSort }} {{ outlineData.ctType }}
           </div>
         </div>
       </div>
@@ -173,6 +173,10 @@ const handleGradeSelect = command => {
     ClassOutline(selectedItem.id).then(res => {
       if (res.code === 0) {
         classOutlineData.value = res.data
+        classOutlineData.value.map((item, index) => {
+          item.ctTypeSort = index + 1
+          item.ctTypeSort = item.ctTypeSort > 9 ? item.ctTypeSort : "0" + item.ctTypeSort
+        })
       }
     })
   }
@@ -205,6 +209,10 @@ const fetchCtTypes = async () => {
           console.log(res);
           if (res.code === 0) {
             classOutlineData.value = res.data
+            classOutlineData.value.map((item, index) => {
+              item.ctTypeSort = index + 1
+              item.ctTypeSort = item.ctTypeSort > 9 ? item.ctTypeSort : "0" + item.ctTypeSort
+            })
           }
         })
       }
@@ -228,8 +236,8 @@ const getCourseTitle = index => {
 
 // 课程标题数组,依赖修改后的 getCourseTitle 函数 修改课程标题数组为 computed 属性
 const courseTitles = computed(() => {
-  return classOutlineData.value.map((item, index) => {
-    return `0${index + 1} ${item.ctType}`;
+  return classOutlineData.value.map(item => {
+    return `${item.ctTypeSort}${item.ctType}`;
   });
 })
 
@@ -280,15 +288,16 @@ const goBack = () => {
 }
 
 const goToAIExperience = outlineData => {
-
-  // if (outlineData.ctTypeSort === 2) {
-    router.push({
-      path: '/ai-develop', // 跳转视频页面
-      query: { typeId: outlineData.id, typeName: outlineData.ctType }
-    })
-  // } else {
-  //   Message().notifyWarning(localStorage.getItem('userName') === "aiTest" ? '您的账号并未开放此课程!' : '演示版未开放此课程!', true)
-  // }
+  if (localStorage.getItem('userName') === "aiTest") {
+    if (localStorage.getItem('selectedGradeId') !== "1" || outlineData.ctTypeSort !== 2) {
+      Message().notifyWarning('您的账号并未开放此课程!', true)
+      return
+    }
+  }
+  router.push({
+    path: '/ai-develop', // 跳转视频页面
+    query: { typeId: outlineData.id, typeName: outlineData.ctType }
+  })
 }
 </script>