| | |
| | | >使用激活码:<span>{{ item.code }}</span></span |
| | | > |
| | | <span class="createDate flex1" |
| | | >激活日期:{{ item.createDate ? item.createDate : "-" }}</span |
| | | >激活日期:{{ item.createDate ? item.createDate : '-' }}</span |
| | | > |
| | | </div> |
| | | <div class="listItemBox flex"> |
| | |
| | | v-for="pItem in item.typeList" |
| | | :key="pItem.id" |
| | | class="listItem" |
| | | @click=" |
| | | goBookDetails(pItem.id, pItem.name, pItem.defaultSaleMethodId) |
| | | " |
| | | @click="goBookDetails(pItem.id, pItem.name, pItem.defaultSaleMethodId)" |
| | | > |
| | | <div class="cover"> |
| | | <img |
| | | :src=" |
| | | pItem.icon ? getPublicImage(pItem.icon, '', '') : bookCover |
| | | " |
| | | :src="pItem.icon ? getPublicImage(pItem.icon, '', '') : bookCover" |
| | | alt="" |
| | | /> |
| | | <!-- <div class="type" v-if="pItem.type">{{ pItem.type }}</div> --> |
| | |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import { reactive, ref, onMounted, inject, watch } from "vue"; |
| | | import moment from "moment"; |
| | | import { getPublicImage } from "@/assets/js/middleGround/tool.js"; |
| | | import { ElMessage } from "element-plus"; |
| | | import { useUserStore } from "@/store"; |
| | | import { useRouter } from "vue-router"; |
| | | import bookCover from "@/assets/images/personalCenter/book-cover.png"; |
| | | const router = useRouter(); |
| | | const userStore = useUserStore(); |
| | | const MG = inject("MG"); |
| | | const activateCode = ref(""); |
| | | const loading = ref(false); |
| | | let dataList = ref([]); |
| | | import { reactive, ref, onMounted, inject, watch } from 'vue' |
| | | import moment from 'moment' |
| | | import { getPublicImage } from '@/assets/js/middleGround/tool.js' |
| | | import { ElMessage } from 'element-plus' |
| | | import { useUserStore } from '@/store' |
| | | import { useRouter } from 'vue-router' |
| | | import bookCover from '@/assets/images/personalCenter/book-cover.png' |
| | | const router = useRouter() |
| | | const userStore = useUserStore() |
| | | const MG = inject('MG') |
| | | const activateCode = ref('') |
| | | const loading = ref(false) |
| | | let dataList = ref([]) |
| | | let pages = reactive({ |
| | | page: 1, |
| | | pageSize: 5, |
| | | count: 0, |
| | | loading: false, |
| | | }); |
| | | }) |
| | | |
| | | // 使用激活码 |
| | | const userActiveCodeGet = () => { |
| | | loading.value = true; |
| | | let lock = true; |
| | | if (activateCode.value == "") { |
| | | loading.value = true |
| | | let lock = true |
| | | if (activateCode.value == '') { |
| | | ElMessage({ |
| | | type: "error", |
| | | message: "请输入激活码!", |
| | | }); |
| | | loading.value = false; |
| | | type: 'error', |
| | | message: '请输入激活码!', |
| | | }) |
| | | loading.value = false |
| | | } else { |
| | | if (lock) { |
| | | lock = false; |
| | | lock = false |
| | | MG.store |
| | | .userActiveCode({ |
| | | code: activateCode.value, |
| | | }) |
| | | .then((res) => { |
| | | ElMessage({ |
| | | type: res == "激活成功" ? "success" : "error", |
| | | type: res == '激活成功' ? 'success' : 'error', |
| | | message: res, |
| | | }); |
| | | activateCode.value = ""; |
| | | loading.value = false; |
| | | getDataList(); |
| | | lock = true; |
| | | }); |
| | | }) |
| | | activateCode.value = '' |
| | | loading.value = false |
| | | getDataList() |
| | | lock = true |
| | | }) |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | |
| | | function getDataList() { |
| | | pages.loading = true; |
| | | pages.loading = true |
| | | MG.store |
| | | .userActiveCodeList({ |
| | | start: (pages.page - 1) * pages.pageSize, |
| | | size: pages.pageSize, |
| | | sort: { |
| | | type: "Desc", |
| | | field: "CreateDate", |
| | | type: 'Desc', |
| | | field: 'CreateDate', |
| | | }, |
| | | }) |
| | | .then((res) => { |
| | | let list: any[] = []; |
| | | let list: any[] = [] |
| | | res.datas.forEach((item) => { |
| | | item.createDate = moment(item.createDate).format("YYYY-MM-DD HH:mm:ss"); |
| | | item.typeList = []; |
| | | item.createDate = moment(item.createDate).format('YYYY-MM-DD HH:mm:ss') |
| | | item.typeList = [] |
| | | item.saleMethodList.forEach(async (i) => { |
| | | const obj = { |
| | | icon: item.productList[0]?.icon, |
| | | id: item.productList[0]?.id, |
| | | name: item.productList[0]?.name, |
| | | type: |
| | | i.type == "defaultSaleMethod" |
| | | ? "电子书" |
| | | : i.name.includes("-") |
| | | ? i.name.split("-")[0] |
| | | : i.name, |
| | | i.type == 'defaultSaleMethod' |
| | | ? '电子书' |
| | | : i.name.includes('-') |
| | | ? i.name.split('-')[0] |
| | | : i.name, |
| | | defaultSaleMethodId: item.productList[0]?.defaultSaleMethodId, |
| | | }; |
| | | } |
| | | |
| | | let parentData = await MG.store.getProductBySaleMethod({ saleMethodId: i.id }); |
| | | if (parentData.storeLinks[0].storeRefCode == "jsek_digitalCourses") { |
| | | obj.type = "数字课程"; |
| | | let parentData = await MG.store.getProductBySaleMethod({ saleMethodId: i.id }) |
| | | if (parentData.storeLinks[0].storeRefCode == 'digitalCourses') { |
| | | obj.type = '数字课程' |
| | | } |
| | | if (parentData.storeLinks[0].storeRefCode == "digitalTextbooks") { |
| | | obj.type = "数字教材"; |
| | | if (parentData.storeLinks[0].storeRefCode == 'digitalTextbooks') { |
| | | obj.type = '数字教材' |
| | | } |
| | | item.typeList.push(obj); |
| | | }); |
| | | list.push(item); |
| | | }); |
| | | item.typeList.push(obj) |
| | | }) |
| | | list.push(item) |
| | | }) |
| | | setTimeout(() => { |
| | | dataList.value = list; |
| | | pages.count = res.totalSize; |
| | | pages.loading = false; |
| | | }, 500); |
| | | dataList.value = list |
| | | pages.count = res.totalSize |
| | | pages.loading = false |
| | | }, 500) |
| | | }) |
| | | .catch(() => { |
| | | pages.loading = false; |
| | | }); |
| | | pages.loading = false |
| | | }) |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getDataList(); |
| | | }); |
| | | getDataList() |
| | | }) |
| | | |
| | | // watch( |
| | | // () => userStore.token, |
| | |
| | | // ) |
| | | |
| | | const handleCurrentChange = (val: number) => { |
| | | pages.page = val; |
| | | getDataList(); |
| | | }; |
| | | pages.page = val |
| | | getDataList() |
| | | } |
| | | // 跳转书本详情 |
| | | const goBookDetails = async (id: number, name: string, defaultSaleMethodId: number) => { |
| | | let parentData = await MG.store.getProductBySaleMethod({ |
| | | saleMethodId: defaultSaleMethodId, |
| | | }); |
| | | if (parentData.storeLinks[0].storeRefCode == "jsek_digitalCourses") { |
| | | }) |
| | | if (parentData.storeLinks[0].storeRefCode == 'jsek_digitalCourses') { |
| | | router.push({ |
| | | name: "digitalCoursesDetails", |
| | | path: '/bookdetail', |
| | | query: { |
| | | bookId: parentData.id, |
| | | bookName: parentData.name, |
| | | }, |
| | | }); |
| | | } else if (parentData.storeLinks[0].storeRefCode == "digitalTextbooks") { |
| | | }) |
| | | } else if (parentData.storeLinks[0].storeRefCode == 'digitalTextbooks') { |
| | | router.push({ |
| | | name: "digitalTextbooksDetails", |
| | | path: '/bookdetail', |
| | | query: { |
| | | bookId: parentData.id, |
| | | bookName: parentData.name, |
| | | }, |
| | | }); |
| | | }) |
| | | } else { |
| | | router.push({ |
| | | name: "bookdetail", |
| | | path: '/bookdetail', |
| | | query: { |
| | | bookId: id, |
| | | }, |
| | | }); |
| | | }) |
| | | } |
| | | }; |
| | | } |
| | | </script> |
| | | <style lang="less" scoped> |
| | | ::v-deep(.activation) { |
| | |
| | | } |
| | | |
| | | .tipTitle { |
| | | font-family: Microsoft YaHei UI, Microsoft YaHei UI; |
| | | font-family: |
| | | Microsoft YaHei UI, |
| | | Microsoft YaHei UI; |
| | | font-weight: 400; |
| | | font-size: 16px; |
| | | color: #000000; |
| | |
| | | padding: 0 20px; |
| | | border: 1px solid #edecec; |
| | | background: #f3f3f3; |
| | | .flex1 span { |
| | | color: #019e58; |
| | | } |
| | | } |
| | | |
| | | .listItemBox { |