Merge branch 'master' of http://182.92.203.7:2001/r/testbookLayout
| | |
| | | import { activeBook } from "@/assets/js/config"; |
| | | import MG from "@/assets/js/middleGround/WebMiddleGroundApi"; |
| | | import getPublicImage from "@/assets/js/middleGround/tool"; |
| | | const getQuestionList = (questionList) => { |
| | | const getQuestionList = async (questionList) => { |
| | | let cardList = [ |
| | | { |
| | | catalogName: "单选题", |
| | |
| | | Embedded_QuestionBank_Difficulty: [], |
| | | }, |
| | | }; |
| | | MG.store.getProductDetail(query).then( (res) => { |
| | | const res = await MG.store.getProductDetail(query); |
| | | res.datas.cmsDatas[0].datas.forEach((item, index) => { |
| | | const questionObj = { |
| | | number: index + 1, // 题号 |
| | |
| | | shortArr.push(questionObj); |
| | | } |
| | | }); |
| | | }); |
| | | } |
| | | cardList[0].infoList = singleChoiceArr |
| | | cardList[1].infoList = judgeArr |
| | |
| | | citem.number = cindex + 1; |
| | | } |
| | | } |
| | | return cardList |
| | | console.log(cardList.filter(item=>item.infoList.length > 0),"cardList.filter(item=>item.infoList.length > 0)"); |
| | | return cardList.filter(item=>item.infoList.length > 0); |
| | | }; |
| | | |
| | | const getQuestionData = (chapterData) => { |
| | | const getQuestionData = async (chapterData) => { |
| | | const data = { ...chapterData }; |
| | | for (let key in chapterData) { |
| | | data[key] = getQuestionList(chapterData[key]); |
| | | data[key] = await getQuestionList(chapterData[key]); |
| | | } |
| | | return data; |
| | | }; |
| | |
| | | pathTen:'' |
| | | }; |
| | | }, |
| | | mounted() { |
| | | this.$data.questionData = getQuestionData(testData[1]) |
| | | // console.log('题目',this.$data.questionData ); |
| | | async mounted() { |
| | | this.$data.questionData = await getQuestionData(testData[1]) |
| | | console.log('题目',this.$data.questionData ); |
| | | this.$data.pathOne = getResourcePath('f6f6588a75086576b87bed2fb9ca1ec1') |
| | | this.$data.pathTwo = getResourcePath('e5993b62684fe55d13190cfe52bf00ed') |
| | | this.$data.pathThree = getResourcePath('6b6d42213aa85aa5ff7724aaf96ffee6') |
| | |
| | | }, |
| | | watch: { |
| | | showCatalogList: { |
| | | handler(newVal) { |
| | | handler(newVal, oldVal) { |
| | | if ( |
| | | this.$store.state.qiankun && |
| | | this.$store.state.qiankun.catalogChange |
| | |
| | | // this.gotoPage(5, 100); |
| | | // setTimeout(() => { |
| | | // this.renderSign("Note", { |
| | | // page: 100, |
| | | // txt: "前儿童生长发育的影响是一个渐", |
| | | // id: "2ACA9359", |
| | | // txt: "营养素和热量,才能", |
| | | // page: "100", |
| | | // type: "Highlight", |
| | | // color: "#F5E12A" |
| | | // }); |
| | | // setTimeout(() => { |
| | | // this.delSign({ |
| | | // ids: ["2ACA9359"] |
| | | // }); |
| | | // }, 2000); |
| | | // }, 1000); |
| | | // }, 3000); |
| | | }, |
| | |
| | | } |
| | | } |
| | | // showCatalogList 当前显示的三个章节,watch监听传递给主应用 |
| | | console.log(this.showCatalogList); |
| | | // 更新上一次滚动的位置 |
| | | this.previousScrollTop = event.target.scrollTop; |
| | | |
| | | // 返回页码和章节信息 |
| | | if (this.$store.state.qiankun && this.$store.state.qiankun.pageChange) |
| | | this.$store.state.qiankun.pageChange({ |
| | | page: 100, |
| | | catalog: 5, |
| | | catalogId: "", |
| | | catalogName: "" |
| | | }); |
| | | // if (this.$store.state.qiankun && this.$store.state.qiankun.pageChange) |
| | | // this.$store.state.qiankun.pageChange({ |
| | | // page: 100, |
| | | // catalog: 5, |
| | | // catalogId: "", |
| | | // catalogName: "" |
| | | // }); |
| | | }, |
| | | gotoPage(catalog, page) { |
| | | if (catalog >= 0 && catalog <= this.catalogLength) { |
| | |
| | | // 高亮 |
| | | pageDom.innerHTML = pageDom.innerHTML.replace( |
| | | reg, |
| | | `<span datatype="Highlight" dataid="${data.id}" style="background: ${data.color};" class="highLight">${data.txt}</span>` |
| | | `<span datatype="Highlight" dataid="${data.id}" style="background: ${data.color};" class="highLight" onclick="signClick('Highlight','${data.id}')">${data.txt}</span>` |
| | | ); |
| | | break; |
| | | case "Dashing": |
| | | // 划线 |
| | | pageDom.innerHTML = pageDom.innerHTML.replace( |
| | | reg, |
| | | `<span datatype="Dashing" dataid="${data.id}" style="text-decoration-color:${data.color};" class="underline">${data.txt}</span>` |
| | | `<span datatype="Dashing" dataid="${data.id}" style="text-decoration-color:${data.color};" class="underline" onclick="signClick('Dashing','${data.id}')">${data.txt}</span>` |
| | | ); |
| | | break; |
| | | case "Note": |
| | | // 笔记 |
| | | pageDom.innerHTML = pageDom.innerHTML.replace( |
| | | reg, |
| | | `<span datatype="Note" dataid="${data.id}" style="border-bottom-color:${data.color}" class="notesline">${data.txt}</span><img src="${NoteIcon}" style="cursor: pointer" />` |
| | | `<span datatype="Note" dataid="${data.id}" style="border-bottom-color:${data.color}" class="notesline" onclick="signClick('Note','${data.id}')">${data.txt}<img src="${NoteIcon}" style="cursor: pointer" /></span>` |
| | | ); |
| | | break; |
| | | } |
| | | // 绑定事件 |
| | | const thisAddDom = ( |
| | | this.container ? this.container : document |
| | | ).querySelector(`[dataid="${data.id}"]`); |
| | | thisAddDom.addEventListener("click", function (e) { |
| | | console.log("点击事件回调的实例,通过这个参数获取类型", e); |
| | | if (this.$store.state.qiankun && this.$store.state.qiankun.signClick) |
| | | this.$store.state.qiankun.signClick(type, data); |
| | | }); |
| | | } |
| | | }, |
| | | delSign({ ids, type }) { |
| | |
| | | export default { |
| | | name: "child-health", |
| | | components: { |
| | | pageContent, |
| | | pageContent |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | }; |
| | | this.MG.store.getProductDetail(query).then((res) => { |
| | | console.log("图书信息",res.datas); |
| | | this.$data.bookData = res.datas |
| | | this.$store.commit('setRootCmsItemId',res.datas.rootCmsItemId) |
| | | this.$data.bookData = res.datas; |
| | | this.$store.commit("setRootCmsItemId", res.datas.rootCmsItemId); |
| | | }); |
| | | }, |
| | | getParentWithClass(element, className) { |
| | |
| | | } |
| | | }, |
| | | handleMouseUp(e) { |
| | | const selection = (this.container ? this.container : window).getSelection(); |
| | | const selection = ( |
| | | this.container ? this.container : window |
| | | ).getSelection(); |
| | | const txt = selection.toString(); |
| | | if (selection.type != "none" && txt) { |
| | | let node = selection.anchorNode.parentNode; |
| | |
| | | y: e.y |
| | | }); |
| | | } |
| | | } else { |
| | | if (this.$store.state.qiankun.windowSelection) { |
| | | this.$store.state.qiankun.windowSelection({ |
| | | chapterNum: "", |
| | | txt: "", |
| | | page: "", |
| | | x: "", |
| | | y: "" |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | |
| | | </style> |
| | | <style lang="less" scoped></style> |