From 924121953fb670fd3c2278fffc26b65b57620110 Mon Sep 17 00:00:00 2001 From: zhongshujie <2862698242@qq.com> Date: 星期二, 06 八月 2024 16:50:14 +0800 Subject: [PATCH] 英语书整本Bug修改结束 --- src/books/artAndDrama/view/components/chapter001.vue | 61 ++++++++++++++++++++++-------- 1 files changed, 44 insertions(+), 17 deletions(-) diff --git a/src/books/artAndDrama/view/components/chapter001.vue b/src/books/artAndDrama/view/components/chapter001.vue index 77e18ae..1849a0e 100644 --- a/src/books/artAndDrama/view/components/chapter001.vue +++ b/src/books/artAndDrama/view/components/chapter001.vue @@ -79,7 +79,7 @@ <span>瑙嗛锛氭垜浠槸涓�瀹朵汉 </span> <el-tooltip class="item" effect="dark" :content="chapterData.isCollectVideo ? '鐐瑰嚮鍙栨秷' : '鐐瑰嚮鏀惰棌'" placement="top-start"> - <img :src="chapterData.isCollectVideo ? collectCheck : collectImg" alt="" class="collect-btn" + <img :src="collectResourceList.findIndex(item => item.id == '691cbd2c13198d04afc7800d0f2cafb0') > -1 ? collectCheck : collectImg" alt="" class="collect-btn" @click="handleCollect('video')" /> </el-tooltip> </p> @@ -202,11 +202,15 @@ </p> <p class="text t-l">姝d箟闃熼暱锛� <textarea v-model="questionData.reading.one" placeholder="璇疯緭鍏ュ唴瀹�" rows="6" - style="margin-left: 40px; width: 92%" class="" @change="setBookQuestion" :class="{ 'textarea-focused': isFocused === 'one' }" @focus="handleFocus('one')" @blur="handleBlur('one')" ></textarea> + style="margin-left: 40px; width: 92%" class="" @change="setBookQuestion" + :class="{ 'textarea-focused': isFocused === 'one' }" @focus="handleFocus('one')" + @blur="handleBlur('one')"></textarea> </p> <p class="text t-l">榛戞殫闃熼暱锛� <textarea v-model="questionData.reading.two" placeholder="璇疯緭鍏ュ唴瀹�" rows="6" - style="margin-left: 40px; width: 92%" class="" @change="setBookQuestion" :class="{ 'textarea-focused': isFocused === 'two' }" @focus="handleFocus('two')" @blur="handleBlur('two')"></textarea> + style="margin-left: 40px; width: 92%" class="" @change="setBookQuestion" + :class="{ 'textarea-focused': isFocused === 'two' }" @focus="handleFocus('two')" + @blur="handleBlur('two')"></textarea> </p> </div> <!-- 姝ゆ涓洪〉鑴氶儴鍒嗭紙闇�瑕佽缃〉鐮侊級 --> @@ -372,7 +376,7 @@ <span>瑙嗛锛氭垜浠槸涓�瀹朵汉 </span> <el-tooltip class="item" effect="dark" :content="chapterData.isCollectVideo ? '鐐瑰嚮鍙栨秷' : '鐐瑰嚮鏀惰棌'" placement="top-start"> - <img :src="chapterData.isCollectVideo ? collectCheck : collectImg" alt="" class="collect-btn" + <img :src="collectResourceList.findIndex(item => item.id == '691cbd2c13198d04afc7800d0f2cafb0') > -1 ? collectCheck : collectImg" alt="" class="collect-btn" @click="handleCollect('video')" /> </el-tooltip> </p> @@ -391,6 +395,7 @@ import matching from "@/components/matching/matching.vue"; import choice from "@/components/choice/choice.vue" import { getResourcePath } from "@/assets/methods/resources"; +import { getCollectResource, setCollectResource } from "@/assets/methods/resources"; export default { name: "chapterOne", components: { @@ -403,12 +408,18 @@ }, }, //鍦ㄨ繖閲屽璋冪敤鐨勬柟娉曡繘琛屾寕杞� - mounted() { - this.getVidoePath(); + async mounted() { const bookQuestion = localStorage.getItem("artAndDrama-book-question-one"); if (bookQuestion) { this.questionData = JSON.parse(bookQuestion); } + this.getVidoePath(); + const data = localStorage.getItem("artAndDrama-chapter01-Data"); + if (data) { + this.chapterData = JSON.parse(data); + } + this.collectResourceList = await getCollectResource(this.config.activeBook.bookId) + }, data() { return { @@ -427,6 +438,7 @@ accentColor: "", color: "#fff", isFocused: null, // 鐢ㄤ簬璺熻釜textarea鐨勮仛鐒︾姸鎬� + collectResourceList:[], chapterData: { isCollectImg: false, isCollectVideo: false, @@ -734,14 +746,13 @@ "3729175530def1b0baca68e0bd344862" ); }, - handleFocus(id) { + handleFocus(id) { this.isFocused = id; // 褰搕extarea鑱氱劍鏃讹紝璁剧疆涓簍rue - }, - handleBlur(id) { + }, + handleBlur(id) { this.isFocused = null; // 褰搕extarea澶卞幓鐒︾偣鏃讹紝璁剧疆涓篺alse - }, + }, setBookQuestion() { - console.log("淇濆瓨"); localStorage.setItem( "artAndDrama-book-question-one", JSON.stringify(this.questionData) @@ -749,18 +760,34 @@ }, handleChapterData() { localStorage.setItem( - "math-chapterData", + "artAndDrama-chapter01-Data", JSON.stringify(this.chapterData) ); }, handleCollect(type) { - if (type == "img") { - this.chapterData.isCollectImg = !this.chapterData.isCollectImg; - } else if (type == "video") { - this.chapterData.isCollectVideo = !this.chapterData.isCollectVideo; - } + if (type == "video") { + this.handleCollectResource("691cbd2c13198d04afc7800d0f2cafb0","691cbd2c13198d04afc7800d0f2cafb0",'',"瑙嗛","bits",'瑙嗛锛氭垜浠槸涓�瀹朵汉') + } this.handleChapterData(); }, + //璧勬簮鏀惰棌浜嬩欢 + handleCollectResource(id, md5, resourcePath, resourceType, source, resourceName) { + 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