| | |
| | | <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> |
| | |
| | | <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 }, |
| | |
| | | }, |
| | | }, |
| | | //在这里对调用的方法进行挂载 |
| | | 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 { |
| | |
| | | auidoPathFour: "", |
| | | auidoPathFive: "", |
| | | isFocused: null, // 用于跟踪textarea的聚焦状态 |
| | | collectResourceList:[], |
| | | chapterData: { |
| | | isCollectImg: false, |
| | | isCollectVideo: false, |
| | |
| | | this.isFocused = null; // 当textarea失去焦点时,设置为false |
| | | }, |
| | | setBookQuestion() { |
| | | console.log("保存"); |
| | | localStorage.setItem( |
| | | "artAndDrama-book-question-two", |
| | | JSON.stringify(this.questionData) |
| | |
| | | }, |
| | | 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> |