| | |
| | | <div class="contentBox"> |
| | | <!-- 菜单 --> |
| | | <div class="menuBox"> |
| | | <div |
| | | v-for="(item, index) in menuData" |
| | | :key="index" |
| | | @click="menuItemClick(item.name)" |
| | | :class="token ? '' : 'notClick'" |
| | | > |
| | | <div :class="['menuItem', activeMenu == item.name ? 'active' : '']" v-if="item.isShow"> |
| | | <div v-for="(item, index) in menuData" :key="index"> |
| | | <div |
| | | :class="['menuItem', activeMenu == item.name ? 'active' : '']" |
| | | @click="menuItemClick(item.name)" |
| | | v-if="item.isShow" |
| | | > |
| | | <div class="menuIcon imgBox"> |
| | | <img :src="item.icon" /> |
| | | </div> |
| | |
| | | <!-- 菜单内容 --> |
| | | <div class="menuContent" v-if="menuState.open"> |
| | | <div class="searchBox"> |
| | | <div class="inputBox" v-if="activeMenu !== '资源'"> |
| | | <div class="inputBox" v-if="activeMenu !== '资源' && activeMenu !== '题库'"> |
| | | <el-input |
| | | class="custom-input" |
| | | placeholder="请输入内容" |
| | |
| | | @clear="handleClear" |
| | | > |
| | | <template #prefix> |
| | | <img :src="listSearch" @click="searchBook" class="hover"/> |
| | | <img :src="listSearch" @click="searchBook" class="hover" /> |
| | | </template> |
| | | </el-input> |
| | | </div> |
| | | <div v-else class="resourceTab"> |
| | | <div v-if="activeMenu == '资源'" class="resourceTab"> |
| | | <div class="tabItem hover" @click="selectResourceType('default')"> |
| | | <div>默认资源</div> |
| | | <div :class="resourceType == 'default' ? 'text' : 'line'"></div> |
| | |
| | | <div class="tabItem hover" @click="selectResourceType('teacher')"> |
| | | <div>教师资源</div> |
| | | <div :class="resourceType == 'teacher' ? 'text' : 'line'"></div> |
| | | </div> |
| | | </div> |
| | | <div v-if="activeMenu == '题库'" class="resourceTab"> |
| | | <div class="tabItem hover" @click="selectExercisesType('exercises')" v-if="bookConfig.textbookComponents.indexOf('3D3B4F55') > -1"> |
| | | <div>习题</div> |
| | | <div :class="exercisesType == 'exercises' ? 'text' : 'line'"></div> |
| | | </div> |
| | | <hr class="hr" v-if="bookConfig.textbookComponents.indexOf('A4821F71') > -1"/> |
| | | <div class="tabItem hover" @click="selectExercisesType('additional')" v-if="bookConfig.textbookComponents.indexOf('A4821F71') > -1"> |
| | | <div>附加题</div> |
| | | <div :class="exercisesType == 'additional' ? 'text' : 'line'"></div> |
| | | </div> |
| | | <hr class="hr" v-if="bookConfig.textbookComponents.indexOf('AFC1A288') > -1"/> |
| | | <div class="tabItem hover" @click="selectExercisesType('wrong')" v-if="bookConfig.textbookComponents.indexOf('AFC1A288') > -1"> |
| | | <div>错题本</div> |
| | | <div :class="exercisesType == 'wrong' ? 'text' : 'line'"></div> |
| | | </div> |
| | | <hr class="hr" v-if="bookConfig.textbookComponents.indexOf('A434F2C0') > -1"/> |
| | | <div class="tabItem hover" @click="selectExercisesType('collection')" v-if="bookConfig.textbookComponents.indexOf('A434F2C0') > -1"> |
| | | <div>收藏夹</div> |
| | | <div :class="exercisesType == 'collection' ? 'text' : 'line'"></div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | v-if="catalogueData.length > 0" |
| | | @node-click="handleNodeClick" |
| | | :filter-node-method="filterNode" |
| | | empty-text="暂无数据" |
| | | > |
| | | <template #default="{ node, data }"> |
| | | <div class="custom-tree-node"> |
| | |
| | | <span class="pageNum">{{ data.page }}</span> |
| | | </div> |
| | | </template> |
| | | <template #empty> |
| | | <el-empty :image-size="60" description="暂无数据" /> |
| | | </template> |
| | | </el-tree> |
| | | <div v-else> |
| | | <el-empty :image-size="60" description="暂无数据" /> |
| | | </div> |
| | | <div v-else></div> |
| | | </div> |
| | | <div class="allSearch" v-if="activeMenu == '检索'"> |
| | | <div class="list-box" v-loading="listLoading"> |
| | |
| | | <el-icon @click="searchOpen(index)" v-else class="hover"><ArrowRight /></el-icon> |
| | | <span>{{ reault.chapterName }} ({{ reault.itemList.length }})</span> |
| | | </div> |
| | | <div v-for="(item, index1) in reault.itemList" :key="index1" class="searchItem" v-show="searchReaultData.isShow && searchReaultData.openIndex == index"> |
| | | <div |
| | | v-for="(item, index1) in reault.itemList" |
| | | :key="index1" |
| | | class="searchItem" |
| | | v-show="searchReaultData.isShow && searchReaultData.openIndex == index" |
| | | > |
| | | <div class="index">{{ index1 + 1 }}.</div> |
| | | <div class="searchCon hover" @click="goSearchContent(item)" v-html="item.txt1" :title="item.txt"> |
| | | </div> |
| | | <div |
| | | class="searchCon hover" |
| | | @click="goSearchContent(item)" |
| | | v-html="item.txt1" |
| | | :title="item.txt" |
| | | ></div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | </div> |
| | | </div> |
| | | <!-- 笔记 --> |
| | | <div class="notesBox" v-if="activeMenu == '笔记'"> |
| | | <div class="notesBox" v-if="activeMenu == '笔记'" v-loading="listLoading"> |
| | | <div class="screenBox"> |
| | | <div class="title">筛选</div> |
| | | <div class="flex1 hover" @click="searchClick('all')"> |
| | |
| | | ></div> |
| | | </div> |
| | | </div> |
| | | <div class="list-box" v-loading="listLoading"> |
| | | <div class="list-box"> |
| | | <div v-if="scribeData.noteList.length > 0"> |
| | | <div v-for="(noteItem, index) in scribeData.noteList" :key="noteItem"> |
| | | <div class="chapterName"> |
| | |
| | | @clear="handleClear" |
| | | > |
| | | <template #prefix> |
| | | <img :src="listSearch" @click="searchBook" class="hover"/> |
| | | <img :src="listSearch" @click="searchBook" class="hover" /> |
| | | </template> |
| | | </el-input> |
| | | </div> |
| | |
| | | item.resourceType == '音频' || |
| | | item.resourceType == '习题' || |
| | | item.resourceType == '图片' |
| | | ) |
| | | ) && item.isDownload == '是' |
| | | " |
| | | ><Download |
| | | /></el-icon> |
| | |
| | | </div> |
| | | </div> |
| | | <!-- 截图 --> |
| | | <div class="screenshotList" v-if="activeMenu == '截图'"> |
| | | <div class="list-box" v-loading="listLoading"> |
| | | <div class="screenshotList" v-if="activeMenu == '截图'" v-loading="listLoading"> |
| | | <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" @mouseover="showDelete = index" @mouseleave="showDelete = null"> |
| | |
| | | </div> |
| | | </div> |
| | | <!-- 书签 --> |
| | | <div class="reMarkList" v-if="activeMenu == '书签'"> |
| | | <div class="list-box" v-loading="listLoading"> |
| | | <div class="reMarkList" v-if="activeMenu == '书签'" v-loading="listLoading"> |
| | | <div class="list-box"> |
| | | <div v-if="reMarkList.length > 0"> |
| | | <div v-for="(item, index) in reMarkList" :key="index" class="reMarkItem"> |
| | | <div class="reMarkCon hover" @click="goReMark(item)"> |
| | |
| | | </div> |
| | | </div> |
| | | <div v-else> |
| | | <el-empty :image-size="60" description="暂无数据" /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="questionList" v-if="activeMenu == '题库'" v-loading="listLoading"> |
| | | <div class="resourceSearchBox" v-if="exercisesType !== 'collection' && exercisesType !=='wrong'"> |
| | | <div class="inputBox"> |
| | | <el-input |
| | | class="custom-input" |
| | | placeholder="请输入内容" |
| | | v-model="searchText" |
| | | @keyup.enter="searchBook" |
| | | clearable |
| | | @clear="handleClear" |
| | | > |
| | | <template #prefix> |
| | | <img :src="listSearch" @click="searchBook" class="hover" /> |
| | | </template> |
| | | </el-input> |
| | | </div> |
| | | </div> |
| | | <div class="list-box" v-loading="listLoading"> |
| | | <div v-if="questionList.length > 0"> |
| | | <div v-for="(item, index) in questionList" :key="index" class="reMarkItem"> |
| | | <div |
| | | class="questionCon hover" |
| | | @click="clickQuestion(exercisesType,item)" |
| | | :title="item.resourceName" |
| | | > |
| | | {{ item.resourceName }} |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div v-if="questionList.length == 0 && (exercisesType !== 'collection' && exercisesType !=='wrong')"> |
| | | <el-empty :image-size="60" description="暂无数据" /> |
| | | </div> |
| | | </div> |
| | |
| | | </div> |
| | | <div class="menuList"> |
| | | <ul class="menu" v-if="teachToolsMenuData.length > 0"> |
| | | <li v-for="item in teachToolsMenuData" :key="item.key"> |
| | | <li v-for="item in teachToolsMenuData" :key="item.key" class="hover"> |
| | | <div |
| | | :class="token ? 'hover' : 'notClick'" |
| | | :style="!toolState.open ? 'padding:10px 15px' : ''" |
| | | v-if="item.isShow" |
| | | @click="selectTeachTools(item)" |
| | |
| | | :style="`left:${floatingToolData.elLeft}px`" |
| | | v-if="floatingToolBox.length > 0" |
| | | > |
| | | <div |
| | | :class="token ? 'hover' : 'notClick'" |
| | | v-for="item in floatingToolBox" |
| | | :key="item.name" |
| | | @click="floatItemHandle(item)" |
| | | > |
| | | <div v-for="item in floatingToolBox" :key="item.name" @click="floatItemHandle(item)"> |
| | | <div v-if="item.isShow"> |
| | | <el-popover |
| | | placement="right" |
| | |
| | | <newWord :resourceUrl="resourceUrl" /> |
| | | </div> |
| | | </el-dialog> |
| | | <el-dialog title="错题本" align-center v-model="wrongQuestionVisble" width="800" class="myDialogs"> |
| | | <div class="wendabox"> |
| | | <wrongQuestion /> |
| | | </div> |
| | | </el-dialog> |
| | | <!-- 答题器 --> |
| | | <examination ref="examinationRef" :activeBook="bookConfig" :info="examinationData.info" :type="examinationData.type" :infoType="examinationData.infoType" /> |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import { ref, reactive, watch, onMounted, onBeforeMount, inject } from 'vue' |
| | | import { ref, reactive, watch, onMounted, onBeforeMount, onBeforeUnmount, inject } from 'vue' |
| | | import { useRouter, useRoute } from 'vue-router' |
| | | import useClipboard from 'vue-clipboard3' |
| | | import examination from '../examination/index.vue' |
| | | const { toClipboard } = useClipboard() |
| | | const MG: any = inject('MG') |
| | | const toolClass = inject('toolClass') |
| | |
| | | import moment from 'moment' |
| | | import dictionary from '@/views/components/dictionary.vue' |
| | | import newWord from '@/views/components/newWord.vue' |
| | | import wrongQuestion from '@/views/components/wrongQuestion.vue' |
| | | import { ElMessage, ElMessageBox, valueEquals } from 'element-plus' |
| | | import logo from '@/assets/images/header/logo.png' |
| | | import mulu from '@/assets/images/menu/mulu.png' |
| | |
| | | import jietu from '@/assets/images/menu/jietu.png' |
| | | import biaoqian from '@/assets/images/menu/biaoqian.png' |
| | | import allSearch from '@/assets/images/menu/allSearch.svg' |
| | | import question from '@/assets/images/menu/question.svg' |
| | | import topbg from '@/assets/images/header/top-bg.png' |
| | | import setting from '@/assets/images/operation/setting.png' |
| | | import search from '@/assets/images/operation/search.png' |
| | |
| | | import shengzikapian from '@/assets/images/menu/shengzikapian.png' |
| | | import hudongwenda from '@/assets/images/menu/hudongwenda.png' |
| | | import siweidaotu from '@/assets/images/menu/siweidaotu.png' |
| | | import GGB from '@/assets/images/menu/GGB.png' |
| | | import GGB from '@/assets/images/menu/function.png' |
| | | import jihe from '@/assets/images/menu/jihe.png' |
| | | import python from '@/assets/images/menu/python.png' |
| | | import cjiajia from '@/assets/images/menu/C++.png' |
| | |
| | | |
| | | import { loadMicroApp } from 'qiankun' |
| | | import { microApps } from '@/child.ts' |
| | | import { open } from 'fs' |
| | | let token = localStorage.getItem('token') |
| | | const canvasWith = ref(1000) |
| | | const canvasheight = ref(3000) |
| | |
| | | window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth |
| | | })() |
| | | } |
| | | |
| | | // 加载微应用 |
| | | microApp = loadMicroApp(microApps[localStorage.getItem('bookId')], { |
| | | sandbox: { |
| | |
| | | |
| | | // 定义父层方法 |
| | | window.qiankunActions.setGlobalState({ |
| | | state:1, |
| | | state: 1, |
| | | disableSign: false, |
| | | windowSelection: (data) => { |
| | | // 绑定子应用选择监听事件 |
| | |
| | | // } |
| | | }) |
| | | |
| | | onBeforeUnmount(() => { |
| | | if (microApp) { |
| | | microApp.unmount() // 卸载微应用 |
| | | } |
| | | }) |
| | | // watch( |
| | | // () => screenWidth.value, |
| | | // (val) => { |
| | |
| | | } else if (phoneInfo) { |
| | | userInfo.value = { |
| | | name: phoneInfo.credential |
| | | |
| | | } |
| | | localStorage.setItem('userInfo', JSON.stringify(userInfo.value)) |
| | | } |
| | |
| | | name: '书签', |
| | | icon: biaoqian, |
| | | isShow: bookConfig.value.textbookComponents.indexOf('CF2E1400') > -1 |
| | | }, |
| | | { |
| | | name: '题库', |
| | | icon: question, |
| | | isShow: bookConfig.value.textbookComponents.indexOf('3D3B4F55') > -1 || bookConfig.value.textbookComponents.indexOf('AFC1A288') > -1 || bookConfig.value.textbookComponents.indexOf('A434F2C0') > -1 || bookConfig.value.textbookComponents.indexOf('A4821F71') > -1 |
| | | } |
| | | ] |
| | | teachToolsMenuData = [ |
| | |
| | | listLoading.value = false |
| | | }) |
| | | .catch(function (error) { |
| | | listLoading.value = false |
| | | console.log(error) |
| | | }) |
| | | } |
| | |
| | | const playIndex = ref(null) //音频播放 |
| | | const audioPlayer = ref(null) |
| | | const getResourceData = () => { |
| | | imgPreviewList.value = [] |
| | | listLoading.value = true |
| | | axios |
| | | .get(bookConfig.value.resourceUrl + '/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.iconPath) { |
| | | item.icon = bookConfig.value.resourceUrl + '/' + item.iconPath |
| | | } else { |
| | | item.icon = '' |
| | | } |
| | | if (resourceType.value == 'default') { |
| | | if (item.isTeacherResource == '否') { |
| | | defaultResourceList.value.push(item) |
| | | } |
| | | } else { |
| | | 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 (resItem.resourcePath) { |
| | | resItem.resourcePath = bookConfig.value.resourceUrl + '/' + resItem.resourcePath |
| | | } else { |
| | | resItem.resourcePath = |
| | | bookConfig.value.requestCtx + '/file/GetPreViewImage?md5=' + resItem.md5 |
| | | } |
| | | |
| | | imgPreviewList.value.push(resItem.resourcePath) |
| | | if (activeClassify.value == 'image') { |
| | | resourceDataList.value.push(resItem) |
| | | } |
| | | imgCount++ |
| | | } else if (resItem.resourceType == '音频') { |
| | | if (activeClassify.value == 'audio') { |
| | | 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++ |
| | | if (token) { |
| | | imgPreviewList.value = [] |
| | | listLoading.value = true |
| | | axios |
| | | .get(bookConfig.value.resourceUrl + '/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.iconPath) { |
| | | item.icon = bookConfig.value.resourceUrl + '/' + item.iconPath |
| | | } else { |
| | | if (activeClassify.value == 'other') { |
| | | resourceDataList.value.push(resItem) |
| | | item.icon = '' |
| | | } |
| | | if (resourceType.value == 'default') { |
| | | if (item.isTeacherResource == '否') { |
| | | defaultResourceList.value.push(item) |
| | | } |
| | | otherCount++ |
| | | } else { |
| | | if (item.isTeacherResource == '是') { |
| | | teacherResourceList.value.push(item) |
| | | } |
| | | } |
| | | }) |
| | | 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) |
| | | } |
| | | }) |
| | | } |
| | | // if(activeClassify.value == "video"){ |
| | | // resourceDataList.value.forEach((item,index)=>{ |
| | | // console.log(item,"item") |
| | | // let video = document.createElement("video"); |
| | | // video.src = bookConfig.value.requestCtx + '/file/api/ApiDownload?md5=' + item.md5; |
| | | // const canvas = document.createElement('canvas') |
| | | // canvas.width = 130 |
| | | // canvas.height = 80 |
| | | // const ctx:any = canvas.getContext('2d'); |
| | | // video.crossOrigin = 'anonymous' // 解决跨域问题,也就是提示污染资源无法转换视频 |
| | | // video.currentTime = 1 // 第一帧 |
| | | 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 (resItem.resourcePath) { |
| | | resItem.resourcePath = bookConfig.value.resourceUrl + '/' + resItem.resourcePath |
| | | } else { |
| | | resItem.resourcePath = |
| | | bookConfig.value.requestCtx + '/file/GetPreViewImage?md5=' + resItem.md5 |
| | | } |
| | | |
| | | // video.oncanplay = () => { //视频准备播放 |
| | | // ctx.drawImage(video, 0, 0, canvas.width, canvas.height) |
| | | // item.icon = canvas.toDataURL("image/png"); //获取base64格式的图片 |
| | | // } |
| | | // }) |
| | | |
| | | // } |
| | | } 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 (resItem.resourcePath) { |
| | | resItem.resourcePath = bookConfig.value.resourceUrl + '/' + resItem.resourcePath |
| | | imgPreviewList.value.push(resItem.resourcePath) |
| | | if (activeClassify.value == 'image') { |
| | | resourceDataList.value.push(resItem) |
| | | } |
| | | imgCount++ |
| | | } else if (resItem.resourceType == '音频') { |
| | | if (activeClassify.value == 'audio') { |
| | | resourceDataList.value.push(resItem) |
| | | } |
| | | audioCount++ |
| | | } else if (resItem.resourceType == '视频') { |
| | | if (activeClassify.value == 'video') { |
| | | resourceDataList.value.push(resItem) |
| | | } |
| | | videoCount++ |
| | | } else { |
| | | resItem.resourcePath = |
| | | bookConfig.value.requestCtx + '/file/GetPreViewImage?md5=' + resItem.md5 |
| | | if (activeClassify.value == 'other') { |
| | | resourceDataList.value.push(resItem) |
| | | } |
| | | otherCount++ |
| | | } |
| | | imgPreviewList.value.push(resItem.resourcePath) |
| | | if (activeClassify.value == 'image') { |
| | | resourceDataList.value.push(resItem) |
| | | } |
| | | imgCount++ |
| | | } else if (resItem.resourceType == '音频') { |
| | | if (activeClassify.value == 'audio') { |
| | | 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' |
| | | }) |
| | | } |
| | | }) |
| | | 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) |
| | | if (audioCount > 0) { |
| | | classifySelectList.value.push({ |
| | | title: '音频', |
| | | count: audioCount, |
| | | key: 'audio' |
| | | }) |
| | | } |
| | | if (videoCount > 0) { |
| | | classifySelectList.value.push({ |
| | | title: '视频', |
| | | count: videoCount, |
| | | key: 'video' |
| | | }) |
| | | } |
| | | 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 (resItem.resourcePath) { |
| | | resItem.resourcePath = bookConfig.value.resourceUrl + '/' + resItem.resourcePath |
| | | } else { |
| | | resItem.resourcePath = |
| | | bookConfig.value.requestCtx + '/file/GetPreViewImage?md5=' + resItem.md5 |
| | | } |
| | | imgPreviewList.value.push(resItem.resourcePath) |
| | | if (activeClassify.value == 'image') { |
| | | resourceDataList.value.push(resItem) |
| | | } |
| | | imgCount++ |
| | | } else if (resItem.resourceType == '音频') { |
| | | if (activeClassify.value == 'audio') { |
| | | resourceDataList.value.push(resItem) |
| | | } |
| | | audioCount++ |
| | | } else if (resItem.resourceType == '视频') { |
| | | if (activeClassify.value == 'video') { |
| | | resourceDataList.value.push(resItem) |
| | | } |
| | | videoCount++ |
| | | } 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 (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) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | listLoading.value = false |
| | | listLoading.value = false |
| | | }) |
| | | .catch(function (error) { |
| | | console.log(error) |
| | | listLoading.value = false |
| | | }) |
| | | } else { |
| | | ElMessageBox.confirm('请先登录!', { |
| | | confirmButtonText: '去登录', |
| | | cancelButtonText: '取消', |
| | | autofocus: false, |
| | | type: 'warning' |
| | | }) |
| | | .catch(function (error) { |
| | | console.log(error) |
| | | }) |
| | | .then(() => { |
| | | router.push('/login') |
| | | }) |
| | | .catch(() => {}) |
| | | } |
| | | } |
| | | //资源播放视频 |
| | | const goPlay = (data, index) => { |
| | |
| | | |
| | | //资源跳转到指定位置 |
| | | const JumpPosition = (data) => { |
| | | console.log(data, '跳转') |
| | | if (window.qiankunState && window.qiankunState.gotoPage) { |
| | | window.qiankunState.gotoPage(Number(data.chapterNum), Number(data.pagination)) |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | //习题 |
| | | const exercisesType = ref('exercises') //习题类型 |
| | | const questionList = ref([]) |
| | | const examinationRef = ref() // 答题器实例 |
| | | const examinationData = reactive({ |
| | | type:"", // 答题类型 option 测试 |
| | | infoType:"", // 数据来源 bits 比特后台 json 假数据 |
| | | info:{}, // 这套题的信息 |
| | | }) |
| | | // 获取习题 |
| | | const getExercisesList = () => { |
| | | if (token) { |
| | | listLoading.value = true |
| | | questionList.value = [] |
| | | axios |
| | | .get(bookConfig.value.resourceUrl + '/resource.json') |
| | | .then(function (response) { |
| | | var json = response.data |
| | | // 处理获取到的json数据 |
| | | if (json.length > 0) { |
| | | json.forEach((item) => { |
| | | if (item.resourceType == '习题') { |
| | | let text = searchText.value.replace(/^\s*|\s*$/g, '') |
| | | if (searchText.value) { |
| | | if (item.resourceName.indexOf(text) > -1) { |
| | | questionList.value.push(item) |
| | | } |
| | | } else { |
| | | questionList.value.push(item) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | listLoading.value = false |
| | | }) |
| | | .catch(() => { |
| | | listLoading.value = false |
| | | }) |
| | | } else { |
| | | ElMessageBox.confirm('请先登录!', { |
| | | confirmButtonText: '去登录', |
| | | cancelButtonText: '取消', |
| | | autofocus: false, |
| | | type: 'warning' |
| | | }) |
| | | .then(() => { |
| | | router.push('/login') |
| | | }) |
| | | .catch(() => {}) |
| | | } |
| | | } |
| | | |
| | | // 获取附加题 |
| | | const getAdditionalList = () => { |
| | | if (token) { |
| | | listLoading.value = true |
| | | questionList.value = [] |
| | | axios |
| | | .get(bookConfig.value.resourceUrl + '/bits-question.json') |
| | | .then((res) => { |
| | | // 处理获取到的json数据 |
| | | if (res.data.data.length > 0) { |
| | | questionList.value = res.data.data |
| | | examinationData.infoType = res.data.type |
| | | } |
| | | listLoading.value = false |
| | | }) |
| | | .catch(() => { |
| | | listLoading.value = false |
| | | }) |
| | | } else { |
| | | ElMessageBox.confirm('请先登录!', { |
| | | confirmButtonText: '去登录', |
| | | cancelButtonText: '取消', |
| | | autofocus: false, |
| | | type: 'warning' |
| | | }) |
| | | .then(() => { |
| | | router.push('/login') |
| | | }) |
| | | .catch(() => {}) |
| | | } |
| | | } |
| | | |
| | | //错题本 |
| | | const wrongQuestionVisble = ref(false) |
| | | const selectExercisesType = (type) => { |
| | | exercisesType.value = type |
| | | searchText.value = '' |
| | | if (type == 'exercises') { |
| | | getExercisesList() |
| | | } else if(type == 'additional') { |
| | | getAdditionalList() |
| | | } else if(type == 'wrong'){ |
| | | openExaminationDialog(true,{},'errorQuestion') |
| | | questionList.value = [] |
| | | }else{ |
| | | openExaminationDialog(true,{},'collectQuestion') |
| | | questionList.value = [] |
| | | } |
| | | } |
| | | // 题列表点击 |
| | | const clickQuestion = (type:string,data:any) => { |
| | | switch (type) { |
| | | case 'exercises': |
| | | JumpPosition(data) |
| | | break; |
| | | case 'additional': |
| | | openExaminationDialog(true,data,'option') |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | const openExaminationDialog = (isSHow:boolean,data:any,type:string) => { |
| | | if(examinationRef.value) { |
| | | examinationRef.value.handleExaminationDialog(isSHow) |
| | | examinationData.type = type |
| | | examinationData.info = data |
| | | } |
| | | |
| | | } |
| | | |
| | | // 选中菜单 |
| | | const activeMenu = ref('目录') |
| | | |
| | | // 菜单点击 |
| | | const menuItemClick = (name) => { |
| | | searchText.value = '' |
| | | allSearchReault.value =[] |
| | | allSearchReault.value = [] |
| | | if (menuState.open && activeMenu.value == name) { |
| | | menuState.open = false |
| | | } else { |
| | |
| | | getReMarkList() |
| | | break |
| | | case '检索': |
| | | break |
| | | case '题库': |
| | | getExercisesList() |
| | | break |
| | | } |
| | | } |
| | |
| | | const allSearchReault = ref([]) |
| | | const searchReaultData = reactive({ |
| | | isShow: true, |
| | | openIndex: 0, |
| | | openIndex: 0 |
| | | }) |
| | | const searchBook = async () => { |
| | | switch (activeMenu.value) { |
| | |
| | | break |
| | | case '书签': |
| | | getReMarkList() |
| | | break |
| | | case '题库': |
| | | getExercisesList() |
| | | break |
| | | case '检索': |
| | | listLoading.value = true |
| | |
| | | console.log(allSearchReault.value, 444) |
| | | listLoading.value = false |
| | | } |
| | | |
| | | } |
| | | break |
| | | } |
| | |
| | | |
| | | //检索跳转 |
| | | const goSearchContent = (item) => { |
| | | console.log(item,1111111111111111111111111111111111111111111111111111) |
| | | if (window.qiankunState && window.qiankunState.gotoPage) { |
| | | window.qiankunState.jumpSearchItem(item) |
| | | } |
| | |
| | | case '检索': |
| | | allSearchReault.value = [] |
| | | break |
| | | case '题库': |
| | | getExercisesList() |
| | | break |
| | | } |
| | | } |
| | | |
| | |
| | | const resourceUrl = ref('') |
| | | |
| | | const selectTeachTools = (item) => { |
| | | activeTool.value = item.name |
| | | switch (item.name) { |
| | | case 'AI智能问答': |
| | | wendaVisible.value = true |
| | | break |
| | | case 'GGB函数工具': |
| | | functionVisible.value = true |
| | | break |
| | | case '思维导图': |
| | | siweiVisble.value = true |
| | | break |
| | | case '模型工具': |
| | | modelToolVisble.value = true |
| | | break |
| | | case '词典': |
| | | cidianVisible.value = true |
| | | break |
| | | case '生词卡片': |
| | | resourceUrl.value = bookConfig.value.resourceUrl |
| | | shengciVisble.value = true |
| | | if (token) { |
| | | activeTool.value = item.name |
| | | switch (item.name) { |
| | | case 'AI智能问答': |
| | | wendaVisible.value = true |
| | | break |
| | | case 'GGB函数工具': |
| | | functionVisible.value = true |
| | | break |
| | | case '思维导图': |
| | | siweiVisble.value = true |
| | | break |
| | | case '模型工具': |
| | | modelToolVisble.value = true |
| | | break |
| | | case '词典': |
| | | cidianVisible.value = true |
| | | break |
| | | case '生词卡片': |
| | | resourceUrl.value = bookConfig.value.resourceUrl |
| | | shengciVisble.value = true |
| | | } |
| | | } else { |
| | | ElMessageBox.confirm('请先登录!', { |
| | | confirmButtonText: '去登录', |
| | | cancelButtonText: '取消', |
| | | autofocus: false, |
| | | type: 'warning' |
| | | }) |
| | | .then(() => { |
| | | router.push('/login') |
| | | }) |
| | | .catch(() => {}) |
| | | } |
| | | } |
| | | |
| | |
| | | console.log(floatingToolData.activeToolData, 'floatingToolData.activeToolData') |
| | | if (floatingToolData.activeToolData == '画笔') { |
| | | floatingToolData.activeToolData = '' |
| | | }else { |
| | | } else { |
| | | floatingToolData.activeToolData = item.name |
| | | } |
| | | |
| | |
| | | case '标记': |
| | | break |
| | | case '书签': |
| | | if(floatingToolData.activeBookmark != '书签' ){ |
| | | if (floatingToolData.activeBookmark != '书签') { |
| | | floatingToolData.activeBookmark = '书签' |
| | | reMark() |
| | | } |
| | | |
| | | break |
| | | case '截屏': |
| | | jitT() |
| | |
| | | const reMarkCon = ref('') |
| | | |
| | | const reMark = () => { |
| | | let chapterData = catalogueData.value.find((item) => item.chapter == Number(currentChapter.value)) |
| | | if (catalogueData.value.length > 0) { |
| | | catalogueData.value.forEach((item1) => { |
| | | if (item1.chapter == Number(currentChapter.value) && item1.start == headerData.process) { |
| | | chapterData.label = item1.label |
| | | } |
| | | }) |
| | | } |
| | | if (token) { |
| | | let chapterData = catalogueData.value.find( |
| | | (item) => item.chapter == Number(currentChapter.value) |
| | | ) |
| | | if (catalogueData.value.length > 0) { |
| | | catalogueData.value.forEach((item1) => { |
| | | if (item1.chapter == Number(currentChapter.value) && item1.start == headerData.process) { |
| | | chapterData.label = item1.label |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (chapterData) { |
| | | reMarkData.value.push({ |
| | | id: toolClass.uuid(8), |
| | | createDate: new Date(), |
| | | page: headerData.process, |
| | | chapterNum: currentChapter.value, |
| | | chapterName: chapterData.label, |
| | | content: reMarkCon.value || chapterData.label |
| | | }) |
| | | MG.identity |
| | | .setUserKey({ |
| | | setKeyRequests: [ |
| | | { |
| | | domain: 'reMark', |
| | | key: bookConfig.value.bookId, |
| | | value: JSON.stringify(reMarkData.value) |
| | | } |
| | | ] |
| | | if (chapterData) { |
| | | reMarkData.value.push({ |
| | | id: toolClass.uuid(8), |
| | | createDate: new Date(), |
| | | page: headerData.process, |
| | | chapterNum: currentChapter.value, |
| | | chapterName: chapterData.label, |
| | | content: reMarkCon.value || chapterData.label |
| | | }) |
| | | .then((res) => { |
| | | floatingToolData.activeToolData = '' |
| | | |
| | | ElMessage({ |
| | | message: '添加书签成功!', |
| | | type: 'success' |
| | | MG.identity |
| | | .setUserKey({ |
| | | setKeyRequests: [ |
| | | { |
| | | domain: 'reMark', |
| | | key: bookConfig.value.bookId, |
| | | value: JSON.stringify(reMarkData.value) |
| | | } |
| | | ] |
| | | }) |
| | | getReMarkList() |
| | | .then((res) => { |
| | | floatingToolData.activeToolData = '' |
| | | |
| | | ElMessage({ |
| | | message: '添加书签成功!', |
| | | type: 'success' |
| | | }) |
| | | getReMarkList() |
| | | }) |
| | | .catch(function (error) {}) |
| | | } |
| | | } else { |
| | | ElMessageBox.confirm('请先登录!', { |
| | | confirmButtonText: '去登录', |
| | | cancelButtonText: '取消', |
| | | autofocus: false, |
| | | type: 'warning' |
| | | }) |
| | | .then(() => { |
| | | router.push('/login') |
| | | }) |
| | | .catch(function (error) {}) |
| | | .catch(() => {}) |
| | | } |
| | | } |
| | | const getReMarkList = () => { |
| | | reMarkList.value = [] |
| | | reMarkData.value = [] |
| | | listLoading.value = true |
| | | MG.identity |
| | | .getUserKey({ |
| | | 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.content.indexOf(text) > -1) { |
| | | if (token) { |
| | | reMarkList.value = [] |
| | | reMarkData.value = [] |
| | | listLoading.value = true |
| | | MG.identity |
| | | .getUserKey({ |
| | | 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.content.indexOf(text) > -1) { |
| | | reMarkList.value.push(item) |
| | | } |
| | | } else { |
| | | reMarkList.value.push(item) |
| | | } |
| | | } else { |
| | | reMarkList.value.push(item) |
| | | } |
| | | }) |
| | | } |
| | | listLoading.value = false |
| | | }) |
| | | } |
| | | listLoading.value = false |
| | | }) |
| | | } else { |
| | | ElMessageBox.confirm('请先登录!', { |
| | | confirmButtonText: '去登录', |
| | | cancelButtonText: '取消', |
| | | autofocus: false, |
| | | type: 'warning' |
| | | }) |
| | | .then(() => { |
| | | router.push('/login') |
| | | }) |
| | | .catch(() => {}) |
| | | } |
| | | } |
| | | |
| | | //跳转 |
| | |
| | | //截图 |
| | | //截图事件 |
| | | function jitT() { |
| | | const screenShotHandler = new ScreenShort({ |
| | | enableWebRtc: false, // 是否显示选项框 |
| | | level: 999, // 层级级别 |
| | | completeCallback: callback, //确认回调 |
| | | closeCallback: closeFn //取消回调 |
| | | } as any) |
| | | if (token) { |
| | | const screenShotHandler = new ScreenShort({ |
| | | enableWebRtc: false, // 是否显示选项框 |
| | | level: 999, // 层级级别 |
| | | completeCallback: callback, //确认回调 |
| | | closeCallback: closeFn //取消回调 |
| | | } as any) |
| | | } else { |
| | | ElMessageBox.confirm('请先登录!', { |
| | | confirmButtonText: '去登录', |
| | | cancelButtonText: '取消', |
| | | autofocus: false, |
| | | type: 'warning' |
| | | }) |
| | | .then(() => { |
| | | router.push('/login') |
| | | }) |
| | | .catch(() => {}) |
| | | } |
| | | } |
| | | //确认回调 |
| | | const callback = (val: any) => { |
| | |
| | | } |
| | | |
| | | const getScreenshotList = () => { |
| | | screenshotData.value = [] |
| | | screenshotList.value = [] |
| | | imgPreviewList.value = [] |
| | | listLoading.value = true |
| | | MG.identity |
| | | .getUserKey({ |
| | | domain: 'screenshot', |
| | | keys: [bookConfig.value.bookId] |
| | | }) |
| | | .then((res) => { |
| | | if (res && res.length > 0 && res[0].value) { |
| | | screenshotData.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) { |
| | | if (token) { |
| | | screenshotData.value = [] |
| | | screenshotList.value = [] |
| | | imgPreviewList.value = [] |
| | | listLoading.value = true |
| | | MG.identity |
| | | .getUserKey({ |
| | | domain: 'screenshot', |
| | | keys: [bookConfig.value.bookId] |
| | | }) |
| | | .then((res) => { |
| | | if (res && res.length > 0 && res[0].value) { |
| | | screenshotData.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) { |
| | | screenshotList.value.push(item) |
| | | imgPreviewList.value.push(item.imgUrl) |
| | | } |
| | | } else { |
| | | screenshotList.value.push(item) |
| | | imgPreviewList.value.push(item.imgUrl) |
| | | } |
| | | } else { |
| | | screenshotList.value.push(item) |
| | | imgPreviewList.value.push(item.imgUrl) |
| | | } |
| | | }) |
| | | } |
| | | listLoading.value = false |
| | | }) |
| | | } |
| | | listLoading.value = false |
| | | }) |
| | | } else { |
| | | ElMessageBox.confirm('请先登录!', { |
| | | confirmButtonText: '去登录', |
| | | cancelButtonText: '取消', |
| | | autofocus: false, |
| | | type: 'warning' |
| | | }) |
| | | .then(() => { |
| | | router.push('/login') |
| | | }) |
| | | .catch(() => {}) |
| | | } |
| | | } |
| | | //查看截图 |
| | | const getCapture = (item, index) => { |
| | |
| | | |
| | | ///内容选中 |
| | | const getSelection = (data) => { |
| | | if (data.txt && token) { |
| | | if (data.txt) { |
| | | toolActive.value = '' |
| | | dialogToolData.txt = data.txt |
| | | dialogToolData.page = data.page |
| | |
| | | |
| | | const synth = window.speechSynthesis |
| | | const dialogToolHandle = async (item) => { |
| | | toolActive.value = item.name |
| | | colorActive.value = '' |
| | | switch (item.name) { |
| | | case 'AI阅读': |
| | | 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 |
| | | break |
| | | case '划线': |
| | | break |
| | | case '高亮': |
| | | break |
| | | case '笔记': |
| | | formData.desc = '' |
| | | noteColorActive.value = '#F5E12A' |
| | | addNoteVisble.value = true |
| | | showToolBox.value = false |
| | | break |
| | | case '标注': |
| | | break |
| | | case '复制': |
| | | try { |
| | | //复制 |
| | | await toClipboard(dialogToolData.txt) |
| | | //下面可以设置复制成功的提示框等操作 |
| | | ElMessage({ |
| | | message: '复制成功', |
| | | type: 'success' |
| | | }) |
| | | } catch (err) { |
| | | ElMessage.error('无法复制文本:' + err) |
| | | } |
| | | showToolBox.value = false |
| | | toolActive.value = '' |
| | | break |
| | | case '词典': |
| | | getSearchResult() |
| | | if (token) { |
| | | toolActive.value = item.name |
| | | colorActive.value = '' |
| | | switch (item.name) { |
| | | case 'AI阅读': |
| | | 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 |
| | | break |
| | | case '划线': |
| | | break |
| | | case '高亮': |
| | | break |
| | | case '笔记': |
| | | formData.desc = '' |
| | | noteColorActive.value = '#F5E12A' |
| | | addNoteVisble.value = true |
| | | showToolBox.value = false |
| | | break |
| | | case '标注': |
| | | break |
| | | case '复制': |
| | | try { |
| | | //复制 |
| | | await toClipboard(dialogToolData.txt) |
| | | //下面可以设置复制成功的提示框等操作 |
| | | ElMessage({ |
| | | message: '复制成功', |
| | | type: 'success' |
| | | }) |
| | | } catch (err) { |
| | | ElMessage.error('无法复制文本:' + err) |
| | | } |
| | | showToolBox.value = false |
| | | toolActive.value = '' |
| | | break |
| | | case '词典': |
| | | getSearchResult() |
| | | |
| | | 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 |
| | | 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 |
| | | } |
| | | } else { |
| | | ElMessageBox.confirm('请先登录!', { |
| | | confirmButtonText: '去登录', |
| | | cancelButtonText: '取消', |
| | | autofocus: false, |
| | | type: 'warning' |
| | | }) |
| | | .then(() => { |
| | | router.push('/login') |
| | | }) |
| | | .catch(() => { |
| | | showToolBox.value = false |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | const addUserKey = () => { |
| | | let dom = '' |
| | | let data = null |
| | | switch (toolActive.value) { |
| | | case '高亮': |
| | | dom = 'highLightData-' + bookConfig.value.bookId |
| | | data = dialogToolData.lineHeight[dialogToolData.chapter] |
| | | if (!data) data = [] |
| | | data.push({ |
| | | id: toolClass.uuid(8), |
| | | txt: dialogToolData.txt, |
| | | page: dialogToolData.page, |
| | | chapterNum: dialogToolData.chapter, |
| | | type: 'Highlight', |
| | | color: colorActive.value |
| | | }) |
| | | break |
| | | case '划线': |
| | | dom = 'underline-' + bookConfig.value.bookId |
| | | data = dialogToolData.scribeList[dialogToolData.chapter] |
| | | if (!data) data = [] |
| | | data.push({ |
| | | id: toolClass.uuid(8), |
| | | txt: dialogToolData.txt, |
| | | page: dialogToolData.page, |
| | | chapterNum: dialogToolData.chapter, |
| | | type: 'Dashing', |
| | | color: colorActive.value |
| | | }) |
| | | break |
| | | case '笔记': |
| | | if (!formData.desc.replace(/^\s*|\s*$/g, '')) { |
| | | ElMessage.error('笔记内容不能为空!') |
| | | return |
| | | } |
| | | if (!noteColorActive.value) { |
| | | ElMessage.error('请选择笔记颜色!') |
| | | return |
| | | } |
| | | dom = 'notes-' + bookConfig.value.bookId |
| | | data = dialogToolData.notesList[dialogToolData.chapter] |
| | | if (!data) data = [] |
| | | data.push({ |
| | | id: toolClass.uuid(8), |
| | | txt: dialogToolData.txt, |
| | | page: dialogToolData.page, |
| | | chapterNum: dialogToolData.chapter, |
| | | type: 'Note', |
| | | color: noteColorActive.value, |
| | | createDate: new Date(), |
| | | note: formData.desc.replace(/^\s*|\s*$/g, '') |
| | | }) |
| | | |
| | | break |
| | | } |
| | | MG.identity |
| | | .setUserKey({ |
| | | setKeyRequests: [ |
| | | { |
| | | domain: dom, |
| | | key: dialogToolData.chapter, |
| | | value: JSON.stringify(data) |
| | | if (token) { |
| | | let dom = '' |
| | | let data = null |
| | | switch (toolActive.value) { |
| | | case '高亮': |
| | | dom = 'highLightData-' + bookConfig.value.bookId |
| | | data = dialogToolData.lineHeight[dialogToolData.chapter] |
| | | if (!data) data = [] |
| | | data.push({ |
| | | id: toolClass.uuid(8), |
| | | txt: dialogToolData.txt, |
| | | page: dialogToolData.page, |
| | | chapterNum: dialogToolData.chapter, |
| | | type: 'Highlight', |
| | | color: colorActive.value |
| | | }) |
| | | break |
| | | case '划线': |
| | | dom = 'underline-' + bookConfig.value.bookId |
| | | data = dialogToolData.scribeList[dialogToolData.chapter] |
| | | if (!data) data = [] |
| | | data.push({ |
| | | id: toolClass.uuid(8), |
| | | txt: dialogToolData.txt, |
| | | page: dialogToolData.page, |
| | | chapterNum: dialogToolData.chapter, |
| | | type: 'Dashing', |
| | | color: colorActive.value |
| | | }) |
| | | break |
| | | case '笔记': |
| | | if (!formData.desc.replace(/^\s*|\s*$/g, '')) { |
| | | ElMessage.error('笔记内容不能为空!') |
| | | return |
| | | } |
| | | ] |
| | | if (!noteColorActive.value) { |
| | | ElMessage.error('请选择笔记颜色!') |
| | | return |
| | | } |
| | | dom = 'notes-' + bookConfig.value.bookId |
| | | data = dialogToolData.notesList[dialogToolData.chapter] |
| | | if (!data) data = [] |
| | | data.push({ |
| | | id: toolClass.uuid(8), |
| | | txt: dialogToolData.txt, |
| | | page: dialogToolData.page, |
| | | chapterNum: dialogToolData.chapter, |
| | | type: 'Note', |
| | | color: noteColorActive.value, |
| | | createDate: new Date(), |
| | | note: formData.desc.replace(/^\s*|\s*$/g, '') |
| | | }) |
| | | |
| | | break |
| | | } |
| | | MG.identity |
| | | .setUserKey({ |
| | | setKeyRequests: [ |
| | | { |
| | | domain: dom, |
| | | key: dialogToolData.chapter, |
| | | value: JSON.stringify(data) |
| | | } |
| | | ] |
| | | }) |
| | | .then((res) => { |
| | | showToolBox.value = false |
| | | addNoteVisble.value = false |
| | | colorActive.value = '' |
| | | noteColorActive.value = '' |
| | | toolActive.value = '' |
| | | getSignData() |
| | | getNotesList() |
| | | }) |
| | | } else { |
| | | ElMessageBox.confirm('请先登录!', { |
| | | confirmButtonText: '去登录', |
| | | cancelButtonText: '取消', |
| | | autofocus: false, |
| | | type: 'warning' |
| | | }) |
| | | .then((res) => { |
| | | showToolBox.value = false |
| | | addNoteVisble.value = false |
| | | colorActive.value = '' |
| | | noteColorActive.value = '' |
| | | toolActive.value = '' |
| | | getSignData() |
| | | getNotesList() |
| | | }) |
| | | .then(() => { |
| | | router.push('/login') |
| | | }) |
| | | .catch(() => {}) |
| | | } |
| | | } |
| | | |
| | | const getSignData = () => { |
| | | MG.identity |
| | | .getUserKey({ |
| | | domain: 'highLightData-' + bookConfig.value.bookId, |
| | | keys: activeCatalog.value.map((item) => item + '') |
| | | }) |
| | | .then((res) => { |
| | | if (res && res.length > 0) { |
| | | for (let i = 0; i < res.length; i++) { |
| | | const item = res[i] |
| | | const data = JSON.parse(item.value) |
| | | // 储值 |
| | | dialogToolData.lineHeight[item.key] = data |
| | | // 渲染 |
| | | for (let j = 0; j < data.length; j++) { |
| | | const citem = data[j] |
| | | if (window.qiankunState && window.qiankunState.renderSign) |
| | | window.qiankunState.renderSign(citem.type, citem) |
| | | if (token) { |
| | | MG.identity |
| | | .getUserKey({ |
| | | domain: 'highLightData-' + bookConfig.value.bookId, |
| | | keys: activeCatalog.value.map((item) => item + '') |
| | | }) |
| | | .then((res) => { |
| | | if (res && res.length > 0) { |
| | | for (let i = 0; i < res.length; i++) { |
| | | const item = res[i] |
| | | const data = JSON.parse(item.value) |
| | | // 储值 |
| | | dialogToolData.lineHeight[item.key] = data |
| | | // 渲染 |
| | | for (let j = 0; j < data.length; j++) { |
| | | const citem = data[j] |
| | | if (window.qiankunState && window.qiankunState.renderSign) |
| | | window.qiankunState.renderSign(citem.type, citem) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }) |
| | | MG.identity |
| | | .getUserKey({ |
| | | domain: 'underline-' + bookConfig.value.bookId, |
| | | keys: activeCatalog.value.map((item) => item + '') |
| | | }) |
| | | .then((res) => { |
| | | if (res && res.length > 0) { |
| | | for (let i = 0; i < res.length; i++) { |
| | | const item = res[i] |
| | | const data = JSON.parse(item.value) |
| | | // 储值 |
| | | dialogToolData.scribeList[item.key] = data |
| | | }) |
| | | MG.identity |
| | | .getUserKey({ |
| | | domain: 'underline-' + bookConfig.value.bookId, |
| | | keys: activeCatalog.value.map((item) => item + '') |
| | | }) |
| | | .then((res) => { |
| | | if (res && res.length > 0) { |
| | | for (let i = 0; i < res.length; i++) { |
| | | const item = res[i] |
| | | const data = JSON.parse(item.value) |
| | | // 储值 |
| | | dialogToolData.scribeList[item.key] = data |
| | | |
| | | // 渲染 |
| | | if (data.length > 0) { |
| | | for (let j = 0; j < data.length; j++) { |
| | | const citem = data[j] |
| | | if (window.qiankunState && window.qiankunState.renderSign) |
| | | window.qiankunState.renderSign(citem.type, citem) |
| | | // 渲染 |
| | | if (data.length > 0) { |
| | | for (let j = 0; j < data.length; j++) { |
| | | const citem = data[j] |
| | | if (window.qiankunState && window.qiankunState.renderSign) |
| | | window.qiankunState.renderSign(citem.type, citem) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }) |
| | | MG.identity |
| | | .getUserKey({ |
| | | domain: 'notes-' + bookConfig.value.bookId, |
| | | keys: activeCatalog.value.map((item) => item + '') |
| | | }) |
| | | .then((res) => { |
| | | if (res && res.length > 0) { |
| | | for (let i = 0; i < res.length; i++) { |
| | | const item = res[i] |
| | | const data = JSON.parse(item.value) |
| | | // 储值 |
| | | dialogToolData.notesList[item.key] = data |
| | | // 渲染 |
| | | if (data.length > 0) { |
| | | for (let j = 0; j < data.length; j++) { |
| | | const citem = data[j] |
| | | if (window.qiankunState && window.qiankunState.renderSign) |
| | | window.qiankunState.renderSign(citem.type, citem) |
| | | }) |
| | | MG.identity |
| | | .getUserKey({ |
| | | domain: 'notes-' + bookConfig.value.bookId, |
| | | keys: activeCatalog.value.map((item) => item + '') |
| | | }) |
| | | .then((res) => { |
| | | if (res && res.length > 0) { |
| | | for (let i = 0; i < res.length; i++) { |
| | | const item = res[i] |
| | | const data = JSON.parse(item.value) |
| | | // 储值 |
| | | dialogToolData.notesList[item.key] = data |
| | | // 渲染 |
| | | if (data.length > 0) { |
| | | for (let j = 0; j < data.length; j++) { |
| | | const citem = data[j] |
| | | if (window.qiankunState && window.qiankunState.renderSign) |
| | | window.qiankunState.renderSign(citem.type, citem) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }) |
| | | } else { |
| | | ElMessageBox.confirm('请先登录!', { |
| | | confirmButtonText: '去登录', |
| | | cancelButtonText: '取消', |
| | | autofocus: false, |
| | | type: 'warning' |
| | | }) |
| | | .then(() => { |
| | | router.push('/login') |
| | | }) |
| | | .catch(() => {}) |
| | | } |
| | | } |
| | | |
| | | //菜单笔记列表 |
| | | const getNotesList = () => { |
| | | let chapterList = [] |
| | | listLoading.value = true |
| | | catalogueData.value.forEach((item) => { |
| | | chapterList.push(item.chapter + '') |
| | | }) |
| | | let uniqueArray = [...new Set(chapterList)] |
| | | scribeData.noteList = [] |
| | | MG.identity |
| | | .getUserKey({ |
| | | domain: 'notes-' + bookConfig.value.bookId, |
| | | keys: uniqueArray |
| | | if (token) { |
| | | let chapterList = [] |
| | | listLoading.value = true |
| | | catalogueData.value.forEach((item) => { |
| | | chapterList.push(item.chapter + '') |
| | | }) |
| | | .then((res) => { |
| | | if (res && res.length > 0) { |
| | | for (let i = 0; i < res.length; i++) { |
| | | 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) => { |
| | | if (item1.chapter == Number(item.key)) { |
| | | dataList.push(item1) |
| | | } |
| | | }) |
| | | } |
| | | let labels = '' |
| | | if (dataList.length > 1) labels = dataList.map((item) => item.label).join('/') |
| | | let uniqueArray = [...new Set(chapterList)] |
| | | scribeData.noteList = [] |
| | | MG.identity |
| | | .getUserKey({ |
| | | domain: 'notes-' + bookConfig.value.bookId, |
| | | keys: uniqueArray |
| | | }) |
| | | .then((res) => { |
| | | if (res && res.length > 0) { |
| | | for (let i = 0; i < res.length; i++) { |
| | | 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) => { |
| | | if (item1.chapter == Number(item.key)) { |
| | | dataList.push(item1) |
| | | } |
| | | }) |
| | | } |
| | | let labels = '' |
| | | if (dataList.length > 1) labels = dataList.map((item) => item.label).join('/') |
| | | |
| | | let list = JSON.parse(item.value) |
| | | let itemList = [] |
| | | if (list.length > 0) { |
| | | list.forEach((item) => { |
| | | if (searchText.value) { |
| | | let text = searchText.value.replace(/^\s*|\s*$/g, '') |
| | | if (item.note.indexOf(text) > -1 || item.txt.indexOf(text) > -1) { |
| | | let list = JSON.parse(item.value) |
| | | let itemList = [] |
| | | if (list.length > 0) { |
| | | list.forEach((item) => { |
| | | if (searchText.value) { |
| | | let text = searchText.value.replace(/^\s*|\s*$/g, '') |
| | | if (item.note.indexOf(text) > -1 || item.txt.indexOf(text) > -1) { |
| | | if (menuState.notesColor == 'all') { |
| | | itemList.push(item) |
| | | } else if (item.color == menuState.notesColor) { |
| | | itemList.push(item) |
| | | } |
| | | } |
| | | } else { |
| | | if (menuState.notesColor == 'all') { |
| | | itemList.push(item) |
| | | } else if (item.color == menuState.notesColor) { |
| | | itemList.push(item) |
| | | } |
| | | } |
| | | } else { |
| | | if (menuState.notesColor == 'all') { |
| | | itemList.push(item) |
| | | } else if (item.color == menuState.notesColor) { |
| | | itemList.push(item) |
| | | } |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | if (dataList[0].chapter == Number(item.key) && itemList.length > 0) { |
| | | scribeData.noteList.push({ |
| | | chapter: dataList[0].chapter, |
| | | chapterName: labels ? labels : dataList[0].label, |
| | | noteList: itemList |
| | | }) |
| | | } |
| | | } |
| | | if (dataList[0].chapter == Number(item.key) && itemList.length > 0) { |
| | | scribeData.noteList.push({ |
| | | chapter: dataList[0].chapter, |
| | | chapterName: labels ? labels : dataList[0].label, |
| | | noteList: itemList |
| | | }) |
| | | } |
| | | console.log(scribeData.noteList, 'scribeData.noteList') |
| | | } |
| | | console.log(scribeData.noteList, 'scribeData.noteList') |
| | | } |
| | | listLoading.value = false |
| | | listLoading.value = false |
| | | }) |
| | | } else { |
| | | ElMessageBox.confirm('请先登录!', { |
| | | confirmButtonText: '去登录', |
| | | cancelButtonText: '取消', |
| | | autofocus: false, |
| | | type: 'warning' |
| | | }) |
| | | .then(() => { |
| | | router.push('/login') |
| | | }) |
| | | .catch(() => {}) |
| | | } |
| | | } |
| | | |
| | | //正文中删除高亮,划线,笔记操作框 |
| | |
| | | const updateUserKey = () => { |
| | | let data = scribeData.noteList.find((item1) => item1.chapter == dialogToolData.chapter) |
| | | data.noteList.forEach((itemNote) => { |
| | | if ((itemNote.id == formData.id)) { |
| | | if (itemNote.id == formData.id) { |
| | | itemNote.note = formData.desc |
| | | itemNote.color = noteColorActive.value |
| | | } |
| | |
| | | |
| | | const layoutBtn = () => { |
| | | localStorage.removeItem('token') |
| | | localStorage.removeItem("userInfo") |
| | | localStorage.removeItem('userInfo') |
| | | router.push('/login') |
| | | } |
| | | const goLogin = () => { |
| | | localStorage.removeItem("userInfo") |
| | | localStorage.removeItem('userInfo') |
| | | router.push('/login') |
| | | } |
| | | </script> |
| | |
| | | -moz-user-select: none; |
| | | -khtml-user-select: none; |
| | | user-select: none; |
| | | .notClick { |
| | | |
| | | pointer-events: none; |
| | | .name{ |
| | | color:#949494 !important; |
| | | } |
| | | |
| | | } |
| | | |
| | | .menuItem { |
| | | text-align: center; |
| | | line-height: 1; |
| | |
| | | display: flex; |
| | | justify-content: space-between; |
| | | .reMarkCon { |
| | | // width: 240px; |
| | | // white-space: nowrap; |
| | | // overflow: hidden; |
| | | // text-overflow: ellipsis; |
| | | // margin-right: 8px; |
| | | display: flex; |
| | | .con { |
| | | width: 200px; |
| | |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | .questionCon { |
| | | width: 240px; |
| | | white-space: nowrap; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | .allSearchList { |
| | | .searchItem { |
| | | margin: 15px; |
| | |
| | | border-radius: 10px; |
| | | padding: 10px; |
| | | display: flex; |
| | | .index{ |
| | | .index { |
| | | line-height: 24px; |
| | | margin-right:10px; |
| | | |
| | | margin-right: 10px; |
| | | } |
| | | .searchCon { |
| | | flex:1; |
| | | flex: 1; |
| | | width: 240px; |
| | | overflow: hidden; |
| | | margin-right: 8px; |
| | |
| | | -webkit-box-orient: vertical; |
| | | -webkit-line-clamp: 2; |
| | | text-overflow: ellipsis; |
| | | .searchColor{ |
| | | background:rgb(245, 225, 42, 0.5) |
| | | .searchColor { |
| | | background: rgb(245, 225, 42, 0.5); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | .allSearch,.notesBox,.resourceBox,.reMarkList,.screenshotList { |
| | | height: calc(100% - 60px); |
| | | overflow-y: auto; |
| | | } |
| | | } |
| | | .allSearch, |
| | | .notesBox, |
| | | .resourceBox, |
| | | .reMarkList, |
| | | .questionList, |
| | | .screenshotList { |
| | | height: calc(100% - 60px); |
| | | overflow-y: auto; |
| | | } |
| | | } |
| | | .menuStateBox { |
| | | width: 25px; |
| | |
| | | -moz-user-select: none; |
| | | -khtml-user-select: none; |
| | | user-select: none; |
| | | .notClick { |
| | | pointer-events: none; |
| | | color:#949494 !important; |
| | | } |
| | | .toolTitle { |
| | | height: 57px; |
| | | line-height: 53px; |
| | |
| | | border-radius: 10px; |
| | | padding: 6px; |
| | | overflow: hidden; |
| | | .notClick { |
| | | pointer-events: none; |
| | | } |
| | | .floatToolItem { |
| | | margin: 10px 0; |
| | | height: 30px; |