Jelajahi Sumber

搜索功能 加全路径,修复搜藏按钮位置问题

zq 2 hari lalu
induk
melakukan
fa26b61ead

+ 8 - 7
src/views/book/courseware/preview/CoursewarePreview.vue

@@ -491,7 +491,6 @@ export default {
         return;
       }
       this.showToolbar = false;
-      // 延迟处理,确保选择已完成
       setTimeout(() => {
         const selection = window.getSelection();
         if (selection.toString().trim() === '') return null;
@@ -505,15 +504,18 @@ export default {
         let selectHandleInfo = this.getSelectionInfo();
         if (!selectHandleInfo || !selectHandleInfo.text) return;
         this.selectHandleInfo = selectHandleInfo;
-        this.showToolbar = true;
-        const container = document.querySelector('.courseware');
-        const boxRect = container.getBoundingClientRect();
+
+        if (!this.canRemark) this.showToolbar = true;
         const selectRect = range.getBoundingClientRect();
         this.contentmenu = {
-          left: `${Math.round(selectRect.left - boxRect.left + selectRect.width / 2 - 63)}px`,
-          top: `${Math.round(selectRect.top - boxRect.top + selectRect.height)}px`, // 向上偏移10px
+          position: 'fixed',
+          left: `${Math.round(selectRect.left + selectRect.width / 2 - 63)}px`,
+          top: `${Math.round(selectRect.bottom + 5)}px`,
         };
       }, 100);
+      if (this.canRemark) {
+        this.endSelection();
+      }
     },
     // 笔记
     setNote() {
@@ -936,7 +938,6 @@ export default {
   }
 
   .contentmenu {
-    position: absolute;
     z-index: 999;
     display: flex;
     column-gap: 4px;

+ 5 - 8
src/web_preview/index.vue

@@ -173,16 +173,13 @@
             </el-row>
             <div>
               <el-table :data="searchList" :show-header="false">
-                <!-- <el-table-column prop="courseware_name" label="课件" />
-                <el-table-column prop="component_type" label="组件" /> -->
                 <el-table-column>
                   <template #default="{ row }">
-                    {{ row.courseware_name + ' / ' + row.component_type_name }}
-                  </template>
-                </el-table-column>
-                <el-table-column label="" width="50">
-                  <template #default="{ row }">
-                    <el-link type="primary" @click="handleLocation(row, 0)">定位</el-link>
+                    <div>{{ row.courseware_name_path }}</div>
+                    <div style="display: flex; align-items: center; justify-content: space-between">
+                      <span>{{ row.courseware_name }}</span>
+                      <el-link type="primary" @click="handleLocation(row, 0)">定位</el-link>
+                    </div>
                   </template>
                 </el-table-column>
               </el-table>