Procházet zdrojové kódy

```
feat(editor): 初始化编辑器内容结构并添加调试日志

- 初始化editorContent为包含默认段落的数组结构
- 添加console.log用于调试editorContent值
- 保持现有表单逻辑不变

fix(breadcrumb): 修复路由参数处理和组件导入

- 修复el-breadcrumb-item的to属性格式
- 添加useRouter导入并注入router实例
- 注释掉查询参数处理逻辑避免路径重复

feat(home): 为不同平台添加专用图标

- 为n8n平台添加n8n图标
- 为coze平台添加coze图标
- 为dify平台添加dify图标
- 为fastGpt平台添加fastgpt图标

fix(learning): 优化课程详情页面参数获取

- 将courseId参数获取从query改为params
- 更新路由跳转路径格式使用动态参数

feat(learning): 使用keep-alive缓存组件提升性能

- 为CourseDirectory组件添加keep-alive缓存
- 为Pinglun组件添加keep-alive缓存
- 为Xuxibiji组件添加keep-alive缓存

feat(learning): 添加onActivated生命周期钩子

- 在多个组件中添加onActivated钩子
- 实现组件激活时的数据刷新逻辑
- 确保课程相关数据在组件重新激活时更新

fix(learning): 修复课程目录计数显示

- 将固定计数(1/20)改为动态计数(1/{{list.length}})
- 确保目录总数与实际数据保持一致

fix(router): 更新学习系统路由配置

- 修改LearningSystemDetail路由路径为动态参数格式
- 修改CourseDetail路由路径为动态参数格式
- 保持路由层级结构不变
```

zhangningning před 1 měsícem
rodič
revize
3f041c27c8

+ 14 - 1
src/components/BlockNoteEditorDialog.vue

@@ -64,7 +64,19 @@ const submitForm = async () => {
 };
 const openDialog = (item) => {
   dialogVisible.value = true;
-  editorContent.value = null;
+  editorContent.value = [
+    {
+      "id": "77efedfb-1c9e-4377-bea4-4d4dfdc20c59",
+      "type": "paragraph",
+      "props": {
+            "backgroundColor": "default",
+            "textColor": "default",
+            "textAlignment": "left"
+        },
+        "content": [],
+        "children": []
+    }
+  ];
   if(item){
     form.noteId = item.noteId;
     form.noteTitle = item.noteTitle;
@@ -79,6 +91,7 @@ const openDialog = (item) => {
   }else{
     title.value = t('common.add')
   }
+  console.log(editorContent.value)
 };
 
 defineExpose({

+ 12 - 9
src/components/Breadcrumb.vue

@@ -5,7 +5,7 @@
     <el-breadcrumb-item
       v-for="item in breadcrumbItems"
       :key="item.path"
-      :to="item.path === $route.path ? undefined : { path: item.path }"
+      :to="item.path === $route.path ? undefined : {path: item.path}"
     >
       {{ item.name }}
     </el-breadcrumb-item>
@@ -14,16 +14,17 @@
 
 <script setup>
 import { computed } from 'vue'
-import { useRoute } from 'vue-router'
+import { useRoute,useRouter } from 'vue-router'
 import { useI18n } from 'vue-i18n' 
 const { t } = useI18n() // 获取t函数// 导入useI18n
 
 const route = useRoute()
+const router = useRouter()
 
 const breadcrumbItems = computed(() => {
   const items = []
   const processedPaths = new Set() // 用于跟踪已处理的路径
-  console.log(2222, route)
+  console.log(2222, route,router)
   // 获取匹配的路由记录
   const matchedRoutes = route.matched.filter(item => item.meta && item.meta.title)
   
@@ -46,23 +47,25 @@ const breadcrumbItems = computed(() => {
       })
     }
     //如果路径中有query参数,需要添加到路径中
-    if (route.query) {
-      const queryParams = new URLSearchParams(route.query)
-      path += '?' + queryParams.toString()
-    }
+    // if (route.query) {
+    //   const queryParams = new URLSearchParams(route.query)
+    //   console.log(111111111,queryParams,queryParams.toString())
+    //   path += '?' + queryParams.toString()
+    // }
+    
     
     // 避免重复添加相同路径的项目
     if (!processedPaths.has(path)) {
       items.push({
         name: title,
-        path: path
+        path: path,
       })
       processedPaths.add(path)
     }
   })
   
   return items
-})
+});
 </script>
 
 <style scoped>

+ 4 - 1
src/pages/Home.vue

@@ -26,7 +26,10 @@
         <div class="platform-item" v-for="item in categoryListTree" :key="item.categoryId"
            @click="activePlatform = item.categoryName; categoryId = item.categoryId;" 
            :class="{'active': categoryId === item.categoryId}">
-          <img :src="item.coverImage" alt="" class="platform-icon n8n-icon bg_color_f5">
+          <img :src="n8Icon" alt="" class="platform-icon n8n-icon bg_color_f5" v-if="item.categoryName === 'n8n'">
+          <img :src="cozeIcon" alt="" class="platform-icon coze-icon bg_color_f5" v-if="item.categoryName === 'coze'">
+          <img :src="difyIcon" alt="" class="platform-icon dify-icon bg_color_f5" v-if="item.categoryName === 'dify'">
+          <img :src="fastgptIcon" alt="" class="platform-icon fastgpt-icon bg_color_f5" v-if="item.categoryName === 'fastGpt'">
           <span class="platform-name">{{item.categoryName}}</span>
         </div>
         <!-- <div class="platform-item" @click="activePlatform = 'n8n'" :class="{'active': activePlatform === 'n8n'}">

+ 1 - 1
src/pages/LearningSystem/CourseDetail.vue

@@ -104,7 +104,7 @@ const appStore = useAppStore()
 
 //获取参数
 const query = route.query;
-const courseId = ref(query.courseId || '');
+const courseId = ref(route.params.courseId || '');
 const info = ref({})
 
 // 视频相关

+ 1 - 1
src/pages/LearningSystem/LearningSystem.vue

@@ -206,7 +206,7 @@
     }
     //增加参数名称
     router.push({
-      path: `/learning-system/detail`,
+      path: `/learning-system/detail/${item.courseId}`,
       query: {
         courseId: item.courseId,
         metaTitle: item.courseTitle || '课程详情'

+ 14 - 6
src/pages/LearningSystem/LearningSystemDetail.vue

@@ -47,13 +47,19 @@
               <CourseDescription :info="info" />
             </el-tab-pane>
             <el-tab-pane :label="$t('common.kechengmulu')" name="kechengmulu">
-              <CourseDirectory :info="info" />
+              <keep-alive>
+                <CourseDirectory :info="info" />
+              </keep-alive>
             </el-tab-pane>
             <el-tab-pane :label="$t('common.pinglun')" name="pinglun">
-              <pinglun :info="info" />
+              <keep-alive>
+                <Pinglun :info="info" />
+              </keep-alive>
             </el-tab-pane>
             <el-tab-pane :label="$t('common.xuxibiji')" name="xuxibiji">
-              <Xuxibiji :info="info" />
+              <keep-alive>
+                <Xuxibiji :info="info" />
+              </keep-alive>
             </el-tab-pane>
           </el-tabs>
         </div>
@@ -84,6 +90,7 @@
   import { useRouter, useRoute } from 'vue-router'
   const router = useRouter()
   const route = useRoute()
+ 
   //获取当前路由路径
   const isChildRoute = computed(() => {
     return route.matched.length > 2
@@ -91,7 +98,7 @@
 
 
   console.log(router,route)
-  import { ref, computed, reactive, onMounted } from 'vue'
+  import { ref, computed, onMounted, onActivated } from 'vue'
   import { useAppStore } from '@/pinia/appStore'
   const appStore = useAppStore()
 
@@ -101,9 +108,10 @@
 
   //获取参数
   const query = route.query;
-  const courseId = ref(query.courseId || '');
+  const courseId = ref(route.params.courseId || '');
   const info = ref({})
 
+  
   onMounted(() => {
    getDetail();
   });
@@ -132,7 +140,7 @@
     }
     //增加参数名称
     router.push({
-      path: `/learning-system/detail/course`,
+      path: `/learning-system/detail/${item.courseId}/course/${item.courseId}`,
       query: {
         courseId: item.courseId,
         metaTitle: '课程详情'

+ 8 - 2
src/pages/LearningSystem/components/CourseDirectory.vue

@@ -2,7 +2,7 @@
   <div class="kechengmulu">
     <div class="gap10">
       <div class="line_vertical"></div>
-      <div class="font_size18 bold">{{$t('common.kechengmulu')}} (1/20)</div>
+      <div class="font_size18 bold">{{$t('common.kechengmulu')}} (1/{{list.length}})</div>
     </div>
     <div class="flex-center-between font_size16 gray list_item" 
     :class="{'active': index === 0}"
@@ -21,7 +21,7 @@
 <script setup>
 import muluIcon from '@/assets/imgs/mulu.png'
 import { getChaptersList } from '@/api/course.js'
-import { ref, onMounted, watch } from 'vue'
+import { ref, onMounted, watch, onActivated } from 'vue'
 const props = defineProps({
   info: {
     type: Object,
@@ -36,6 +36,12 @@ watch(() => props.info.courseId, (newVal, oldVal) => {
   }
 })
 
+onActivated(() => {
+ if(props.info.courseId){
+    getChaptersListFn();
+  }
+})
+
 const list = ref([]);
 
 const getChaptersListFn = () => {

+ 7 - 3
src/pages/LearningSystem/components/pinglun.vue

@@ -37,7 +37,7 @@
 import DGTMessage from '@/utils/message'
 import Pagination from '@/components/Pagination.vue'
 import { getCommentList,commentAdd } from '@/api/comment.js'
-import { ref, onMounted,reactive,watch } from 'vue'
+import { ref, onMounted,reactive,watch, onActivated } from 'vue'
 import { useI18n } from 'vue-i18n' 
 const { t } = useI18n() 
 import { useAppStore } from '@/pinia/appStore'
@@ -70,7 +70,11 @@ const searchFom = reactive({
 const list = ref([]);
 
 
-
+onActivated(() => {
+ if(props.info.courseId){
+    getList('init');
+  }
+})
 const handlePageChange = (page) => {
   searchFom.pageNum = page
   // 这里可以添加获取数据的逻辑
@@ -111,7 +115,7 @@ const handleSend = async () => {
 <style scoped lang="scss">
   .pinglun{
     .list{
-      max-height: 100vh;
+      // max-height: 100vh;
       overflow: auto;
     }
     .list_item{

+ 7 - 1
src/pages/LearningSystem/components/xuxibiji.vue

@@ -41,7 +41,7 @@ import addIcon from '@/assets/imgs/add.png'
 import BlockNoteEditorDialog from '@/components/BlockNoteEditorDialog.vue'
 import Pagination from '@/components/Pagination.vue'
 import { getnoteList,noteAdd,noteEdit,noteDel, getnoteDetail } from '@/api/note.js'
-import { ref, onMounted,reactive,watch } from 'vue'
+import { ref, onMounted,reactive,watch,onActivated } from 'vue'
 import DGTMessage from '@/utils/message'
 import { ElMessageBox } from 'element-plus'
 import { useI18n } from 'vue-i18n' 
@@ -64,6 +64,12 @@ watch(() => props.info.courseId, (newVal, oldVal) => {
   }
 })
 
+onActivated(() => {
+ if(props.info.courseId){
+    getList('init');
+  }
+})
+
 const comments = ref('');
 const listTotal = ref(0);
 const searchFom = reactive({

+ 2 - 2
src/router/index.js

@@ -86,13 +86,13 @@ const routes = [
     meta: { title: 'route.learning_system' },
     children: [
       {
-        path: 'detail',
+        path: 'detail/:courseId',
         name: 'LearningSystemDetail',
         component: () => import('@/pages/LearningSystem/LearningSystemDetail.vue'),
         meta: { title: '' },
         children: [
           {
-            path: 'course',
+            path: 'course/:courseId',
             name: 'CourseDetail',
             component: () => import('@/pages/LearningSystem/CourseDetail.vue'),
             meta: { title: '' }