| | |
| | | import { ref, watch, provide, onMounted, inject } from 'vue' |
| | | import { useRoute, useRouter, onBeforeRouteUpdate } from 'vue-router' |
| | | import { menu } from './config' |
| | | import { getPublicImage } from '@/assets/js/middleGround/tool.js' |
| | | import { getPublicImage } from '@/assets/js/middleGround/tool' |
| | | import defaultImg from '@/assets/images/default-book-img.png' |
| | | |
| | | const router: any = useRouter() |
| | |
| | | |
| | | onMounted(() => { |
| | | classInfo.value = JSON.parse(route.query.classInfo) |
| | | classIcon.value = classInfo.value.icon ? getPublicImage(classInfo.value.icon, 200) : defaultImg |
| | | classIcon.value = classInfo.value.icon ?? defaultImg |
| | | menu.forEach((item) => { |
| | | if ('/' + item.path === path.value) { |
| | | label.value = item.label |
| | |
| | | display: flex; |
| | | flex-direction: column; |
| | | background-color: #fff; |
| | | .mainbg { |
| | | background: #019e58; |
| | | color: #fff; |
| | | } |
| | | .layoutContentBox { |
| | | flex: 1; |
| | | height: auto; |
| | |
| | | } |
| | | |
| | | onMounted(() => { |
| | | defaultCmsPath.value = classInfo.bookRefCode ? 'digitalTextbooks' : 'defaultGoodsStore3' |
| | | defaultCmsPath.value = classInfo.bookRefCode ? '*' : 'defaultGoodsStore3' |
| | | getMessage() |
| | | }) |
| | | |
| | |
| | | >使用激活码:<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 { |
| | |
| | | <div class="personalPage-title">我的班级</div> |
| | | <div class="tabs"> |
| | | <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick"> |
| | | <el-tab-pane |
| | | :label="'当前班级(' + calssList.length + ')'" |
| | | name="1" |
| | | ></el-tab-pane> |
| | | <el-tab-pane :label="'当前班级(' + calssList.length + ')'" name="1"></el-tab-pane> |
| | | <!-- <el-tab-pane label="历史班级(5)" name="2"></el-tab-pane> --> |
| | | </el-tabs> |
| | | </div> |
| | | <div class="headerBox"> |
| | | <div class="searchBox"> |
| | | <el-input |
| | | v-model="searchKey" |
| | | clearable |
| | | @clear="searchList()" |
| | | placeholder="请输入关键字" |
| | | > |
| | | <el-input v-model="searchKey" clearable @clear="searchList()" placeholder="请输入关键字"> |
| | | <template #append> |
| | | <el-button |
| | | type="primary" |
| | | class="searchBtn" |
| | | @click="searchList()" |
| | | :icon="Search" |
| | | /> |
| | | <el-button type="primary" class="searchBtn" @click="searchList()" :icon="Search" /> |
| | | </template> |
| | | </el-input> |
| | | </div> |
| | | <el-button type="primary" class="applyStartClasses" @click="openJoin()" |
| | | >加入班级</el-button |
| | | > |
| | | <el-button type="primary" class="applyStartClasses" @click="openJoin()">加入班级</el-button> |
| | | <el-dialog v-model="dialogVisible" title="加入班级" width="500"> |
| | | <div class="codeContent"> |
| | | <span>邀请码:</span> |
| | |
| | | <div class="itemCon"> |
| | | <span>开课时间:</span> |
| | | <span |
| | | >{{ moment(classDetail.beginDate).format("YYYY-MM-DD") }} - |
| | | {{ moment(classDetail.endDate).format("YYYY-MM-DD") }}</span |
| | | >{{ moment(classDetail.beginDate).format('YYYY-MM-DD') }} - |
| | | {{ moment(classDetail.endDate).format('YYYY-MM-DD') }}</span |
| | | > |
| | | </div> |
| | | </div> |
| | |
| | | <div class="itemInfo" @click="goClassManage(item)"> |
| | | <div class="infoBox"> |
| | | <p> |
| | | 状态:<span v-if="item.userState == 'WaitValid'" style="color: #ef9f29"> |
| | | 审核中 </span |
| | | ><span v-if="item.userState == 'Normal'" style="color: #1dbd11"> |
| | | 进行中 </span |
| | | 状态:<span v-if="item.userState == 'WaitValid'" style="color: #ef9f29"> 审核中 </span |
| | | ><span v-if="item.userState == 'Normal'" style="color: #1dbd11"> 进行中 </span |
| | | ><span v-if="item.userState == 'Reject'" style="color: red"> 未通过 </span> |
| | | </p> |
| | | <p>班级人数:{{ item.memberCount }} / {{ item.maxUserCount }}</p> |
| | |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import { reactive, ref, onMounted, inject, watch } from "vue"; |
| | | import { Search } from "@element-plus/icons-vue"; |
| | | import { useRouter } from "vue-router"; |
| | | import { ElMessage } from "element-plus"; |
| | | import { getPublicImage } from "@/assets/js/middleGround/tool.js"; |
| | | import moment from "moment"; |
| | | import useClipboard from "vue-clipboard3"; |
| | | import { reactive, ref, onMounted, inject, watch } from 'vue' |
| | | import { Search } from '@element-plus/icons-vue' |
| | | import { useRouter } from 'vue-router' |
| | | import { ElMessage } from 'element-plus' |
| | | import { getPublicImage } from '@/assets/js/middleGround/tool.js' |
| | | import moment from 'moment' |
| | | import useClipboard from 'vue-clipboard3' |
| | | |
| | | const { toClipboard } = useClipboard(); |
| | | const MG: any = inject("MG"); |
| | | const config: any = inject("config"); |
| | | const router = useRouter(); |
| | | const activeName = ref("1"); |
| | | const { toClipboard } = useClipboard() |
| | | const MG: any = inject('MG') |
| | | const config: any = inject('config') |
| | | const router = useRouter() |
| | | const activeName = ref('1') |
| | | |
| | | interface ClassItem { |
| | | id: string; |
| | | name: string; |
| | | memberCount: number; |
| | | maxUserCount: number; |
| | | userState: string; |
| | | beginDate: string; |
| | | endDate: string; |
| | | classTime: string; |
| | | id: string |
| | | name: string |
| | | memberCount: number |
| | | maxUserCount: number |
| | | userState: string |
| | | beginDate: string |
| | | endDate: string |
| | | classTime: string |
| | | linkProductDto: { |
| | | product: { |
| | | name: string; |
| | | icon: string; |
| | | }; |
| | | }; |
| | | name: string |
| | | icon: string |
| | | } |
| | | } |
| | | } |
| | | |
| | | const calssList = ref<ClassItem[]>([]); |
| | | const searchKey = ref(""); |
| | | const codeText = ref(""); |
| | | const dialogVisible = ref(false); |
| | | const classDetail = ref(); |
| | | const isLoading = ref(true); |
| | | const calssList = ref<ClassItem[]>([]) |
| | | const searchKey = ref('') |
| | | const codeText = ref('') |
| | | const dialogVisible = ref(false) |
| | | const classDetail = ref() |
| | | const isLoading = ref(true) |
| | | |
| | | let pages = reactive({ |
| | | currentPage: 1, |
| | |
| | | pageSize: 6, |
| | | count: 0, |
| | | loading: false, |
| | | }); |
| | | }) |
| | | |
| | | onMounted(() => { |
| | | getCurrentClassList(); |
| | | }); |
| | | getCurrentClassList() |
| | | }) |
| | | |
| | | // 分页 |
| | | const handleSizeChange = (val: number) => { |
| | | pages.pageSize = val; |
| | | getCurrentClassList(); |
| | | }; |
| | | pages.pageSize = val |
| | | getCurrentClassList() |
| | | } |
| | | |
| | | const handleCurrentChange = (val: number) => { |
| | | pages.page = val; |
| | | pages.currentPage = val; |
| | | getCurrentClassList(); |
| | | }; |
| | | pages.page = val |
| | | pages.currentPage = val |
| | | getCurrentClassList() |
| | | } |
| | | |
| | | const handleClick = (val: any) => { |
| | | activeName.value = val; |
| | | }; |
| | | activeName.value = val |
| | | } |
| | | |
| | | const openJoin = () => { |
| | | dialogVisible.value = true; |
| | | classDetail.value = null; |
| | | codeText.value = ""; |
| | | }; |
| | | dialogVisible.value = true |
| | | classDetail.value = null |
| | | codeText.value = '' |
| | | } |
| | | |
| | | // 搜索 |
| | | const searchList = () => { |
| | | pages.page = 1; |
| | | pages.currentPage = 1; |
| | | getCurrentClassList(); |
| | | }; |
| | | pages.page = 1 |
| | | pages.currentPage = 1 |
| | | getCurrentClassList() |
| | | } |
| | | |
| | | // 复制 |
| | | const copy = async (text: string) => { |
| | | try { |
| | | await toClipboard(text); |
| | | await toClipboard(text) |
| | | ElMessage({ |
| | | message: "复制成功", |
| | | type: "success", |
| | | }); |
| | | message: '复制成功', |
| | | type: 'success', |
| | | }) |
| | | } catch (e) { |
| | | console.error(e); |
| | | console.error(e) |
| | | } |
| | | }; |
| | | } |
| | | |
| | | // 加入班级 |
| | | const joinClass = () => { |
| | | if (!codeText.value) { |
| | | ElMessage({ |
| | | message: "无效的邀请码", |
| | | type: "error", |
| | | }); |
| | | return false; |
| | | message: '无效的邀请码', |
| | | type: 'error', |
| | | }) |
| | | return false |
| | | } |
| | | const data = { refCode: codeText.value }; |
| | | const data = { refCode: codeText.value } |
| | | MG.identity.joinGroupByRefCode(data).then((res: any) => { |
| | | if (res == "组不存在") { |
| | | if (res == '组不存在') { |
| | | ElMessage({ |
| | | message: "无效的班级", |
| | | type: "error", |
| | | }); |
| | | message: '无效的班级', |
| | | type: 'error', |
| | | }) |
| | | } |
| | | if (res == "组成员数量已最大,不能加入") { |
| | | if (res == '组成员数量已最大,不能加入') { |
| | | ElMessage({ |
| | | message: "班级成员数量已最大,不能加入", |
| | | type: "error", |
| | | }); |
| | | message: '班级成员数量已最大,不能加入', |
| | | type: 'error', |
| | | }) |
| | | } |
| | | if (res == "已经申请过加入此组") { |
| | | if (res == '已经申请过加入此组') { |
| | | ElMessage({ |
| | | message: "已经申请过加入此班级", |
| | | type: "error", |
| | | }); |
| | | message: '已经申请过加入此班级', |
| | | type: 'error', |
| | | }) |
| | | } |
| | | dialogVisible.value = false; |
| | | getCurrentClassList(); |
| | | }); |
| | | }; |
| | | dialogVisible.value = false |
| | | getCurrentClassList() |
| | | }) |
| | | } |
| | | |
| | | // 获取当前班级列表 |
| | | const getCurrentClassList = () => { |
| | | isLoading.value = true; |
| | | isLoading.value = true |
| | | const data = { |
| | | start: (pages.page - 1) * pages.pageSize, |
| | | size: pages.pageSize, |
| | | sort: { |
| | | type: "Desc", |
| | | field: "CreateDate", |
| | | type: 'Desc', |
| | | field: 'CreateDate', |
| | | subSorts: [], |
| | | }, |
| | | filterList: [], |
| | |
| | | ? [ |
| | | { |
| | | keywords: searchKey.value, |
| | | field: "Name", |
| | | compareType: "Contains", |
| | | field: 'Name', |
| | | compareType: 'Contains', |
| | | }, |
| | | ] |
| | | : [], |
| | | }; |
| | | } |
| | | MG.identity.joinedGroupByList(data).then((res: any) => { |
| | | isLoading.value = false; |
| | | pages.count = res.totalSize; |
| | | isLoading.value = false |
| | | pages.count = res.totalSize |
| | | if (res.datas) { |
| | | calssList.value = res.datas.map((item: any) => { |
| | | return { |
| | | ...item, |
| | | classTime: |
| | | moment(item.beginDate).format("YYYY.MM.DD") + |
| | | "--" + |
| | | moment(item.endDate).format("YYYY.MM.DD"), |
| | | moment(item.beginDate).format('YYYY.MM.DD') + |
| | | '--' + |
| | | moment(item.endDate).format('YYYY.MM.DD'), |
| | | bookName: item.linkProductDto.product.name, |
| | | bookIcon: getPublicImage(item.linkProductDto.product.icon, 100), |
| | | }; |
| | | }); |
| | | } |
| | | }) |
| | | } |
| | | }); |
| | | }; |
| | | }) |
| | | } |
| | | |
| | | // 跳转班级管理 |
| | | const goClassManage = async (item: any) => { |
| | | if (item.userState == "WaitValid") { |
| | | if (item.userState == 'WaitValid') { |
| | | ElMessage({ |
| | | message: "正在审核中....", |
| | | type: "warning", |
| | | }); |
| | | return false; |
| | | message: '正在审核中....', |
| | | type: 'warning', |
| | | }) |
| | | return false |
| | | } |
| | | if (item.userState == "Reject") { |
| | | if (item.userState == 'Reject') { |
| | | ElMessage({ |
| | | message: "审核未通过", |
| | | type: "warning", |
| | | }); |
| | | return false; |
| | | message: '审核未通过', |
| | | type: 'warning', |
| | | }) |
| | | return false |
| | | } |
| | | const bookInfo = await getBookDetail(item.linkProductDto?.product); |
| | | const bookInfo = await getBookDetail(item.linkProductDto?.product) |
| | | let info = { |
| | | id: item.id, |
| | | name: item.name, |
| | |
| | | author: bookInfo.author, |
| | | isbn: bookInfo.isbn, |
| | | bookRefCode: bookInfo.refCode, |
| | | }; |
| | | } |
| | | let page = router.resolve({ |
| | | path: "/classManage", |
| | | path: '/classManage', |
| | | query: { |
| | | classInfo: JSON.stringify(info), |
| | | }, |
| | | }); |
| | | window.open(page.href, "_blank"); |
| | | }) |
| | | window.open(page.href, '_blank') |
| | | // router.push({ |
| | | // path: '/classManage', |
| | | // query: { |
| | | // classInfo: JSON.stringify(info) |
| | | // } |
| | | // }) |
| | | }; |
| | | } |
| | | |
| | | // 获取教材详情 |
| | | const getBookDetail = async (item: any) => { |
| | | const path = item.refCode ? "digitalTextbooks" : config.goodsStore; |
| | | const path = item.refCode ? '*' : config.goodsStore |
| | | let query = { |
| | | path, |
| | | queryType: "*", |
| | | queryType: '*', |
| | | productId: String(item.id), |
| | | storeInfo: path, |
| | | coverSize: { |
| | | height: 300, |
| | | width: 210, |
| | |
| | | author: [], |
| | | isbn: [], |
| | | }, |
| | | }; |
| | | const res = await MG.store.getProductDetail(query); |
| | | return res.datas ?? null; |
| | | }; |
| | | } |
| | | const res = await MG.store.getProductDetail(query) |
| | | return res.datas ?? null |
| | | } |
| | | |
| | | // 通过code查询班级 |
| | | const getClassDetail = () => { |
| | | if (codeText.value == "") { |
| | | if (codeText.value == '') { |
| | | ElMessage({ |
| | | message: "请输入邀请码", |
| | | type: "warning", |
| | | }); |
| | | return false; |
| | | message: '请输入邀请码', |
| | | type: 'warning', |
| | | }) |
| | | return false |
| | | } |
| | | const data = { |
| | | classIdOrRefCode: codeText.value, |
| | | }; |
| | | } |
| | | MG.edu |
| | | .getCourseClass(data) |
| | | .then((res: any) => { |
| | | classDetail.value = res; |
| | | classDetail.value = res |
| | | }) |
| | | .catch((err: any) => { |
| | | console.log(err); |
| | | }); |
| | | }; |
| | | console.log(err) |
| | | }) |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | |
| | | overflow: hidden; |
| | | .courseItem { |
| | | float: left; |
| | | width: 46%; |
| | | width: 45%; |
| | | margin: 0 2% 20px; |
| | | border-radius: 8px; |
| | | border: 1px solid #efefef; |
| | |
| | | padding: 0 20px; |
| | | // color: #fff; |
| | | background-color: #f8f8f8; |
| | | box-sizing: border-box; |
| | | .title { |
| | | font-weight: 600; |
| | | } |
| | |
| | | .infoBox { |
| | | flex: 1; |
| | | font-size: 12px; |
| | | padding: 10px 0; |
| | | p { |
| | | margin-bottom: 10px; |
| | | } |
| | |
| | | width: 90px; |
| | | height: 120px; |
| | | margin-right: 20px; |
| | | box-shadow: 0px 0px 20px 1px #ccc; |
| | | } |
| | | .infoBox { |
| | | flex: 1; |
| | |
| | | }) |
| | | return false |
| | | } |
| | | // if (userInfo.role == 'Teacher') { |
| | | // const data: any = menu.filter((item) => item.path != 'myClass') |
| | | // listMenu.value = data |
| | | // } else { |
| | | // const data: any = menu.filter((item) => item.path != 'myCourse') |
| | | // listMenu.value = data |
| | | // } |
| | | listMenu.value = menu |
| | | if (userInfo.role == 'Teacher') { |
| | | const data: any = menu.filter((item) => item.path != 'myClass') |
| | | listMenu.value = data |
| | | } else { |
| | | const data: any = menu.filter((item) => item.path != 'myCourse') |
| | | listMenu.value = data |
| | | } |
| | | }) |
| | | const goRouter = (item: any) => { |
| | | if (!localStorage.getItem(config.tokenKey) || localStorage.getItem(config.tokenKey) == null) { |
| | |
| | | <div class="personalPage-content"> |
| | | <div class="tipsText"> |
| | | <div> |
| | | 如您在教材试用申请过程中遇到问题,请于工作时间联系我们。<span class="phone"> |
| | | QQ号:3565269931 / 咨询电话010-65778403(工作时间:9:00~17:00) |
| | | </span> |
| | | {{ description }} |
| | | </div> |
| | | </div> |
| | | <div class="stageBtm" v-for="(item, index) in listData" :key="index"> |
| | |
| | | layout="total, prev, pager, next, slot" |
| | | :total="paginationData.totalCount" |
| | | > |
| | | <div style="display: inline-block"> |
| | | <div style="display: flex; align-items: center"> |
| | | <span class="el-pagination__jump" |
| | | >前往 |
| | | <div class="el-input el-pagination__editor is-in-pagination"> |
| | |
| | | import { reactive, ref, onMounted, inject } from 'vue' |
| | | import { getPublicImage } from '@/assets/js/middleGround/tool' |
| | | import { useRouter } from 'vue-router' |
| | | import tool from '@/assets/js/toolClass' |
| | | import defaultImg from '@/assets/images/default-book-img.png' |
| | | const MG: any = inject('MG') |
| | | const config: any = inject('config') |
| | |
| | | totalPage: 0, |
| | | }) |
| | | let inputPage = ref(1) |
| | | let description = ref('') |
| | | |
| | | const getTextBookList = () => { |
| | | loading.value = true |
| | |
| | | listData.value = res.datas |
| | | }) |
| | | } |
| | | |
| | | const getType = () => { |
| | | const data = { |
| | | refCodes: ['sampleBook'], |
| | | } |
| | | MG.resource |
| | | .getCmsTypeByRefCode(data) |
| | | .then((res) => { |
| | | if (res?.length) { |
| | | description.value = res[0]?.description |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | description.value = '' |
| | | }) |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getType() |
| | | getTextBookList() |
| | | }) |
| | | |
| | | const toDetail = (item: any) => { |
| | | router.push({ |
| | | name: 'digitalTextbooks-textbooksDetail', |
| | | path: '/bookdetail', |
| | | query: { |
| | | id: item.id, |
| | | rootCmsItemId: item.rootCmsItemId, |
| | | bookId: item.id, |
| | | }, |
| | | }) |
| | | } |
| | | const read = (pItem: any) => { |
| | | let token = MG.tool.getCookie(config.tokenKey) |
| | | window.open(config.textReaderUrl + '?bookId=' + pItem.refCode + '&token=' + token) |
| | | // let token = tool.getCookie(config.tokenKey) |
| | | // const url = config.textReaderUrl + '#/home' + '?bookId=' + pItem.id + '&token=' + token |
| | | // debugger |
| | | // window.open(url) |
| | | router.push({ |
| | | path: '/bookdetail', |
| | | query: { |
| | | bookId: pItem.id, |
| | | }, |
| | | }) |
| | | } |
| | | const handleSizeChange = (val: number) => { |
| | | paginationData.limit = val |
| | |
| | | } |
| | | |
| | | .pageBox { |
| | | display: flex; |
| | | justify-content: center; |
| | | background-color: #fff; |
| | | margin-top: 50px; |
| | | } |
| | | .stageBtm { |
| | | border: 1px solid #dcdcdc; |
| | |
| | | padding: 15px; |
| | | box-sizing: border-box; |
| | | .listImg { |
| | | display: inline-block; |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | margin-right: 60px; |
| | | width: 120px; |
| | | img { |
| | | width: 120px; |
| | | cursor: pointer; |
| | | box-shadow: 0px 0px 20px 1px #ccc; |
| | | } |
| | | .name { |
| | | line-height: 27px; |
| | | line-height: 30px; |
| | | font-size: 15px; |
| | | color: #333; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | white-space: nowrap; |
| | | padding: 5px 0; |
| | | box-sizing: border-box; |
| | | } |
| | | } |
| | | } |
| | |
| | | </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; |
| | |
| | | <div class="personalPage-title">我的购物车</div> |
| | | <div class="personalPage-content"> |
| | | <div class="deleteBox"> |
| | | <el-dialog |
| | | v-model="dialogVisible" |
| | | width="30%" |
| | | draggable |
| | | align-center |
| | | :modal="false" |
| | | > |
| | | <el-dialog v-model="dialogVisible" width="30%" draggable align-center :modal="false"> |
| | | <span> |
| | | <el-icon style="color: orange"> <Warning /> </el-icon |
| | | >确认要删除选中的商品吗?</span |
| | | <el-icon style="color: orange"> <Warning /> </el-icon>确认要删除选中的商品吗?</span |
| | | > |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | |
| | | |
| | | <el-dialog v-model="showHide" width="30%" draggable align-center :modal="false"> |
| | | <span |
| | | ><el-icon style="color: orange"> <Warning /> </el-icon |
| | | >确认要删除选中的商品吗?</span |
| | | ><el-icon style="color: orange"> <Warning /> </el-icon>确认要删除选中的商品吗?</span |
| | | > |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | |
| | | <el-table-column label="全选" width="200"> |
| | | <template #default="scope"> |
| | | <div style="position: relative; width: 110px"> |
| | | <el-image |
| | | :src="scope.row.imgUrl ? scope.row.imgUrl : defaultImg" |
| | | class="bookImg" |
| | | > |
| | | <el-image :src="scope.row.imgUrl ? scope.row.imgUrl : defaultImg" class="bookImg"> |
| | | </el-image> |
| | | <div |
| | | class="labelBox" |
| | |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | <el-table-column |
| | | property="name" |
| | | label="商品信息" |
| | | width="200" |
| | | /> |
| | | <el-table-column property="name" label="商品信息" width="200" /> |
| | | <el-table-column property="productType" label="商品类型" width="200" /> |
| | | <el-table-column label="价格"> |
| | | <template #default="scope">¥{{ scope.row.unitprice.toFixed(2) }}</template> |
| | |
| | | 总价:<span v-if="sumUnitprice">¥{{ sumUnitprice.toFixed(2) }}</span> |
| | | <span v-else>¥0.00</span> |
| | | </p> |
| | | <el-button class="button" type="warning" @click="goPaymentPage" |
| | | >结算</el-button |
| | | > |
| | | <el-button class="button" type="warning" @click="goPaymentPage">结算</el-button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import { onMounted, ref, inject, watch } from "vue"; |
| | | import { ElTable, ElMessage } from "element-plus"; |
| | | import { reactive } from "vue"; |
| | | import { useRouter } from "vue-router"; |
| | | import { InfoFilled } from "@element-plus/icons-vue"; |
| | | import { useUserStore } from "@/store"; |
| | | import { getPublicImage } from "@/assets/js/middleGround/tool.js"; |
| | | import defaultImg from "@/assets/images/default-book-img.png"; |
| | | const dialogVisible = ref(false); |
| | | const router = useRouter(); |
| | | const userStore = useUserStore(); |
| | | const MG = inject("MG"); |
| | | const total = ref(); |
| | | const multipleTableRef = ref(); |
| | | const loading = ref(true); |
| | | const selectAll = ref(false); |
| | | const multipleSelection = ref([]); |
| | | const orderNumber = ref(); |
| | | const select = ref(false); |
| | | const showHide = ref(false); |
| | | const selectedItemCount = ref(0); // 新增一个变量用于存储已选商品数量 |
| | | const sumUnitprice = ref(); |
| | | import { onMounted, ref, inject, watch } from 'vue' |
| | | import { ElTable, ElMessage } from 'element-plus' |
| | | import { reactive } from 'vue' |
| | | import { useRouter } from 'vue-router' |
| | | import { InfoFilled } from '@element-plus/icons-vue' |
| | | import { useUserStore } from '@/store' |
| | | import { getPublicImage } from '@/assets/js/middleGround/tool.js' |
| | | import defaultImg from '@/assets/images/default-book-img.png' |
| | | const dialogVisible = ref(false) |
| | | const router = useRouter() |
| | | const userStore = useUserStore() |
| | | const MG = inject('MG') |
| | | const total = ref() |
| | | const multipleTableRef = ref() |
| | | const loading = ref(true) |
| | | const selectAll = ref(false) |
| | | const multipleSelection = ref([]) |
| | | const orderNumber = ref() |
| | | const select = ref(false) |
| | | const showHide = ref(false) |
| | | const selectedItemCount = ref(0) // 新增一个变量用于存储已选商品数量 |
| | | const sumUnitprice = ref() |
| | | |
| | | watch(multipleSelection, (newSelection) => { |
| | | // 当 multipleSelection.value 发生变化时触发的回调函数 |
| | | let sum = 0; |
| | | let sum = 0 |
| | | newSelection.forEach((item) => { |
| | | sum += item.unitprice; |
| | | }); |
| | | sum += item.unitprice |
| | | }) |
| | | |
| | | sumUnitprice.value = sum; |
| | | sumUnitprice.value = sum |
| | | |
| | | selectedItemCount.value = newSelection.length; |
| | | }); |
| | | selectedItemCount.value = newSelection.length |
| | | }) |
| | | |
| | | onMounted(() => { |
| | | shoppingCartGet(); |
| | | shoppingCartGet() |
| | | // totalPrice() |
| | | }); |
| | | }) |
| | | const batchDelete = (evt) => { |
| | | let target = evt.target; |
| | | if (target.nodeName == "SPAN") { |
| | | target = evt.target.parentNode; |
| | | let target = evt.target |
| | | if (target.nodeName == 'SPAN') { |
| | | target = evt.target.parentNode |
| | | } |
| | | target.blur(); |
| | | target.blur() |
| | | if (multipleSelection.value.length === 0) { |
| | | // 如果没有选择任何商品,可以在此处给出提示或者直接返回 |
| | | ElMessage({ |
| | | message: "未选择商品", |
| | | type: "warning", |
| | | }); |
| | | message: '未选择商品', |
| | | type: 'warning', |
| | | }) |
| | | } else { |
| | | showHide.value = true; |
| | | showHide.value = true |
| | | // showHide.value = false |
| | | } |
| | | }; |
| | | } |
| | | |
| | | const handleSelectionChange = (val) => { |
| | | // console.log(val); |
| | | |
| | | multipleSelection.value = val; |
| | | multipleSelection.value = val |
| | | // 判断是否全部选择 |
| | | if (!delShoppingSelec.value) { |
| | | if (val.length === shoppingCartData.length) { |
| | | selectAll.value = true; |
| | | selectAll.value = true |
| | | } else { |
| | | selectAll.value = false; |
| | | selectAll.value = false |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | |
| | | // 切换所有行选中状态的方法 |
| | | const toggleAllSelection = () => { |
| | | if (shoppingCartData.length === 0) { |
| | | selectAll.value = false; |
| | | selectAll.value = false |
| | | |
| | | ElMessage({ |
| | | message: "没有可选择的商品", |
| | | type: "warning", |
| | | }); |
| | | message: '没有可选择的商品', |
| | | type: 'warning', |
| | | }) |
| | | } else { |
| | | multipleTableRef.value.toggleAllSelection(); |
| | | multipleTableRef.value.toggleAllSelection() |
| | | } |
| | | }; |
| | | const selectedRow = ref(); |
| | | } |
| | | const selectedRow = ref() |
| | | const dialog = (index, row) => { |
| | | dialogVisible.value = true; |
| | | dialogVisible.value = true |
| | | |
| | | // 将当前行数据存储起来,以备删除时使用 |
| | | selectedRow.value = row; |
| | | }; |
| | | selectedRow.value = row |
| | | } |
| | | |
| | | const handleDelete = () => { |
| | | const row = selectedRow.value; |
| | | dialogVisible.value = false; |
| | | const row = selectedRow.value |
| | | dialogVisible.value = false |
| | | MG.store |
| | | .delShoppingCart({ |
| | | ids: [row.id], |
| | | }) |
| | | .then((res) => { |
| | | shoppingCartGet(); |
| | | shoppingCartGet() |
| | | ElMessage({ |
| | | message: "删除成功", |
| | | type: "success", |
| | | }); |
| | | message: '删除成功', |
| | | type: 'success', |
| | | }) |
| | | //更新购物车数量 |
| | | userStore.updateRightPop(); |
| | | userStore.updateRightPop() |
| | | }) |
| | | .catch((error) => { |
| | | ElMessage.error("删除失败"); |
| | | }); |
| | | }; |
| | | ElMessage.error('删除失败') |
| | | }) |
| | | } |
| | | |
| | | //表单的样式 |
| | | const cellStyle = ({ row, column, rowIndex, columnIndex }) => { |
| | | if (columnIndex === 4) { |
| | | return { color: "#019e58" }; |
| | | return { color: '#019e58' } |
| | | } |
| | | }; |
| | | } |
| | | |
| | | const shoppingCartData = reactive([]); |
| | | const shoppingCartData = reactive([]) |
| | | |
| | | const shoppingCartGet = () => { |
| | | let query = { |
| | |
| | | size: 999, |
| | | filterList: [], |
| | | searchList: [], |
| | | }; |
| | | } |
| | | MG.store.getShoppingCartProductList(query).then((res) => { |
| | | const newData = res.datas.map((item) => { |
| | | console.log(item.saleMethod.type, "item.saleMethod.type"); |
| | | if (item.productMonWithLinkDto.links[0].storeRefCode == "digitalTextbooks") { |
| | | item.typeTxt = "数字教材"; |
| | | item.productType = "数字教材"; |
| | | } else if ( |
| | | item.productMonWithLinkDto.links[0].storeRefCode == "jsek_digitalCourses" |
| | | ) { |
| | | item.typeTxt = "数字课程"; |
| | | item.productType = "数字课程"; |
| | | console.log(item.saleMethod.type, 'item.saleMethod.type') |
| | | if (item.productMonWithLinkDto.links[0].storeRefCode == 'digitalTextbooks') { |
| | | item.typeTxt = '数字教材' |
| | | item.productType = '数字教材' |
| | | } else if (item.productMonWithLinkDto.links[0].storeRefCode == 'digitalCourses') { |
| | | item.typeTxt = '数字课程' |
| | | item.productType = '数字课程' |
| | | } else { |
| | | item.typeTxt = "电子书"; |
| | | item.productType = "图书服务-电子书"; |
| | | item.typeTxt = '电子书' |
| | | item.productType = '图书服务-电子书' |
| | | } |
| | | |
| | | // console.log(item.saleMethod.id); |
| | | console.log(item.saleMethod.type, "item.saleMethod.type"); |
| | | console.log(item.saleMethod.type, 'item.saleMethod.type') |
| | | return { |
| | | saleMethodId: item.saleMethod.id, |
| | | id: item.id, |
| | | name: |
| | | item.linkCmsItems.length && item.linkCmsItems[0].name |
| | | ? item.productMonWithLinkDto.product.name + ":" + item.linkCmsItems[0].name |
| | | ? item.productMonWithLinkDto.product.name + ':' + item.linkCmsItems[0].name |
| | | : item.productMonWithLinkDto.product.name, |
| | | type: item.saleMethod.type == "createProductItemSaleMethod" ? "item" : "product", |
| | | type: item.saleMethod.type == 'createProductItemSaleMethod' ? 'item' : 'product', |
| | | typeTxt: item.typeTxt, |
| | | productType: item.productType, |
| | | imgUrl: getPublicImage(item.productMonWithLinkDto.product.icon, "", "160"), |
| | | imgUrl: getPublicImage(item.productMonWithLinkDto.product.icon, '', '160'), |
| | | unitprice: item.saleMethod.price, |
| | | expire: |
| | | new Date(item.saleMethod.endDate).getTime() < new Date().getTime() || |
| | | new Date().getTime() < new Date(item.saleMethod.beginDate).getTime() |
| | | ? true |
| | | : false, |
| | | }; |
| | | }); |
| | | } |
| | | }) |
| | | |
| | | // 重新赋值 shoppingCartData.value |
| | | shoppingCartData.splice(0, shoppingCartData.length, ...newData); |
| | | loading.value = false; |
| | | }); |
| | | }; |
| | | shoppingCartData.splice(0, shoppingCartData.length, ...newData) |
| | | loading.value = false |
| | | }) |
| | | } |
| | | |
| | | //跳转面包屑 |
| | | const goPaymentPage = async () => { |
| | | try { |
| | | // console.log(multipleSelection.value, 346588998) |
| | | let expire = multipleSelection.value.filter((item) => item.expire == true); |
| | | let expire = multipleSelection.value.filter((item) => item.expire == true) |
| | | if (expire.length > 0) { |
| | | ElMessage({ |
| | | message: "您选择的商品有不在有效期内的,请重新选择可购买商品!", |
| | | type: "warning", |
| | | }); |
| | | message: '您选择的商品有不在有效期内的,请重新选择可购买商品!', |
| | | type: 'warning', |
| | | }) |
| | | } else { |
| | | const selectedIds = multipleSelection.value.map((item) => item.id); |
| | | const saleMethodId = multipleSelection.value.map((item) => item.saleMethodId); |
| | | const selectedIds = multipleSelection.value.map((item) => item.id) |
| | | const saleMethodId = multipleSelection.value.map((item) => item.saleMethodId) |
| | | |
| | | console.log(saleMethodId, 789); |
| | | console.log(saleMethodId, 789) |
| | | |
| | | let queryCreateOrder = { linkIds: selectedIds }; |
| | | const createOrderResult = await MG.store.shoppingCartCreateOrder(queryCreateOrder); |
| | | orderNumber.value = createOrderResult.orderNumber; |
| | | let queryCreateOrder = { linkIds: selectedIds } |
| | | const createOrderResult = await MG.store.shoppingCartCreateOrder(queryCreateOrder) |
| | | orderNumber.value = createOrderResult.orderNumber |
| | | |
| | | if (selectedIds.length) { |
| | | router.push({ |
| | | name: "paymentPage", |
| | | name: 'paymentPage', |
| | | query: { |
| | | crumbsKey: key, |
| | | orderNumber: orderNumber.value, |
| | | // type: route.query.type, |
| | | type: "shoppingCart", |
| | | type: 'shoppingCart', |
| | | onNorderSaleMethod: saleMethodId, |
| | | }, |
| | | }); |
| | | }) |
| | | } else { |
| | | ElMessage({ |
| | | message: "请选择商品", |
| | | type: "warning", |
| | | }); |
| | | message: '请选择商品', |
| | | type: 'warning', |
| | | }) |
| | | } |
| | | } |
| | | } catch (error) { |
| | | console.error(error); |
| | | console.error(error) |
| | | // 错误处理逻辑 |
| | | } |
| | | }; |
| | | } |
| | | |
| | | const delShoppingSelec = ref(); |
| | | const delShoppingSelec = ref() |
| | | |
| | | const confirmEvent = () => { |
| | | showHide.value = false; |
| | | showHide.value = false |
| | | if (multipleSelection.value.length === 0) { |
| | | // 如果没有选择任何商品,可以在此处给出提示或者直接返回 |
| | | return; |
| | | return |
| | | } else { |
| | | const selectedIds = multipleSelection.value.map((item) => item.id); |
| | | const selectedIds = multipleSelection.value.map((item) => item.id) |
| | | MG.store |
| | | .delShoppingCart({ ids: selectedIds }) |
| | | .then((res) => { |
| | | delShoppingSelec.value = res; |
| | | delShoppingSelec.value = res |
| | | ElMessage({ |
| | | message: "批量删除成功", |
| | | type: "success", |
| | | }); |
| | | selectAll.value = false; |
| | | message: '批量删除成功', |
| | | type: 'success', |
| | | }) |
| | | selectAll.value = false |
| | | // 删除成功后,刷新购物车列表 |
| | | shoppingCartGet(); |
| | | shoppingCartGet() |
| | | //更新购物车数量 |
| | | userStore.updateRightPop(); |
| | | userStore.updateRightPop() |
| | | }) |
| | | .catch((error) => { |
| | | console.error("批量删除失败", error); |
| | | ElMessage.error("批量删除失败"); |
| | | }); |
| | | console.error('批量删除失败', error) |
| | | ElMessage.error('批量删除失败') |
| | | }) |
| | | } |
| | | }; |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | |
| | | margin: 0 auto; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .selectproduct { |
| | | margin-top: 30px; |
| | | } |
| | | |
| | | ::v-deep { |
| | |
| | | </div> |
| | | </div> |
| | | <el-dialog align-center v-model="detailDialog" title="消息" class="messageDialog"> |
| | | <div> |
| | | <div class="messageContent"> |
| | | <div class="title">{{ dataInfo.name }}</div> |
| | | <div class="content" v-html="dataInfo.content"></div> |
| | | </div> |
| | |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import { reactive, ref, onMounted, inject, watch } from "vue"; |
| | | import moment from "moment"; |
| | | import { useUserStore } from "@/store"; |
| | | const userStore = useUserStore(); |
| | | const MG: any = inject("MG"); |
| | | const config: any = inject("config"); |
| | | let dataList = ref([]); |
| | | import { reactive, ref, onMounted, inject, watch } from 'vue' |
| | | import moment from 'moment' |
| | | import { useUserStore } from '@/store' |
| | | const userStore = useUserStore() |
| | | const MG: any = inject('MG') |
| | | const config: any = inject('config') |
| | | let dataList = ref([]) |
| | | let pages = reactive({ |
| | | page: 1, |
| | | pageSize: 10, |
| | | count: 0, |
| | | loading: false, |
| | | }); |
| | | const detailDialog = ref(false); |
| | | }) |
| | | const detailDialog = ref(false) |
| | | let dataInfo = reactive({ |
| | | name: "", |
| | | content: "", |
| | | }); |
| | | name: '', |
| | | content: '', |
| | | }) |
| | | |
| | | function getDataList() { |
| | | pages.loading = true; |
| | | pages.loading = true |
| | | MG.app |
| | | .getAppMessageList({ |
| | | appRefCode: config.appRefCode, |
| | | start: (pages.page - 1) * pages.pageSize, |
| | | size: pages.pageSize, |
| | | sort: { |
| | | type: "Desc", |
| | | field: "CreateDate", |
| | | type: 'Desc', |
| | | field: 'CreateDate', |
| | | }, |
| | | }) |
| | | .then((res) => { |
| | | pages.count = res.totalSize; |
| | | pages.count = res.totalSize |
| | | res.datas.forEach((item) => { |
| | | item.createDate = moment(item.createDate).format("YYYY-MM-DD HH:mm:ss"); |
| | | }); |
| | | dataList.value = res.datas; |
| | | pages.loading = false; |
| | | item.createDate = moment(item.createDate).format('YYYY-MM-DD HH:mm:ss') |
| | | }) |
| | | dataList.value = res.datas |
| | | pages.loading = false |
| | | }) |
| | | .catch(() => { |
| | | pages.loading = false; |
| | | }); |
| | | pages.loading = false |
| | | }) |
| | | } |
| | | onMounted(() => { |
| | | getDataList(); |
| | | }); |
| | | getDataList() |
| | | }) |
| | | |
| | | watch( |
| | | () => userStore?.token, |
| | | () => { |
| | | getDataList(); |
| | | } |
| | | ); |
| | | getDataList() |
| | | }, |
| | | ) |
| | | |
| | | const handleCurrentChange = (val: number) => { |
| | | pages.page = val; |
| | | getDataList(); |
| | | }; |
| | | pages.page = val |
| | | getDataList() |
| | | } |
| | | |
| | | function viewDetail(data) { |
| | | MG.app |
| | |
| | | }) |
| | | .then((res) => { |
| | | if (res) { |
| | | dataInfo.name = res.name; |
| | | dataInfo.content = res.content; |
| | | detailDialog.value = true; |
| | | dataInfo.name = res.name |
| | | dataInfo.content = res.content |
| | | detailDialog.value = true |
| | | } |
| | | }); |
| | | }) |
| | | } |
| | | </script> |
| | | <style lang="less" scoped> |
| | |
| | | |
| | | .messageDialog { |
| | | width: 600px; |
| | | .messageContent { |
| | | padding: 15px; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .title { |
| | | line-height: 22px; |
| | |
| | | pItem.orderSaleMethod.product.name, |
| | | pItem.orderSaleMethod.product.cmsTypeRefCode, |
| | | item.remarks, |
| | | pItem.orderSaleMethod.id |
| | | pItem.orderSaleMethod.id, |
| | | ) |
| | | " |
| | | > |
| | |
| | | <img |
| | | :src=" |
| | | pItem.orderSaleMethod.product.icon |
| | | ? getPublicImage( |
| | | pItem.orderSaleMethod.product.icon, |
| | | '', |
| | | '' |
| | | ) |
| | | ? getPublicImage(pItem.orderSaleMethod.product.icon, '', '') |
| | | : bookCover |
| | | " |
| | | alt="" |
| | |
| | | </div> |
| | | <div class="title flex ai-c"> |
| | | {{ |
| | | pItem.orderSaleMethod.type === "defaultSaleMethod" || |
| | | pItem.orderSaleMethod.type === 'defaultSaleMethod' || |
| | | pItem.orderSaleMethod.cmsItemList.length == 0 |
| | | ? pItem.orderSaleMethod.product.name |
| | | : pItem.orderSaleMethod.product.name + |
| | | ":" + |
| | | ':' + |
| | | pItem.orderSaleMethod.cmsItemList[0].name |
| | | }} |
| | | </div> |
| | | </div> |
| | | <span class="state">{{ |
| | | pItem.orderSaleMethod.product.cmsTypeRefCode == |
| | | "digitalTextbooks" |
| | | ? "数字教材" |
| | | : pItem.orderSaleMethod.product.cmsTypeRefCode == |
| | | "jsek_digitalCourses" |
| | | ? "数字课程" |
| | | : pItem.orderSaleMethod.type == "defaultSaleMethod" |
| | | ? "图书服务-电子书" |
| | | : pItem.orderSaleMethod.type == "createProductSaleMethod" && |
| | | pItem.orderSaleMethod.cmsItemList == 0 |
| | | ? "图书服务-组卷" |
| | | : pItem.orderSaleMethod.cmsItemList[0].type == |
| | | "questionBankFolder" |
| | | ? "图书服务-云测试" |
| | | : "图书服务-云学习" |
| | | pItem.orderSaleMethod.product.cmsTypeRefCode == 'digitalTextbooks' |
| | | ? '数字教材' |
| | | : pItem.orderSaleMethod.product.cmsTypeRefCode == 'jsek_digitalCourses' |
| | | ? '数字课程' |
| | | : pItem.orderSaleMethod.type == 'defaultSaleMethod' |
| | | ? '图书服务-电子书' |
| | | : pItem.orderSaleMethod.type == 'createProductSaleMethod' && |
| | | pItem.orderSaleMethod.cmsItemList == 0 |
| | | ? '图书服务-组卷' |
| | | : pItem.orderSaleMethod.cmsItemList[0].type == 'questionBankFolder' |
| | | ? '图书服务-云测试' |
| | | : '图书服务-云学习' |
| | | }}</span> |
| | | <div class="price"> |
| | | <span>¥{{ pItem.payPrice.toFixed(2) }}</span> |
| | |
| | | <span v-if="item.createDate"> |
| | | 创建时间: |
| | | <span>{{ item.createDate.slice(0, 10) }}</span> |
| | | <span style="margin-left: 5px">{{ |
| | | item.createDate.slice(11, 19) |
| | | }}</span> |
| | | <span style="margin-left: 5px">{{ item.createDate.slice(11, 19) }}</span> |
| | | </span> |
| | | <span class="right"> |
| | | <span |
| | | >总计:<span class="main" |
| | | >¥{{ item.totalPrice.toFixed(2) }}</span |
| | | ></span |
| | | >总计:<span class="main">¥{{ item.totalPrice.toFixed(2) }}</span></span |
| | | > |
| | | <span class="status yes" v-if="item.state == 'Success'">已完成</span> |
| | | <span class="status cancel" v-if="item.state == 'Cancel'" |
| | | >已取消</span |
| | | > |
| | | <span class="status cancel" v-if="item.state == 'ReFoundFinished'" |
| | | >已退款</span |
| | | > |
| | | <span class="status cancel" v-if="item.state == 'Cancel'">已取消</span> |
| | | <span class="status cancel" v-if="item.state == 'ReFoundFinished'">已退款</span> |
| | | <span class="status" v-if="item.state == 'WaitPay'"> |
| | | <span class="main hover" @click="toPay(item.orderNumber)" |
| | | >立即支付</span |
| | | > |
| | | <span class="main hover" @click="toPay(item.orderNumber)">立即支付</span> |
| | | <span class="grey hover" @click="cancleOrder(item.orderNumber)" |
| | | >取消订单</span |
| | | > |
| | |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import { reactive, ref, onMounted, inject, watch } from "vue"; |
| | | import { ElMessage } from "element-plus"; |
| | | import { getPublicImage } from "@/assets/js/middleGround/tool.js"; |
| | | import { useRouter } from "vue-router"; |
| | | import { useUserStore } from "@/store"; |
| | | import bookCover from "@/assets/images/personalCenter/book-cover.png"; |
| | | const router = useRouter(); |
| | | const userStore = useUserStore(); |
| | | const MG: any = inject("MG"); |
| | | let order = ref("all"); |
| | | let dataList = ref([]); |
| | | let queryFilter = reactive([]); |
| | | import { reactive, ref, onMounted, inject, watch } from 'vue' |
| | | import { ElMessage } from 'element-plus' |
| | | import { getPublicImage } from '@/assets/js/middleGround/tool.js' |
| | | import { useRouter } from 'vue-router' |
| | | import { useUserStore } from '@/store' |
| | | import bookCover from '@/assets/images/personalCenter/book-cover.png' |
| | | const router = useRouter() |
| | | const userStore = useUserStore() |
| | | const MG: any = inject('MG') |
| | | let order = ref('all') |
| | | let dataList = ref([]) |
| | | let queryFilter = reactive([]) |
| | | let pages = reactive({ |
| | | page: 1, |
| | | pageSize: 5, |
| | | count: 0, |
| | | loading: false, |
| | | }); |
| | | }) |
| | | |
| | | const tabCart = (event: Event) => { |
| | | order.value = event.props.name; |
| | | pages.page = 1; |
| | | dataList.value = []; |
| | | if (order.value == "all") { |
| | | queryFilter.value = []; |
| | | order.value = event.props.name |
| | | pages.page = 1 |
| | | dataList.value = [] |
| | | if (order.value == 'all') { |
| | | queryFilter.value = [] |
| | | } |
| | | if (order.value == "payment") { |
| | | queryFilter.value = [{ field: "State", value: "WaitPay" }]; |
| | | if (order.value == 'payment') { |
| | | queryFilter.value = [{ field: 'State', value: 'WaitPay' }] |
| | | } |
| | | if (order.value == "complete") { |
| | | queryFilter.value = [{ field: "State", value: "Success" }]; |
| | | if (order.value == 'complete') { |
| | | queryFilter.value = [{ field: 'State', value: 'Success' }] |
| | | } |
| | | if (order.value == "cancellation") { |
| | | queryFilter.value = [{ field: "State", value: "Cancel" }]; |
| | | if (order.value == 'cancellation') { |
| | | queryFilter.value = [{ field: 'State', value: 'Cancel' }] |
| | | } |
| | | getDataList(); |
| | | }; |
| | | getDataList() |
| | | } |
| | | function getDataList() { |
| | | pages.loading = true; |
| | | pages.loading = true |
| | | const data = { |
| | | start: pages.pageSize * pages.page - pages.pageSize, |
| | | size: pages.pageSize, |
| | | filterList: queryFilter.value, |
| | | sort: { |
| | | type: "Desc", |
| | | field: "CreateDate", |
| | | type: 'Desc', |
| | | field: 'CreateDate', |
| | | }, |
| | | }; |
| | | } |
| | | MG.store |
| | | .getUserOrderList(data) |
| | | .then((res) => { |
| | | res.datas.forEach((item, index) => { |
| | | item.index = |
| | | pages.page == 1 ? index + 1 : pages.pageSize * (pages.page - 1) + (index + 1); |
| | | item.productList = item.saleMethodLinks; |
| | | item.time = item.createDate.slice(0, 10) + +item.createDate.slice(11, 20); |
| | | }); |
| | | pages.count = res.totalSize; |
| | | dataList.value = [...res.datas]; |
| | | console.log("订单列表", res.datas); |
| | | pages.loading = false; |
| | | item.index = pages.page == 1 ? index + 1 : pages.pageSize * (pages.page - 1) + (index + 1) |
| | | item.productList = item.saleMethodLinks |
| | | item.time = item.createDate.slice(0, 10) + +item.createDate.slice(11, 20) |
| | | }) |
| | | pages.count = res.totalSize |
| | | dataList.value = [...res.datas] |
| | | console.log('订单列表', res.datas) |
| | | pages.loading = false |
| | | }) |
| | | .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, |
| | | refCode: string, |
| | | remarks: string, |
| | | orderSaleMethodId: string |
| | | orderSaleMethodId: string, |
| | | ) => { |
| | | let parentData = null; |
| | | let bookId = id; |
| | | if (refCode == "digitalCourses") { |
| | | let parentData = null |
| | | let bookId = id |
| | | if (refCode == 'digitalCourses') { |
| | | router.push({ |
| | | path: "/bookdetail", |
| | | path: '/bookdetail', |
| | | query: { |
| | | bookId: bookId, |
| | | }, |
| | | }); |
| | | } else if (refCode == "digitalTextbooks") { |
| | | }) |
| | | } else if (refCode == 'digitalTextbooks') { |
| | | router.push({ |
| | | path: "/bookdetail", |
| | | path: '/bookdetail', |
| | | query: { |
| | | bookId: bookId, |
| | | }, |
| | | }); |
| | | }) |
| | | } else { |
| | | parentData = await MG.store.getProductBySaleMethod({ |
| | | saleMethodId: orderSaleMethodId, |
| | | }); |
| | | }) |
| | | if (parentData.parentProduct.length > 0) { |
| | | bookId = parentData.parentProduct[parentData.parentProduct.length - 1].id; |
| | | bookId = parentData.parentProduct[parentData.parentProduct.length - 1].id |
| | | } |
| | | router.push({ |
| | | path: "/bookdetail", |
| | | path: '/bookdetail', |
| | | query: { |
| | | bookId: bookId, |
| | | }, |
| | | }); |
| | | }) |
| | | } |
| | | }; |
| | | } |
| | | //立即支付 |
| | | const toPay = (orderNo) => { |
| | | router.push({ |
| | | path: "/paymentPage", //要跳转的页面 |
| | | path: '/paymentPage', //要跳转的页面 |
| | | query: { |
| | | orderNum: orderNo, |
| | | type: "personalCenter", |
| | | type: 'personalCenter', |
| | | }, |
| | | }); |
| | | }; |
| | | }) |
| | | } |
| | | |
| | | //取消订单 |
| | | const cancleOrder = (orderNum) => { |
| | | MG.store.cancelOrder({ orderNum: orderNum }).then(() => { |
| | | ElMessage({ |
| | | message: "订单已取消", |
| | | type: "success", |
| | | }); |
| | | getDataList(); |
| | | }); |
| | | }; |
| | | message: '订单已取消', |
| | | type: 'success', |
| | | }) |
| | | getDataList() |
| | | }) |
| | | } |
| | | </script> |
| | | <style lang="less" scoped> |
| | | .cartClass { |
| | |
| | | |
| | | .title { |
| | | height: 180px; |
| | | line-height: 180px; |
| | | } |
| | | |
| | | .state { |