| | |
| | | </div> |
| | | <div class="details"> |
| | | <div class="text-flow" v-if="item.product.name"> |
| | | {{ item.product.name || "-" }} |
| | | {{ item.product.name || '-' }} |
| | | </div> |
| | | <div class="text-flow" :title="item.isbn"> |
| | | ISBN:{{ item.isbn.length != 0 ? item.isbn : "-" }} |
| | | ISBN:{{ item.isbn.length != 0 ? item.isbn : '-' }} |
| | | </div> |
| | | <div class="text-flow"> |
| | | 作者:{{ item.author.length != 0 ? item.author : "-" }} |
| | | </div> |
| | | <div class="text-flow">作者:{{ item.author.length != 0 ? item.author : '-' }}</div> |
| | | <!-- <div class="text-flow" v-if="item.ExpiryDate"> |
| | | 截止日期:<span style="color: #dd0000">{{ item.ExpiryDate }}</span> |
| | | </div> --> |
| | |
| | | </template> |
| | | |
| | | <script lang="ts" setup> |
| | | import { reactive, ref, onMounted, inject, watch } from "vue"; |
| | | import { useRouter } from "vue-router"; |
| | | import defaultImg from "@/assets/images/default-book-img.png"; |
| | | import { useUserStore } from "@/store"; |
| | | import tool from "@/assets/js/toolClass"; |
| | | const MG: any = inject("MG"); |
| | | const config: any = inject("config"); |
| | | const router = useRouter(); |
| | | let collectList = ref([]); |
| | | let currentCollect = ref("book"); |
| | | let isLoading = ref(false); |
| | | import { reactive, ref, onMounted, inject, watch } from 'vue' |
| | | import { useRouter } from 'vue-router' |
| | | import defaultImg from '@/assets/images/default-book-img.png' |
| | | import { useUserStore } from '@/store' |
| | | import tool from '@/assets/js/toolClass' |
| | | const MG: any = inject('MG') |
| | | const config: any = inject('config') |
| | | const router = useRouter() |
| | | let collectList = ref([]) |
| | | let currentCollect = ref('book') |
| | | let isLoading = ref(false) |
| | | let pages = reactive({ |
| | | page: 1, |
| | | pageSize: 10, |
| | | count: 0, |
| | | loading: false, |
| | | }); |
| | | let linkType = ref("PurchasedProduct"); |
| | | }) |
| | | let linkType = ref('PurchasedProduct') |
| | | let paginationData = reactive({ |
| | | page: 1, |
| | | limit: 10, |
| | | totalCount: 0, |
| | | totalPage: 0, |
| | | }); |
| | | let inputPage = ref(1); |
| | | const loading = ref(false); |
| | | const listData = ref([]); |
| | | }) |
| | | let inputPage = ref(1) |
| | | const loading = ref(false) |
| | | const listData = ref([]) |
| | | const keyQueryRequests = [ |
| | | { |
| | | key: "author", |
| | | key: 'author', |
| | | }, |
| | | { |
| | | key: "isbn", |
| | | key: 'isbn', |
| | | }, |
| | | ]; |
| | | ] |
| | | |
| | | const getData = () => { |
| | | loading.value = true; |
| | | loading.value = true |
| | | const searchData = [ |
| | | { |
| | | keywords: "digitalTextbooks", |
| | | field: "ProductType", |
| | | keywords: 'digitalTextbooks', |
| | | field: 'ProductType', |
| | | }, |
| | | ]; |
| | | ] |
| | | const data = { |
| | | Size: paginationData.limit, |
| | | Start: (paginationData.page - 1) * paginationData.limit, |
| | | sort: { |
| | | type: "Desc", |
| | | field: "CreateDate", |
| | | type: 'Desc', |
| | | field: 'CreateDate', |
| | | }, |
| | | searchList: searchData, |
| | | keyQueryRequests: keyQueryRequests, |
| | | }; |
| | | } |
| | | MG.store.getPurchasedProductList(data).then(async (response) => { |
| | | listData.value = handResultsChange(response.datas); |
| | | listData.value = handResultsChange(response.datas) |
| | | listData.value.forEach((item) => { |
| | | item.product.icon = tool.getPublicImage(item.product.icon); |
| | | }); |
| | | item.product.icon = tool.getPublicImage(item.product.icon) |
| | | }) |
| | | // //当前页面 |
| | | paginationData.totalCount = response.totalSize; |
| | | paginationData.totalCount = response.totalSize |
| | | paginationData.totalPage = |
| | | response.totalSize % paginationData.limit === 0 |
| | | ? response.totalSize / paginationData.limit |
| | | : Math.floor(response.totalSize / paginationData.limit) + 1; |
| | | loading.value = false; |
| | | collectList.value = response.datas; |
| | | }); |
| | | }; |
| | | : Math.floor(response.totalSize / paginationData.limit) + 1 |
| | | loading.value = false |
| | | collectList.value = response.datas |
| | | }) |
| | | } |
| | | onMounted(() => { |
| | | getData(); |
| | | }); |
| | | getData() |
| | | }) |
| | | // 处理查询结果 |
| | | const handResultsChange = (data) => { |
| | | let fieldsData = []; |
| | | let fieldsData = [] |
| | | for (let i = 0; i < data.length; i++) { |
| | | const item = data[i]; |
| | | const item = data[i] |
| | | for (const val in keyQueryRequests) { |
| | | fieldsData.push(keyQueryRequests[val].key); |
| | | fieldsData.push(keyQueryRequests[val].key) |
| | | } |
| | | for (let i = 0; i < fieldsData.length; i++) { |
| | | const field = fieldsData[i]; |
| | | item[field] = JSON.parse(item.datas[field]); |
| | | const datas = item[field]; |
| | | const field = fieldsData[i] |
| | | item[field] = JSON.parse(item.datas[field]) |
| | | const datas = item[field] |
| | | if (datas.length > 0) { |
| | | if (datas[0].Value) { |
| | | item[field] = datas[0].Value; |
| | | item[field] = datas[0].Value |
| | | } else if (datas[0].Data) { |
| | | item[field] = datas[0].Data.Value; |
| | | item[field] = datas[0].Data.Value |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return data; |
| | | }; |
| | | return data |
| | | } |
| | | |
| | | //到图书详情 |
| | | const goDetail = (item) => { |
| | | router.push({ |
| | | path: "/bookdetail", |
| | | path: '/bookdetail', |
| | | query: { |
| | | bookId: item.product.id, |
| | | }, |
| | | }); |
| | | }; |
| | | }) |
| | | } |
| | | |
| | | //分页 |
| | | const handleSizeChange = (val) => { |
| | | paginationData.limit = val; |
| | | getData(); |
| | | }; |
| | | paginationData.limit = val |
| | | getData() |
| | | } |
| | | const handleCurrentChange = (val) => { |
| | | paginationData.page = val; |
| | | inputPage.value = val; |
| | | getData(); |
| | | }; |
| | | paginationData.page = val |
| | | inputPage.value = val |
| | | getData() |
| | | } |
| | | const jumpFun = (event) => { |
| | | event.target.blur(); |
| | | var that = this; |
| | | event.target.blur() |
| | | var that = this |
| | | if (inputPage.value <= 0) { |
| | | inputPage.value = 1; |
| | | inputPage.value = 1 |
| | | } |
| | | if (inputPage.value > paginationData.totalPage) { |
| | | inputPage.value = paginationData.totalPage; |
| | | inputPage.value = paginationData.totalPage |
| | | } |
| | | paginationData.page = inputPage.value; |
| | | getData(); |
| | | }; |
| | | paginationData.page = inputPage.value |
| | | getData() |
| | | } |
| | | </script> |
| | | <style scoped> |
| | | .pageCon { |
| | |
| | | .myCarTopPage { |
| | | display: flex; |
| | | justify-content: flex-start; |
| | | flex-wrap: wrap; |
| | | box-sizing: border-box; |
| | | overflow: hidden; |
| | | padding-bottom: 20px; |
| | | } |
| | | .details div:first-child { |
| | | font-size: 16px; |
| | |
| | | } |
| | | .bookone { |
| | | display: flex; |
| | | width: 420px; |
| | | width: 405px; |
| | | min-height: 173px; |
| | | float: left; |
| | | cursor: pointer; |
| | | margin: 10px; |
| | | box-sizing: border-box; |
| | | margin: 20px 0px 0 20px; |
| | | padding: 10px 30px; |
| | | border: 1px solid #ddd; |
| | | box-sizing: border-box; |
| | | } |
| | | .bookone:hover { |
| | | -moz-box-shadow: 4px 3px 6px rgba(0, 0, 0, 0.3); |
| | |
| | | width: 120px; |
| | | height: 160px; |
| | | background: #fff; |
| | | box-shadow: 0px 0px 20px 1px #ccc; |
| | | } |
| | | .newBookli .imgBox { |
| | | position: relative; |