From e13f2f0963a1b84271fe8ca767654614186b606c Mon Sep 17 00:00:00 2001 From: YM <479443481@qq.com> Date: 星期四, 13 六月 2024 18:10:49 +0800 Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/TextbookReader --- src/views/readerPages/webHome.vue | 2068 ++++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 1,360 insertions(+), 708 deletions(-) diff --git a/src/views/home.vue b/src/views/readerPages/webHome.vue similarity index 68% rename from src/views/home.vue rename to src/views/readerPages/webHome.vue index 73d43c4..d7fb39c 100644 --- a/src/views/home.vue +++ b/src/views/readerPages/webHome.vue @@ -6,14 +6,19 @@ <span></span> <div class="userInfoBox"> <div class="userName" v-if="userInfo.name">{{ userInfo.name }}</div> - <div><div class="layout hover" @click="layoutBtn">閫�鍑�</div></div> + <div v-if="token"><div class="layout hover" @click="layoutBtn">閫�鍑�</div></div> + <div v-else><div class="layout hover" @click="goLogin">鐧诲綍</div></div> </div> </div> <div class="contentBox"> <!-- 鑿滃崟 --> <div class="menuBox"> - <div v-for="(item, index) in menuData" :key="index" @click="menuItemClick(item.name)"> - <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> @@ -88,41 +93,21 @@ <!-- 鑿滃崟鍐呭 --> <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="璇疯緭鍏ュ唴瀹�" v-model="searchText" @keyup.enter="searchBook" + clearable + @clear="handleClear" > <template #prefix> - <el-icon><Search /></el-icon> - </template> - <template #suffix> - <svg - @click="searchBook" - xmlns="http://www.w3.org/2000/svg" - width="24" - height="24" - viewBox="0 0 24 24" - fill="none" - stroke="currentColor" - stroke-width="2" - stroke-linecap="round" - stroke-linejoin="round" - class="icon icon-tabler icons-tabler-outline icon-tabler-list-search hover" - > - <path stroke="none" d="M0 0h24v24H0z" fill="none" /> - <path d="M15 15m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0" /> - <path d="M18.5 18.5l2.5 2.5" /> - <path d="M4 6h16" /> - <path d="M4 12h4" /> - <path d="M4 18h4" /> - </svg> + <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> @@ -133,15 +118,26 @@ <div :class="resourceType == 'teacher' ? 'text' : 'line'"></div> </div> </div> + <div v-if="activeMenu == '涔犻'" class="resourceTab"> + <div class="tabItem hover" @click="selectExercisesType('exercises')"> + <div>涔犻</div> + <div :class="exercisesType == 'exercises' ? 'text' : 'line'"></div> + </div> + <hr class="hr" /> + <div class="tabItem hover" @click="selectExercisesType('wrong')"> + <div>閿欓鏈�</div> + <div :class="exercisesType == 'wrong' ? 'text' : 'line'"></div> + </div> + </div> </div> <!-- 鐩綍 --> - <div class="menuList" v-if="activeMenu == '鐩綍'"> + <div class="menuList" v-if="activeMenu == '鐩綍'" v-loading="listLoading"> <el-tree ref="catalogTree" default-expand-all="true" :expand-on-click-node="false" - highlight-current node-key="start" + highlight-current :data="catalogueData" :props="defaultProps" v-if="catalogueData.length > 0" @@ -154,9 +150,45 @@ <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 v-else></div> + </div> + <div class="allSearch" v-if="activeMenu == '妫�绱�'"> + <div class="list-box" v-loading="listLoading"> + <div v-if="allSearchReault.length > 0" class="allSearchList"> + <div v-for="(reault, index) in allSearchReault" :key="index"> + <div class="chapterName"> + <el-icon + @click="searchClose(index)" + v-if="searchReaultData.isShow && searchReaultData.openIndex == index" + class="hover" + ><ArrowDown + /></el-icon> + <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 class="index">{{ index1 + 1 }}.</div> + <div + class="searchCon hover" + @click="goSearchContent(item)" + v-html="item.txt1" + :title="item.txt" + ></div> + </div> + </div> + </div> + <div v-else> + <el-empty :image-size="60" description="鏆傛棤鏁版嵁" /> + </div> </div> </div> <!-- 绗旇 --> @@ -178,7 +210,7 @@ ></div> </div> </div> - <div class="list-box"> + <div class="list-box" v-loading="listLoading"> <div v-if="scribeData.noteList.length > 0"> <div v-for="(noteItem, index) in scribeData.noteList" :key="noteItem"> <div class="chapterName"> @@ -244,8 +276,8 @@ </div> </div> <!-- 璧勬簮 --> - <div class="" v-if="activeMenu == '璧勬簮'"> - <div class="resourceBox" v-if="classifySelectList.length > 0"> + <div class="resourceBox" v-if="activeMenu == '璧勬簮'" v-loading="listLoading"> + <div class="resourceSearchBox" v-if="classifySelectList.length > 0"> <div class="classification"> <div v-for="item in classifySelectList" @@ -274,31 +306,11 @@ placeholder="璇疯緭鍏ュ唴瀹�" v-model="searchText" @keyup.enter="searchBook" + clearable + @clear="handleClear" > <template #prefix> - <el-icon><Search /></el-icon> - </template> - <template #suffix> - <svg - @click="searchBook" - xmlns="http://www.w3.org/2000/svg" - width="20" - height="20" - viewBox="0 0 20 20" - fill="none" - stroke="currentColor" - stroke-width="2" - stroke-linecap="round" - stroke-linejoin="round" - class="icon icon-tabler icons-tabler-outline icon-tabler-list-search hover" - > - <path stroke="none" d="M0 0h24v24H0z" fill="none" /> - <path d="M15 15m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0" /> - <path d="M18.5 18.5l2.5 2.5" /> - <path d="M4 6h16" /> - <path d="M4 12h4" /> - <path d="M4 18h4" /> - </svg> + <img :src="listSearch" @click="searchBook" class="hover" /> </template> </el-input> </div> @@ -313,8 +325,13 @@ @mouseover="showHandle = index" @mouseleave="showHandle = null" > - <img :src="item.icon" mode="" v-if="item.icon" /> - <el-icon v-else-if="activeClassify == 'image'" size="30"><Picture /></el-icon> + <img :src="item.resourcePath" mode="" v-if="activeClassify == 'image'" /> + <img + :src="item.icon" + mode="" + v-else-if="item.icon && activeClassify != 'image'" + /> + <!-- <el-icon v-else-if="activeClassify == 'image'" size="30"></el-icon> --> <el-icon v-else-if="activeClassify == 'audio'" size="30"><Headset /></el-icon> <el-icon v-else-if="activeClassify == 'video'" size="30" ><VideoCamera @@ -340,11 +357,18 @@ ><VideoPlay /></el-icon> <el-icon - @click="goPlay(item)" + @click="goPlay(item, index)" size="20" class="icon hover" - v-if="item.resourceType == '闊抽'" - ><Headset + v-if="item.resourceType == '闊抽' && playIndex != index" + ><VideoPlay + /></el-icon> + <el-icon + @click="goPause()" + size="20" + class="icon hover" + v-if="item.resourceType == '闊抽' && playIndex == index" + ><VideoPause /></el-icon> <el-icon @click="getCapture(item, index)" @@ -363,7 +387,7 @@ item.resourceType == '闊抽' || item.resourceType == '涔犻' || item.resourceType == '鍥剧墖' - ) + ) && item.isDownload == '鏄�' " ><Download /></el-icon> @@ -389,8 +413,8 @@ </div> </div> <!-- 鎴浘 --> - <div class="" v-if="activeMenu == '鎴浘'"> - <div class="list-box"> + <div class="screenshotList" v-if="activeMenu == '鎴浘'"> + <div class="list-box" v-loading="listLoading"> <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"> @@ -413,14 +437,50 @@ </div> </div> </div> - <!-- 鏍囩 --> - <div class="" v-if="activeMenu == '涔︾'"> - <div class="list-box"> + <!-- 涔︾ --> + <div class="reMarkList" v-if="activeMenu == '涔︾'"> + <div class="list-box" v-loading="listLoading"> <div v-if="reMarkList.length > 0"> <div v-for="(item, index) in reMarkList" :key="index" class="reMarkItem"> - <div class="reMarkCon">{{ item.chapterName }} P{{ item.page }}</div> + <div class="reMarkCon hover" @click="goReMark(item)"> + <span class="con">{{ item.content }}</span> <span>P{{ item.page }}</span> + </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> + </div> + <div class="questionList" v-if="activeMenu == '涔犻'"> + <div class="resourceSearchBox"> + <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="JumpPosition(item)" + :title="item.resourceName" + > + {{ item.resourceName }} </div> </div> </div> @@ -471,9 +531,9 @@ </div> <div class="rightBox"> <div class="pageSizeBox"> - <div><img :src="zoomOut" @click="changePageSize('reduce')" /></div> + <div class="hover"><img :src="zoomOut" @click="changePageSize('reduce')" /></div> <div>{{ headerData.pageSize }}%</div> - <div><img :src="zoomIn" @click="changePageSize('add')" /></div> + <div class="hover"><img :src="zoomIn" @click="changePageSize('add')" /></div> </div> <!-- <div class="brushImgBox"> <div @click="jumpContent('note' + index)"> @@ -713,9 +773,8 @@ </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="item.name === activeTool ? 'activeItem hover' : 'menuItem hover'" :style="!toolState.open ? 'padding:10px 15px' : ''" v-if="item.isShow" @click="selectTeachTools(item)" @@ -726,7 +785,10 @@ </li> </ul> </div> - <div :class="['openBox', toolState.open ? 'right' : '']"> + <div + :class="['openBox', toolState.open ? 'right' : '']" + v-if="teachToolsMenuData.length > 0" + > <!-- <img :src="shouqiR" v-if="toolState.open" @click="toolState.open = false" /> --> <!-- <img :src="shouqiL" v-if="!toolState.open" @click="toolState.open = true" /> --> <svg @@ -810,12 +872,7 @@ :style="`left:${floatingToolData.elLeft}px`" v-if="floatingToolBox.length > 0" > - <div - class="hover" - 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" @@ -852,13 +909,24 @@ </div> </template> </el-popover> + <div class="floatToolItem mark" v-if="floatingToolData.activeBookmark == '涔︾'"> + <el-tooltip class="box-item" effect="dark" :content="item.name" placement="right"> + <div class="imgBox"> + <img :src="tagW" alt="" v-if="floatingToolData.activeBookmark == item.name" /> + <img :src="item.icon" alt="" v-else /> + </div> + </el-tooltip> + </div> <div :class=" floatingToolData.activeToolData == item.name ? 'floatToolActive floatToolItem' : 'floatToolItem' " - v-else + v-else-if=" + floatingToolData.activeToolData != '涔︾' && + floatingToolData.activeToolData != '鏍囪' + " > <el-tooltip class="box-item" effect="dark" :content="item.name" placement="right"> <div class="imgBox"> @@ -890,7 +958,7 @@ </div> </div> </div> - <div class="toolSelectBox" v-show="!(toolActive == '楂樹寒' || toolActive == '鍒掔嚎')"> + <div class="toolSelectBox" v-show="toolActive != '楂樹寒' && toolActive != '鍒掔嚎'"> <div v-for="item in dialogToolList" :key="item.icon" @click="dialogToolHandle(item)"> <div :class="item.name == toolActive ? 'dialogToolItem active' : 'dialogToolItem'" @@ -915,12 +983,12 @@ <!-- <el-button @click="delUserKey">鍒犻櫎</el-button> --> <div class="dialogToolItem"> <el-tooltip class="box-item" effect="dark" content="鍒犻櫎" placement="bottom"> - <img :src="trash" @click="delUserKey" /> + <img :src="deleteIcon" @click="delUserKey" /> </el-tooltip> </div> - <div class="dialogToolItem"> - <el-tooltip class="box-item" effect="dark" content="绗旇" placement="bottom" v-if="isUpdate"> - <img :src="noteUpdate" @click="updateNote" /> + <div class="dialogToolItem" v-if="isUpdate"> + <el-tooltip class="box-item" effect="dark" content="绗旇" placement="bottom"> + <img :src="biji2" @click="updateNote" /> </el-tooltip> </div> </div> @@ -943,14 +1011,23 @@ :style="{ top: `${dialogToolData.top}px`, left: `${dialogToolData.left}px` }" > <div class="content"> + <div class="word">{{ dictionaryData.data.word }}</div> <div class="phone_con"> <div class="per-phone"> - 鑻� /<span>{{ dictionaryData.data.ukPhone }}</span - >/ + 鑻� <span>/{{ dictionaryData.data.ukPhone }}/</span + ><img + :src="sound" + class="soundBtn hover" + @click="soundWord(dictionaryData.data.word, 'en-UK')" + /> </div> <div class="per-phone"> - 缇� /<span>{{ dictionaryData.data.usPhone }}</span - >/ + 缇� <span>/{{ dictionaryData.data.usPhone }}/</span + ><img + :src="sound" + class="soundBtn hover" + @click="soundWord(dictionaryData.data.word, 'en-US')" + /> </div> </div> <div class="trans"> @@ -964,18 +1041,26 @@ </div> </div> - <el-dialog title="璧勬簮" align-center v-model="resourVisble" width="845" class="resourDialog"> + <el-dialog + title="璧勬簮" + align-center + v-model="resourVisble" + width="845" + class="resourDialog" + :before-close="resourVisbleClose" + > <div class="videoBox" v-if="resourType == '瑙嗛'"> <video controls controlslist="nodownload" :src="testVideo"></video> </div> - <div class="videoBox" v-if="resourType == '闊抽'"> - <!-- <video controls controlslist="nodownload" :src="testVideo"></video> --> - <audio ref="audioPlayer" :src="testVideo" controls></audio> - </div> + <!-- <div class="wordBox" v-if="resourType == 'word'"> <vue-office-docx :src="testWord" /> </div> --> </el-dialog> + <div class="audioBox" v-show="false"> + <!-- <video controls controlslist="nodownload" :src="testVideo"></video> --> + <audio ref="audioPlayer" :src="testAudio" controls @loadedmetadata="autoPlay"></audio> + </div> <!-- 鍥剧墖 --> <el-image-viewer v-if="confirmDialog" @@ -1082,11 +1167,15 @@ <iframe src="https://adjam93.github.io/threejs-model-viewer/#" frameborder="0"></iframe> </div> </el-dialog> + <el-dialog title="鐢熻瘝鍗$墖" align-center v-model="shengciVisble" width="800" class="myDialogs"> + <div class="wendabox"> + <newWord :resourceUrl="resourceUrl" /> + </div> + </el-dialog> </template> <script setup lang="ts"> -import { ref, reactive, watch, onMounted, onBeforeMount, inject } from 'vue' -import { ctxUrl } from '@/assets/js/config' +import { ref, reactive, watch, onMounted, onBeforeMount, onBeforeUnmount, inject } from 'vue' import { useRouter, useRoute } from 'vue-router' import useClipboard from 'vue-clipboard3' const { toClipboard } = useClipboard() @@ -1099,6 +1188,7 @@ let route = useRoute() import moment from 'moment' import dictionary from '@/views/components/dictionary.vue' +import newWord from '@/views/components/newWord.vue' import { ElMessage, ElMessageBox, valueEquals } from 'element-plus' import logo from '@/assets/images/header/logo.png' import mulu from '@/assets/images/menu/mulu.png' @@ -1107,10 +1197,13 @@ import zhishitupu from '@/assets/images/menu/zhishitupu.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 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 search1 from '@/assets/images/operation/search1.png' +import sound from '@/assets/images/operation/sound.png' +import listSearch from '@/assets/images/operation/list-search.svg' import aIzhinengwenda from '@/assets/images/menu/AIzhinengwenda.png' import aIyuyinyuedu from '@/assets/images/menu/AIyuyinyuedu.png' @@ -1129,56 +1222,57 @@ import daiban from '@/assets/images/menu/daiban.png' import shouqiR from '@/assets/images/menu/shouqi-R.png' import shouqiL from '@/assets/images/menu/shouqi-L.png' -import charuziyuan from '../assets/images/operation/charuziyuan.png' -import charuziyuan_blue from '../assets/images/operation/charuziyuan_blue.png' -import dati_charu from '../assets/images/operation/dati_charu.png' -import dati_charu_blue from '../assets/images/operation/dati_charu_blue.png' -import xiake from '../assets/images/operation/xiake.png' +import charuziyuan from '@/assets/images/operation/charuziyuan.png' +import charuziyuan_blue from '@/assets/images/operation/charuziyuan_blue.png' +import dati_charu from '@/assets/images/operation/dati_charu.png' +import dati_charu_blue from '@/assets/images/operation/dati_charu_blue.png' +import xiake from '@/assets/images/operation/xiake.png' -import huabi from '../assets/images/operation/huabi-w.png' -import wenzi2 from '../assets/images/operation/wenzi.png' -import biaoqianw from '../assets/images/operation/biaoqian-w.png' -import baiban from '../assets/images/operation/baiban-w.png' -import biaozhu from '../assets/images/operation/pencil-minus.svg' -import jieping from '../assets/images/operation/screenshot-w.png' -import clearPrevious from '../assets/images/operation/clearPrevious.png' -import hide from '../assets/images/operation/hide.png' -import show from '../assets/images/operation/show.png' -import tuichu from '../assets/images/operation/tuichu.png' -import tuxing from '../assets/images/operation/tuxing.png' -import chongzuo from '../assets/images/operation/chongzuo.png' -import qingchu2 from '../assets/images/operation/qingchu.png' +import huabi from '@/assets/images/operation/huabi-w.png' +import wenzi2 from '@/assets/images/operation/wenzi.png' +import biaoqianw from '@/assets/images/operation/biaoqian-w.png' +import tagW from '@/assets/images/operation/tag-w.svg' +import baiban from '@/assets/images/operation/baiban-w.png' +import biaozhu from '@/assets/images/operation/pencil-minus.svg' +import jieping from '@/assets/images/operation/screenshot-w.png' +import clearPrevious from '@/assets/images/operation/clearPrevious.png' +import hide from '@/assets/images/operation/hide.png' +import show from '@/assets/images/operation/show.png' +import tuichu from '@/assets/images/operation/tuichu.png' +import tuxing from '@/assets/images/operation/tuxing.png' +import chongzuo from '@/assets/images/operation/chongzuo.png' +import qingchu2 from '@/assets/images/operation/qingchu.png' -import gaoliang from '../assets/images/operation/gaoliang.png' -import gaoliang1 from '../assets/images/operation/gaoliang-b.png' -import huaxian from '../assets/images/operation/huaxian.png' -import huaxian1 from '../assets/images/operation/huaxian1.png' -import biji2 from '../assets/images/operation/biji.png' -import biji1 from '../assets/images/operation/biji-b.png' -import biaozhu2 from '../assets/images/operation/biaozhu.png' -import biaozhu3 from '../assets/images/operation/biaozhu1.png' -import fuzhi from '../assets/images/operation/fuzhi.png' -import fuzhi1 from '../assets/images/operation/fuzhi-b.png' -import AIyuedu from '../assets/images/operation/AIyuedu.png' -import AIyuedu1 from '../assets/images/operation/AIyuedu-b.png' -import cidian2 from '../assets/images/operation/cidian.png' -import cidian1 from '../assets/images/operation/cidian-b.png' -import baidu from '../assets/images/operation/baidu.png' -import baidu1 from '../assets/images/operation/baidu-b.png' -import yuyinyuedu from '../assets/images/operation/yuyinyuedu.png' -import yuyinyuedu1 from '../assets/images/operation/yuyinyuedu-b.png' -import xuanzhong from '../assets/images/operation/xuanzhong.png' -import xuanzhong1 from '../assets/images/operation/xuanzhong1.png' +import gaoliang from '@/assets/images/operation/gaoliang.png' +import gaoliang1 from '@/assets/images/operation/gaoliang-b.png' +import huaxian from '@/assets/images/operation/huaxian.png' +import huaxian1 from '@/assets/images/operation/huaxian1.png' +import biji2 from '@/assets/images/operation/biji.png' +import biji1 from '@/assets/images/operation/biji-b.png' +import biaozhu2 from '@/assets/images/operation/biaozhu.png' +import biaozhu3 from '@/assets/images/operation/biaozhu1.png' +import fuzhi from '@/assets/images/operation/fuzhi.png' +import fuzhi1 from '@/assets/images/operation/fuzhi-b.png' +import AIyuedu from '@/assets/images/operation/AIyuedu.png' +import AIyuedu1 from '@/assets/images/operation/AIyuedu-b.png' +import cidian2 from '@/assets/images/operation/cidian.png' +import cidian1 from '@/assets/images/operation/cidian-b.png' +import baidu from '@/assets/images/operation/baidu.png' +import baidu1 from '@/assets/images/operation/baidu-b.png' +import yuyinyuedu from '@/assets/images/operation/yuyinyuedu.png' +import yuyinyuedu1 from '@/assets/images/operation/yuyinyuedu-b.png' +import xuanzhong from '@/assets/images/operation/xuanzhong.png' +import xuanzhong1 from '@/assets/images/operation/xuanzhong1.png' -import zoomIn from '../assets/images/operation/zoomIn.png' -import zoomOut from '../assets/images/operation/zoomOut.png' -import huabi2 from '../assets/images/operation/huabi.svg' -import trash from '../assets/images/operation/trash.svg' -import noteUpdate from '../assets/images/operation/Note-b.svg' +import zoomIn from '@/assets/images/operation/zoomIn.png' +import zoomOut from '@/assets/images/operation/zoomOut.png' +import huabi2 from '@/assets/images/operation/huabi.svg' +import deleteIcon from '@/assets/images/operation/delete1.svg' +import noteUpdate from '@/assets/images/operation/Note-b.svg' -import shanchu from '../assets/images/operation/delete.png' -import bianji from '../assets/images/operation/bianji.png' -import video from '../assets/images/content/resource.png' +import shanchu from '@/assets/images/operation/delete.png' +import bianji from '@/assets/images/operation/bianji.png' +import video from '@/assets/images/content/resource.png' //寮曞叆VueOfficeDocx缁勪欢 import VueOfficeDocx from '@vue-office/docx' //寮曞叆鐩稿叧鏍峰紡 @@ -1191,6 +1285,7 @@ import { loadMicroApp } from 'qiankun' import { microApps } from '@/child.ts' +let token = localStorage.getItem('token') const canvasWith = ref(1000) const canvasheight = ref(3000) const screenWidth = ref( @@ -1202,7 +1297,9 @@ const activeCatalog = ref() const reMarResult = ref() onMounted(() => { - getUserInfo() + if (token) { + getUserInfo() + } setTimeout(() => { canvasWith.value = document.querySelector('.content-box').offsetWidth canvasheight.value = document.querySelector('.content-box').offsetHeight @@ -1220,9 +1317,8 @@ window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth })() } - // 鍔犺浇寰簲鐢� - microApp = loadMicroApp(microApps.book1, { + microApp = loadMicroApp(microApps[localStorage.getItem('bookId')], { sandbox: { strictStyleIsolation: true, experimentalStyleIsolation: true @@ -1233,6 +1329,7 @@ window.qiankunActions.onGlobalStateChange((state, prev) => { console.log('鐖跺眰state鍙樺寲', state) window.qiankunState = state + if (window.qiankunState && window.qiankunState.initTestBook) { window.qiankunState.initTestBook( localStorage.getItem('bookId') + '', @@ -1243,7 +1340,8 @@ // 瀹氫箟鐖跺眰鏂规硶 window.qiankunActions.setGlobalState({ - state: 1, // 鍔犺浇瀛愬簲鐢� + state: 1, + disableSign: false, windowSelection: (data) => { // 缁戝畾瀛愬簲鐢ㄩ�夋嫨鐩戝惉浜嬩欢 console.log(data, '瀛愬簲鐢ㄩ�夋嫨') @@ -1253,6 +1351,7 @@ showToolBox.value = false lineDelete.showLineDelete = false dictionaryData.showContent = false + isUpdate.value = false toolActive.value = '' lineDelete.top = data.y + 20 lineDelete.left = data.x @@ -1260,30 +1359,47 @@ }, chooseWords: (data) => { console.log(data, '鑻辫鐢熻瘝') - if (data) { - dialogToolData.txt = data.word - dialogToolData.left = data.x - dialogToolData.top = data.y + 20 - getSearchResult() + switch (data.type) { + case 'word': + if (data) { + dialogToolData.txt = data.word + dialogToolData.left = data.x + dialogToolData.top = data.y + 20 + getSearchResult() + } + break + case 'swdt': + console.log() + siweiVisble.value = true + break + case 'readText': + window.speechSynthesis.cancel() + const synth = window.speechSynthesis + const utterances = new SpeechSynthesisUtterance(data.data) + // utterances.lang = 'EN' // 璁剧疆璇█涓轰腑鏂� + synth.speak(utterances) + + break } }, getBookConfig: (data) => { console.log(data.bookConfig, '鍥句功閰嶇疆') bookConfig.value = data.bookConfig getCatalogueData() - getResourceData() + // getResourceData() getTextbookComponents() - getReMarkList() + // getReMarkList() }, catalogChange: (data) => { activeCatalog.value = data.showCatalogList - getSignData() + if (!window.qiankunState.disableSign && token) { + getSignData() + } console.log(data, '绔犺妭鍒囨崲锛氱洰鍓嶆樉绀虹殑涓変釜绔犺妭') }, pageChange: (data) => { headerData.process = Number(data.page) currentChapter.value = data.catalog - // catalogTree.value.filter(Number(data.start)) console.log(data, '椤甸潰鍒囨崲锛氱洰鍓嶆樉绀洪〉闈㈠拰瀵瑰簲鐨勭珷鑺備俊鎭�') if (catalogTree.value) { catalogTree.value.setCurrentKey(Number(data.page)) @@ -1291,20 +1407,31 @@ showToolBox.value = false lineDelete.showLineDelete = false dictionaryData.showContent = false + + reMarkCon.value = data.text reMarResult.value = reMarkData.value.find((item) => { return item.chapterNum == data.catalog && item.page == data.page }) if (reMarResult.value) { + floatingToolData.activeBookmark = '涔︾' floatingToolData.activeToolData = '涔︾' } else { + floatingToolData.activeBookmark = '' floatingToolData.activeToolData = '' } } }) - // 璋冪敤瀛愬眰鏂规硶 - // if (window.qiankunState && window.qiankunState.aa) window.qiankunState.aa(1) + // // 璋冪敤瀛愬眰鏂规硶 + // if (window.qiankunState && window.qiankunState.getAnswers){ + // window.qiankunState.getAnswers(localStorage.getItem("")) + // } }) +onBeforeUnmount(() => { + if (microApp) { + microApp.unmount() // 鍗歌浇寰簲鐢� + } +}) // watch( // () => screenWidth.value, // (val) => { @@ -1326,21 +1453,26 @@ if (res) { let teacherRole = res.roleLinks.find((item) => item.role.refCode == 'teacher') let teacherInfos = res.infoList.find((item) => item.type == 'teacherInfo') + let wechatInfo = res.infoList.find((item) => item.type == 'WeChat') + let studentInfo = res.infoList.find((item) => item.type == 'Default') let phoneInfo = res.secretList.find((item) => item.type == 'MobilePhone') let nameAndPassword = res.secretList.find((item) => item.type == 'LoginNameAndPassword') - if (nameAndPassword) { + if (teacherRole && teacherInfos) { userInfo.value = { - name: nameAndPassword.credential - } - localStorage.setItem('userInfo', JSON.stringify(userInfo.value)) - } else if (teacherRole && teacherInfos) { - userInfo.value = { + ...teacherInfos, name: teacherInfos.name, role: 'Teacher', roleId: teacherRole.role.id } localStorage.setItem('userInfo', JSON.stringify(userInfo.value)) + } else if (wechatInfo) { + userInfo.value = { + ...wechatInfo, + phoneNumber: phoneInfo?.credential, + Email: emailInfo?.credential, + role: 'Student' + } } else if (phoneInfo) { userInfo.value = { name: phoneInfo.credential @@ -1367,6 +1499,11 @@ isShow: bookConfig.value.textbookComponents.indexOf('1E16353F') > -1 }, { + name: '妫�绱�', + icon: allSearch, + isShow: bookConfig.value.textbookComponents.indexOf('B7C5B45D') > -1 + }, + { name: '绗旇', icon: biji, isShow: bookConfig.value.textbookComponents.indexOf('A3298FCF') > -1 @@ -1390,7 +1527,12 @@ name: '涔︾', icon: biaoqian, isShow: bookConfig.value.textbookComponents.indexOf('CF2E1400') > -1 - } + }, + // { + // name: '涔犻', + // icon: zhishitupu, + // isShow: true + // } ] teachToolsMenuData = [ { @@ -1404,7 +1546,7 @@ isShow: bookConfig.value.textbookComponents.indexOf('83FB80FD') > -1 }, { - name: '鐢熷瓧鍗$墖', + name: '鐢熻瘝鍗$墖', icon: shengzikapian, isShow: bookConfig.value.textbookComponents.indexOf('38D32EE3') > -1 }, @@ -1535,10 +1677,12 @@ ] } +const listLoading = ref(false) //鑾峰彇鐩綍 const catalogueData = ref([]) const getCatalogueData = () => { + listLoading.value = true axios .get(bookConfig.value.resourceUrl + '/information.json') .then(function (response) { @@ -1547,6 +1691,7 @@ console.log(json, '鐩綍') catalogueData.value = json.data headerData.totlePage = json.data[json.data.length - 1].end + listLoading.value = false }) .catch(function (error) { console.log(error) @@ -1555,7 +1700,7 @@ const defaultProps = { children: 'children', label: 'label', - page: 'page' + start: 'start' } const filterNode = (value, data) => { @@ -1565,9 +1710,22 @@ const handleNodeClick = (data) => { console.log(data) - headerData.process = data.start - if (window.qiankunState && window.qiankunState.gotoPage) - window.qiankunState.gotoPage(data.chapter, data.start) + if (localStorage.getItem('tryPageCount')) { + if (data.start < localStorage.getItem('tryPageCount')) { + headerData.process = data.start + if (window.qiankunState && window.qiankunState.gotoPage) + window.qiankunState.gotoPage(data.chapter, data.start) + } else { + ElMessage({ + message: '璇曡宸茬粨鏉�!', + type: 'warning' + }) + } + } else { + headerData.process = data.start + if (window.qiankunState && window.qiankunState.gotoPage) + window.qiankunState.gotoPage(data.chapter, data.start) + } } //鑾峰彇璧勬簮 @@ -1583,208 +1741,227 @@ const resourVisble = ref(false) const resourType = ref('') //璧勬簮绫诲瀷鍥剧墖/闊抽 const testVideo = ref('') //瑙嗛閾炬帴 +const testAudio = ref('') //闊抽閾炬帴 const testWord = ref('') //word閾炬帴 const showHandle = ref(null) - +const playIndex = ref(null) //闊抽鎾斁 +const audioPlayer = ref(null) const getResourceData = () => { - imgPreviewList.value = [] - 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 (resourceType.value == 'default') { - if (item.isTeacherResource == '鍚�') { - defaultResourceList.value.push(item) + 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 { + 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 (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 + defaultResourceList.value.forEach((resItem1) => { + if (resItem1.resourceType == classifySelectList.value[0].title) { + resourceDataList.value.push(resItem1) + } + }) } } else { - if (item.isTeacherResource == '鏄�') { - teacherResourceList.value.push(item) + 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 (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) - } - 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++ + if (audioCount > 0) { + classifySelectList.value.push({ + title: '闊抽', + count: audioCount, + key: 'audio' + }) } - }) - classifySelectList.value = [] - if (imgCount > 0) { - classifySelectList.value.push({ - title: '鍥剧墖', - count: imgCount, - key: 'image' - }) - imgPreviewList.value = resourceDataList.value - } - 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) - } - 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++ + if (videoCount > 0) { + classifySelectList.value.push({ + title: '瑙嗛', + count: videoCount, + key: 'video' + }) } - }) - classifySelectList.value = [] - if (imgCount > 0) { - classifySelectList.value.push({ - title: '鍥剧墖', - count: imgCount, - key: 'image' - }) - imgPreviewList.value = resourceDataList.value - } - 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 (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 + }) + .catch(function (error) { + console.log(error) + }) + } else { + ElMessageBox.confirm('璇峰厛鐧诲綍锛�', { + confirmButtonText: '鍘荤櫥褰�', + cancelButtonText: '鍙栨秷', + autofocus: false, + type: 'warning' }) - .catch(function (error) { - console.log(error) - }) + .then(() => { + router.push('/login') + }) + .catch(() => {}) + } } //璧勬簮鎾斁瑙嗛 -const goPlay = (data) => { +const goPlay = (data, index) => { resourType.value = data.resourceType - if (data.resourceType == '瑙嗛' || data.resourceType == '闊抽') { - resourVisble.value = true + if (data.resourceType == '瑙嗛') { if (data.md5) { testVideo.value = bookConfig.value.requestCtx + '/file/api/ApiDownload?md5=' + data.md5 } else { testVideo.value = bookConfig.value.resourceUrl + '/' + data.resourcePath } + resourVisble.value = true + } else if (data.resourceType == '闊抽') { + playIndex.value = index + if (data.md5) { + testAudio.value = bookConfig.value.requestCtx + '/file/api/ApiDownload?md5=' + data.md5 + } else { + testAudio.value = bookConfig.value.resourceUrl + '/' + data.resourcePath + } + autoPlay() } else { if (data.md5) { window.open(bookConfig.value.requestCtx + '/file/api/ApiDownload?md5=' + data.md5) @@ -1797,9 +1974,25 @@ // testWord.value = bookConfig.value.resourceUrl + '/' + data.resourcePath // } } +// 鍏抽棴瑙嗛 +const resourVisbleClose = () => { + resourVisble.value = false + testVideo.value = '' +} +const autoPlay = () => { + if (audioPlayer.value) { + audioPlayer.value.play() + } +} +const goPause = () => { + playIndex.value = null + testAudio.value = '' +} +// //璧勬簮璺宠浆鍒版寚瀹氫綅缃� const JumpPosition = (data) => { + console.log(data, '璺宠浆') if (window.qiankunState && window.qiankunState.gotoPage) { window.qiankunState.gotoPage(Number(data.chapterNum), Number(data.pagination)) } @@ -1826,12 +2019,63 @@ } } +//涔犻 +const exercisesType = ref('exercises') //涔犻绫诲瀷 +const questionList = ref([]) +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 + }) + } else { + ElMessageBox.confirm('璇峰厛鐧诲綍锛�', { + confirmButtonText: '鍘荤櫥褰�', + cancelButtonText: '鍙栨秷', + autofocus: false, + type: 'warning' + }) + .then(() => { + router.push('/login') + }) + .catch(() => {}) + } +} +const selectExercisesType = (type) => { + exercisesType.value = type + searchText.value = '' + + if (type == 'exercises') { + getExercisesList() + } else { + questionList.value = [] + } +} + // 閫変腑鑿滃崟 const activeMenu = ref('鐩綍') // 鑿滃崟鐐瑰嚮 const menuItemClick = (name) => { searchText.value = '' + allSearchReault.value = [] if (menuState.open && activeMenu.value == name) { menuState.open = false } else { @@ -1845,6 +2089,7 @@ getNotesList() break case '璧勬簮': + getResourceData() break case '鐭ヨ瘑鍥捐氨': break @@ -1853,6 +2098,11 @@ break case '涔︾': getReMarkList() + break + case '妫�绱�': + break + case '涔犻': + getExercisesList() break } } @@ -1899,6 +2149,10 @@ animation: false, bgColorList: [ { + lable: '鐧�', + key: '#fff' + }, + { lable: '榛�', key: '#FBF9F4' }, @@ -1936,6 +2190,9 @@ }) } const bgColorSelect = (item) => { + window.qiankunActions.setGlobalState({ + bgColor: item.key + }) settingForm.bgColorActive = item.key } //绗旇棰滆壊绛涢�� @@ -1960,6 +2217,11 @@ } const catalogTree = ref() +const allSearchReault = ref([]) +const searchReaultData = reactive({ + isShow: true, + openIndex: 0 +}) const searchBook = async () => { switch (activeMenu.value) { case '鐩綍': @@ -1991,6 +2253,127 @@ case '涔︾': getReMarkList() break + case '涔犻': + getExercisesList() + break + case '妫�绱�': + listLoading.value = true + allSearchReault.value = [] + console.log(window.qiankunState.searchBookByKeyword) + if (window.qiankunState && window.qiankunState.searchBookByKeyword) { + let searchReault = window.qiankunState.searchBookByKeyword(searchText.value) + if (searchReault.length > 0) { + let catalogueList = sortArr(catalogueData.value, 'chapter') + if (catalogueList.length > 0) { + catalogueList.forEach((item) => { + let labels = '' + if (item.length > 1) { + labels = item.map((i) => i.label).join('/') + } + let itemList = [] + let text = searchText.value.replace(/^\s*|\s*$/g, '') + searchReault.forEach((item1) => { + if (item[0].chapter == item1.catalog) { + item1.txt1 = item1.txt + let replaceStr = "<span class='searchColor'>" + text + '</span>' + + let htmlStr = item1.txt1.split(text).join(replaceStr) + item1.txt1 = '<p>' + htmlStr + '</p>' + itemList.push(item1) + } + }) + if (itemList.length > 0) { + allSearchReault.value.push({ + chapter: item[0].chapter, + chapterName: labels ? labels : item[0].label, + itemList: itemList + }) + } + }) + } + console.log(allSearchReault.value, 444) + listLoading.value = false + } + } + break + } +} + +function sortArr(arr, str) { + var _arr = [], + _t = [], + // 涓存椂鐨勫彉閲� + _tmp + + // 鎸夌収鐗瑰畾鐨勫弬鏁板皢鏁扮粍鎺掑簭灏嗗叿鏈夌浉鍚屽�煎緱鎺掑湪涓�璧� + arr = arr.sort(function (a, b) { + var s = a[str], + t = b[str] + + return s < t ? -1 : 1 + }) + + if (arr.length) { + _tmp = arr[0][str] + } + // console.log( arr ); + // 灏嗙浉鍚岀被鍒殑瀵硅薄娣诲姞鍒扮粺涓�涓暟缁� + for (var i in arr) { + if (arr[i][str] === _tmp) { + _t.push(arr[i]) + } else { + _tmp = arr[i][str] + _arr.push(_t) + _t = [arr[i]] + } + } + // 灏嗘渶鍚庣殑鍐呭鎺ㄥ嚭鏂版暟缁� + _arr.push(_t) + return _arr +} +//妫�绱㈢珷鑺傛敹璧� +const searchOpen = (index) => { + searchReaultData.isShow = true + searchReaultData.openIndex = index +} +//妫�绱㈢珷鑺傛墦寮� +const searchClose = (index) => { + searchReaultData.isShow = false + searchReaultData.openIndex = index +} + +//妫�绱㈣烦杞� +const goSearchContent = (item) => { + if (window.qiankunState && window.qiankunState.gotoPage) { + window.qiankunState.jumpSearchItem(item) + } +} + +const handleClear = () => { + switch (activeMenu.value) { + case '鐩綍': + if (catalogTree) catalogTree.value.filter(searchText.value) + break + case '绗旇': + getNotesList() + break + case '璧勬簮': + getResourceData() + break + case '鐭ヨ瘑鍥捐氨': + break + case '鎴浘': + getScreenshotList() + break + case '涔︾': + getReMarkList() + break + case '妫�绱�': + allSearchReault.value = [] + break + case '涔犻': + getExercisesList() + break } } @@ -2000,29 +2383,47 @@ const functionVisible = ref(false) const siweiVisble = ref(false) const modelToolVisble = ref(false) +const shengciVisble = ref(false) const activeTool = ref(0) const toolState = reactive({ open: true }) +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 + 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(() => {}) } } @@ -2055,6 +2456,7 @@ let canvas = null const floatingToolData = reactive({ activeToolData: '', //閫変腑宸ュ叿 + activeBookmark: '', //閫変腑涔︾ elLeft: 390, startclientx: 0, startclienty: 0 @@ -2084,9 +2486,6 @@ console.log(floatingToolData.activeToolData, 'floatingToolData.activeToolData') if (floatingToolData.activeToolData == '鐢荤瑪') { floatingToolData.activeToolData = '' - } else if (floatingToolData.activeToolData == '涔︾') { - delReMark() - floatingToolData.activeToolData = '' } else { floatingToolData.activeToolData = item.name } @@ -2100,7 +2499,10 @@ case '鏍囪': break case '涔︾': - reMark() + if (floatingToolData.activeBookmark != '涔︾') { + floatingToolData.activeBookmark = '涔︾' + reMark() + } break case '鎴睆': jitT() @@ -2185,8 +2587,18 @@ console.log(str, '鏍囪') if (str == 'hide') { if (window.qiankunState && window.qiankunState.delSign) { - window.qiankunState.delSign({ ids: [] }) + window.qiankunState.delSign({ type: 'Highlight' }) + window.qiankunState.delSign({ type: 'Dashing' }) + window.qiankunState.delSign({ type: 'Note' }) } + window.qiankunActions.setGlobalState({ + disableSign: true + }) + } else { + window.qiankunActions.setGlobalState({ + disableSign: false + }) + getSignData() } } @@ -2195,63 +2607,111 @@ const reMarkList = ref([]) const reMarkData = ref([]) const reMarkId = ref([]) +const reMarkCon = ref('') const reMark = () => { - let chapterData = catalogueData.value.find((item) => item.chapter == Number(currentChapter.value)) - console.log(chapterData) - if (chapterData) { - reMarkData.value.push({ - id: toolClass.uuid(8), - createDate: new Date(), - page: headerData.process, - chapterNum: currentChapter.value, - chapterName: chapterData.label - }) - MG.identity - .setUserKey({ - setKeyRequests: [ - { - domain: 'reMark', - key: bookConfig.value.bookId, - value: JSON.stringify(reMarkData.value) - } - ] + 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 + } }) - .then((res) => { - floatingToolData.activeToolData = '' - ElMessage({ - message: '娣诲姞涔︾鎴愬姛!', - type: 'success' + } + + 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) + } + ] }) - 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 = [] - 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.name.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 + }) + } else { + ElMessageBox.confirm('璇峰厛鐧诲綍锛�', { + confirmButtonText: '鍘荤櫥褰�', + cancelButtonText: '鍙栨秷', + autofocus: false, + type: 'warning' }) + .then(() => { + router.push('/login') + }) + .catch(() => {}) + } +} + +//璺宠浆 +const goReMark = (item) => { + console.log(item) + if (window.qiankunState && window.qiankunState.gotoPage) { + window.qiankunState.gotoPage(Number(item.chapterNum), Number(item.page)) + } } // 鍐呭椤靛垹闄や功绛� const delReMark = () => { @@ -2299,12 +2759,25 @@ //鎴浘 //鎴浘浜嬩欢 function jitT() { - const screenShotHandler = new ScreenShort({ - enableWebRtc: false, // 鏄惁鏄剧ず閫夐」妗� - level: 99, // 灞傜骇绾у埆 - 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) => { @@ -2323,7 +2796,7 @@ if (isUpdateImg.value) { screenshotData.value = [] screenshotList.value.forEach((itemNote) => { - if ((itemNote.id = screenshotId.value)) { + if (itemNote.id == screenshotId.value) { itemNote.name = nameData.value } }) @@ -2369,41 +2842,55 @@ } const getScreenshotList = () => { - screenshotData.value = [] - screenshotList.value = [] - imgPreviewList.value = [] - 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 + }) + } else { + ElMessageBox.confirm('璇峰厛鐧诲綍锛�', { + confirmButtonText: '鍘荤櫥褰�', + cancelButtonText: '鍙栨秷', + autofocus: false, + type: 'warning' }) + .then(() => { + router.push('/login') + }) + .catch(() => {}) + } } //鏌ョ湅鎴浘 const getCapture = (item, index) => { - imgUrl.value = item.imgUrl + imgUrl.value = item.imgUrl || item.resourcePath previewIndex.value = index confirmDialog.value = true } const closePreview = () => { - imgPreviewList.value = [] confirmDialog.value = false } // 缂栬緫鎴浘鍚嶇О @@ -2468,6 +2955,9 @@ dialogToolData.left = data.x dialogToolData.top = data.y showToolBox.value = true + dictionaryData.showContent = false + lineDelete.showLineDelete = false + dictionaryData.showContent = false } } @@ -2530,53 +3020,71 @@ const synth = window.speechSynthesis const dialogToolHandle = async (item) => { - toolActive.value = item.name - colorActive.value = '' - switch (item.name) { - case 'AI闃呰': - const utterance = new SpeechSynthesisUtterance(dialogToolData.txt) - 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 + }) } } @@ -2590,213 +3098,257 @@ } 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] - console.log(citem.type, citem) - 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 - // 娓叉煋 - 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 - // 娓叉煋 - 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 = [] - 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 = list + itemList.push(item) } else if (item.color == menuState.notesColor) { itemList.push(item) } } - } else { - if (menuState.notesColor == 'all') { - itemList = list - } 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 + }) + } else { + ElMessageBox.confirm('璇峰厛鐧诲綍锛�', { + confirmButtonText: '鍘荤櫥褰�', + cancelButtonText: '鍙栨秷', + autofocus: false, + type: 'warning' }) + .then(() => { + router.push('/login') + }) + .catch(() => {}) + } } //姝f枃涓垹闄ら珮浜紝鍒掔嚎锛岀瑪璁版搷浣滄 @@ -2816,6 +3368,7 @@ lineDelete.id = id lineDelete.showLineDelete = true if (type == 'Note') { + noteContent.show = false let list = dialogToolData.notesList[chapterNum] let data = list.find((item) => item.id == id) formData.id = id @@ -2840,22 +3393,21 @@ color: '' }) window.noteHover = (type, id, chapterNum) => { - console.log(type, 'typetype') let list = dialogToolData.notesList[chapterNum] let data = list.find((item) => item.id == id) noteContent.note = data.note noteContent.color = data.color + noteContent.show = true document.addEventListener('mousemove', function (event) { var x = event.offsetX var y = event.offsetY // console.log('榧犳爣鍧愭爣浣嶇疆锛�', x, y) - noteContent.top = event.clientY + 10 + noteContent.top = event.clientY + 20 noteContent.left = event.clientX - noteContent.show = true }) } -window.noteOut = () => { - console.log(123) +window.noteOut = (type) => { + console.log(type, 123) noteContent.show = false } @@ -2894,7 +3446,9 @@ if (window.qiankunState && window.qiankunState.delSign) { window.qiankunState.delSign({ ids: [ids] }) } - getSignData() + if (!window.qiankunState.disableSign) { + getSignData() + } if (type == 'Note') { getNotesList() } @@ -2922,7 +3476,7 @@ 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 } @@ -2941,7 +3495,9 @@ addNoteVisble.value = false isUpdate.value = false getNotesList() - getSignData() + if (!window.qiankunState.disableSign) { + getSignData() + } }) } @@ -3004,6 +3560,15 @@ }) } } + +//鍗曡瘝闃呰 +const soundWord = (word, en) => { + window.speechSynthesis.cancel() + const synth = window.speechSynthesis + const utterances = new SpeechSynthesisUtterance(word) + // utterances.lang = en // 璁剧疆璇█涓轰腑鏂� + synth.speak(utterances) +} //鍐呭鍖哄煙椤堕儴鏄剧ず const headerData = reactive({ @@ -3058,7 +3623,12 @@ } const layoutBtn = () => { - localStorage.clear() + localStorage.removeItem('token') + localStorage.removeItem('userInfo') + router.push('/login') +} +const goLogin = () => { + localStorage.removeItem('userInfo') router.push('/login') } </script> @@ -3072,6 +3642,7 @@ display: flex; flex-direction: column; padding: 0 15px; + .headerBox { height: 48px; // background-image: url('@/assets/images/header/top-bg.png'); @@ -3123,6 +3694,10 @@ box-shadow: 10px 0 10px -10px rgba(0, 0, 0, 0.07); background: #fff; border-radius: 16px 0px 0px 0px; + -moz-user-select: none; + -khtml-user-select: none; + user-select: none; + .menuItem { text-align: center; line-height: 1; @@ -3142,11 +3717,11 @@ display: inline-block; width: 32px; height: 32px; - .name { - text-align: center; - line-height: 1; - color: #2c3e50; - } + } + .name { + text-align: center; + line-height: 1; + color: #2c3e50; } } .reload { @@ -3168,6 +3743,9 @@ height: calc(100vh - 48px); overflow-y: auto; background: #e0f2ff; + -moz-user-select: none; + -khtml-user-select: none; + user-select: none; .searchBox { width: 100%; height: 60px; @@ -3177,7 +3755,7 @@ align-items: center; border-bottom: 1px solid #efefef; } - .resourceBox { + .resourceSearchBox { padding: 10px 0; margin: 0 20px; border-bottom: 1px solid rgba(204, 204, 204, 0.32); @@ -3270,6 +3848,7 @@ background: #fff; height: 34px; } + .is-focus, .el-input__wrapper { box-shadow: none !important; @@ -3277,6 +3856,10 @@ border: none !important; height: 34px !important; } + } + .el-input-group__append { + padding: 0 10px !important; + background: none !important; } } .screenBox { @@ -3514,18 +4097,66 @@ border-radius: 10px; padding: 10px; 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; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + margin-right: 8px; + } } .deleteReMarkImg { display: flex; align-items: center; } + .questionCon { + width: 240px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } } + + .allSearchList { + .searchItem { + margin: 15px; + background: #fff; + border-radius: 10px; + padding: 10px; + display: flex; + .index { + line-height: 24px; + margin-right: 10px; + } + .searchCon { + flex: 1; + width: 240px; + overflow: hidden; + margin-right: 8px; + height: 45px; + line-height: 22px; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + text-overflow: ellipsis; + .searchColor { + background: rgb(245, 225, 42, 0.5); + } + } + } + } + } + .allSearch, + .notesBox, + .resourceBox, + .reMarkList, + .questionList, + .screenshotList { + height: calc(100% - 60px); + overflow-y: auto; } } .menuStateBox { @@ -3589,6 +4220,8 @@ div { padding: 5px; + display: flex; + align-items: center; img { width: 18px; height: 18px; @@ -3643,6 +4276,9 @@ box-shadow: -3px 0px 6px 1px rgba(0, 0, 0, 0.07); background: #fff; border-radius: 0px 16px 0px 0px; + -moz-user-select: none; + -khtml-user-select: none; + user-select: none; .toolTitle { height: 57px; line-height: 53px; @@ -3894,6 +4530,7 @@ width: 190px; display: flex; background: #ffffff; + box-shadow: 0px 0px 10px 1px rgba(0, 0, 0, 0.16); border-radius: 5px; margin-bottom: 10px; @@ -3918,22 +4555,24 @@ z-index: 2; box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.3); padding: 5px 10px; - background: #fff; + // background: #fff; + background-color: rgba(90, 90, 90, 0.9); border-radius: 5px; display: flex; .dialogToolItem { padding: 3px; - margin: 0 10px; + margin: 0 5px; border-radius: 5px; display: flex; justify-content: center; align-items: center; } .dialogToolItem:hover { - background-color: rgba(44, 44, 44, 0.2); + background-color: rgba(255, 255, 255, 0.3); } } .noteContentBox { + max-width: 240px; position: fixed; z-index: 2; padding: 10px; @@ -3946,10 +4585,13 @@ padding: 5px 20px; background: #fff; border-radius: 5px; + .word { + font-weight: bold; + } .phone_con { .per-phone { - width: 150px; align-items: center; + // justify-content: space-between; background: #f4f5f7; border-radius: 15px; box-sizing: border-box; @@ -3961,7 +4603,12 @@ padding: 8px 10px; span { margin: 0 10px; + flex: 1; } + } + .soundBtn { + width: 16px; + height: 14px; } } .trans { @@ -3980,7 +4627,8 @@ } .wendabox { width: 100%; - height: 700px; + height: 80vh; + iframe { width: 100%; height: 100%; @@ -4020,8 +4668,12 @@ box-sizing: border-box; } } +.myDialogs { + height: 90vh; +} .myAnserDialogs { - width: 628px; + width: 700px; + height: 90vh; } .myNoteDialogs { width: 500px !important; @@ -4056,9 +4708,9 @@ video { width: 100%; } - audio { - width: 100%; - } +} +.audioBox { + // display:none; } .wordBox { -- Gitblit v1.9.1