From 8bb0a518dd4d9450370582c4d4ac3ae1dba1466b Mon Sep 17 00:00:00 2001
From: litian <2804272236@qq.com>
Date: 星期五, 25 四月 2025 15:28:18 +0800
Subject: [PATCH] 资源

---
 src/views/readerPages/webHome.vue |   87 +++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 82 insertions(+), 5 deletions(-)

diff --git a/src/views/readerPages/webHome.vue b/src/views/readerPages/webHome.vue
index 11694f2..f6b981a 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 = [
     {
@@ -1988,11 +2011,11 @@
               item.icon = ''
             }
             if (resourceType.value == 'default') {
-              if (item.isTeacherResource == '鍚�') {
+              if (item.isDefaultResource == '鏄�') {
                 defaultResourceList.value.push(item)
               }
             } else {
-              if (item.isTeacherResource == '鏄�') {
+              if (item.isTeacherResource == '鏄�' && item.isDefaultResource == '鍚�') {
                 teacherResourceList.value.push(item)
               }
             }
@@ -2237,7 +2260,7 @@
     // } else if (data.resourcePath) {
     //   window.open(bookConfig.value.resourceUrl + '/' + data.resourcePath)
     // }
-  } else if (data.resourceType == 'PPT' || data.resourceType == 'PDF') {
+  } else if (data.resourceType == 'PPT' || data.resourceType == 'PDF' || data.resourceType == 'WORD') {
     let md5 = data.md5
     let dataList = []
     MG.file
@@ -2804,6 +2827,7 @@
     case '妫�绱�':
       allSearchReault.value = []
       if (window.qiankunState && window.qiankunState.searchBookByKeyword) {
+        console.log(window.qiankunState.searchBookByKeyword)
         let searchReault = window.qiankunState.searchBookByKeyword(searchText.value)
         if (searchReault.length > 0) {
           listLoading.value = true
@@ -2921,7 +2945,7 @@
       break
   }
 }
-
+type pomodoroType = InstanceType<typeof Pomodoro>
 const baiduVisible = ref(false)
 const wendaVisible = ref(false)
 const cidianVisible = ref(false)
@@ -2931,13 +2955,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 +2987,8 @@
         break
       case '璁$畻鍣�':
         calculatorVisble.value = true
+      case '鐣寗闂归挓':
+        pomodoroRef.value.setDialogVisable(true)
         break
     }
   } else {
@@ -4464,6 +4491,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 +5264,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