| | |
| | | >申请试用</el-button |
| | | > |
| | | <el-button plain @click="useCode" v-if="!bookInfo.alreadyBuy">使用购书码</el-button> |
| | | <el-button plain @click="read" v-if="bookInfo.alreadyBuy">开始阅读</el-button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | import VRIcon from '@/assets/images/digitalTextbooks/VR.png' |
| | | import ziliaoIcon from '@/assets/images/digitalTextbooks/ziliao.png' |
| | | import teacherCertification from '@/views/personalCenter/teacherCertification.vue' |
| | | import { ElMessage } from 'element-plus' |
| | | |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { ref, onBeforeMount, inject, reactive, onMounted, watchEffect } from 'vue' |
| | | const MG = inject('MG') |
| | | const config = inject('config') |
| | |
| | | getBookResource() |
| | | } |
| | | }) |
| | | |
| | | const getTextBookList = async () => { |
| | | const data = { |
| | | start: 0, |
| | | size: 9999, |
| | | topicIdOrRefCode: 'applyDigitalBook', |
| | | appRefCode: config.appRefCode, |
| | | sort: { |
| | | type: 'Desc', |
| | | field: 'CreateDate', |
| | | }, |
| | | } |
| | | const res = await MG.ugc.getTopicMessageList(data) |
| | | if (res.datas && res.datas.length > 0) { |
| | | for (let i = 0; i < res.datas.length; i++) { |
| | | const item = res.datas[i] |
| | | item.content = JSON.parse(item.content)[0] |
| | | item.productId = item.content.id |
| | | } |
| | | const currentBook = res.datas.find((item) => item.productId == digitalTextId.value) |
| | | if (currentBook) { |
| | | return currentBook |
| | | } else { |
| | | return null |
| | | } |
| | | } else { |
| | | return null |
| | | } |
| | | } |
| | | |
| | | const read = () => { |
| | | let token = localStorage.getItem(config.tokenKey) |
| | | const url = config.textBookResourceUrl + '?bookId=' + bookInfo.value.refCode + '&token=' + token |
| | | window.open(url) |
| | | } |
| | | |
| | | const userActiveCodeGet = () => { |
| | | let lock = true |
| | |
| | | } |
| | | |
| | | //申请试用 |
| | | const applyTextBook = () => { |
| | | const applyTextBook = async () => { |
| | | console.log(userStore.userInfo, 'userInfo') |
| | | const isApply = await getTextBookList() |
| | | if (isApply?.state == 'WaitAudit') { |
| | | ElMessageBox.confirm('您已申请试用该书,是否前往查看', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }).then(() => { |
| | | router.push({ |
| | | path: '/myApply', |
| | | }) |
| | | }) |
| | | } else { |
| | | toApply() |
| | | } |
| | | } |
| | | |
| | | const toApply = () => { |
| | | if (localStorage.getItem(config.tokenKey)) { |
| | | if (userStore.userInfo && userStore.userInfo.role == 'Teacher') { |
| | | localStorage.setItem('applyBookInfo', JSON.stringify(bookInfo.value)) |