From 2cac4a0f4ea0b1cf7bff4759fae8136c72792563 Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期一, 14 四月 2025 15:30:29 +0800
Subject: [PATCH] 番茄闹钟

---
 src/views/readerPages/webHome.vue |  275 +++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 236 insertions(+), 39 deletions(-)

diff --git a/src/views/readerPages/webHome.vue b/src/views/readerPages/webHome.vue
index e5858b5..f709147 100644
--- a/src/views/readerPages/webHome.vue
+++ b/src/views/readerPages/webHome.vue
@@ -12,6 +12,9 @@
         <div v-else>
           <div class="layout hover" @click="goLogin">鐧诲綍</div>
         </div>
+        <!-- <div>
+          <div class="layout hover" @click="openFormulaDialog">鍏紡</div>
+        </div> -->
       </div>
     </div>
     <div class="contentBox">
@@ -396,7 +399,7 @@
                             class="icon hover"
                             size="20"
                             @click="JumpPosition(item)"
-                            v-if="resourceType == 'default'"
+                            v-if="item.pagination"
                           >
                             <LocationInformation />
                           </el-icon>
@@ -432,18 +435,24 @@
                           >
                             <View />
                           </el-icon>
+                          <!-- 鍏朵粬绫诲瀷棰勮鎴栫洿鎺ヤ笅杞� -->
+                          <el-icon
+                            @click="goPlay(item)"
+                            size="20"
+                            class="icon hover"
+                            v-if="
+                              item.resourceType != '瑙嗛' &&
+                              item.resourceType != '闊抽' &&
+                              item.resourceType != '鍥剧墖'
+                            "
+                          >
+                            <View />
+                          </el-icon>
                           <el-icon
                             size="20"
                             class="icon hover"
-                            @click="goPlay(item)"
-                            v-if="
-                              !(
-                                item.resourceType == '瑙嗛' ||
-                                item.resourceType == '闊抽' ||
-                                item.resourceType == '涔犻' ||
-                                item.resourceType == '鍥剧墖'
-                              ) && item.isDownload == '鏄�'
-                            "
+                            @click="goDownload(item)"
+                            v-if="item.isDownload == '鏄�'"
                           >
                             <Download />
                           </el-icon>
@@ -639,6 +648,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>
@@ -1147,9 +1168,12 @@
       <video controls controlslist="nodownload" :src="testVideo"></video>
     </div>
 
-    <!-- <div class="wordBox" v-if="resourType == 'word'">
-      <vue-office-docx :src="testWord" />
-    </div> -->
+    <div class="wordBox" v-if="resourType == 'PDF' || resourType == 'PPT' || resourType == 'WORD'">
+      <div v-for="(item, index) in showData" :key="index" class="pdfItem" :page="index + 1">
+        <img :src="item.showSrc" alt="" style="min-height: 550px" loading="lazy" />
+        <el-divider content-position="center"> 绗� {{ index + 1 }} 椤� </el-divider>
+      </div>
+    </div>
   </el-dialog>
   <div class="audioBox" v-show="false">
     <!-- <video controls controlslist="nodownload" :src="testVideo"></video> -->
@@ -1258,6 +1282,11 @@
   </el-dialog>
   <el-dialog title="妯″瀷宸ュ叿" align-center v-model="modelToolVisble" width="80%" class="myDialogs">
     <div class="wendabox">
+      <iframe :src="sceneUrl" frameborder="0"></iframe>
+    </div>
+  </el-dialog>
+  <el-dialog title="妯″瀷宸ュ叿" align-center v-model="modelTool" width="80%" class="myDialogs">
+    <div class="wendabox">
       <iframe src="https://adjam93.github.io/threejs-model-viewer/#" frameborder="0"></iframe>
     </div>
   </el-dialog>
@@ -1277,6 +1306,11 @@
       <wrongQuestion />
     </div>
   </el-dialog>
+  <el-dialog title="鍏紡缂栬緫" align-center v-model="formulaDialog" class="myDialogs">
+    <div class="wendabox">
+      <formula />
+    </div>
+  </el-dialog>
   <!-- 绛旈鍣� -->
   <examination
     ref="examinationRef"
@@ -1287,16 +1321,22 @@
   />
   <!-- 璁$畻鍣� -->
   <el-dialog title="璁$畻鍣�" align-center v-model="calculatorVisble" width="850" class="myDialogs">
-    <calculatorNew></calculatorNew>
+    <!-- <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')
 //鑾峰彇璺敱鍣�
@@ -1306,6 +1346,7 @@
 import moment from 'moment'
 import dictionary from '@/views/components/dictionary.vue'
 import newWord from '@/views/components/newWord.vue'
+import formula from '@/views/components/formula.vue'
 import wrongQuestion from '@/views/components/wrongQuestion.vue'
 import voiceReader from '@/views/components/voiceReader.vue'
 import logo from '@/assets/images/header/logo.png'
@@ -1465,7 +1506,6 @@
         window.qiankunState.initTestBook(localStorage.getItem('bookId') + '', tryPageCount.value)
       }
     }
-
   })
 
   // 瀹氫箟鐖跺眰鏂规硶
@@ -1555,7 +1595,6 @@
   // if (window.qiankunState && window.qiankunState.getAnswers){
   //   window.qiankunState.getAnswers(localStorage.getItem(""))
   // }
-
 })
 
 onBeforeUnmount(() => {
@@ -1606,6 +1645,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.includes(res.datas[0].defaultSaleMethodId)) {
       isBuy.value = true
@@ -1778,13 +1818,18 @@
       icon: fanqiezhong,
       isShow: bookConfig.value.textbookComponents.indexOf('E4DC9777') > -1
     }
+    // {
+    //   name: '鐣寗闂归挓',
+    //   icon: fanqiezhong,
+    //   isShow: true
+    // }
   ]
   floatingToolBox = [
     {
       icon: huabi,
       name: '鐢荤瑪',
-      // isShow: bookConfig.value.textbookComponents.indexOf('800109C0') > -1
-      isShow: true
+      isShow: bookConfig.value.textbookComponents.indexOf('800109C0') > -1
+      // isShow: true
     },
     {
       icon: baiban,
@@ -1869,9 +1914,9 @@
       if (localStorage.getItem('chapter') && localStorage.getItem('startPage')) {
         let chapter = Number(localStorage.getItem('chapter'))
         let start = Number(localStorage.getItem('startPage'))
-        
+
         if (window.qiankunState && window.qiankunState.gotoPage) {
-          window.qiankunState.gotoPage(chapter,start)
+          window.qiankunState.gotoPage(chapter, start)
           localStorage.removeItem('chapter')
           localStorage.removeItem('startPage')
         }
@@ -1879,7 +1924,6 @@
     })
     .catch(function (error) {
       listLoading.value = false
-
     })
 }
 const defaultProps = {
@@ -2033,6 +2077,15 @@
                 if (resItem1.resourceType == classifySelectList.value[0].title) {
                   resourceDataList.value.push(resItem1)
                 }
+                if (activeClassify.value == 'other') {
+                  if (
+                    resItem1.resourceType != '鍥剧墖' &&
+                    resItem1.resourceType != '瑙嗛' &&
+                    resItem1.resourceType != '闊抽'
+                  ) {
+                    resourceDataList.value.push(resItem1)
+                  }
+                }
               })
             }
           } else {
@@ -2107,6 +2160,15 @@
                 if (resItem1.resourceType == classifySelectList.value[0].title) {
                   resourceDataList.value.push(resItem1)
                 }
+                if (activeClassify.value == 'other') {
+                  if (
+                    resItem1.resourceType != '鍥剧墖' &&
+                    resItem1.resourceType != '瑙嗛' &&
+                    resItem1.resourceType != '闊抽'
+                  ) {
+                    resourceDataList.value.push(resItem1)
+                  }
+                }
               })
             }
           }
@@ -2139,7 +2201,10 @@
   }
 }
 //璧勬簮鎾斁瑙嗛
+const sceneUrl = ref()
+const showData = ref()
 const goPlay = (data, index) => {
+  console.log(data.resourceType, 123)
   resourType.value = data.resourceType
   if (data.resourceType == '瑙嗛') {
     if (data.md5) {
@@ -2156,6 +2221,59 @@
       testAudio.value = bookConfig.value.resourceUrl + '/' + data.resourcePath
     }
     autoPlay()
+  } else if (data.resourceType == '妯″瀷') {
+    console.log(data, 222)
+    let file = bookConfig.value.requestCtx + '/file/api/ApiDownload?md5=' + data.md5
+    console.log(file.exd, 777)
+    const ctx = 'https://jsek.bnuic.com'
+    if (data.md5) {
+      sceneUrl.value =
+        'https://jsek.bnuic.com/books/book/civilAviation/static/modelView/index.html?md5=' +
+        data.md5 +
+        '&name=je' +
+        '&domain=' +
+        ctx +
+        '&exd=obj' +
+        '&target=iframe'
+    } else {
+      sceneUrl.value = bookConfig.value.resourceUrl + '/' + data.resourcePath
+    }
+    modelToolVisble.value = true
+    // if (data.md5) {
+    //   window.open(bookConfig.value.requestCtx + '/file/api/ApiDownload?md5=' + data.md5)
+    // } else if (data.resourcePath) {
+    //   window.open(bookConfig.value.resourceUrl + '/' + data.resourcePath)
+    // }
+  } else if (data.resourceType == 'PPT' || data.resourceType == 'PDF') {
+    let md5 = data.md5
+    let dataList = []
+    MG.file
+      .getPdfInfo({
+        md5
+      })
+      .then((res: any) => {
+        console.log()
+        if (res && res.totalPages) {
+          for (let i = 0; i < res.totalPages; i++) {
+            const src =
+              bookConfig.value.requestCtx +
+              '/file/GetPdfPageImage?md5=' +
+              md5 +
+              '&index=' +
+              (i + 1) +
+              '&dpi=300'
+            dataList.push({
+              showSrc: src
+            })
+          }
+          console.log(dataList)
+          showData.value = dataList
+          // 鍚姩椤电爜瑙傚療
+          setTimeout(() => {
+            resourVisble.value = true
+          }, 500)
+        }
+      })
   } else {
     if (data.md5) {
       window.open(bookConfig.value.requestCtx + '/file/api/ApiDownload?md5=' + data.md5)
@@ -2167,6 +2285,13 @@
   //  else if (data.resourceType == 'word') {
   //   testWord.value = bookConfig.value.resourceUrl + '/' + data.resourcePath
   // }
+}
+const goDownload = (data) => {
+  if (data.md5) {
+    window.open(bookConfig.value.requestCtx + '/file/api/ApiDownload?md5=' + data.md5)
+  } else if (data.resourcePath) {
+    window.open(bookConfig.value.resourceUrl + '/' + data.resourcePath)
+  }
 }
 // 鍏抽棴瑙嗛
 const resourVisbleClose = () => {
@@ -2194,6 +2319,9 @@
 //璧勬簮绫诲瀷閫夋嫨榛樿/鏁欏笀
 const selectResourceType = (type) => {
   resourceType.value = type
+  resourceDataList.value = []
+  classifySelectList.value = []
+  activeClassify.value = ''
   searchText.value = ''
   if (type == 'collect') {
     getCollectResource()
@@ -2304,6 +2432,15 @@
               collectResourceList.value.forEach((resItem1) => {
                 if (resItem1.resourceType == classifySelectList.value[0].title) {
                   resourceDataList.value.push(resItem1)
+                }
+                if (activeClassify.value == 'other') {
+                  if (
+                    resItem1.resourceType != '鍥剧墖' &&
+                    resItem1.resourceType != '瑙嗛' &&
+                    resItem1.resourceType != '闊抽'
+                  ) {
+                    resourceDataList.value.push(resItem1)
+                  }
                 }
               })
             }
@@ -2790,22 +2927,24 @@
       break
   }
 }
-
+type pomodoroType = InstanceType<typeof Pomodoro>
 const baiduVisible = ref(false)
 const wendaVisible = ref(false)
 const cidianVisible = ref(false)
 const functionVisible = ref(false)
 const siweiVisble = ref(false)
 const modelToolVisble = ref(false)
+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) {
@@ -2819,7 +2958,7 @@
         siweiVisble.value = true
         break
       case '妯″瀷宸ュ叿':
-        modelToolVisble.value = true
+        modelTool.value = true
         break
       case '璇嶅吀':
         cidianVisible.value = true
@@ -2830,6 +2969,8 @@
         break
       case '璁$畻鍣�':
         calculatorVisble.value = true
+      case '鐣寗闂归挓':
+        pomodoroRef.value.setDialogVisable(true)
         break
     }
   } else {
@@ -2908,7 +3049,6 @@
 
 //娴獥宸ュ叿鏍忕偣鍑讳簨浠�
 const floatItemHandle = (item) => {
-  console.log(floatingToolData.activeToolData, 'floatingToolData.activeToolData')
   if (floatingToolData.activeToolData == '鐢荤瑪') {
     floatingToolData.activeToolData = ''
   } else {
@@ -3145,7 +3285,6 @@
 
 //璺宠浆
 const goReMark = (item) => {
-  console.log(item)
   if (window.qiankunState && window.qiankunState.gotoPage) {
     window.qiankunState.gotoPage(Number(item.chapterNum), Number(item.page))
   }
@@ -3230,7 +3369,6 @@
 }
 //鍙栨秷鍥炶皟
 const closeFn = (base64: any) => {
-  console.log(base64)
   floatingToolData.activeToolData = ''
 }
 //淇濆瓨鎴浘
@@ -3477,7 +3615,6 @@
         window.speechSynthesis.cancel()
         const synth = window.speechSynthesis
         const utterance = new SpeechSynthesisUtterance(dialogToolData.txt)
-        console.log(utterance, 1)
         utterance.lang = 'zh-CN' // 璁剧疆璇█涓轰腑鏂�
         synth.speak(utterance)
         showToolBox.value = false
@@ -3514,10 +3651,8 @@
 
         showToolBox.value = false
         // cidianVisible.value = true
-        console.log(dialogToolData.txt)
         break
       case '鐧剧':
-        console.log('https://baike.baidu.com/item/' + dialogToolData.txt)
         baiduVisible.value = true
         break
     }
@@ -3758,7 +3893,6 @@
             const item = res[i]
             // 鍌ㄥ��
             let data = catalogueData.value.find((item1) => item1.chapter == Number(item.key))
-            // console.log(data,'666')
             let dataList = []
             if (catalogueData.value.length > 0) {
               catalogueData.value.forEach((item1) => {
@@ -3800,7 +3934,6 @@
               })
             }
           }
-          console.log(scribeData.noteList, 'scribeData.noteList')
         }
         listLoading.value = false
       })
@@ -3874,13 +4007,11 @@
   document.addEventListener('mousemove', function (event) {
     var x = event.offsetX
     var y = event.offsetY
-    // console.log('榧犳爣鍧愭爣浣嶇疆锛�', x, y)
     noteContent.top = event.clientY + 20
     noteContent.left = event.clientX
   })
 }
 window.noteOut = (type) => {
-  console.log(type, 123)
   noteContent.show = false
 }
 
@@ -3930,7 +4061,6 @@
 
 //绗旇璺宠浆
 const jumpContent = (item) => {
-  console.log(item)
   if (window.qiankunState && window.qiankunState.gotoPage) {
     window.qiankunState.gotoPage(Number(item.chapterNum), Number(item.page))
   }
@@ -3938,7 +4068,6 @@
 
 //鑿滃崟绗旇缂栬緫
 const update = (item) => {
-  console.log(item)
   dialogToolData.chapter = item.chapterNum
   noteColorActive.value = item.color
   formData.id = item.id
@@ -4021,13 +4150,11 @@
         }
       ])
       .then((res) => {
-        console.log(res[0][0], 'cid')
         if (res.length > 0 && res[0].length > 0) {
           res[0].map((item) => {
             item.trans = JSON.parse(item.trans)
           })
           dictionaryData.data = res[0][0]
-          console.log(dictionaryData.data, '14')
           dictionaryData.showContent = true
         }
       })
@@ -4116,6 +4243,34 @@
     router.replace({
       path: '/login'
     })
+  }
+}
+
+const formulaDialog = ref(false)
+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>
@@ -4868,6 +5023,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;
+            }
+          }
+        }
       }
     }
 
@@ -5274,7 +5456,7 @@
 
 .wendabox {
   width: 100%;
-  height: 95vh;
+  height: 82vh;
 
   iframe {
     width: 100%;
@@ -5375,6 +5557,17 @@
 
 .wordBox {
   height: 600px;
+  width: 100%;
+  overflow-y: scroll;
+
+  img {
+    display: block;
+    margin: 0 auto;
+    width: 90%;
+    height: auto;
+    box-shadow: 0px 0px 10px 1px rgba(0, 0, 0, 0.1);
+    object-fit: contain;
+  }
 }
 
 .imgUrlBox {
@@ -5391,4 +5584,8 @@
   bottom: 30px;
   left: 50px;
 }
+.iframe-box {
+  width: 100%;
+  height: 800px;
+}
 </style>

--
Gitblit v1.9.1