From 3c3336804abaee7ce364cfb7be10d3849f6dd9cc Mon Sep 17 00:00:00 2001 From: zhongshujie <2862698242@qq.com> Date: 星期四, 08 八月 2024 16:05:44 +0800 Subject: [PATCH] 艺术戏剧(8.8) --- src/books/artAndDrama/view/components/chapter002.vue | 52 ++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 40 insertions(+), 12 deletions(-) diff --git a/src/books/artAndDrama/view/components/chapter002.vue b/src/books/artAndDrama/view/components/chapter002.vue index 515195d..f982cfe 100644 --- a/src/books/artAndDrama/view/components/chapter002.vue +++ b/src/books/artAndDrama/view/components/chapter002.vue @@ -115,13 +115,12 @@ <p class="text">甯歌█閬擄細鑹█涓�鍙ヤ笁鍐殩锛屾伓璇激浜哄叚鏈堝瘨銆傝瑷�鍦ㄤ汉涓庝汉鐨勪氦寰�涓捣鐫�閲嶈鐨勪綔鐢紝鏈夌潃鏃犵┓鐨勫姏閲忋��</p> <p class="text t-l" ><span class="hs1">鈼�</span>濡傛灉鏈嬪弸蹇冩儏涓嶅ソ锛屼綘璇ユ�庝箞瀹夋叞浠�/濂瑰憿锛� <textarea v-model="questionData.reading.one" placeholder="璇疯緭鍏ュ唴瀹�" rows="6" - style="margin-left: 40px; width: 92%" class="fz-16 fm-son" @change="setBookQuestion"></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"><span class="hs1">鈼�</span>濡傛灉浣犻個璇峰ソ鏈嬪弸鏉ュ閲屽仛瀹紝浣犺璇翠粈涔堟潵娆㈣繋浠�/濂瑰憿锛� <textarea v-model="questionData.reading.two" placeholder="璇疯緭鍏ュ唴瀹�" rows="6" - style="margin-left: 40px; width: 92%" class="fz-16 fm-son" @change="setBookQuestion"> - </textarea> + style="margin-left: 40px; width: 92%" class="" @change="setBookQuestion" :class="{ 'textarea-focused': isFocused === 'two' }" @focus="handleFocus('two')" @blur="handleBlur('two')" ></textarea> </p> <h3 class="lefth3" id="c016" style="margin-top: 7%;"><img class="img-gn1" alt="" @@ -250,7 +249,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 == 'a3c9b55ac8227e4c885384ff2fc6c0e7') > -1 ? collectCheck : collectImg" alt="" class="collect-btn" @click="handleCollect('video')" /> </el-tooltip> </p> @@ -268,6 +267,7 @@ <script> import drag from "@/components/dragQuestion/index.vue" import { getResourcePath } from "@/assets/methods/resources"; +import { getCollectResource, setCollectResource } from "@/assets/methods/resources"; export default { name: "chapterTwo", components: { drag }, @@ -277,12 +277,17 @@ }, }, //鍦ㄨ繖閲屽璋冪敤鐨勬柟娉曡繘琛屾寕杞� - mounted() { + async mounted() { this.getVidoePath(); const bookQuestion = localStorage.getItem("artAndDrama-book-question-two"); if (bookQuestion) { this.questionData = JSON.parse(bookQuestion); } + const data = localStorage.getItem("artAndDrama-chapter02-Data"); + if (data) { + this.chapterData = JSON.parse(data); + } + this.collectResourceList = await getCollectResource(this.config.activeBook.bookId) }, data() { return { @@ -294,6 +299,8 @@ auidoPathThree: "", auidoPathFour: "", auidoPathFive: "", + isFocused: null, // 鐢ㄤ簬璺熻釜textarea鐨勮仛鐒︾姸鎬� + collectResourceList:[], chapterData: { isCollectImg: false, isCollectVideo: false, @@ -469,8 +476,13 @@ "a37bb621b2591e3666e94d1a3bc23bc0" ); }, + handleFocus(id) { + this.isFocused = id; // 褰搕extarea鑱氱劍鏃讹紝璁剧疆涓簍rue + }, + handleBlur(id) { + this.isFocused = null; // 褰搕extarea澶卞幓鐒︾偣鏃讹紝璁剧疆涓篺alse + }, setBookQuestion() { - console.log("淇濆瓨"); localStorage.setItem( "artAndDrama-book-question-two", JSON.stringify(this.questionData) @@ -478,18 +490,34 @@ }, handleChapterData() { localStorage.setItem( - "math-chapterData", + "artAndDrama-chapter02-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("a3c9b55ac8227e4c885384ff2fc6c0e7","a3c9b55ac8227e4c885384ff2fc6c0e7",'',"瑙嗛","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