From 1d5d7f10cd90e7b1212a58234ef271584f0035c9 Mon Sep 17 00:00:00 2001 From: YM <479443481@qq.com> Date: 星期三, 15 五月 2024 23:35:58 +0800 Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/TextbookReader --- src/views/home.vue | 132 +++++++++++++++++++++++++++---------------- 1 files changed, 83 insertions(+), 49 deletions(-) diff --git a/src/views/home.vue b/src/views/home.vue index 118f144..6ca5fd0 100644 --- a/src/views/home.vue +++ b/src/views/home.vue @@ -92,9 +92,14 @@ <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,13 +118,22 @@ <!-- 鐩綍 --> <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" + > + <template #default="{ node, data }"> + <div class="custom-tree-node"> + <div class="catalogueLabel">{{ node.label }}</div> + <span class="pageNum">{{ data.page }}</span> + </div> + </template> + </el-tree> <div v-if="catalogueData.length == 0"> <el-empty :image-size="60" description="鏆傛棤鏁版嵁" /> </div> @@ -144,8 +158,8 @@ </div> </div> <div class="list-box"> - <div v-if=" scribeData.noteList.length > 0"> - <div v-for="(item, index) in scribeData.noteList" :key="item.key" class="listItem"> + <div v-if="scribeData.noteList.length > 0"> + <div v-for="(item, index) in scribeData.noteList" :key="item.key" class="listItem"> <div class="textBox"> <div class="title"> <div class="title-con"> @@ -183,7 +197,7 @@ </div> </div> </div> - <div v-if=" scribeData.noteList.length == 0"> + <div v-if="scribeData.noteList.length == 0"> <el-empty :image-size="60" description="鏆傛棤鏁版嵁" /> </div> </div> @@ -779,13 +793,15 @@ <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> <el-dialog title="鐧惧害鐧剧" align-center v-model="baiduVisible" width="60%" class="myDialogs"> <div class="wendabox"> - <iframe :src="'https://baike.baidu.com/item/' + selectText" frameborder="0"></iframe> + <iframe :src="'https://baike.baidu.com/item/' + dialogToolData.txt" frameborder="0"></iframe> </div> </el-dialog> <el-dialog title="AI鏅鸿兘闂瓟" align-center v-model="wendaVisible" width="26%" class="myDialogs"> @@ -796,7 +812,7 @@ <el-dialog title="璇嶅吀" align-center v-model="cidianVisible" width="60%" class="myDialogs"> <div class="wendabox"> <!-- <iframe src="https://www.vocabulary.com/" frameborder="0"></iframe> --> - <dictionary :searchCon="selectText" /> + <dictionary :searchCon="dialogToolData.txt" /> </div> </el-dialog> <el-dialog @@ -983,10 +999,11 @@ windowSelection: (data) => { // 缁戝畾瀛愬簲鐢ㄩ�夋嫨鐩戝惉浜嬩欢 console.log(data, '瀛愬簲鐢ㄩ�夋嫨') - if(data.txt){ + if (data.txt) { getSelection(data) - }else{ + } else { showToolBox.value = false + toolActive = '' } }, catalogChange: (data) => { @@ -1002,8 +1019,7 @@ // catalogName: "", // } console.log(data, '椤甸潰鍒囨崲锛氱洰鍓嶆樉绀洪〉闈㈠拰瀵瑰簲鐨勭珷鑺備俊鎭�') - }, - + } }) // 璋冪敤瀛愬眰鏂规硶 // if (window.qiankunState && window.qiankunState.aa) window.qiankunState.aa(1) @@ -1025,7 +1041,7 @@ // getNotesList() // 鑾峰彇绗旇 // getlineHeightList() //鑾峰彇楂樹寒 // getScribeList() //鑾峰彇鍒掔嚎 - // getScreenshotList() //鎴浘 + getScreenshotList() //鎴浘 } ) //鑾峰彇鐩綍 @@ -1034,7 +1050,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 @@ -1045,10 +1061,18 @@ } const defaultProps = { children: 'children', - label: 'label' + label: 'label', + page: 'page', } +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) } //鑾峰彇璧勬簮 @@ -1193,7 +1217,7 @@ case '0': break case '1': - // getSignData() + // getSignData() break case '2': break @@ -1285,11 +1309,14 @@ } // getNotesList() } +const catalogTree = ref() const searchBook = async () => { + if (activeMenu.value == 0) { + if (catalogTree) catalogTree.value.filter(searchText.value) + } if (activeMenu.value == 1) { // getNotesList() getSignData() - } if (activeMenu.value == 2) { let dataList = JSON.parse(JSON.stringify(resourceDataList.value)) @@ -1598,10 +1625,7 @@ const labelShow = (str) => {} //鏍囩 -const reMark =() => { - - -} +const reMark = () => {} //鎴浘 //鎴浘浜嬩欢 function jitT() { @@ -1643,16 +1667,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('鎴浘鍚嶇О涓嶈兘涓虹┖!') } @@ -1742,7 +1768,7 @@ { icon: fuzhi, activeIcon: fuzhi1, name: '澶嶅埗' }, { icon: AIyuedu, activeIcon: AIyuedu1, name: 'AI闃呰' }, { icon: cidian2, activeIcon: cidian1, name: '璇嶅吀' }, - { icon: baidu, activeIcon: cidian1, name: '鐧剧' } + { icon: baidu, activeIcon: baidu, name: '鐧剧' } // { icon: yuyinyuedu, activeIcon: yuyinyuedu1, name: '璇煶闃呰' } // { icon: cidian2, activeIcon: cidian1, name: '缈昏瘧' } ]) @@ -1891,6 +1917,7 @@ cidianVisible.value = true break case '鐧剧': + console.log('https://baike.baidu.com/item/' + dialogToolData.txt) baiduVisible.value = true break } @@ -1912,6 +1939,7 @@ case '楂樹寒': dom = 'highLightData-' + bookId.value data = dialogToolData.lineHeight[dialogToolData.chapter] + if (!data) data = [] data.push({ id: toolClass.uuid(8), txt: dialogToolData.txt, @@ -1923,6 +1951,7 @@ case '鍒掔嚎': dom = 'underline-' + bookId.value data = dialogToolData.scribeList[dialogToolData.chapter] + if (!data) data = [] data.push({ id: toolClass.uuid(8), txt: dialogToolData.txt, @@ -1934,14 +1963,16 @@ 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] : [] + if (!data) data = [] data.push({ id: toolClass.uuid(8), txt: dialogToolData.txt, @@ -1951,7 +1982,7 @@ createDate: new Date(), note: formData.desc.replace(/^\s*|\s*$/g, '') }) - + break } request({ @@ -1975,8 +2006,6 @@ getSignData() }) } - - const getSignData = () => { request({ @@ -2040,7 +2069,7 @@ // 鍌ㄥ�� scribeData.noteList = data dialogToolData.notesList[item.key] = data - console.log(dialogToolData.notesList,"notesList") + console.log(dialogToolData.notesList, 'notesList') // 娓叉煋 for (let j = 0; j < data.length; j++) { const citem = data[j] @@ -2062,19 +2091,21 @@ }) // 鍒掔嚎銆佺瑪璁般�侀珮浜偣鍑诲洖璋� -window.signClick = (type, id)=>{ - console.log("signClick鐐瑰嚮浜嬩欢鍥炶皟鐨勫疄渚�", type, id); +window.signClick = (type, id) => { + console.log('signClick鐐瑰嚮浜嬩欢鍥炶皟鐨勫疄渚�', type, id) // if (window.qiankunState && window.qiankunState.delSign) window.qiankunState.delSign({ids:[id]}) - if(type == 'Note'){ + if (type == 'Note') { let data = dialogToolData.notesList.filter((item) => id.indexOf(item.id) == -1) console.log(data) formData.desc = notes.note noteColorActive.value = notes.color addNoteVisble.value = true - }else{ + } else { lineDelete.showLineDelete = true lineDelete.deleteType = type lineDelete.id = id + lineDelete.top = 500 + lineDelete.left = 500 } } @@ -2120,11 +2151,11 @@ ] } }).then((res) => { - if (window.qiankunState && window.qiankunState.delSign) window.qiankunState.delSign({ids:[ids]}) + if (window.qiankunState && window.qiankunState.delSign) + window.qiankunState.delSign({ ids: [ids] }) getSignData() }) } - const lineDeleteBtn = () => { if (lineDelete.deleteType == 'underline') { @@ -2225,12 +2256,12 @@ message: '鍒犻櫎绗旇鎴愬姛!', type: 'success' }) - if (window.qiankunState && window.qiankunState.delSign) window.qiankunState.delSign({ids:[id]}) + if (window.qiankunState && window.qiankunState.delSign) + window.qiankunState.delSign({ ids: [id] }) getNotesList() }) } } - //鍐呭鍖哄煙椤堕儴鏄剧ず @@ -2390,7 +2421,7 @@ align-items: center; } .resourceBox { - padding: 15px 0; + padding: 10px 0; margin: 0 20px; border-bottom: 1px solid rgba(204, 204, 204, 0.32); .classification { @@ -2407,7 +2438,8 @@ } .count { width: 35px; - margin: 5px auto; + margin: 0 auto; + margin-top:5px; border-radius: 10px; background: #fff; color: #c8c8c8; @@ -2437,6 +2469,7 @@ } .inputBox { margin-top: 10px; + width:100% !important; } } .resourceTab { @@ -2470,6 +2503,7 @@ } } .inputBox { + width:85%; .custom-input { border: 1px solid #0093ff !important; border-radius: 50px; -- Gitblit v1.9.1