litian
2024-05-21 480728c3c1b96d94a2053c1e418c173006d4ff68
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">
@@ -91,7 +91,7 @@
      <!-- 菜单内容 -->
      <div class="menuContent" v-if="menuState.open">
        <div class="searchBox">
          <div class="inputBox" v-if="activeMenu !== 2">
          <div class="inputBox" v-if="activeMenu !== '资源'">
            <el-input
              class="custom-input"
              placeholder="请输入内容"
@@ -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,16 +1701,22 @@
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) => {
  floatingToolData.activeToolData = item.name
  canvasShow.value = false
  switch (floatingToolData.activeToolData) {
    case '画笔':
      canvasShow.value = true
      toolSelectData.activeTool = 'huabi'
      break
    case '标注':
    case '标记':
      break
    case '书签':
      reMark()
@@ -1631,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()
@@ -1684,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() {
@@ -1702,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
}
//取消回调
@@ -1712,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',
@@ -1725,7 +1956,7 @@
        setKeyRequests: [
          {
            domain: 'screenshot',
            key: bookId.value,
            key: bookConfig.value.bookId,
            value: JSON.stringify(screenshotData.value)
          }
        ]
@@ -1738,6 +1969,7 @@
        urlData.value = ''
        floatingToolData.activeToolData = ''
        screenshotVisble.value = false
        isUpdateImg.value = false
      })
      .catch(function (error) {
        screenshotLoading.value = false
@@ -1751,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) => {
@@ -1768,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(() => {})
}
//选中文字工具栏
@@ -1822,6 +2078,7 @@
///内容选中
const getSelection = (data) => {
  if (data.txt) {
    toolActive.value = ''
    dialogToolData.txt = data.txt
    dialogToolData.page = data.page
    dialogToolData.chapter = data.chapterNum
@@ -2014,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({
@@ -2027,7 +2284,7 @@
      })
      break
    case '划线':
      dom = 'underline-' + bookId.value
      dom = 'underline-' + bookConfig.value.bookId
      data = dialogToolData.scribeList[dialogToolData.chapter]
      if (!data) data = []
      data.push({
@@ -2048,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({
@@ -2092,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) => {
@@ -2115,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) => {
@@ -2139,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) => {
@@ -2171,7 +2428,7 @@
    url: '/identity/api/ApiGetAppUserKey',
    method: 'post',
    data: {
      domain: 'notes-' + bookId.value,
      domain: 'notes-' + bookConfig.value.bookId,
      keys: chapterList
    }
  }).then((res) => {
@@ -2252,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
  }
@@ -2284,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))
  }
}
//菜单笔记编辑
@@ -2303,6 +2561,7 @@
  data.noteList.forEach((itemNote) => {
    if ((itemNote.id = formData.id)) {
      itemNote.note = formData.desc
      itemNote.color = noteColorActive.value
    }
  })
  request({
@@ -2311,7 +2570,7 @@
    data: {
      setKeyRequests: [
        {
          domain: 'notes-' + bookId.value,
          domain: 'notes-' + bookConfig.value.bookId,
          key: dialogToolData.chapter,
          value: JSON.stringify(data.noteList)
        }
@@ -2330,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(() => {})
}
//内容区域顶部显示
@@ -2701,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;
            }
          }
        }
@@ -2729,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%;
@@ -2743,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;
@@ -2817,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 {
@@ -2828,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;
@@ -2975,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;
@@ -2987,7 +3276,7 @@
        }
      }
      .right {
        right: 184px !important;
        right: 215px !important;
        border-radius: 0px 3px 3px 0px !important;
      }
      .classRoomBox {
@@ -3201,7 +3490,8 @@
.myDialogs,
.myNoteDialogs,
.resourDialog {
.resourDialog,
.baiduDialog {
  padding: 0 !important;
  border-radius: 10px !important;
  overflow: hidden;
@@ -3239,6 +3529,10 @@
.screenshotDialog {
  width: 400px !important;
}
.baiduDialog {
  width: 90vw;
  height: 90vh;
}
.noteColorSelectBox {
  margin-top: 10px;
  width: 190px;