From 1675a23509c082f3d5ffd844227634a271dacafd Mon Sep 17 00:00:00 2001 From: YM <479443481@qq.com> Date: 星期三, 15 五月 2024 21:24:57 +0800 Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/TextbookReader --- src/views/home.vue | 74 +++++++++++++++++++++++-------------- 1 files changed, 46 insertions(+), 28 deletions(-) diff --git a/src/views/home.vue b/src/views/home.vue index 2e5faef..a82403b 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> @@ -983,7 +987,11 @@ windowSelection: (data) => { // 缁戝畾瀛愬簲鐢ㄩ�夋嫨鐩戝惉浜嬩欢 console.log(data, '瀛愬簲鐢ㄩ�夋嫨') - getSelection(data) + if(data.txt){ + getSelection(data) + }else{ + showToolBox.value = false + } }, catalogChange: (data) => { activeCatalog.value = data.showCatalogList @@ -998,9 +1006,9 @@ // catalogName: "", // } console.log(data, '椤甸潰鍒囨崲锛氱洰鍓嶆樉绀洪〉闈㈠拰瀵瑰簲鐨勭珷鑺備俊鎭�') - } + }, + }) - // 璋冪敤瀛愬眰鏂规硶 // if (window.qiankunState && window.qiankunState.aa) window.qiankunState.aa(1) }) @@ -1030,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 @@ -1043,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) } //鑾峰彇璧勬簮 @@ -1281,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() } @@ -1592,10 +1611,7 @@ const labelShow = (str) => {} //鏍囩 -const reMark =() => { - - -} +const reMark = () => {} //鎴浘 //鎴浘浜嬩欢 function jitT() { @@ -1637,16 +1653,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('鎴浘鍚嶇О涓嶈兘涓虹┖!') } @@ -1928,14 +1946,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, @@ -1945,7 +1964,7 @@ createDate: new Date(), note: formData.desc.replace(/^\s*|\s*$/g, '') }) - + break } request({ @@ -2047,7 +2066,7 @@ url: '/identity/api/ApiGetAppUserKey', method: 'post', data: { - domain: 'note-' + bookId.value, + domain: 'notes-' + bookId.value, keys: activeCatalog.value.map((item) => item + '') } }).then((res) => { @@ -2078,8 +2097,8 @@ }) // 鍒掔嚎銆佺瑪璁般�侀珮浜偣鍑诲洖璋� -window.signClick = (type, id)=>{ - console.log("signClick鐐瑰嚮浜嬩欢鍥炶皟鐨勫疄渚�", type, id); +window.signClick = (type, id) => { + console.log('signClick鐐瑰嚮浜嬩欢鍥炶皟鐨勫疄渚�', type, id) } window.notesVisbleShow = function (txt) { @@ -2223,7 +2242,6 @@ }) } } - //鍐呭鍖哄煙椤堕儴鏄剧ず -- Gitblit v1.9.1