From d7e53e63dd6c435e226d9f08cde31ca35131c911 Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期一, 14 四月 2025 15:30:33 +0800 Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/TextbookReader --- src/views/readerPages/webHome.vue | 80 +++++++++++++++++++++++++++++++++++++++- 1 files changed, 78 insertions(+), 2 deletions(-) diff --git a/src/views/readerPages/webHome.vue b/src/views/readerPages/webHome.vue index 11694f2..2c9cb33 100644 --- a/src/views/readerPages/webHome.vue +++ b/src/views/readerPages/webHome.vue @@ -649,6 +649,18 @@ <div class="canvas-box" v-show="canvasShow"> <canvas id="canvasRef" :width="canvasWith" :height="canvasheight"></canvas> </div> + <!-- 鐣寗闂归挓缁勪欢 --> + <div + class="watch-box" + v-if="pomodoroRef && pomodoroRef.isShow" + :style="{ top:position.x + 'px', left:position.y + 'px'}" + > + <p @mousedown.native="mouseDown">{{ formatTime(pomodoroRef.pageData.currentTime) }}</p> + <span @click="()=> pomodoroRef.isRuning ? pomodoroRef.pauseFun() : pomodoroRef.startFun()">{{pomodoroRef.isRuning ? '鏆傚仠': '寮�濮�'}}</span> + <span @click="pomodoroRef.resetFun" >閲嶇疆</span> + <span @click="pomodoroRef.handleRestFun(false)">闀夸紤鎭�</span> + <span @click="pomodoroRef.handleRestFun(true)">鐭紤鎭�</span> + </div> </div> </div> <!-- 鐢荤瑪缁勪欢 --> @@ -1325,14 +1337,19 @@ <!-- <calculatorNew></calculatorNew> --> <iframe src="https://www.geogebra.org/scientific" frameborder="0" class="iframe-box"></iframe> </el-dialog> + <!-- 鐣寗闂归挓 --> + <!-- <pomodoro ref="pomodoroRef" /> --> </template> <script setup lang="ts"> import examination from '@/views/examination/index.vue' +import pomodoro from '@/views/components/pomodoro.vue' import { ref, reactive, watch, onMounted, onBeforeMount, onBeforeUnmount, inject } from 'vue' import { useRouter, useRoute } from 'vue-router' import { ElMessage, ElMessageBox, valueEquals } from 'element-plus' +import { useFormatData } from '@/hooks/public' import useClipboard from 'vue-clipboard3' const { toClipboard } = useClipboard() +const { formatTime } = useFormatData() const MG: any = inject('MG') const toolClass = inject('toolClass') //鑾峰彇璺敱鍣� @@ -1642,6 +1659,7 @@ } MG.store.getProductList(obj).then((res) => { console.log(res.datas, '鍥句功淇℃伅') + if (!res.datas.length) return bookInfo.value = res.datas[0] if (res.datas[0].purchasedSaleMethodIdList.indexOf(res.datas[0].defaultSaleMethodId) > -1) { isBuy.value = true @@ -1815,6 +1833,11 @@ icon: fanqiezhong, isShow: bookConfig.value.textbookComponents.indexOf('E4DC9777') > -1 } + // { + // name: '鐣寗闂归挓', + // icon: fanqiezhong, + // isShow: true + // } ] floatingToolBox = [ { @@ -2921,7 +2944,7 @@ break } } - +type pomodoroType = InstanceType<typeof Pomodoro> const baiduVisible = ref(false) const wendaVisible = ref(false) const cidianVisible = ref(false) @@ -2931,13 +2954,14 @@ const modelTool = ref(false) const shengciVisble = ref(false) const calculatorVisble = ref(false) +const pomodoroRef = ref<pomodoroType>() const activeTool = ref(0) const toolState = reactive({ open: true }) const resourceUrl = ref('') -const selectTeachTools = (item) => { +const selectTeachTools = (item: any) => { if (token) { activeTool.value = item.name switch (item.name) { @@ -2962,6 +2986,8 @@ break case '璁$畻鍣�': calculatorVisble.value = true + case '鐣寗闂归挓': + pomodoroRef.value.setDialogVisable(true) break } } else { @@ -4464,6 +4490,29 @@ const openFormulaDialog = () => { formulaDialog.value = true } + +// 鐣寗閽熺Щ鍔� +const isMove = ref<boolean>(false) +const position = reactive({x:100,y:100}) +const dragOffset = reactive({x:0,y:0}) +const mouseDown = (e: MouseEvent) => { + isMove.value = true + dragOffset.x = e.clientX - position.x + dragOffset.y = e.clientY - position.y + document.addEventListener('mousemove', mouseMove) + document.addEventListener('mouseup', mouseUp) +} +const mouseUp = (e: MouseEvent) => { + isMove.value = false + document.removeEventListener('mousemove', mouseMove) + document.removeEventListener('mouseup', mouseUp) +} +const mouseMove = (e: MouseEvent) => { + if (isMove.value) { + position.x = e.clientX - dragOffset.x + position.y = e.clientY - dragOffset.y + } +} </script> <style lang="less"> @@ -5214,6 +5263,33 @@ z-index: 96; background: rgba(255, 255, 255, 0.2); } + .watch-box { + display: flex; + align-items: center; + position: absolute; + background-color: #555; + color: #fff; + padding: 10px; + border-radius: 5px; + width: max-content; + p { + cursor: move; + padding: 0 8px; + font-size: 18px; + border-radius: 4px; + margin-right: 10px; + background-color: #666; + } + span { + cursor: pointer; + border-right: 1px solid #fff; + padding: 0 4px; + font-size: 14px; + &:last-child { + border-right: none; + } + } + } } } -- Gitblit v1.9.1