From 480728c3c1b96d94a2053c1e418c173006d4ff68 Mon Sep 17 00:00:00 2001
From: litian <2804272236@qq.com>
Date: 星期二, 21 五月 2024 10:40:08 +0800
Subject: [PATCH] json

---
 src/views/home.vue |  859 ++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 576 insertions(+), 283 deletions(-)

diff --git a/src/views/home.vue b/src/views/home.vue
index e8b9eb8..b4ac3ad 100644
--- a/src/views/home.vue
+++ b/src/views/home.vue
@@ -23,7 +23,7 @@
           </div>
           <div class="name">{{ item.name }}</div>
         </div>
-        <div class="reload hover" @click="reload()">鍒锋柊</div>
+        <!-- <div class="reload hover" @click="reload()">鍒锋柊</div> -->
         <!-- 璁剧疆 -->
         <el-popover placement="right" :width="300" trigger="click">
           <div class="settingBox">
@@ -119,8 +119,8 @@
         <div class="menuList" v-if="activeMenu == '鐩綍'">
           <el-tree
             ref="catalogTree"
-            style="max-width: 600px"
             default-expand-all="true"
+            expand-on-click-node="false"
             :data="catalogueData"
             :props="defaultProps"
             v-if="catalogueData.length > 0"
@@ -129,7 +129,7 @@
           >
             <template #default="{ node, data }">
               <div class="custom-tree-node">
-                <div class="catalogueLabel">{{ node.label }}</div>
+                <div class="catalogueLabel" :title="node.label">{{ node.label }}</div>
                 <span class="pageNum">{{ data.page }}</span>
               </div>
             </template>
@@ -172,8 +172,8 @@
                         <span>{{ moment(item.createDate).format('YYYY-MM-DD') }}</span>
                       </div>
                       <div>
-                        <img :src="bianji" @click="update(item)" />
-                        <img :src="shanchu" @click="deleteBtn(item)" />
+                        <img :src="bianji" @click="update(item)" class="hover" />
+                        <img :src="shanchu" @click="deleteBtn(item)" class="hover" />
                       </div>
                     </div>
                     <div
@@ -210,7 +210,7 @@
         </div>
         <!-- 璧勬簮 -->
         <div class="" v-if="activeMenu == '璧勬簮'">
-          <div class="resourceBox">
+          <div class="resourceBox" v-if="classifySelectList.length > 0">
             <div class="classification">
               <div
                 v-for="item in classifySelectList"
@@ -258,18 +258,12 @@
                       <el-icon v-else-if="activeClassify == 'video'" size="30"
                         ><VideoCamera
                       /></el-icon>
-                      <el-icon
-                        v-else-if="activeClassify == 'other' && item.fileType == 'PDF'"
-                        size="30"
-                        ><Files
-                      /></el-icon>
-                      <el-icon
-                        v-else-if="activeClassify == 'other' && item.fileType == ''"
-                        size="30"
+                      <el-icon v-else-if="activeClassify == 'other'" size="30"><Files /></el-icon>
+                      <el-icon v-else-if="activeClassify == 'exercises'" size="30"
                         ><Tickets
                       /></el-icon>
                     </div>
-                    <div class="rName" v-html="item.resourceName"></div>
+                    <div class="rName" :title="item.resourceName">{{ item.resourceName }}</div>
                   </div>
                 </el-col>
               </el-row>
@@ -292,15 +286,16 @@
           <div class="list-box">
             <div class="screenshot" v-if="screenshotList.length > 0">
               <div v-for="(item, index) in screenshotList" :key="item" class="captureItem">
-                <div class="imgBox">
-                  <img
-                    :src="item.imgUrl"
-                    class="capture"
-                    mode="aspectFill"
-                    @click="getCapture(item)"
-                  />
-                  <div class="deleteBox hover" @click="deleteScreenshot(item, 'capture')">
-                    <img :src="shanchu" />
+                <div class="imgBox" @mouseover="showDelete = index" @mouseleave="showDelete = null">
+                  <img :src="item.imgUrl" class="capture hover" mode="aspectFill" />
+                  <div class="deleteBox" v-if="showDelete == index">
+                    <div class="delImg">
+                      <el-icon @click="getCapture(item, index)" size="18" class="icon hover"
+                        ><View
+                      /></el-icon>
+                      <img :src="bianji" class="icon hover" @click="updateScreenshot(item)" />
+                      <img :src="shanchu" class="icon hover" @click="deleteScreenshot(item)" />
+                    </div>
                   </div>
                 </div>
                 <div class="captureName" :title="item.name">{{ item.name }}</div>
@@ -312,9 +307,17 @@
           </div>
         </div>
         <!-- 鏍囩 -->
-        <div class="" v-if="activeMenu == '鏍囩'">
+        <div class="" v-if="activeMenu == '涔︾'">
           <div class="list-box">
-            <div>
+            <div v-if="reMarkList.length > 0">
+              <div v-for="(item, index) in reMarkList" :key="index" class="reMarkItem">
+                <div class="reMarkCon">{{ item.chapterName }} 绗瑊{ item.page }}椤�</div>
+                <div class="deleteReMarkImg">
+                  <img :src="shanchu" class="icon hover" @click="deleteReMark(item)" />
+                </div>
+              </div>
+            </div>
+            <div v-else>
               <el-empty :image-size="60" description="鏆傛棤鏁版嵁" />
             </div>
           </div>
@@ -334,8 +337,8 @@
             <div class="">宸蹭笂璇撅細{{ headerData.classTime }}</div> -->
           </div>
           <div class="progress">
-            <div class="bookName">{{ bookName }}</div>
-            <div v-if="headerData.totlePage && bookName">
+            <div class="bookName">{{ bookConfig.bookName }}</div>
+            <div v-if="headerData.totlePage && bookConfig.bookName">
               {{ headerData.process }}/{{ headerData.totlePage }}
             </div>
           </div>
@@ -445,10 +448,10 @@
             placement="right"
             width="120"
             trigger="click"
-            v-if="floatingToolData.activeToolData == '鏍囨敞'"
+            v-if="floatingToolData.activeToolData == '鏍囪'"
           >
             <div class="popinnerBox">
-              <div class="label" v-if="floatingToolData.activeToolData == '鏍囨敞'">
+              <div class="label" v-if="floatingToolData.activeToolData == '鏍囪'">
                 <div class="labelItem hover" @click="labelShow('hide')">
                   <img :src="hide" />
                   <div>闅愯棌</div>
@@ -482,7 +485,6 @@
                 : 'floatToolItem'
             "
             v-else
-            @click="floatItemHandle(item)"
           >
             <img
               :src="floatingToolData.activeToolData == item.name ? item.activeIcon : item.icon"
@@ -560,7 +562,7 @@
               </div>
             </div>
             <template #reference>
-              <div class="floatToolItem" @click="toolSelectHandle('huabi')">
+              <div class="floatToolItem hover" @click="toolSelectHandle('huabi')">
                 <div class="imgBox">
                   <img :src="huabi2" alt="" />
                 </div>
@@ -573,31 +575,37 @@
               <div class="lineStyle">
                 <div class="lineTypeBox">
                   <div
-                    :class="toolSelectData.fontSizeActive == '14' ? 'typeItem lineTypeActive' : 'typeItem'"
+                    :class="
+                      toolSelectData.fontSizeActive == '14' ? 'typeItem lineTypeActive' : 'typeItem'
+                    "
                     @click="selectfontSize('14')"
                   >
                     灏�
                     <div class="activeIcon" v-if="toolSelectData.fontSizeActive == '14'">
-                        <img :src="xuanzhong" />
-                      </div>
+                      <img :src="xuanzhong" />
+                    </div>
                   </div>
                   <div
-                    :class="toolSelectData.fontSizeActive == '16' ? 'typeItem lineTypeActive' : 'typeItem'"
+                    :class="
+                      toolSelectData.fontSizeActive == '16' ? 'typeItem lineTypeActive' : 'typeItem'
+                    "
                     @click="selectfontSize('16')"
                   >
                     涓�
                     <div class="activeIcon" v-if="toolSelectData.fontSizeActive == '16'">
-                        <img :src="xuanzhong" />
-                      </div>
+                      <img :src="xuanzhong" />
+                    </div>
                   </div>
                   <div
-                    :class="toolSelectData.fontSizeActive == '18' ? 'typeItem lineTypeActive' : 'typeItem'"
+                    :class="
+                      toolSelectData.fontSizeActive == '18' ? 'typeItem lineTypeActive' : 'typeItem'
+                    "
                     @click="selectfontSize('18')"
                   >
                     澶�
                     <div class="activeIcon" v-if="toolSelectData.fontSizeActive == '18'">
-                        <img :src="xuanzhong" />
-                      </div>
+                      <img :src="xuanzhong" />
+                    </div>
                   </div>
                 </div>
                 <div class="lineStyle">
@@ -617,7 +625,7 @@
               </div>
             </div>
             <template #reference>
-              <div class="floatToolItem" @click="toolSelectHandle('wenzi')">
+              <div class="floatToolItem hover" @click="toolSelectHandle('wenzi')">
                 <div class="imgBox">
                   <img :src="wenzi2" alt="" />
                 </div>
@@ -629,8 +637,18 @@
             <div class="popinnerBox">
               <div class="graphBox">
                 <div class="graphSelect">
-
-                 
+                  <div class="flex1">
+                    <div class="square hover" @click="graphSelect('square')"></div>
+                  </div>
+                  <div class="flex1">
+                    <div class="rotundity hover" @click="graphSelect('rotundity')"></div>
+                  </div>
+                  <div class="flex1">
+                    <div class="triangle hover" @click="graphSelect('triangle')"></div>
+                  </div>
+                  <div class="flex1">
+                    <div class="lineSegment hover" @click="graphSelect('lineSegment')">/</div>
+                  </div>
                 </div>
                 <div class="lineStyle">
                   <div class="colorSelectBox">
@@ -649,7 +667,7 @@
               </div>
             </div>
             <template #reference>
-              <div class="floatToolItem" @click="toolSelectHandle('tuxing')">
+              <div class="floatToolItem hover" @click="toolSelectHandle('tuxing')">
                 <div class="imgBox">
                   <img :src="tuxing" alt="" />
                 </div>
@@ -657,31 +675,31 @@
               </div>
             </template>
           </el-popover>
-          <div class="floatToolItem" @click="toolSelectHandle('xiangpi')">
+          <!-- <div class="floatToolItem" @click="toolSelectHandle('xiangpi')">
             <div class="imgBox">
               <img :src="clear" alt="" />
             </div>
             <div class="text">姗$毊鎿�</div>
-          </div>
-          <div class="floatToolItem" @click="toolSelectHandle('chexiao')">
+          </div> -->
+          <div class="floatToolItem hover" @click="toolSelectHandle('chexiao')">
             <div class="imgBox">
               <img :src="clearPrevious" alt="" />
             </div>
             <div class="text">鎾ら攢</div>
           </div>
-          <div class="floatToolItem" @click="toolSelectHandle('chongzuo')">
+          <!-- <div class="floatToolItem" @click="toolSelectHandle('chongzuo')">
             <div class="imgBox">
               <img :src="chongzuo" alt="" />
             </div>
             <div class="text">閲嶅仛</div>
-          </div>
-          <div class="floatToolItem" @click="toolSelectHandle('qingchu')">
+          </div> -->
+          <div class="floatToolItem hover" @click="toolSelectHandle('qingchu')">
             <div class="imgBox">
               <img :src="qingchu2" alt="" />
             </div>
             <div class="text">娓呴櫎</div>
           </div>
-          <div class="floatToolItem layOutTool" @click="toolSelectHandle('tuichu')">
+          <div class="floatToolItem layOutTool hover" @click="toolSelectHandle('tuichu')">
             <div class="imgBox">
               <img :src="tuichu" alt="" />
             </div>
@@ -741,6 +759,14 @@
       <vue-office-docx :src="testWord" />
     </div>
   </el-dialog>
+  <!-- 鍥剧墖 -->
+  <el-image-viewer
+    v-if="confirmDialog"
+    :zoom-rate="1.2"
+    @close="closePreview"
+    :initial-index="previewIndex"
+    :url-list="imgPreviewList"
+  />
   <el-dialog
     title="娣诲姞绗旇"
     align-center
@@ -777,18 +803,6 @@
     </template>
   </el-dialog>
   <el-dialog
-    align-center
-    v-model="confirmDialog"
-    width="60%"
-    :closeOnClickModal="false"
-    title="鍥剧墖"
-    class="resourDialog"
-  >
-    <div class="imgUrlBox">
-      <img :src="imgUrl" mode="aspectFill" />
-    </div>
-  </el-dialog>
-  <el-dialog
     title="淇濆瓨鎴浘"
     align-center
     v-model="screenshotVisble"
@@ -808,12 +822,12 @@
       </span>
     </template>
   </el-dialog>
-  <el-dialog title="鐧惧害鐧剧" align-center v-model="baiduVisible" width="60%" class="myDialogs">
+  <el-dialog title="鐧惧害鐧剧" align-center v-model="baiduVisible" width="80%" class="baiduDialog">
     <div class="wendabox">
       <iframe :src="'https://baike.baidu.com/item/' + dialogToolData.txt" frameborder="0"></iframe>
     </div>
   </el-dialog>
-  <el-dialog title="AI鏅鸿兘闂瓟" align-center v-model="wendaVisible" width="26%" class="myDialogs">
+  <el-dialog title="AI鏅鸿兘闂瓟" align-center v-model="wendaVisible" width="60%" class="myDialogs">
     <div class="wendabox">
       <iframe src="https://yiyan.baidu.com/" frameborder="0"></iframe>
     </div>
@@ -828,7 +842,7 @@
     title="GGB鍑芥暟宸ュ叿"
     align-center
     v-model="functionVisible"
-    width="60%"
+    width="80%"
     class="myDialogs"
   >
     <div class="wendabox">
@@ -849,7 +863,7 @@
 
 <script setup lang="ts">
 import { ref, reactive, watch, onMounted, onBeforeMount, inject } from 'vue'
-import { ctxUrl, resourceUrl, requestCtx } from '@/assets/js/config'
+import { ctxUrl } from '@/assets/js/config'
 import { useRouter, useRoute } from 'vue-router'
 import useClipboard from 'vue-clipboard3'
 const { toClipboard } = useClipboard()
@@ -966,12 +980,9 @@
 )
 const brushBoxLeft = ref(500)
 let microApp = null // 寰簲鐢ㄥ疄渚�
-const bookName = ref('')
-const bookId = ref(1)
+const bookConfig = ref({})
 const activeCatalog = ref()
 onMounted(() => {
-  getCatalogueData()
-  getResourceData()
   setTimeout(() => {
     canvasWith.value = document.querySelector('.content-box').offsetWidth
     canvasheight.value = document.querySelector('.content-box').offsetHeight
@@ -999,8 +1010,6 @@
 
   window.qiankunActions.onGlobalStateChange((state, prev) => {
     console.log('鐖跺眰state鍙樺寲', state)
-    bookName.value = state.bookName
-    bookId.value = state.bookId
     window.qiankunState = state
   })
 
@@ -1021,18 +1030,21 @@
         lineDelete.left = data.x
       }
     },
+    getBookConfig: (data) => {
+      console.log(data, '鍥句功閰嶇疆')
+      bookConfig.value = data.bookConfig
+      getCatalogueData()
+      getResourceData()
+      getTextbookComponents()
+    },
     catalogChange: (data) => {
       activeCatalog.value = data.showCatalogList
       getSignData()
       console.log(data, '绔犺妭鍒囨崲锛氱洰鍓嶆樉绀虹殑涓変釜绔犺妭')
     },
     pageChange: (data) => {
-      // {
-      //   page: 100,
-      //   catalog: 5,
-      //   catalogId: "",
-      //   catalogName: "",
-      // }
+      headerData.process = Number(data.page)
+      currentChapter.value = data.catalog
       console.log(data, '椤甸潰鍒囨崲锛氱洰鍓嶆樉绀洪〉闈㈠拰瀵瑰簲鐨勭珷鑺備俊鎭�')
     }
   })
@@ -1053,28 +1065,20 @@
     }
   }
 )
-watch(
-  () => bookId.value,
-  (val) => {
-    getNotesList() // 鑾峰彇鑿滃崟绗旇
-    // getlineHeightList() //鑾峰彇楂樹寒
-    // getScribeList() //鑾峰彇鍒掔嚎
-    getScreenshotList() //鎴浘
-  }
-)
+//鑾峰彇褰撳墠涔︾睄鎵�闇�缁勪欢
+const getTextbookComponents = () => {}
+
 //鑾峰彇鐩綍
 const catalogueData = ref([])
 const getCatalogueData = () => {
   axios
-    .get(resourceUrl + '/1/information.json?t=123')
+    .get(bookConfig.value.resourceUrl + '/1/information.json')
     .then(function (response) {
       console.log(response.data, '鐩綍')
       var json = response.data
       // 澶勭悊鑾峰彇鍒扮殑json鏁版嵁
-
       catalogueData.value = json.data
       headerData.totlePage = json.data[json.data.length - 1].end
-      console.log(json[json.length - 1])
     })
     .catch(function (error) {
       console.log(error)
@@ -1099,64 +1103,202 @@
 
 //鑾峰彇璧勬簮
 //璧勬簮鍒嗙被
-const classifySelectList = reactive([
-  {
-    title: '鍥剧墖',
-    count: 0,
-    key: 'image'
-  },
-  {
-    title: '闊抽',
-    count: 0,
-    key: 'audio'
-  },
-  {
-    title: '瑙嗛',
-    count: 0,
-    key: 'video'
-  },
-  {
-    title: '鍏朵粬',
-    count: 0,
-    key: 'other'
-  }
-])
-const activeClassify = ref('image')
+const classifySelectList = ref()
+//璧勬簮绫诲瀷
+const resourceType = ref('default') //榛樿/鏁欏笀
+const activeClassify = ref('')
 const searchShow = ref(true)
-const resourceData = ref({})
+const defaultResourceList = ref([])
+const teacherResourceList = ref([])
 const resourceDataList = ref([])
-const resourceImgList = ref([])
-const resourceVideoList = ref([])
-const resourceAudioList = ref([])
-const resourceDocList = ref([])
 const resourVisble = ref(false)
-const resourType = ref('')
+const resourType = ref('') //璧勬簮绫诲瀷鍥剧墖/闊抽
 const testVideo = ref('') //瑙嗛閾炬帴
 const testWord = ref('') //word閾炬帴
+
 const getResourceData = () => {
   axios
-    .get(resourceUrl + '/1/resource.json')
+    .get(bookConfig.value.resourceUrl + '/1/resource.json?t=12')
     .then(function (response) {
       var json = response.data
       // 澶勭悊鑾峰彇鍒扮殑json鏁版嵁
       if (json.length > 0) {
+        defaultResourceList.value = []
+        teacherResourceList.value = []
+        // 鑾峰彇鏁扮粍涓墍鏈夊璞$殑age灞炴�х殑鏁伴噺
         json.forEach((item) => {
-          if (item.fileType == '鍥剧墖') {
-            resourceImgList.value.push(item)
-          } else if (item.fileType == '瑙嗛') {
-            resourceVideoList.value.push(item)
-          } else if (item.fileType == '闊抽') {
-            resourceAudioList.value.push(item)
+          if (resourceType.value == 'default') {
+            if (item.isTeacherResource == '鍚�') {
+              defaultResourceList.value.push(item)
+            }
           } else {
-            resourceDocList.value.push(item)
+            if (item.isTeacherResource == '鏄�') {
+              teacherResourceList.value.push(item)
+            }
           }
         })
+        if (defaultResourceList.value.length > 0) {
+          let imgCount = 0
+          let audioCount = 0
+          let videoCount = 0
+          let exercisesCount = 0
+          let otherCount = 0
+          resourceDataList.value = []
+          defaultResourceList.value.forEach((resItem) => {
+            if (resItem.resourceType == '鍥剧墖') {
+              if (activeClassify.value == 'image') {
+                resourceDataList.value.push(resItem)
+              }
+              imgCount++
+            } else if (resItem.resourceType == '闊抽') {
+              if (activeClassify.value == 'audio') {
+                resourceDataList.value.push(resItem)
+              }
+              resourceDataList.value.push(resItem)
+              audioCount++
+            } else if (resItem.resourceType == '瑙嗛') {
+              if (activeClassify.value == 'video') {
+                resourceDataList.value.push(resItem)
+              }
+              videoCount++
+            } else if (resItem.resourceType == '涔犻') {
+              if (activeClassify.value == 'exercises') {
+                resourceDataList.value.push(resItem)
+              }
+              exercisesCount++
+            } else {
+              if (activeClassify.value == 'other') {
+                resourceDataList.value.push(resItem)
+              }
+              otherCount++
+            }
+          })
+          classifySelectList.value = []
+          if (imgCount > 0) {
+            classifySelectList.value.push({
+              title: '鍥剧墖',
+              count: imgCount,
+              key: 'image'
+            })
+          }
+          if (audioCount > 0) {
+            classifySelectList.value.push({
+              title: '闊抽',
+              count: audioCount,
+              key: 'audio'
+            })
+          }
+          if (videoCount > 0) {
+            classifySelectList.value.push({
+              title: '瑙嗛',
+              count: videoCount,
+              key: 'video'
+            })
+          }
+          if (exercisesCount > 0) {
+            classifySelectList.value.push({
+              title: '涔犻',
+              count: exercisesCount,
+              key: 'exercises'
+            })
+          }
+          if (otherCount > 0) {
+            classifySelectList.value.push({
+              title: '鍏朵粬',
+              count: otherCount,
+              key: 'other'
+            })
+          }
+          if (!activeClassify.value) {
+            activeClassify.value = classifySelectList.value[0].key
+            defaultResourceList.value.forEach((resItem1) => {
+              if (resItem1.resourceType == classifySelectList.value[0].title) {
+                resourceDataList.value.push(resItem1)
+              }
+            })
+          }
+        } else {
+          let imgCount = 0
+          let audioCount = 0
+          let videoCount = 0
+          let exercisesCount = 0
+          let otherCount = 0
+          resourceDataList.value = []
+          teacherResourceList.value.forEach((resItem) => {
+            if (resItem.resourceType == '鍥剧墖') {
+              if (activeClassify.value == 'image') {
+                resourceDataList.value.push(resItem)
+              }
+              imgCount++
+            } else if (resItem.resourceType == '闊抽') {
+              if (activeClassify.value == 'audio') {
+                resourceDataList.value.push(resItem)
+              }
+              resourceDataList.value.push(resItem)
+              audioCount++
+            } else if (resItem.resourceType == '瑙嗛') {
+              if (activeClassify.value == 'video') {
+                resourceDataList.value.push(resItem)
+              }
+              videoCount++
+            } else if (resItem.resourceType == '涔犻') {
+              if (activeClassify.value == 'exercises') {
+                resourceDataList.value.push(resItem)
+              }
+              exercisesCount++
+            } else {
+              if (activeClassify.value == 'other') {
+                resourceDataList.value.push(resItem)
+              }
+              otherCount++
+            }
+          })
+          classifySelectList.value = []
+          if (imgCount > 0) {
+            classifySelectList.value.push({
+              title: '鍥剧墖',
+              count: imgCount,
+              key: 'image'
+            })
+          }
+          if (audioCount > 0) {
+            classifySelectList.value.push({
+              title: '闊抽',
+              count: audioCount,
+              key: 'audio'
+            })
+          }
+          if (videoCount > 0) {
+            classifySelectList.value.push({
+              title: '瑙嗛',
+              count: videoCount,
+              key: 'video'
+            })
+          }
+          if (exercisesCount > 0) {
+            classifySelectList.value.push({
+              title: '涔犻',
+              count: exercisesCount,
+              key: 'exercises'
+            })
+          }
+          if (otherCount > 0) {
+            classifySelectList.value.push({
+              title: '鍏朵粬',
+              count: otherCount,
+              key: 'other'
+            })
+          }
+          if (!activeClassify.value) {
+            activeClassify.value = classifySelectList.value[0].key
+            teacherResourceList.value.forEach((resItem1) => {
+              if (resItem1.resourceType == classifySelectList.value[0].title) {
+                resourceDataList.value.push(resItem1)
+              }
+            })
+          }
+        }
       }
-      resourceDataList.value = resourceImgList.value
-      classifySelectList[0].count = resourceImgList.value.length
-      classifySelectList[1].count = resourceAudioList.value.length
-      classifySelectList[2].count = resourceVideoList.value.length
-      classifySelectList[3].count = resourceDocList.value.length
     })
     .catch(function (error) {
       console.log(error)
@@ -1164,37 +1306,32 @@
 }
 
 const goResourceDetail = (data) => {
-  resourType.value = data.fileType
-  if (data.fileType == '瑙嗛') {
+  console.log(data)
+  resourType.value = data.resourceType
+  if (data.resourceType == '瑙嗛') {
     resourVisble.value = true
-    testVideo.value = requestCtx + '/file/api/ApiDownload?md5=' + data.md5
-  } else if (data.fileType == 'PDF') {
-    window.open(requestCtx + '/file/api/ApiDownload?md5=' + data.md5)
-    // testWord.value = resourceUrl + '/resourceData/' + data.name
+    testVideo.value = bookConfig.value.requestCtx + '/file/api/ApiDownload?md5=' + data.md5
+  } else if (data.resourceType == 'word') {
+    testWord.value = bookConfig.value.resourceUrl + '/resourceData/' + data.name
+  } else {
+    if (window.qiankunState && window.qiankunState.gotoPage) {
+      window.qiankunState.gotoPage(Number(data.chapterNum), Number(data.pagination))
+    }
   }
 }
 
+//璧勬簮绫诲瀷閫夋嫨榛樿/鏁欏笀
+const selectResourceType = (type) => {
+  resourceType.value = type
+  searchText.value = ''
+  getResourceData()
+}
+//璧勬簮绫诲瀷鍥剧墖/瑙嗛/闊抽/涔犻/鍏朵粬
 const classifyClick = (item) => {
   activeClassify.value = item.key
   resourceDataList.value = []
   searchText.value = ''
-  switch (item.key) {
-    case 'image':
-      resourceDataList.value = resourceImgList.value
-      break
-    case 'audio':
-      resourceDataList.value = resourceAudioList.value
-      break
-    case 'video':
-      resourceDataList.value = resourceVideoList.value
-      break
-    case 'other':
-      resourceDataList.value = resourceDocList.value
-      break
-  }
-  resourceDataList.value.forEach((item) => {
-    item.resourceName = '<p>' + htmlStr + '</p>'
-  })
+  getResourceData()
 }
 const searchBtn = () => {
   if (searchShow.value) {
@@ -1232,8 +1369,7 @@
 ])
 // 閫変腑鑿滃崟
 const activeMenu = ref('鐩綍')
-//璧勬簮绫诲瀷
-const resourceType = ref('default')
+
 // 鑿滃崟鐐瑰嚮
 const menuItemClick = (name) => {
   activeMenu.value = name
@@ -1250,9 +1386,10 @@
     case '鐭ヨ瘑鍥捐氨':
       break
     case '鎴浘':
-    getScreenshotList()
+      getScreenshotList()
       break
     case '涔︾':
+      getReMarkList()
       break
   }
 }
@@ -1272,16 +1409,6 @@
   // }
 }
 
-const selectResourceType = (type) => {
-  resourceType.value = type
-  if (resourceType.value == 'teacher') {
-    activeClassify.value = 'image'
-    resourceDataList.value = []
-  } else {
-    activeClassify.value = 'image'
-    resourceDataList.value = resourceImgList.value
-  }
-}
 const searchText = ref<string>('') //绛涢��
 const menuState = reactive({
   open: true,
@@ -1362,31 +1489,11 @@
         let text = searchText.value.replace(/^\s*|\s*$/g, '')
         dataList.forEach((item) => {
           if (item.resourceName.indexOf(text) > -1) {
-            let replaceStr = "<span style='background:#F5E12A'>" + text + '</span>'
-            let htmlStr = item.resourceName.split(text).join(replaceStr)
-            item.resourceName = '<p>' + htmlStr + '</p>'
             resourceDataList.value.push(item)
           }
         })
       } else {
-        resourceDataList.value = []
-        switch (activeClassify.value) {
-          case 'image':
-            resourceDataList.value = resourceImgList.value
-            break
-          case 'audio':
-            resourceDataList.value = resourceAudioList.value
-            break
-          case 'video':
-            resourceDataList.value = resourceVideoList.value
-            break
-          case 'other':
-            resourceDataList.value = resourceDocList.value
-            break
-        }
-        resourceDataList.value.forEach((item) => {
-          item.resourceName = '<p>' + htmlStr + '</p>'
-        })
+        getResourceData()
       }
       break
     case '鐭ヨ瘑鍥捐氨':
@@ -1395,6 +1502,7 @@
       getScreenshotList()
       break
     case '涔︾':
+      getReMarkList()
       break
   }
 }
@@ -1517,7 +1625,7 @@
   {
     activeIcon: biaozhu1,
     icon: biaozhu,
-    name: '鏍囨敞'
+    name: '鏍囪'
   },
   {
     activeIcon: biaoqian1,
@@ -1536,11 +1644,7 @@
   elLeft: 400,
   elTop: 300,
   startclientx: 0,
-  startclienty: 0,
-  fontSizeActive: '16',
-  thicknessActive: '3', //鐢荤瑪閫変腑绮楃粏
-  lineTypeActive: 'solid', //鐢荤瑪閫変腑绾跨被鍨�
-  lineColorActive: '#333' //鐢荤瑪閫変腑绾块鑹�
+  startclienty: 0
 })
 
 //鐢诲竷
@@ -1597,6 +1701,11 @@
 const urlData = ref('') //鎴浘base64
 const screenshotList = ref([])
 const screenshotData = ref([])
+const imgPreviewList = ref([])
+const previewIndex = ref(0)
+const showDelete = ref(null)
+const isUpdateImg = ref(false)
+const screenshotId = ref(0)
 
 //娴獥宸ュ叿鏍忕偣鍑讳簨浠�
 const floatItemHandle = (item) => {
@@ -1607,7 +1716,7 @@
       canvasShow.value = true
       toolSelectData.activeTool = 'huabi'
       break
-    case '鏍囨敞':
+    case '鏍囪':
       break
     case '涔︾':
       reMark()
@@ -1632,13 +1741,15 @@
 //鐢荤瑪鎿嶄綔鏍忎簨浠�
 const toolSelectData = reactive({
   activeTool: '',
-  fontSizeActive: '16',
+  fontSizeActive: '16', // 鏂囧瓧鎿嶄綔鏂囧瓧澶у皬
   thicknessActive: '3', //鐢荤瑪閫変腑绮楃粏
   lineTypeActive: 'solid', //鐢荤瑪閫変腑绾跨被鍨�
-  lineColorActive: '#333' //鐢荤瑪閫変腑绾块鑹�
+  lineColorActive: '#333', //鐢荤瑪閫変腑绾块鑹�
+  graphType: '' //鍥惧舰绫诲瀷锛屾柟褰紝鍦嗗舰...
 })
 const toolSelectHandle = (title) => {
   toolSelectData.activeTool = title
+  toolSelectData.lineColorActive = ''
   switch (title) {
     case 'huabi':
       init()
@@ -1685,11 +1796,117 @@
   toolSelectData.fontSizeActive = str
 }
 
-//鏍囨敞鏄剧ず闅愯棌
-const labelShow = (str) => {}
+//閫夋嫨鍥惧舰
+const graphSelect = (type) => {
+  toolSelectData.graphType = type
+  switch (type) {
+    case 'square':
+      break
+    case 'rotundity':
+      break
+    case 'triangle':
+      break
+    case 'lineSegment':
+      break
+  }
+}
+//鏍囪鏄剧ず闅愯棌
+const labelShow = (str) => {
+  console.log(str, '鏍囪')
+  if (str == 'hide') {
+    if (window.qiankunState && window.qiankunState.delSign) {
+      window.qiankunState.delSign({ ids: [] })
+    }
+  }
+}
 
 //涔︾
-const reMark = () => {}
+const currentChapter = ref(0)
+const reMarkList = ref([])
+const reMarkData = ref([])
+const reMarkId = ref([])
+
+const reMark = () => {
+  let chapterData = catalogueData.value.find((item) => item.chapter == Number(currentChapter.value))
+  console.log(chapterData)
+  reMarkData.value.push({
+    id: toolClass.uuid(8),
+    createDate: new Date(),
+    page: headerData.process,
+    chapterNum: currentChapter.value,
+    chapterName: chapterData.label
+  })
+  request({
+    url: '/identity/api/ApiAppUserSetKey',
+    method: 'post',
+    data: {
+      setKeyRequests: [
+        {
+          domain: 'reMark',
+          key: bookConfig.value.bookId,
+          value: JSON.stringify(reMarkData.value)
+        }
+      ]
+    }
+  })
+    .then((res) => {
+      floatingToolData.activeToolData = ''
+      getReMarkList()
+    })
+    .catch(function (error) {})
+}
+const getReMarkList = () => {
+  reMarkList.value = []
+  reMarkData.value = []
+  request({
+    url: '/identity/api/ApiGetAppUserKey',
+    method: 'post',
+    data: {
+      domain: 'reMark',
+      keys: [bookConfig.value.bookId]
+    }
+  }).then((res) => {
+    if (res && res.length > 0 && res[0].value) {
+      reMarkData.value = JSON.parse(res[0].value)
+      let list = JSON.parse(res[0].value)
+      list.forEach((item) => {
+        let text = searchText.value.replace(/^\s*|\s*$/g, '')
+        if (searchText.value) {
+          if (item.name.indexOf(text) > -1) {
+            reMarkList.value.push(item)
+          }
+        } else {
+          reMarkList.value.push(item)
+        }
+      })
+      console.log(reMarkList.value, '124')
+    }
+  })
+}
+//鍒犻櫎涔︾
+const deleteReMark = (item) => {
+  let list = reMarkList.value.filter((itemData) => itemData.id !== item.id)
+  request({
+    url: '/identity/api/ApiAppUserSetKey',
+    method: 'post',
+    data: {
+      setKeyRequests: [
+        {
+          domain: 'reMark',
+          key: bookConfig.value.bookId,
+          value: JSON.stringify(list)
+        }
+      ]
+    }
+  }).then((res) => {
+    ElMessage({
+      message: '鍒犻櫎涔︾鎴愬姛!',
+      type: 'success'
+    })
+    getReMarkList()
+  })
+}
+
 //鎴浘
 //鎴浘浜嬩欢
 function jitT() {
@@ -1703,6 +1920,7 @@
 //纭鍥炶皟
 const callback = (val: any) => {
   screenshotVisble.value = true
+  nameData.value = moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
   urlData.value = val.base64
 }
 //鍙栨秷鍥炶皟
@@ -1713,11 +1931,23 @@
 //淇濆瓨鎴浘
 const addScreenshot = () => {
   if (nameData.value) {
-    screenshotData.value.push({
-      createDate: new Date(),
-      imgUrl: urlData.value,
-      name: nameData.value
-    })
+    if (isUpdateImg.value) {
+      screenshotData.value = []
+      screenshotList.value.forEach((itemNote) => {
+        if ((itemNote.id = screenshotId.value)) {
+          itemNote.name = nameData.value
+        }
+      })
+      screenshotData.value = screenshotList.value
+    } else {
+      screenshotData.value.push({
+        id: toolClass.uuid(8),
+        createDate: new Date(),
+        imgUrl: urlData.value,
+        name: nameData.value
+      })
+    }
+
     screenshotLoading.value = true
     request({
       url: '/identity/api/ApiAppUserSetKey',
@@ -1726,7 +1956,7 @@
         setKeyRequests: [
           {
             domain: 'screenshot',
-            key: bookId.value,
+            key: bookConfig.value.bookId,
             value: JSON.stringify(screenshotData.value)
           }
         ]
@@ -1739,6 +1969,7 @@
         urlData.value = ''
         floatingToolData.activeToolData = ''
         screenshotVisble.value = false
+        isUpdateImg.value = false
       })
       .catch(function (error) {
         screenshotLoading.value = false
@@ -1752,16 +1983,17 @@
 }
 
 const getScreenshotList = () => {
+  screenshotData.value = []
+  screenshotList.value = []
   request({
     url: '/identity/api/ApiGetAppUserKey',
     method: 'post',
     data: {
       domain: 'screenshot',
-      keys: [bookId.value]
+      keys: [bookConfig.value.bookId]
     }
   }).then((res) => {
     if (res && res.length > 0 && res[0].value) {
-      screenshotList.value =[]
       screenshotData.value = JSON.parse(res[0].value)
       let list = JSON.parse(res[0].value)
       list.forEach((item) => {
@@ -1769,42 +2001,65 @@
         if (searchText.value) {
           if (item.name.indexOf(text) > -1) {
             screenshotList.value.push(item)
+            imgPreviewList.value.push(item.imgUrl)
           }
         } else {
           screenshotList.value.push(item)
+          imgPreviewList.value.push(item.imgUrl)
         }
       })
-      console.log(screenshotList.value,"124")
     }
   })
 }
 //鏌ョ湅鎴浘
-const getCapture = (item) => {
+const getCapture = (item, index) => {
   imgUrl.value = item.imgUrl
+  previewIndex.value = index
   confirmDialog.value = true
 }
+const closePreview = () => {
+  imgPreviewList.value = []
+  confirmDialog.value = false
+}
+// 缂栬緫鎴浘鍚嶇О
+const updateScreenshot = (item) => {
+  nameData.value = item.name
+  screenshotId.value = item.id
+  isUpdateImg.value = true
+  screenshotVisble.value = true
+}
+
 //鍒犻櫎鎴浘
 const deleteScreenshot = (item) => {
-  let list = screenshotList.value.filter((itemData) => itemData.imgUrl !== item.imgUrl)
-  request({
-    url: '/identity/api/ApiAppUserSetKey',
-    method: 'post',
-    data: {
-      setKeyRequests: [
-        {
-          domain: 'screenshot',
-          key: bookId.value,
-          value: JSON.stringify(list)
-        }
-      ]
-    }
-  }).then((res) => {
-    ElMessage({
-      message: '鍒犻櫎鎴浘鎴愬姛!',
-      type: 'success'
-    })
-    getScreenshotList()
+  let list = screenshotList.value.filter((itemData) => itemData.id !== item.id)
+  ElMessageBox.confirm('纭畾瑕佸垹闄ゆ鎴浘鍚楋紵', {
+    confirmButtonText: '纭畾',
+    cancelButtonText: '鍙栨秷',
+    autofocus: false,
+    type: 'warning'
   })
+    .then(() => {
+      request({
+        url: '/identity/api/ApiAppUserSetKey',
+        method: 'post',
+        data: {
+          setKeyRequests: [
+            {
+              domain: 'screenshot',
+              key: bookConfig.value.bookId,
+              value: JSON.stringify(list)
+            }
+          ]
+        }
+      }).then((res) => {
+        ElMessage({
+          message: '鍒犻櫎鎴浘鎴愬姛!',
+          type: 'success'
+        })
+        getScreenshotList()
+      })
+    })
+    .catch(() => {})
 }
 
 //閫変腑鏂囧瓧宸ュ叿鏍�
@@ -1823,6 +2078,7 @@
 ///鍐呭閫変腑
 const getSelection = (data) => {
   if (data.txt) {
+    toolActive.value = ''
     dialogToolData.txt = data.txt
     dialogToolData.page = data.page
     dialogToolData.chapter = data.chapterNum
@@ -2015,7 +2271,7 @@
   let data = null
   switch (toolActive.value) {
     case '楂樹寒':
-      dom = 'highLightData-' + bookId.value
+      dom = 'highLightData-' + bookConfig.value.bookId
       data = dialogToolData.lineHeight[dialogToolData.chapter]
       if (!data) data = []
       data.push({
@@ -2028,7 +2284,7 @@
       })
       break
     case '鍒掔嚎':
-      dom = 'underline-' + bookId.value
+      dom = 'underline-' + bookConfig.value.bookId
       data = dialogToolData.scribeList[dialogToolData.chapter]
       if (!data) data = []
       data.push({
@@ -2049,7 +2305,7 @@
         ElMessage.error('璇烽�夋嫨绗旇棰滆壊!')
         return
       }
-      dom = 'notes-' + bookId.value
+      dom = 'notes-' + bookConfig.value.bookId
       data = dialogToolData.notesList[dialogToolData.chapter]
       if (!data) data = []
       data.push({
@@ -2093,7 +2349,7 @@
     url: '/identity/api/ApiGetAppUserKey',
     method: 'post',
     data: {
-      domain: 'highLightData-' + bookId.value,
+      domain: 'highLightData-' + bookConfig.value.bookId,
       keys: activeCatalog.value.map((item) => item + '')
     }
   }).then((res) => {
@@ -2116,7 +2372,7 @@
     url: '/identity/api/ApiGetAppUserKey',
     method: 'post',
     data: {
-      domain: 'underline-' + bookId.value,
+      domain: 'underline-' + bookConfig.value.bookId,
       keys: activeCatalog.value.map((item) => item + '')
     }
   }).then((res) => {
@@ -2140,7 +2396,7 @@
     url: '/identity/api/ApiGetAppUserKey',
     method: 'post',
     data: {
-      domain: 'notes-' + bookId.value,
+      domain: 'notes-' + bookConfig.value.bookId,
       keys: activeCatalog.value.map((item) => item + '')
     }
   }).then((res) => {
@@ -2172,7 +2428,7 @@
     url: '/identity/api/ApiGetAppUserKey',
     method: 'post',
     data: {
-      domain: 'notes-' + bookId.value,
+      domain: 'notes-' + bookConfig.value.bookId,
       keys: chapterList
     }
   }).then((res) => {
@@ -2253,11 +2509,11 @@
   let data = null
   switch (type) {
     case 'Highlight':
-      dom = 'highLightData-' + bookId.value
+      dom = 'highLightData-' + bookConfig.value.bookId
       data = dialogToolData.lineHeight
       break
     case 'Dashing':
-      dom = 'underline-' + bookId.value
+      dom = 'underline-' + bookConfig.value.bookId
       data = dialogToolData.scribeList
       break
   }
@@ -2285,8 +2541,9 @@
 //绗旇璺宠浆
 const jumpContent = (item) => {
   console.log(item)
-  if (window.qiankunState && window.qiankunState.gotoPage)
+  if (window.qiankunState && window.qiankunState.gotoPage) {
     window.qiankunState.gotoPage(Number(item.chapterNum), Number(item.page))
+  }
 }
 
 //鑿滃崟绗旇缂栬緫
@@ -2304,6 +2561,7 @@
   data.noteList.forEach((itemNote) => {
     if ((itemNote.id = formData.id)) {
       itemNote.note = formData.desc
+      itemNote.color = noteColorActive.value
     }
   })
   request({
@@ -2312,7 +2570,7 @@
     data: {
       setKeyRequests: [
         {
-          domain: 'notes-' + bookId.value,
+          domain: 'notes-' + bookConfig.value.bookId,
           key: dialogToolData.chapter,
           value: JSON.stringify(data.noteList)
         }
@@ -2331,28 +2589,37 @@
   let data = scribeData.noteList.find((item1) => item1.chapter == Number(item.chapterNum))
   // 绉婚櫎
   let list = data.noteList.filter((itemData) => itemData.id !== item.id)
-  request({
-    url: '/identity/api/ApiAppUserSetKey',
-    method: 'post',
-    data: {
-      setKeyRequests: [
-        {
-          domain: 'notes-' + bookId.value,
-          key: item.chapterNum,
-          value: JSON.stringify(list)
-        }
-      ]
-    }
-  }).then((res) => {
-    ElMessage({
-      message: '鍒犻櫎绗旇鎴愬姛!',
-      type: 'success'
-    })
-    getNotesList()
-    if (window.qiankunState && window.qiankunState.delSign) {
-      window.qiankunState.delSign({ ids: [item.id] })
-    }
+  ElMessageBox.confirm('纭畾瑕佸垹闄ゆ绗旇鍚楋紵', {
+    confirmButtonText: '纭畾',
+    cancelButtonText: '鍙栨秷',
+    autofocus: false,
+    type: 'warning'
   })
+    .then(() => {
+      request({
+        url: '/identity/api/ApiAppUserSetKey',
+        method: 'post',
+        data: {
+          setKeyRequests: [
+            {
+              domain: 'notes-' + bookConfig.value.bookId,
+              key: item.chapterNum,
+              value: JSON.stringify(list)
+            }
+          ]
+        }
+      }).then((res) => {
+        ElMessage({
+          message: '鍒犻櫎绗旇鎴愬姛!',
+          type: 'success'
+        })
+        getNotesList()
+        if (window.qiankunState && window.qiankunState.delSign) {
+          window.qiankunState.delSign({ ids: [item.id] })
+        }
+      })
+    })
+    .catch(() => {})
 }
 
 //鍐呭鍖哄煙椤堕儴鏄剧ず
@@ -2702,14 +2969,7 @@
 
             .rName {
               margin-top: 10px;
-              height: 20px;
               line-height: 20px;
-              display: -webkit-box;
-              -webkit-box-orient: vertical;
-              -webkit-line-clamp: 1;
-              overflow: hidden;
-              text-overflow: ellipsis;
-              color: #000;
             }
           }
         }
@@ -2730,13 +2990,23 @@
             }
             .deleteBox {
               position: absolute;
-              top: 2px;
-              right: 2px;
-              width: 20px;
-              height: 20px;
-              background: rgba(44, 44, 44, 0.3);
+              top: 0;
+              left: 0;
+              width: 100%;
+              height: 100%;
+              background: rgba(44, 44, 44, 0.6);
               text-align: center;
               padding: 2px;
+              .delImg {
+                height: 100%;
+                display: flex;
+                align-items: center;
+                justify-content: center;
+                .icon {
+                  position: static;
+                  margin: 5px;
+                }
+              }
             }
             // .capture {
             //   width: 100%;
@@ -2744,9 +3014,8 @@
             .captureName {
               height: 20px;
               line-height: 20px;
-              display: -webkit-box;
-              -webkit-box-orient: vertical;
-              -webkit-line-clamp: 1;
+              width: 120px;
+              white-space: nowrap;
               overflow: hidden;
               text-overflow: ellipsis;
               color: #000;
@@ -2818,6 +3087,24 @@
         .chapterName {
           margin: 15px;
         }
+        .reMarkItem {
+          margin: 15px;
+          background: #fff;
+          border-radius: 10px;
+          padding: 10px;
+          display: flex;
+          .reMarkCon {
+            width: 240px;
+            white-space: nowrap;
+            overflow: hidden;
+            text-overflow: ellipsis;
+            margin-right: 8px;
+          }
+          .deleteReMarkImg {
+            display: flex;
+            align-items: center;
+          }
+        }
       }
     }
     .menuStateBox {
@@ -2829,9 +3116,10 @@
       position: fixed;
       line-height: 22px;
       top: 50%;
-      left: 370px;
+      left: 395px;
       text-align: center;
       box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.16);
+      z-index: 2;
       img {
         height: 10px;
         width: 18px;
@@ -2976,7 +3264,7 @@
         border: 1px solid #bce3ff;
         position: absolute;
         top: 50%;
-        right: 50px;
+        right: 67px;
         box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.16);
         display: flex;
         align-items: center;
@@ -2988,7 +3276,7 @@
         }
       }
       .right {
-        right: 184px !important;
+        right: 215px !important;
         border-radius: 0px 3px 3px 0px !important;
       }
       .classRoomBox {
@@ -3202,7 +3490,8 @@
 
 .myDialogs,
 .myNoteDialogs,
-.resourDialog {
+.resourDialog,
+.baiduDialog {
   padding: 0 !important;
   border-radius: 10px !important;
   overflow: hidden;
@@ -3240,6 +3529,10 @@
 .screenshotDialog {
   width: 400px !important;
 }
+.baiduDialog {
+  width: 90vw;
+  height: 90vh;
+}
 .noteColorSelectBox {
   margin-top: 10px;
   width: 190px;

--
Gitblit v1.9.1