From 0673f7fe45966e537c4b6263dd7dfc8cbd1f5ad5 Mon Sep 17 00:00:00 2001 From: QYF-GitLab1 <1940665526@qq.com> Date: 星期三, 21 五月 2025 17:37:55 +0800 Subject: [PATCH] 中药手册 --- src/books/hotelEnglishTrainingBrochure2nd/view/components/index.vue | 93 ++++++++++++++++++++++++++-------------------- 1 files changed, 52 insertions(+), 41 deletions(-) diff --git a/src/books/hotelEnglishTrainingBrochure2nd/view/components/index.vue b/src/books/hotelEnglishTrainingBrochure2nd/view/components/index.vue index 7409fe3..e60699f 100644 --- a/src/books/hotelEnglishTrainingBrochure2nd/view/components/index.vue +++ b/src/books/hotelEnglishTrainingBrochure2nd/view/components/index.vue @@ -3,23 +3,14 @@ <div id="searchDomBox" style="display: none"> <div id="searchContent"></div> </div> - <div - class="page-content" - :style="{ - fontSize: fontSize + 'px', - transform: `scale(${pageZoom})`, - transformOrigin: 'center top', - }" - > - <pageHeader - v-if="showCatalogList.indexOf(1) > -1" - :showPageList="loadPageList" - ></pageHeader> - <chapterOne - v-if="showCatalogList.indexOf(2) > -1" - :showPageList="loadPageList" - :interfaceQuestion="questionDataMap" - ></chapterOne> + <div class="page-content" :style="{ + fontSize: fontSize + 'px', + transform: `scale(${pageZoom})`, + transformOrigin: 'center top', + }"> + <pageHeader v-if="showCatalogList.indexOf(1) > -1" :showPageList="loadPageList"></pageHeader> + <chapterOne v-if="showCatalogList.indexOf(2) > -1" :showPageList="loadPageList" + :interfaceQuestion="questionDataMap"></chapterOne> <!-- <chapterTwo v-if="showCatalogList.indexOf(2) > -1" :showPageList="loadPageList" @@ -37,9 +28,9 @@ :showPageList="loadPageList" :interfaceQuestion="questionDataMap" ></chapterFive> --> - </div> - <translateWord :pageX="pageX" :pageY="pageY" :showWord="showWord" v-if="showWord" /> + <translateWord :pageX="pageX" :pageY="pageY" :showWord="showWord" :IPA="IPA" :prototype="prototype" + :translate="translate" v-if="showWord" /> </div> </template> @@ -54,6 +45,7 @@ import NoteIcon from "@/assets/images/biji.png"; // import getQuestionList from "@/assets/methods/examination"; // import testData from "../../assets/examinationList"; +import keyWordData from "../../assets/englishKeyWords.js"; import _ from "lodash"; import Swiper from "swiper/bundle"; import "swiper/swiper-bundle.css"; @@ -78,9 +70,13 @@ audioPath: "", currentTime: null, videoList: [], - pageX:0, - pageY:0, - showWord:"", + pageX: 0, + pageY: 0, + showWord: "", + prototype: "", + IPA: "", + translate: "", + keywordList: keyWordData }; }, computed: { @@ -123,7 +119,7 @@ this.initViewer(); this.closeAudio(); this.closeVideo(); - this.handleTanslateWord() + this.handleTanslateWord(); }, 200); }, }, @@ -194,9 +190,9 @@ }, 500); // 娴嬭瘯椤甸潰璺宠浆 - setTimeout(() => { - this.gotoPage(2, 6); - }, 500); + // setTimeout(() => { + // this.gotoPage(2, 18); + // }, 500); // const pageDom = (this.container ? this.container : document) // .querySelector("#app") @@ -472,8 +468,8 @@ page && pageThemeColor && pageThemeColor[page] ? pageThemeColor[page] : chapterNum && chapterThemeColor && chapterThemeColor[chapterNum] - ? chapterThemeColor[chapterNum] - : bookThemeColor; + ? chapterThemeColor[chapterNum] + : bookThemeColor; if (themeColor) { domItem.style.color = themeColor; } @@ -490,8 +486,8 @@ page && pageThemeColor && pageThemeColor[page] ? pageThemeColor[page] : chapterNum && chapterThemeColor && chapterThemeColor[chapterNum] - ? chapterThemeColor[chapterNum] - : bookThemeColor; + ? chapterThemeColor[chapterNum] + : bookThemeColor; if (themeColor) { domItem.style.backgroundColor = themeColor; } @@ -508,8 +504,8 @@ page && pageThemeColor && pageThemeColor[page] ? pageThemeColor[page] : chapterNum && chapterThemeColor && chapterThemeColor[chapterNum] - ? chapterThemeColor[chapterNum] - : bookThemeColor; + ? chapterThemeColor[chapterNum] + : bookThemeColor; if (themeColor) { domItem.style.borderColor = themeColor; } @@ -838,7 +834,7 @@ // 璁板綍楂樹寒淇℃伅 this.highlightData = data; // 璺宠浆 - this.gotoPage(data.catalog, data.page, () => {}); + this.gotoPage(data.catalog, data.page, () => { }); }, // 椤甸潰鍚戜笅婊氬姩锛岄煶棰戝皬绐楁挱鏀惧姛鑳� getAduio() { @@ -963,19 +959,30 @@ const doms = ( this.container ? this.container : document ).querySelectorAll(".ts-word"); - for(let index = 0;index < doms.length;index++){ + for (let index = 0; index < doms.length; index++) { const dom = doms[index]; dom.onmouseenter = (event) => { - this.pageX = event.pageX; - this.pageY = event.pageY; - this.showWord = event.target.innerText; - console.log(event.target.innerText); + if (this.showWord != event.target.innerText) { + const rect = dom.getBoundingClientRect(); + this.pageX = rect.left; + this.pageY = rect.top + rect.height; + this.keywordList.forEach((item) => { + if (item.name == event.target.innerText) { + this.showWord = item.name + this.prototype = item.prototype + this.IPA = item.IPA + this.translate = item.translate + } + }); + } }; - dom.onmouseleave = () => { - this.showWord = "" + dom.onmouseleave = (event) => { + if (this.showWord == event.target.innerText) { + this.showWord = ""; + } }; } - } + }, }, components: { translateWord, @@ -991,6 +998,10 @@ <style lang="less" scoped> .page-main { + width: 100% !important; + height: 100% !important; + overflow: auto; + .page-content { max-width: 816px; min-width: 375px; -- Gitblit v1.9.1