From fe52c75b42ef2815dc5c66e964c2b388ed09d097 Mon Sep 17 00:00:00 2001 From: zhongshujie <2862698242@qq.com> Date: 星期五, 25 四月 2025 11:28:21 +0800 Subject: [PATCH] 环境变量修改 --- src/books/artInitiationForAges0to3/view/index.vue | 80 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 80 insertions(+), 0 deletions(-) diff --git a/src/books/artInitiationForAges0to3/view/index.vue b/src/books/artInitiationForAges0to3/view/index.vue new file mode 100644 index 0000000..2c711dc --- /dev/null +++ b/src/books/artInitiationForAges0to3/view/index.vue @@ -0,0 +1,80 @@ +<template> + <div class="artInitiationForAges0to3" @mouseup="handleMouseUp"> + <pageContent></pageContent> + </div> + </template> + + <script> + import pageContent from "./components/index.vue"; + export default { + name: "artInitiationForAges0to3", + components: { + pageContent, + }, + computed: { + fontSize() { + return this.$store.state.qiankun.fontSize; + }, + pageZoom() { + return this.$store.state.qiankun.scale / 100; + }, + }, + + methods: { + getParentWithClass(element, className) { + while (element.parentElement) { + element = element.parentElement; + if (element.classList.contains(className)) { + return element; + } + } + }, + handleMouseUp(e) { + const selection = ( + this.container ? this.container : window + ).getSelection(); + const txt = selection.toString(); + if (selection.type != "none" && txt) { + let node = selection.anchorNode.parentNode; + let pageHtml = this.getParentWithClass( + selection.anchorNode, + "page-box" + ); + let chapterDom = this.getParentWithClass( + selection.anchorNode, + "chapter" + ); + let chapterNum; + if (chapterDom) chapterNum = chapterDom.getAttribute("num"); + if (pageHtml) { + const page = pageHtml.getAttribute("page"); + // 鐩戝惉閫変腑鏂囨湰浜嬩欢锛屽苟瑙﹀彂鐖跺眰鏂规硶 + if (this.$store.state.qiankun.windowSelection) { + this.$store.state.qiankun.windowSelection({ + chapterNum, + txt, + page, + x: e.x, + y: e.y, + }); + } + } + } else { + if (this.$store.state.qiankun.windowSelection) { + this.$store.state.qiankun.windowSelection({ + chapterNum: "", + txt: "", + page: "", + x: e.x, + y: e.y, + }); + } + } + }, + }, + }; + </script> + + <style lang="less"> + @import "../assets/main.less"; + </style> \ No newline at end of file -- Gitblit v1.9.1