From 6aac0dd9c6d6bd3de148f3d6e123f9c91b1aab4b Mon Sep 17 00:00:00 2001 From: user1 <10901603+no-distractions1@user.noreply.gitee.com> Date: 星期二, 02 七月 2024 09:31:04 +0800 Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/testbookLayout --- src/books/mathBook/view/components/chapter001.vue | 194 +++++++++++++++++++++++++++++++++++++----------- 1 files changed, 149 insertions(+), 45 deletions(-) diff --git a/src/books/mathBook/view/components/chapter001.vue b/src/books/mathBook/view/components/chapter001.vue index 6715dee..a31cf36 100644 --- a/src/books/mathBook/view/components/chapter001.vue +++ b/src/books/mathBook/view/components/chapter001.vue @@ -156,7 +156,7 @@ placement="top-start" > <img - :src="chapterData.isCollectImg ? collectCheck : collectImg" + :src="collectResourceList.findIndex(item => item.id == '722FE833') > -1 ? collectCheck : collectImg" alt="" class="collect-btn" @click="handleCollect('img')" @@ -184,7 +184,7 @@ placement="top-start" > <img - :src="chapterData.isCollectVideo ? collectCheck : collectImg" + :src="collectResourceList.findIndex(item => item.id == 'a28cd862d61b5df2201406b76e9f01b0') > -1 ? collectCheck : collectImg" alt="" class="collect-btn" @click="handleCollect('video')" @@ -564,16 +564,22 @@ </p> <div class="bj"> <examinations - :cardList="questionData" + :cardList="questionData[9]" + :hideCollect="true" + sourceType="json" inputBc="#d3edfa" v-if="questionData" :isReal="false" ></examinations> + <p class="gr-title">鍥涖�佸嚱鏁� f(x)=x鈥�-3 鐨勫浘鍍忓湪 杞村乏杈圭殑閮ㄥ垎濡傚浘鎵�绀猴紝璇蜂綘鐢诲嚭杩欎釜鍑芥暟鍥惧儚鍦� y杞村彸杈圭殑閮ㄥ垎.</p> + <div style="margin:0 auto;width:330px"> + <graffiti :page="9" :bcImg="this.config.activeBook.resourceUrl + '/images/0103-2.jpg'" :imgHeight="300" :imgWidth="300" :bcColor="'#d3edfa'" /> + </div> + </div> </div> </div> </div> - <!-- 鍑芥暟鎺т欢寮圭獥 --> <el-dialog :visible.sync="dialogVisible" @@ -816,24 +822,28 @@ <script> import examinations from "@/components/examinations/index.vue"; +import graffiti from '@/components/graffiti/index.vue' import { getResourcePath } from "@/assets/methods/resources"; -import axios from "axios"; +import { getCollectResource,setCollectResource } from "@/assets/methods/resources"; export default { name: "chapter-one", - components: { examinations }, + components: { examinations,graffiti }, props: { showPageList: { type: Array, default: [], }, + questionData:{ + type:Object + } }, - mounted() { + async mounted() { const data = localStorage.getItem("math-chapterData"); if (data) { this.chapterData = JSON.parse(data); } this.getPath(); - this.getQuestionData(); + this.collectResourceList = await getCollectResource(this.config.activeBook.bookId) }, data() { return { @@ -848,9 +858,9 @@ thinkingDialog: false, stepDialog: false, videoPath: "", - questionData: [], stepIndex: 1, thinkIndex: 1, + collectResourceList:[], chapterData: { isCollectImg: false, isCollectVideo: false, @@ -881,6 +891,80 @@ isShow: false, }, ], + dragQuestion:[ + { + analysisCon: null, + answer: ['A','B','C'], + difficulty: 0, + id: "7BC7B760", + isCollect: false, + isComplete: false, + isRight: null, + isUnfold: "", + isUserAnswer: false, + number: 1, + option: [ + { + img: "", + index: "010311", + txt: "鑳嗗皬鐨�", + value: "A", + isShow:true + }, + { + img: "", + index: "010312", + txt: "鍠勮壇鐨�", + value: "B", + isShow:true + }, + { + img: "", + index: "010313", + txt: "娌夌ǔ鐨�", + value: "C", + isShow:true + }, + ], + optionStyle: "Txt", + questionType: "drag", + score: 2, + stem: { + 0: "铓傝殎闃熼暱璧拌矾鏄傞鎸鸿兏銆佹浼愬潥瀹氾紝瀹冩槸涓�鍙�(", + 1:{ + data: "span", + num: 0 + }, + 2: ")铓傝殎;灏忚殏铓佽蛋璧疯矾鏉ュ皬蹇冪考缈硷紝鐪肩椋樺拷涓嶅畾锛屽畠鏄竴鍙�(", + 3:{ + data:"span", + num:1 + }, + 4:")铓傝殎;铓傝殎灏忓闈㈠甫寰瑧锛屾椂鍒绘効鎰忓府鍔╁ぇ瀹讹紝瀹冩槸涓�鍙�(", + 5:{ + data:"span", + num:2, + }, + 6:" )铓傝殎" + }, + stemStyle: "RichTxt", + type: "鎷栨嫿棰�", + userAnswer:[ + { + vlaue:'', + txt:'' + }, + { + vlaue:'', + txt:'' + }, + { + vlaue:'', + txt:'' + }, + ] + }, + ] }; }, methods: { @@ -895,45 +979,46 @@ "a28cd862d61b5df2201406b76e9f01b0" ); }, - getQuestionData() { - axios - .get(this.config.activeBook.resourceUrl + "/question.json") - .then((res) => { - let oldAnswer = localStorage.getItem( - this.config.activeBook.name + "oldAnswerData" - ); - if (oldAnswer) { - oldAnswer = JSON.parse(oldAnswer); - console.log("鏃ф暟鎹�", oldAnswer); - if (oldAnswer[9]) { - for (let index = 0; index < res.data.data.length; index++) { - const item = res.data.data[index]; - if (item.infoList.length) { - for ( - let cindex = 0; - cindex < item.infoList.length; - cindex++ - ) { - const citem = item.infoList[cindex]; - const question = oldAnswer[9].find( - (ditem) => ditem.id == citem.id - ); - if (question) { - citem.userAnswer = question.userAnswer; - } - } - } - } - } - } - this.questionData = res.data.data; - }); - }, + // getQuestionData() { + // axios + // .get(this.config.activeBook.resourceUrl + "/question.json") + // .then((res) => { + // let oldAnswer = localStorage.getItem( + // this.config.activeBook.name + "oldAnswerData" + // ); + // if (oldAnswer) { + // oldAnswer = JSON.parse(oldAnswer); + // console.log("鏃ф暟鎹�", oldAnswer); + // if (oldAnswer[9]) { + // for (let index = 0; index < res.data.data.length; index++) { + // const item = res.data.data[index]; + // if (item.infoList.length) { + // for ( + // let cindex = 0; + // cindex < item.infoList.length; + // cindex++ + // ) { + // const citem = item.infoList[cindex]; + // const question = oldAnswer[9].find( + // (ditem) => ditem.id == citem.id + // ); + // if (question) { + // citem.userAnswer = question.userAnswer; + // } + // } + // } + // } + // } + // } + // this.questionData = res.data.data; + // }); + // }, handleCollect(type) { if (type == "img") { - this.chapterData.isCollectImg = !this.chapterData.isCollectImg; + this.handleCollectResource("722FE833","",'images/0101-1.jpg',"鍥剧墖","json",'鍥�3-15') } else if (type == "video") { - this.chapterData.isCollectVideo = !this.chapterData.isCollectVideo; + this.handleCollectResource("a28cd862d61b5df2201406b76e9f01b0","a28cd862d61b5df2201406b76e9f01b0",'',"瑙嗛","bits",'瑙嗛锛氬垽鏁板嚱鏁板鍋舵�х殑鏂规硶鍜屾楠�') + // setCollectResource(this.config.activeBook.bookId,[]) } this.handleChapterData(); }, @@ -958,6 +1043,25 @@ this.stepIndex++; } }, + //璧勬簮鏀惰棌浜嬩欢 + handleCollectResource(id,md5,resourcePath,resourceType,source,resourceName){ + console.log(this.collectResourceList); + let list = this.collectResourceList + if(list.findIndex(item => item.id == id) > -1) { + list = list.filter(item => item.id != id) + } else { + list.push({ + id, + md5, + resourcePath, + resourceType, + source, + resourceName, + }) + } + this.collectResourceList = list + setCollectResource(this.config.activeBook.bookId,this.collectResourceList) + } }, }; </script> -- Gitblit v1.9.1