From 79bab3a99c87cb9a83c909bcc5e01bf1332b6b12 Mon Sep 17 00:00:00 2001
From: litian <2804272236@qq.com>
Date: 星期三, 15 五月 2024 21:31:35 +0800
Subject: [PATCH] s

---
 src/views/home.vue |   58 ++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 36 insertions(+), 22 deletions(-)

diff --git a/src/views/home.vue b/src/views/home.vue
index 118f144..a664aea 100644
--- a/src/views/home.vue
+++ b/src/views/home.vue
@@ -92,9 +92,9 @@
       <div class="menuContent" v-if="menuState.open">
         <div class="searchBox">
           <div class="inputBox" v-if="activeMenu !== 2">
-            <el-input class="custom-input" placeholder="璇疯緭鍏ュ唴瀹�" v-model="searchText">
+            <el-input class="custom-input" placeholder="璇疯緭鍏ュ唴瀹�" v-model="searchText" @keyup.enter="searchBook">
               <template #prefix>
-                <el-icon @click="searchBook"><Search /></el-icon>
+                <el-icon><Search /></el-icon>
               </template>
             </el-input>
           </div>
@@ -113,12 +113,14 @@
         <!-- 鐩綍 -->
         <div class="menuList" v-if="activeMenu == 0">
           <el-tree
+            ref="catalogTree"
             style="max-width: 600px"
             default-expand-all="true"
             :data="catalogueData"
             :props="defaultProps"
             v-if="catalogueData.length > 0"
             @node-click="handleNodeClick"
+            :filter-node-method="filterNode"
           />
           <div v-if="catalogueData.length == 0">
             <el-empty :image-size="60" description="鏆傛棤鏁版嵁" />
@@ -779,7 +781,9 @@
     <template #footer>
       <span class="dialog-footer">
         <el-button @click="screenshotClose">鍙� 娑�</el-button>
-        <el-button type="primary" @click="addScreenshot" :loading="screenshotLoading">纭� 瀹�</el-button>
+        <el-button type="primary" @click="addScreenshot" :loading="screenshotLoading"
+          >纭� 瀹�</el-button
+        >
       </span>
     </template>
   </el-dialog>
@@ -1034,7 +1038,7 @@
   axios
     .get(resourceUrl + '/1/information.json?t=123')
     .then(function (response) {
-      console.log(response.data);
+      console.log(response.data)
       var json = response.data
       // 澶勭悊鑾峰彇鍒扮殑json鏁版嵁
       catalogueData.value = json.data
@@ -1047,8 +1051,15 @@
   children: 'children',
   label: 'label'
 }
+const filterNode = (value, data) => {
+  if (!value) return true
+  return data.label.indexOf(value) !== -1
+}
+
 const handleNodeClick = (data) => {
-  document.getElementById(data.id).scrollIntoView()
+  console.log(data)
+  if (window.qiankunState && window.qiankunState.gotoPage)
+    window.qiankunState.gotoPage(data.chapter, data.start)
 }
 
 //鑾峰彇璧勬簮
@@ -1285,7 +1296,11 @@
   }
   // getNotesList()
 }
+const catalogTree = ref()
 const searchBook = async () => {
+  if (activeMenu.value == 0) {
+    if (catalogTree) catalogTree.value.filter(searchText.value)
+  }
   if (activeMenu.value == 1) {
     // getNotesList()
     getSignData()
@@ -1598,10 +1613,7 @@
 const labelShow = (str) => {}
 
 //鏍囩
-const reMark =() => {
-
-  
-}
+const reMark = () => {}
 //鎴浘
 //鎴浘浜嬩欢
 function jitT() {
@@ -1643,16 +1655,18 @@
           }
         ]
       }
-    }).then((res) => {
-      screenshotLoading.value = false
-      getScreenshotList()
-      nameData.value = ''
-      urlData.value = ''
-      floatingToolData.activeToolData = ''
-      screenshotVisble.value = false
-    }).catch(function (error) {
-      screenshotLoading.value = false
     })
+      .then((res) => {
+        screenshotLoading.value = false
+        getScreenshotList()
+        nameData.value = ''
+        urlData.value = ''
+        floatingToolData.activeToolData = ''
+        screenshotVisble.value = false
+      })
+      .catch(function (error) {
+        screenshotLoading.value = false
+      })
   } else {
     ElMessage.error('鎴浘鍚嶇О涓嶈兘涓虹┖!')
   }
@@ -1934,14 +1948,15 @@
     case '绗旇':
       if (!formData.desc.replace(/^\s*|\s*$/g, '')) {
         ElMessage.error('绗旇鍐呭涓嶈兘涓虹┖!')
-        return 
+        return
       }
       if (!noteColorActive.value) {
         ElMessage.error('璇烽�夋嫨绗旇棰滆壊!')
         return
       }
       dom = 'notes-' + bookId.value
-      data = dialogToolData.notesList.length != 0 ? dialogToolData.notesList[dialogToolData.chapter] : []
+      data =
+        dialogToolData.notesList.length != 0 ? dialogToolData.notesList[dialogToolData.chapter] : []
       data.push({
         id: toolClass.uuid(8),
         txt: dialogToolData.txt,
@@ -1951,7 +1966,7 @@
         createDate: new Date(),
         note: formData.desc.replace(/^\s*|\s*$/g, '')
       })
-      
+
       break
   }
   request({
@@ -2230,7 +2245,6 @@
     })
   }
 }
-
 
 //鍐呭鍖哄煙椤堕儴鏄剧ず
 

--
Gitblit v1.9.1