From c8d1e1ed1d5c8d20a9aad8554d51001afb3c6312 Mon Sep 17 00:00:00 2001 From: YM <479443481@qq.com> Date: 星期三, 20 十一月 2024 15:28:27 +0800 Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/TextbookReader --- src/views/components/calculatorNew.vue | 65 ++++ src/views/components/pdfview.vue | 2 src/views/readerPages/webHome.vue | 472 +++++++++++++++++++++++++-------- src/assets/js/config.ts | 4 src/views/readerPages/home.vue | 134 ++++++--- src/child.ts | 18 + src/views/examination/index.vue | 2 src/App.vue | 10 src/views/readerPages/mobileHome.vue | 127 +++++++- src/main.ts | 3 10 files changed, 652 insertions(+), 185 deletions(-) diff --git a/src/App.vue b/src/App.vue index 93c6e67..c0d982a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -119,18 +119,20 @@ } let bookId = getUrlParam('bookId') +let chapter = getUrlParam('chapter') +let startPage = getUrlParam('startPage') let token = getUrlParam('token') -let tryPageCount = getUrlParam('tryPageCount') if(bookId){ localStorage.setItem('bookId', bookId) -} -if(tryPageCount){ - localStorage.setItem('tryPageCount', tryPageCount) } if(token && token != null && token != 'null'){ localStorage.setItem('token', token) } +if(chapter && startPage){ + localStorage.setItem('chapter', chapter) + localStorage.setItem('startPage', startPage) +} if (bookId) { router.replace({ path: '/home', diff --git a/src/assets/js/config.ts b/src/assets/js/config.ts index c6832f7..9ef7968 100644 --- a/src/assets/js/config.ts +++ b/src/assets/js/config.ts @@ -1,12 +1,14 @@ // 娴嬭瘯 export const requestCtx = "https://jsek.bnuic.com"; //jsek export const appId = 3; +// export const requestCtx = "http://182.92.203.7:3007"; //jsek +// export const appId = 27 export const requestTimeOut = 300000; // 璇锋眰瓒呮椂鏃堕棿 export const tokenKey = "token"; export const userInfoKey = "website-front-userInfo"; // 鐢ㄦ埛淇℃伅key export const appRefCode = "jingshieke"; export const goodsStore = `defaultGoodsStore${appId}`; // 榛樿鍟嗗搧搴�(涔﹀煄) export const digitalTextbooks = "jsek_digitalTextbooks";//鏁板瓧鏁欐潗 - export const loginCtx = "http://jsysf.bnuic.com/home/#/digitalTextbooks?login=true"; //鐧诲綍閾炬帴 +// export const loginCtx = ""; //鐧诲綍閾炬帴 diff --git a/src/child.ts b/src/child.ts index 0153d60..67dd7f9 100644 --- a/src/child.ts +++ b/src/child.ts @@ -58,6 +58,24 @@ entry: '//jsek.bnuic.com/books/book/artAndDrama', container: '#container', activeRule: '/home' //鍖归厤鎵�鏈変互/subPath寮�澶寸殑涓哄瓙搴旂敤 + }, + civilAviation:{ + name: 'app-content', + entry: '//jsek.bnuic.com/books/book/civilAviation', + container: '#container', + activeRule: '/home' //鍖归厤鎵�鏈変互/subPath寮�澶寸殑涓哄瓙搴旂敤 + }, + civilAviationServices:{ + name: 'app-content', + entry: '//jsek.bnuic.com/books/book/civilAviationServices', + container: '#container', + activeRule: '/home' //鍖归厤鎵�鏈変互/subPath寮�澶寸殑涓哄瓙搴旂敤 + }, + botany:{ + name: 'app-content', + entry: '//182.92.203.7:3007/books/book/botany', + container: '#container', + activeRule: '/home' //鍖归厤鎵�鏈変互/subPath寮�澶寸殑涓哄瓙搴旂敤 } } diff --git a/src/main.ts b/src/main.ts index 43ec77a..78dfb1f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -24,13 +24,10 @@ // 璺敱鎵ц涔嬪墠鐨勪竴浜涙搷浣� router.beforeEach((to, from, next) => { - console.log(to, from) const isInternalLink = from.fullPath.includes('/testBookReader') if (isInternalLink) { - console.log('閫氳繃鍐呴儴閾炬帴杩涘叆椤圭洰') sessionStorage.removeItem('loginCtx') } else { - console.log(loginCtx, '閫氳繃澶栭儴閾炬帴杩涘叆椤圭洰') sessionStorage.setItem('loginCtx', loginCtx) } diff --git a/src/views/components/calculatorNew.vue b/src/views/components/calculatorNew.vue new file mode 100644 index 0000000..075e08e --- /dev/null +++ b/src/views/components/calculatorNew.vue @@ -0,0 +1,65 @@ +<template> + <div ref="ggbContainer" class="ggb-container"></div> +</template> + +<script lang="ts"> +import { defineComponent, onMounted, ref } from 'vue'; +export default defineComponent({ + name: 'GeoGebraCalculator', + setup() { + const ggbContainer = ref<HTMLDivElement | null>(null); + + onMounted(() => { + if (!window.GGBApplet) { + const script = document.createElement('script'); + script.src = 'https://www.geogebra.org/apps/deployggb.js'; + script.onload = () => { + initGeoGebra(); + }; + document.body.appendChild(script); + } else { + initGeoGebra(); + } + + function initGeoGebra() { + var params = { + "id": "ggbApplet", + "appName": "scientific", + "width": 800, + "height": 800, + "showToolBar": true, + "borderColor": null, + "showMenuBar": true, + "allowStyleBar": true, + "showAlgebraInput": true, + "enableLabelDrags": false, + "enableShiftDragZoom": true, + "capturingThreshold": null, + "showToolBarHelp": false, + "errorDialogsActive": true, + "showTutorialLink": true, + "showLogging": true, + "useBrowserForJS": false + }; + + if (ggbContainer.value) { + const applet = new GGBApplet(params, true); + applet.inject(ggbContainer.value); + } + } + }); + + return { + ggbContainer, + }; + }, +}); +</script> + +<style scoped> +.ggb-container { + width: 100%; + height: 100%; + /* 鍏朵粬鏍峰紡 */ +} +</style> \ No newline at end of file diff --git a/src/views/components/pdfview.vue b/src/views/components/pdfview.vue index 226f239..f700400 100644 --- a/src/views/components/pdfview.vue +++ b/src/views/components/pdfview.vue @@ -131,7 +131,7 @@ MG.file .getPdfInfo({ md5: preViewMd5.value }) .then((res) => { - totalPage.value = res.totalPages + totalPage.value = JSON.parse(res).totalPages createDom(currentPage.value) }) .catch((err) => { diff --git a/src/views/examination/index.vue b/src/views/examination/index.vue index 2cba8ed..6499ea5 100644 --- a/src/views/examination/index.vue +++ b/src/views/examination/index.vue @@ -210,7 +210,7 @@ examination.loading = true examination.submitStatus = false examination.cardList = [] - examination.collectList = [] + // examination.collectList = [] examination.errorList = [] goTop() if (props.type == 'option') { diff --git a/src/views/readerPages/home.vue b/src/views/readerPages/home.vue index 419eadb..0f45f5e 100644 --- a/src/views/readerPages/home.vue +++ b/src/views/readerPages/home.vue @@ -1,17 +1,11 @@ <template> <div class="homePage"> - <webHome v-if="!homeBoxHide" /> + <webHome v-if="homeBoxWebHide" /> <mobileHome v-if="homeBoxHide" /> </div> <div class="pdfDialog"> - <el-dialog - v-model="dialogState.dialogVisible" - width="60vw" - top="2vh" - lock-scroll - :show-close="false" - class="custom-dialog" - > + <el-dialog v-model="dialogState.dialogVisible" width="60vw" top="2vh" lock-scroll :show-close="false" + class="custom-dialog"> <template #header> <div class="header_title"> <span>{{ dialogState.pdfTitle }}</span> @@ -30,11 +24,11 @@ import mobileHome from '@/views//readerPages/mobileHome.vue' import preView from '../components/pdfview.vue' // import { da } from 'element-plus/es/locale' -const qiankunActions = inject('qiankunActions') const screenWidth = ref( window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth ) const homeBoxHide = ref(false) +const homeBoxWebHide = ref(false) const dialogState = reactive({ dialogVisible: false, pdfTitle: '', @@ -44,7 +38,9 @@ onMounted(() => { if (screenWidth.value < 420) { homeBoxHide.value = true + homeBoxWebHide.value = false } else { + homeBoxWebHide.value = true homeBoxHide.value = false } window.qiankunActions.setGlobalState({ @@ -67,23 +63,10 @@ height: 100%; } -.pdfDialog { - .el-overlay { - z-index: 2004 !important; - } -} -.pdfModal { - width: 100%; - height: 90vh; -} - .custom-dialog { - overflow: hidden !important; + .el-dialog { padding: 0; - - .el-dialog__body { - padding: 0; - } +} .el-dialog__header { background-color: rgba(0, 0, 0, 0.8); @@ -116,28 +99,91 @@ } } -@media screen and (max-width: 1070px) { - .pdfModal { - width: 100%; - height: 80vh; - } - .custom-dialog { - .el-dialog { - width: 90vw !important; +.pdfModal { + width: 100%; + height: 90vh; + + .pdfBox-component { + width: 100%; + height: 100%; + position: relative; + + .preview { + width: 100%; + height: 100%; + + .imageBox { + height: calc(100% - 30px); + overflow-x: hidden; + overflow-y: auto; + background: #ccc; + box-sizing: border-box; + + img { + margin: 0 auto; + display: flex; + justify-content: center; + } + + } + + .imageBox:hover { + cursor: zoom-in !important; + } + + ::v-deep .el-dialog__header { + background-color: rgba(0, 0, 0, 0.8); + + .header_title { + display: flex; + justify-content: space-between; + align-items: center; + color: #fff; + font-weight: 900; + font-size: 16px; + font-family: 'FZLTXIHJW'; + + span:nth-child(2):hover { + cursor: pointer; + } + } + + ::v-deep .el-dialog__title, + ::v-deep .el-dialog__headerbtn .el-dialog__close { + color: #fff; + font-weight: 900; + font-size: 16px; + font-family: 'FZLTXIHJW'; + } + } + + .bottom_tool { + height: 30px; + background-color: rgba(0, 0, 0, 0.8); + display: flex; + justify-content: flex-end; + align-items: center; + + svg { + margin-right: 15px; + fill: #d1d1d1; + } + + svg:hover { + fill: #fff; + cursor: pointer; + } + } } - } -} -@media screen and (max-width: 800px) { - .pdfModal { - width: 100%; - height: 60vh; - } - - .custom-dialog { - .el-dialog { - width: 90vw !important; + .notBox { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: calc(100% - 30px); + min-height: 300px; } } } diff --git a/src/views/readerPages/mobileHome.vue b/src/views/readerPages/mobileHome.vue index bdc6540..2f0f453 100644 --- a/src/views/readerPages/mobileHome.vue +++ b/src/views/readerPages/mobileHome.vue @@ -526,21 +526,17 @@ </div> </template> <script setup lang="ts"> -import { ref, reactive, watch, onMounted, onBeforeMount, inject } from 'vue' +import { ref, reactive, watch, onMounted, onBeforeUnmount,inject } from 'vue' import axios from 'axios' -import { useRouter, useRoute } from 'vue-router' import { ElMessage, ElMessageBox, valueEquals } from 'element-plus' import useClipboard from 'vue-clipboard3' const { toClipboard } = useClipboard() const MG: any = inject('MG') const toolClass = inject('toolClass') -const qiankunActions = inject('qiankunActions') import { loadMicroApp } from 'qiankun' import { microApps } from '@/child.ts' -//鑾峰彇璺敱鍣� -let router = useRouter() + //鑾峰彇褰撳墠璺敱鐨勪俊鎭� -let route = useRoute() import moment from 'moment' import bianji from '@/assets/images/operation/bianji.png' @@ -549,13 +545,25 @@ import search from '@/assets/images/operation/search.png' import search1 from '@/assets/images/operation/search1.png' import xuanzhong from '@/assets/images/operation/xuanzhong.png' - +let token = localStorage.getItem('token') +const bookInfo = ref() +const isBuy = ref(false) +const tryPageCount = ref(0) let microApp = null // 寰簲鐢ㄥ疄渚� const bookConfig = ref({}) +let userInfo = ref({}) //褰撳墠鏄剧ず绔犺妭 const activeCatalog = ref() +const currentChapter = ref(1) onMounted(() => { + if (token) { + getUserInfo() + } + if (localStorage.getItem('bookId')) { + getBookInfo() + } // 鍔犺浇寰簲鐢� + microApp = loadMicroApp(microApps[localStorage.getItem('bookId')], { sandbox: { strictStyleIsolation: true, @@ -567,17 +575,20 @@ window.qiankunActions.onGlobalStateChange((state, prev) => { console.log('鐖跺眰state鍙樺寲', state) window.qiankunState = state - - if (window.qiankunState && window.qiankunState.initTestBook) { - window.qiankunState.initTestBook( - localStorage.getItem('bookId') + '', - localStorage.getItem('tryPageCount') - ) + if (isBuy.value) { + if (window.qiankunState && window.qiankunState.initTestBook) { + window.qiankunState.initTestBook(localStorage.getItem('bookId') + '') + } + } else { + if (window.qiankunState && window.qiankunState.initTestBook) { + window.qiankunState.initTestBook(localStorage.getItem('bookId') + '', tryPageCount.value) + } } }) // 瀹氫箟鐖跺眰鏂规硶 window.qiankunActions.setGlobalState({ + state: 1, disableSign: false, // windowSelection: (data) => { // // 缁戝畾瀛愬簲鐢ㄩ�夋嫨鐩戝惉浜嬩欢 @@ -628,15 +639,15 @@ }, catalogChange: (data) => { activeCatalog.value = data.showCatalogList - if (window.qiankunState.disableSign) { - // getSignData() - } + // if (window.qiankunState.disableSign) { + // // getSignData() + // } // getSignData() console.log(data, '绔犺妭鍒囨崲锛氱洰鍓嶆樉绀虹殑涓変釜绔犺妭') }, pageChange: (data) => { headerData.process = Number(data.page) - // currentChapter.value = data.catalog + currentChapter.value = data.catalog // console.log(data, '椤甸潰鍒囨崲锛氱洰鍓嶆樉绀洪〉闈㈠拰瀵瑰簲鐨勭珷鑺備俊鎭�') // if (catalogTree.value) { // catalogTree.value.setCurrentKey(Number(data.page)) @@ -657,6 +668,83 @@ } }) }) + +onBeforeUnmount(() => { + if (microApp) { + microApp.unmount() // 鍗歌浇寰簲鐢� + } +}) + +const getUserInfo = () => { + MG.identity.getCurrentAppUser().then((res) => { + 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 (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 + } + localStorage.setItem('userInfo', JSON.stringify(userInfo.value)) + } + } + }) +} +//鏍规嵁refcode鑾峰彇鍥句功淇℃伅 + +const getBookInfo = () => { + const obj = { + storeInfo: 'jsek_digitalTextbooks', + path: '*', + queryType: '*', + coverSize: { + width: 150 + }, + paging: { + start: 0, + size: 6 + }, + filterList: [ + { + value: 'Normal', + field: 'state' + } + ], + fields: { + author: [], + RefCodes: [localStorage.getItem('bookId')], + probationPage: [] + } + } + MG.store.getProductList(obj).then((res) => { + bookInfo.value = res.datas[0] + if (res.datas[0].purchasedSaleMethodIdList.includes(res.datas[0].defaultSaleMethodId)) { + isBuy.value = true + } else { + isBuy.value = false + } + tryPageCount.value = Number(res.datas[0].probationPage) + }) +} //鑿滃崟 const activeIndex = ref('0') @@ -1479,6 +1567,7 @@ } } +let dialogToolList = [] //閫変腑鏂囧瓧鎿嶄綔 //閫変腑鏂囧瓧宸ュ叿鏍� const showToolBox = ref(false) const toolActive = ref('') @@ -1780,7 +1869,6 @@ text-align: right; } .pageBox-content { - height: 100%; height: calc(100vh - 130px); #container { background: #fbf9f4; @@ -1788,6 +1876,9 @@ #__qiankun_microapp_wrapper_for_app_content_1__ { height: 100%; } + #__qiankun_microapp_wrapper_for_app_content__{ + height: 100%; + } } } } diff --git a/src/views/readerPages/webHome.vue b/src/views/readerPages/webHome.vue index 3ba1680..12eaf1e 100644 --- a/src/views/readerPages/webHome.vue +++ b/src/views/readerPages/webHome.vue @@ -6,9 +6,12 @@ <span></span> <div class="userInfoBox"> <div class="userName" v-if="userInfo.name">{{ userInfo.name }}</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 @click="openFormulaDialog">鍏紡</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"> @@ -197,9 +200,12 @@ @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> + > + <ArrowDown /> + </el-icon> + <el-icon @click="searchOpen(index)" v-else class="hover"> + <ArrowRight /> + </el-icon> <span>{{ reault.chapterName }} 锛坽{ reault.itemList.length }}锛�</span> </div> <div @@ -250,9 +256,12 @@ @click="noteClose(index)" v-if="scribeData.isShow && scribeData.openIndex == index" class="hover" - ><ArrowDown - /></el-icon> - <el-icon @click="noteOpen(index)" v-else class="hover"><ArrowRight /></el-icon> + > + <ArrowDown /> + </el-icon> + <el-icon @click="noteOpen(index)" v-else class="hover"> + <ArrowRight /> + </el-icon> <span>{{ noteItem.chapterName }}</span> </div> <div @@ -369,9 +378,18 @@ ><VideoCamera /></el-icon> --> <!-- <el-icon v-else-if="activeClassify == 'other'" size="30"><Files /></el-icon> --> - <img src="@/assets/images/resource/yp-mr.png" v-else-if="activeClassify == 'audio'" /> - <img src="@/assets/images/resource/sp-mr.png" v-else-if="activeClassify == 'video'" /> - <img src="@/assets/images/resource/qt-mr.png" v-else-if="activeClassify == 'other'" /> + <img + src="@/assets/images/resource/yp-mr.png" + v-else-if="activeClassify == 'audio'" + /> + <img + src="@/assets/images/resource/sp-mr.png" + v-else-if="activeClassify == 'video'" + /> + <img + src="@/assets/images/resource/qt-mr.png" + v-else-if="activeClassify == 'other'" + /> <div class="handleBox" v-if="showHandle == index"> <div class="delImg"> <el-icon @@ -379,36 +397,41 @@ size="20" @click="JumpPosition(item)" v-if="resourceType == 'default'" - ><LocationInformation - /></el-icon> + > + <LocationInformation /> + </el-icon> <el-icon @click="goPlay(item)" size="20" class="icon hover" v-if="item.resourceType == '瑙嗛'" - ><VideoPlay - /></el-icon> + > + <VideoPlay /> + </el-icon> <el-icon @click="goPlay(item, index)" size="20" class="icon hover" v-if="item.resourceType == '闊抽' && playIndex != index" - ><VideoPlay - /></el-icon> + > + <VideoPlay /> + </el-icon> <el-icon @click="goPause()" size="20" class="icon hover" v-if="item.resourceType == '闊抽' && playIndex == index" - ><VideoPause - /></el-icon> + > + <VideoPause /> + </el-icon> <el-icon @click="getCapture(item, index)" size="20" class="icon hover" v-if="item.resourceType == '鍥剧墖'" - ><View - /></el-icon> + > + <View /> + </el-icon> <el-icon size="20" class="icon hover" @@ -421,14 +444,29 @@ item.resourceType == '鍥剧墖' ) && item.isDownload == '鏄�' " - ><Download - /></el-icon> + > + <Download /> + </el-icon> <!-- 鏀惰棌鎸夐挳 --> - <img - :src="collectResourceList.findIndex(citem => citem.id == item.id) > -1 ? isHeart : heart " - class="icon hover" - style="width: 15px;" - @click="handleCollectResource(item.id,item.md5 ? item.md5 : '',item.resourcePath ? item.resourcePath : '',item.resourceType,item.resourceType == '瑙嗛' || '闊抽' ? 'bits' : 'json',item.resourceName)" /> + <img + :src=" + collectResourceList.findIndex((citem) => citem.id == item.id) > -1 + ? isHeart + : heart + " + class="icon hover" + style="width: 15px" + @click=" + handleCollectResource( + item.id, + item.md5 ? item.md5 : '', + item.resourcePath ? item.resourcePath : '', + item.resourceType, + item.resourceType == '瑙嗛' || '闊抽' ? 'bits' : 'json', + item.resourceName + ) + " + /> </div> </div> </div> @@ -459,9 +497,9 @@ <img :src="item.imgUrl" class="capture hover" mode="aspectFill" /> <div class="deleteBox" v-if="showDelete == index"> <div class="delImg"> - <el-icon @click="getCapture(item, index)" size="18" class="icon hover" - ><View - /></el-icon> + <el-icon @click="getCapture(item, index)" size="18" class="icon hover"> + <View /> + </el-icon> <img :src="bianji" class="icon hover" @click="updateScreenshot(item)" /> <img :src="shanchu" class="icon hover" @click="deleteScreenshot(item)" /> </div> @@ -538,9 +576,9 @@ </div> <!-- 棰樺簱搴曢儴鏀惰棌澶瑰拰閿欓闆� --> <ul class="question-bottom" v-if="activeMenu == '棰樺簱'"> - <li @click="selectExercisesType('collection')">鏀惰棌澶�</li> - <li @click="selectExercisesType('wrong')">閿欓鏈�</li> - </ul> + <li @click="selectExercisesType('collection')">鏀惰棌澶�</li> + <li @click="selectExercisesType('wrong')">閿欓鏈�</li> + </ul> <!-- 鑿滃崟鍐呭鏀惰捣 --> <div class="menuStateBox" v-if="menuState.open"> <svg @@ -817,7 +855,7 @@ </div> </div> <!-- 璇煶闃呰缁勪欢 --> - <!-- <div class="voice-reader"> + <!-- <div class="voice-reader"> <voiceReader /> </div> --> </div> @@ -1258,23 +1296,20 @@ :infoType="examinationData.infoType" /> <!-- 璁$畻鍣� --> - <el-dialog title="璁$畻鍣�" align-center v-model="calculatorVisble" width="550" style="height:548px"> - <calculator /> - </el-dialog> + <el-dialog title="璁$畻鍣�" align-center v-model="calculatorVisble" width="850" class="myDialogs"> + <!-- <calculatorNew></calculatorNew> --> + <iframe src="https://www.geogebra.org/scientific" frameborder="0" class="iframe-box"></iframe> + </el-dialog> </template> - <script setup lang="ts"> -import heart from '@/assets/images/examination/collectIcon.png' -import isHeart from '@/assets/images/examination/collectClickIcon.png' +import examination from '@/views/examination/index.vue' import { ref, reactive, watch, onMounted, onBeforeMount, onBeforeUnmount, inject } from 'vue' import { useRouter, useRoute } from 'vue-router' +import { ElMessage, ElMessageBox, valueEquals } from 'element-plus' import useClipboard from 'vue-clipboard3' -import examination from '../examination/index.vue' -import calculator from '../components/calculator.vue' const { toClipboard } = useClipboard() const MG: any = inject('MG') const toolClass = inject('toolClass') -const qiankunActions = inject('qiankunActions') //鑾峰彇璺敱鍣� let router = useRouter() //鑾峰彇褰撳墠璺敱鐨勪俊鎭� @@ -1285,7 +1320,6 @@ import formula from '@/views/components/formula.vue' import wrongQuestion from '@/views/components/wrongQuestion.vue' import voiceReader from '@/views/components/voiceReader.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 biji from '@/assets/images/menu/biji.png' @@ -1394,9 +1428,16 @@ const bookConfig = ref({}) const activeCatalog = ref() const reMarResult = ref() +const bookInfo = ref() +const isBuy = ref(false) +const tryPageCount = ref(0) +const searchText = ref() onMounted(() => { if (token) { getUserInfo() + } + if (localStorage.getItem('bookId')) { + getBookInfo() } setTimeout(() => { canvasWith.value = document.querySelector('.content-box').offsetWidth @@ -1427,13 +1468,16 @@ window.qiankunActions.onGlobalStateChange((state, prev) => { console.log('鐖跺眰state鍙樺寲', state) window.qiankunState = state - - if (window.qiankunState && window.qiankunState.initTestBook) { - window.qiankunState.initTestBook( - localStorage.getItem('bookId') + '', - localStorage.getItem('tryPageCount') - ) + if (isBuy.value) { + if (window.qiankunState && window.qiankunState.initTestBook) { + window.qiankunState.initTestBook(localStorage.getItem('bookId') + '') + } + } else { + if (window.qiankunState && window.qiankunState.initTestBook) { + window.qiankunState.initTestBook(localStorage.getItem('bookId') + '', tryPageCount.value) + } } + }) // 瀹氫箟鐖跺眰鏂规硶 @@ -1523,6 +1567,7 @@ // if (window.qiankunState && window.qiankunState.getAnswers){ // window.qiankunState.getAnswers(localStorage.getItem("")) // } + }) onBeforeUnmount(() => { @@ -1544,6 +1589,44 @@ // } // } // ) + +//鏍规嵁refcode鑾峰彇鍥句功淇℃伅 + +const getBookInfo = () => { + const obj = { + storeInfo: 'jsek_digitalTextbooks', + path: '*', + queryType: '*', + coverSize: { + width: 150 + }, + paging: { + start: 0, + size: 6 + }, + filterList: [ + { + value: 'Normal', + field: 'state' + } + ], + fields: { + author: [], + RefCodes: [localStorage.getItem('bookId')], + probationPage: [] + } + } + MG.store.getProductList(obj).then((res) => { + console.log(res.datas, '鍥句功淇℃伅') + bookInfo.value = res.datas[0] + if (res.datas[0].purchasedSaleMethodIdList.includes(res.datas[0].defaultSaleMethodId)) { + isBuy.value = true + } else { + isBuy.value = false + } + tryPageCount.value = Number(res.datas[0].probationPage) + }) +} const getUserInfo = () => { MG.identity.getCurrentAppUser().then((res) => { @@ -1712,7 +1795,8 @@ { icon: huabi, name: '鐢荤瑪', - isShow: bookConfig.value.textbookComponents.indexOf('800109C0') > -1 + // isShow: bookConfig.value.textbookComponents.indexOf('800109C0') > -1 + isShow: true }, { icon: baiban, @@ -1794,10 +1878,20 @@ catalogueData.value = json.data headerData.totlePage = json.data[json.data.length - 1].end listLoading.value = false + if (localStorage.getItem('chapter') && localStorage.getItem('startPage')) { + let chapter = Number(localStorage.getItem('chapter')) + let start = Number(localStorage.getItem('startPage')) + + if (window.qiankunState && window.qiankunState.gotoPage) { + window.qiankunState.gotoPage(chapter,start) + localStorage.removeItem('chapter') + localStorage.removeItem('startPage') + } + } }) .catch(function (error) { listLoading.value = false - console.log(error) + }) } const defaultProps = { @@ -1812,9 +1906,8 @@ } const handleNodeClick = (data) => { - console.log(data) - if (localStorage.getItem('tryPageCount')) { - if (data.start < localStorage.getItem('tryPageCount')) { + if (!isBuy.value) { + if (data.start < tryPageCount.value) { headerData.process = data.start if (window.qiankunState && window.qiankunState.gotoPage) window.qiankunState.gotoPage(data.chapter, data.start) @@ -2125,12 +2218,11 @@ activeClassify.value = item.key resourceDataList.value = [] searchText.value = '' - if(resourceType.value == 'collect') { + if (resourceType.value == 'collect') { getCollectResource() } else { getResourceData() } - } const searchBtn = () => { if (searchShow.value) { @@ -2142,17 +2234,17 @@ // 鑾峰彇鏀惰棌鐨勮祫婧� const getCollectResource = () => { - if(token) { + if (token) { MG.identity - .getUserKey({ - domain: 'collectResource', - keys: [bookConfig.value.bookId] - }) - .then((res) => { - if (res.length) { - collectResourceList.value = JSON.parse(res[0].value) - console.log('鏀惰棌璧勬簮鍒楄〃', collectResourceList.value) - if(collectResourceList.value.length > 0) { + .getUserKey({ + domain: 'collectResource', + keys: [bookConfig.value.bookId] + }) + .then((res) => { + if (res.length) { + collectResourceList.value = JSON.parse(res[0].value) + console.log('鏀惰棌璧勬簮鍒楄〃', collectResourceList.value) + if (collectResourceList.value.length > 0) { let imgCount = 0 let audioCount = 0 let videoCount = 0 @@ -2227,11 +2319,11 @@ } }) } + } + } else { + resourceDataList.value = [] } - } else { - resourceDataList.value = [] - } - }) + }) } else { ElMessageBox.confirm('璇峰厛鐧诲綍锛�', { confirmButtonText: '鍘荤櫥褰�', @@ -2252,27 +2344,27 @@ } } // 鏀惰棌鎸夐挳 -const handleCollectResource = (id,md5,resourcePath,resourceType,source,resourceName) => { - if(collectResourceList.value.findIndex(item => item.id == id) > -1) { - collectResourceList.value = collectResourceList.value.filter(item => item.id != id) - } else { - collectResourceList.value.push({ - id, - md5, - resourcePath:resourcePath.replace(bookConfig.value.resourceUrl + '/',''), - resourceType, - source, - resourceName - }) - } - MG.identity.setUserKey({ +const handleCollectResource = (id, md5, resourcePath, resourceType, source, resourceName) => { + if (collectResourceList.value.findIndex((item) => item.id == id) > -1) { + collectResourceList.value = collectResourceList.value.filter((item) => item.id != id) + } else { + collectResourceList.value.push({ + id, + md5, + resourcePath: resourcePath.replace(bookConfig.value.resourceUrl + '/', ''), + resourceType, + source, + resourceName + }) + } + MG.identity.setUserKey({ setKeyRequests: [ { - domain: "collectResource", - key:bookConfig.value.bookId, - value: JSON.stringify(collectResourceList.value), - }, - ], + domain: 'collectResource', + key: bookConfig.value.bookId, + value: JSON.stringify(collectResourceList.value) + } + ] }) } @@ -2369,15 +2461,14 @@ //閿欓鏈� const wrongQuestionVisble = ref(false) const selectExercisesType = (type) => { - if (type == 'exercises') { getExercisesList() - exercisesType.value = type - searchText.value = '' + exercisesType.value = type + searchText.value = '' } else if (type == 'additional') { getAdditionalList() - exercisesType.value = type - searchText.value = '' + exercisesType.value = type + searchText.value = '' } else if (type == 'wrong') { openExaminationDialog(true, {}, 'errorQuestion') } else { @@ -2458,7 +2549,6 @@ // } } -const searchText = ref<string>('') //绛涢�� const menuState = reactive({ open: true, notesColor: 'all' //绗旇棰滆壊 @@ -2751,8 +2841,8 @@ shengciVisble.value = true break case '璁$畻鍣�': - calculatorVisble.value = true - break + calculatorVisble.value = true + break } } else { ElMessageBox.confirm('璇峰厛鐧诲綍锛�', { @@ -4066,15 +4156,18 @@ display: flex; justify-content: space-between; align-items: center; + .logoTxt { font-size: 24px; color: #333; letter-spacing: 2px; font-weight: bold; } + .userInfoBox { display: flex; align-items: center; + .userName { font-size: 18px; margin-right: 15px; @@ -4082,6 +4175,7 @@ border-right: 1px solid #e0e0e0; color: #2c2c2c; } + .layout { width: 69px; height: 30px; @@ -4093,11 +4187,13 @@ } } } + .contentBox { overflow: hidden; flex: 1; display: flex; position: relative; + .menuBox { width: 80px; flex-shrink: 0; @@ -4120,30 +4216,36 @@ width: 63px; margin: 10px auto; border-radius: 10px; + &.active, &:hover { background-color: rgba(0, 147, 255, 0.1); + p { color: #0093ff; } } + .menuIcon { display: inline-block; width: 32px; height: 32px; } + .name { text-align: center; line-height: 1; color: #2c3e50; } } + .reload { width: 80px; position: absolute; bottom: 100px; text-align: center; } + .setting { width: 80px; position: absolute; @@ -4151,6 +4253,7 @@ text-align: center; } } + .menuContent { // position: relative; width: 300px; @@ -4161,6 +4264,7 @@ -moz-user-select: none; -khtml-user-select: none; user-select: none; + .searchBox { width: 100%; height: 60px; @@ -4170,22 +4274,27 @@ align-items: center; border-bottom: 1px solid #efefef; } + .resourceSearchBox { padding: 10px 0; margin: 0 20px; border-bottom: 1px solid rgba(204, 204, 204, 0.32); + .classification { width: 100%; display: flex; justify-content: space-between; align-items: center; + .flex1 { flex: 1; text-align: center; } + .title { color: #999999; } + .count { width: 35px; margin: 0 auto; @@ -4196,16 +4305,19 @@ height: 18px; font-size: 12px; } + .activeClassify, .classifyItem:hover { .title { color: #0093ff; } + .count { background: #0093ff; color: #fff; } } + .showSearch { .imgBox { width: 39px; @@ -4213,17 +4325,20 @@ border-radius: 16px; margin: 0 auto; } + .imgBox:hover, .activeSearch { border: 1px solid #0093ff; } } } + .inputBox { margin-top: 10px; width: 100% !important; } } + .resourceTab { width: 100%; height: 60px; @@ -4231,18 +4346,22 @@ justify-content: center; align-items: center; font-size: 16px; + .hr { height: 25px; color: #dbdbdb !important; } + .tabItem:first-child(1) { border-right: 1px solid #707070; } + .tabItem { flex: 1; text-align: center; line-height: 57px; } + .text { width: 43px; height: 3px; @@ -4250,12 +4369,15 @@ background: #0093ff; border-radius: 3px 3px 0px 0px; } + .line { height: 3px; } } + .inputBox { width: 85%; + .custom-input { border: 1px solid #0093ff !important; border-radius: 50px; @@ -4267,19 +4389,23 @@ .is-focus, .el-input__wrapper { box-shadow: none !important; + .el-input__inner { border: none !important; height: 34px !important; } } + .el-input-group__append { padding: 0 10px !important; background: none !important; } } + .screenBox { display: flex; padding: 0 10px; + .title { margin: 10px 0; line-height: 40px; @@ -4330,14 +4456,17 @@ border: 1px solid #0093ff; } } + .menuList { height: calc(100% - 60px); overflow-y: auto; padding: 10px 0; } + .list-box { .resourceList { padding: 10px; + .resourceItem { padding: 10px 0; align-items: center; @@ -4352,11 +4481,13 @@ align-items: center; justify-content: center; position: relative; + img { height: 100%; width: 100%; object-fit: contain; } + .handleBox { position: absolute; top: 0; @@ -4366,11 +4497,13 @@ background: rgba(44, 44, 44, 0.6); text-align: center; padding: 2px; + .delImg { height: 100%; display: flex; align-items: center; justify-content: center; + .icon { position: static; margin: 5px; @@ -4386,21 +4519,25 @@ } } } + .screenshot { padding: 20px; display: flex; flex-wrap: wrap; justify-content: space-between; + .captureItem { margin-bottom: 10px; width: 46%; position: relative; + .imgBox { border: 1px solid #d8d8d8; width: 100%; height: 80px; margin-bottom: 5px; } + .deleteBox { position: absolute; top: 0; @@ -4410,11 +4547,13 @@ background: rgba(44, 44, 44, 0.6); text-align: center; padding: 2px; + .delImg { height: 100%; display: flex; align-items: center; justify-content: center; + .icon { position: static; margin: 5px; @@ -4422,6 +4561,7 @@ } } } + // .capture { // width: 100%; // } @@ -4445,22 +4585,26 @@ background: #fff; border-radius: 5px; padding: 10px 0; + .textBox { .title { display: flex; justify-content: space-between; align-items: center; margin-right: 10px; + .border-left { height: 25px; border-right: 4px solid; border-radius: 0 5px 5px 0; margin-right: 10px; } + .title-con { display: flex; align-items: center; color: #949494; + .round { width: 10px; height: 10px; @@ -4473,6 +4617,7 @@ margin-left: 5px; } } + .chapter { color: #b7b7b7; margin: 5px 5px 5px 14px; @@ -4485,10 +4630,12 @@ padding: 0 5px; } } + .noteText { margin: 10px 10px 10px 15px; border-radius: 3px; padding: 2px 5px; + .con { max-height: 65px; display: -webkit-box; @@ -4498,14 +4645,17 @@ } } } + .chapterName { margin: 15px; display: flex; align-items: center; + span { margin-left: 5px; } } + .reMarkItem { margin: 15px; background: #fff; @@ -4513,8 +4663,10 @@ padding: 10px; display: flex; justify-content: space-between; + .reMarkCon { display: flex; + .con { width: 200px; white-space: nowrap; @@ -4523,10 +4675,12 @@ margin-right: 8px; } } + .deleteReMarkImg { display: flex; align-items: center; } + .questionCon { width: 240px; white-space: nowrap; @@ -4542,10 +4696,12 @@ border-radius: 10px; padding: 10px; display: flex; + .index { line-height: 24px; margin-right: 10px; } + .searchCon { flex: 1; width: 240px; @@ -4557,6 +4713,7 @@ -webkit-box-orient: vertical; -webkit-line-clamp: 2; text-overflow: ellipsis; + .searchColor { background: rgb(245, 225, 42, 0.5); } @@ -4564,6 +4721,7 @@ } } } + .allSearch, .notesBox, .resourceBox, @@ -4573,30 +4731,33 @@ height: calc(100% - 60px); overflow-y: auto; } + .questionList { - height:83% + height: 83%; } + .question-bottom { position: absolute; bottom: 0; display: flex; justify-content: space-evenly; - width:300px; - padding:20px 0; - background-color:#fff; + width: 300px; + padding: 20px 0; + background-color: #fff; li { cursor: pointer; width: 65px; - height:65px; - border:1px solid #cfcfcf; - border-radius:10px; - background-color:#f9f9f9; - display:flex; + height: 65px; + border: 1px solid #cfcfcf; + border-radius: 10px; + background-color: #f9f9f9; + display: flex; justify-content: center; align-items: center; } } } + .menuStateBox { width: 25px; height: 25px; @@ -4608,6 +4769,7 @@ text-align: center; box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.3); z-index: 2; + img { height: 10px; width: 18px; @@ -4618,6 +4780,7 @@ flex: 1; font-size: 16px; position: relative; + .pageBox-header { height: 57px; padding: 0 20px; @@ -4626,6 +4789,7 @@ z-index: 99; align-items: center; justify-content: space-between; + .classTime { display: flex; align-items: center; @@ -4633,6 +4797,7 @@ border-radius: 20px 20px 20px 20px; color: #0093ff; padding: 8px; + .qureIcon { width: 9px; height: 9px; @@ -4641,16 +4806,20 @@ margin: 0 5px; } } + .progress { text-align: center; + .bookName { font-weight: 800; margin-bottom: 5px; color: #333; } } + .rightBox { display: flex; + .pageSizeBox { display: flex; align-items: center; @@ -4660,21 +4829,25 @@ padding: 5px; display: flex; align-items: center; + img { width: 18px; height: 18px; } } } + .brushImgBox { display: flex; align-items: center; border-left: 1px solid #d8d8d8; + div { padding: 5px; display: flex; align-items: center; } + .brushImg { width: 22px; margin-left: 20px; @@ -4683,21 +4856,26 @@ } } } + .pageBox-content { height: calc(100% - 57px); background: #fbf9f4; padding: 10px 0; + .content-box { height: 100%; position: relative; + #container { background: #fbf9f4; height: 100%; + #__qiankun_microapp_wrapper_for_app_content__ { height: 100%; } } } + .canvas-box { height: 100%; width: 100%; @@ -4709,6 +4887,7 @@ } } } + .toolBox { position: relative; box-shadow: -3px 0px 6px 1px rgba(0, 0, 0, 0.07); @@ -4717,11 +4896,13 @@ -moz-user-select: none; -khtml-user-select: none; user-select: none; + .toolTitle { height: 57px; line-height: 53px; text-align: center; border-bottom: 1px solid #efefef; + .text { width: 43px; height: 3px; @@ -4730,8 +4911,10 @@ border-radius: 3px 3px 0px 0px; } } + .menu { padding-top: 20px; + li > div { // height: 50px; padding: 10px 36px; @@ -4751,6 +4934,7 @@ } } } + .openBox { width: 25px; height: 25px; @@ -4769,22 +4953,27 @@ width: 18px; } } + .right { right: 198px !important; border-radius: 0px 3px 3px 0px !important; } + .classRoomBox { position: absolute; bottom: 0; width: 100%; + .el-tabs__nav { width: 100% !important; } + .el-tabs__item { flex: 1 !important; padding: 0 !important; text-align: center; } + .el-tabs__active-bar { width: 43px !important; left: 30px !important; @@ -4792,13 +4981,16 @@ bottom: 1px; border-radius: 3px 3px 0px 0px; } + .tabBox { height: 100px; padding: 10px 17px; text-align: center; + .insertSelect { display: flex; justify-content: space-between; + .selectItem { text-align: center; background: rgba(207, 207, 207, 0.13); @@ -4806,6 +4998,7 @@ border-radius: 5px; border: 2px solid #cfcfcf; } + .typeActive { text-align: center; color: #0093ff; @@ -4815,6 +5008,7 @@ background: rgba(0, 147, 255, 0.13); } } + .giveLessons { color: #0093ff; width: 90px; @@ -4825,6 +5019,7 @@ display: flex; align-items: center; justify-content: center; + span { margin-left: 10px; } @@ -4845,6 +5040,7 @@ border-radius: 10px; padding: 6px; overflow: hidden; + .floatToolItem { margin: 10px 0; height: 30px; @@ -4854,11 +5050,13 @@ border-radius: 5px; color: #fff; cursor: pointer; + .imgBox { width: 24px; height: 24px; margin: 0 auto; position: relative; + img { width: 100%; height: 100%; @@ -4874,10 +5072,12 @@ margin: auto; } } + .text { margin-right: 5px; } } + .floatToolItem:hover, .floatToolActive { background-color: rgba(255, 255, 255, 0.3); @@ -4896,10 +5096,12 @@ background: #fff; overflow: hidden; box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.3); + .toolList { display: flex; justify-content: center; align-items: center; + .floatToolItem { margin: 6px 8px; padding: 5px; @@ -4910,6 +5112,7 @@ align-items: center; // flex: 1; font-size: 14px; + .imgBox { height: 18px; width: 18px; @@ -4917,9 +5120,11 @@ margin: 0 auto; } } + .floatToolItem:hover { background-color: rgba(44, 44, 44, 0.2); } + .layOutTool { height: 20px; margin-right: 5px; @@ -4931,6 +5136,7 @@ .dialogToolBox { position: fixed; z-index: 2; + .toolSelectBox { height: 40px; display: flex; @@ -4940,6 +5146,7 @@ overflow: hidden; padding: 5px; background-color: rgba(90, 90, 90, 0.9); + // background-image: linear-gradient(to right, #0093ff, #005dff); .dialogToolItem { user-select: none; @@ -4950,10 +5157,12 @@ margin: 0 5px; cursor: pointer; text-align: center; + span { color: #fff; } } + .dialogToolItem:hover, .active { background-color: rgba(255, 255, 255, 0.2); @@ -4963,6 +5172,7 @@ } } } + .colorSelectBox { padding: 5px 10px; width: 190px; @@ -4972,8 +5182,10 @@ box-shadow: 0px 0px 10px 1px rgba(0, 0, 0, 0.16); border-radius: 5px; margin-bottom: 10px; + .flex1 { flex: 1; + .scribeItem { width: 18px; height: 18px; @@ -4988,6 +5200,7 @@ } } } + .lineDeleteBox { position: fixed; z-index: 2; @@ -4997,6 +5210,7 @@ background-color: rgba(90, 90, 90, 0.9); border-radius: 5px; display: flex; + .dialogToolItem { padding: 3px; margin: 0 5px; @@ -5005,10 +5219,12 @@ justify-content: center; align-items: center; } + .dialogToolItem:hover { background-color: rgba(255, 255, 255, 0.3); } } + .noteContentBox { max-width: 240px; position: fixed; @@ -5016,6 +5232,7 @@ padding: 10px; border-radius: 5px; } + .dictionaryDataBox { position: fixed; z-index: 2; @@ -5023,9 +5240,11 @@ padding: 5px 20px; background: #fff; border-radius: 5px; + .word { font-weight: bold; } + .phone_con { .per-phone { align-items: center; @@ -5039,33 +5258,40 @@ margin-right: 10px; margin-top: 10px; padding: 8px 10px; + span { margin: 0 10px; flex: 1; } } + .soundBtn { width: 16px; height: 14px; } } + .trans { padding: 20px 0; + .itemList { display: flex; padding: 10px 0; + .index { margin-right: 15px; } + .pos { margin-right: 30px; } } } } + .wendabox { width: 100%; - height: 80vh; + height: 95vh; iframe { width: 100%; @@ -5097,38 +5323,48 @@ top: 0px !important; right: 0px !important; } + .el-dialog__body { padding: 20px !important; } + .el-dialog__footer { padding: 10px 20px 20px !important; text-align: right; box-sizing: border-box; } } + .myDialogs { height: 90vh; } + .myAnserDialogs { width: 700px; height: 90vh; } + .myNoteDialogs { width: 500px !important; } + .screenshotDialog { width: 400px !important; } + .baiduDialog { width: 90vw; height: 90vh; } + .noteColorSelectBox { margin-top: 10px; width: 190px; display: flex; + .flex1 { flex: 1; + .scribeItem { width: 18px; height: 18px; @@ -5141,12 +5377,15 @@ } } } + .videoBox { text-align: center; + video { width: 100%; } } + .audioBox { // display:none; } @@ -5154,16 +5393,23 @@ .wordBox { height: 600px; } + .imgUrlBox { width: 100%; text-align: center; + img { width: 100%; } } + .voice-reader { - position:absolute; - bottom:30px; - left:50px; + position: absolute; + bottom: 30px; + left: 50px; +} +.iframe-box { + width:100%; + height: 800px; } </style> -- Gitblit v1.9.1