From 07b53eedf9771d98485c9d7e310f6126a53af80e Mon Sep 17 00:00:00 2001 From: QYF-GitLab1 <1940665526@qq.com> Date: 星期日, 24 八月 2025 12:17:12 +0800 Subject: [PATCH] 样式调整 --- src/views/classManage/interactionDetail.vue | 2 src/views/personalCenter/class.vue | 286 ++++++------- src/views/personalCenter/course.vue | 1 src/views/classManage/index.vue | 8 src/views/personalCenter/activeCode.vue | 163 +++--- src/views/personalCenter/myApply.vue | 56 ++ src/views/personalCenter/myOrder.vue | 199 ++++----- src/views/personalCenter/myBook.vue | 148 +++--- src/views/personalCenter/myCart.vue | 273 +++++------- src/views/personalCenter/myMessage.vue | 74 +- src/views/personalCenter/index.vue | 15 11 files changed, 602 insertions(+), 623 deletions(-) diff --git a/src/views/classManage/index.vue b/src/views/classManage/index.vue index cdc925a..8495815 100644 --- a/src/views/classManage/index.vue +++ b/src/views/classManage/index.vue @@ -52,7 +52,7 @@ 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() @@ -92,7 +92,7 @@ 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 @@ -165,6 +165,10 @@ display: flex; flex-direction: column; background-color: #fff; + .mainbg { + background: #019e58; + color: #fff; + } .layoutContentBox { flex: 1; height: auto; diff --git a/src/views/classManage/interactionDetail.vue b/src/views/classManage/interactionDetail.vue index 5232036..7da4da6 100644 --- a/src/views/classManage/interactionDetail.vue +++ b/src/views/classManage/interactionDetail.vue @@ -187,7 +187,7 @@ } onMounted(() => { - defaultCmsPath.value = classInfo.bookRefCode ? 'digitalTextbooks' : 'defaultGoodsStore3' + defaultCmsPath.value = classInfo.bookRefCode ? '*' : 'defaultGoodsStore3' getMessage() }) diff --git a/src/views/personalCenter/activeCode.vue b/src/views/personalCenter/activeCode.vue index d87ce16..f78e69e 100644 --- a/src/views/personalCenter/activeCode.vue +++ b/src/views/personalCenter/activeCode.vue @@ -29,7 +29,7 @@ >浣跨敤婵�娲荤爜锛�<span>{{ item.code }}</span></span > <span class="createDate flex1" - >婵�娲绘棩鏈燂細{{ item.createDate ? item.createDate : "-" }}</span + >婵�娲绘棩鏈燂細{{ item.createDate ? item.createDate : '-' }}</span > </div> <div class="listItemBox flex"> @@ -38,15 +38,11 @@ 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> --> @@ -86,112 +82,112 @@ </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, @@ -201,39 +197,37 @@ // ) 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) { @@ -249,7 +243,9 @@ } .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; @@ -265,6 +261,9 @@ padding: 0 20px; border: 1px solid #edecec; background: #f3f3f3; + .flex1 span { + color: #019e58; + } } .listItemBox { diff --git a/src/views/personalCenter/class.vue b/src/views/personalCenter/class.vue index 3b25649..f6a6dff 100644 --- a/src/views/personalCenter/class.vue +++ b/src/views/personalCenter/class.vue @@ -3,34 +3,19 @@ <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> @@ -49,8 +34,8 @@ <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> @@ -72,10 +57,8 @@ <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> @@ -102,43 +85,43 @@ </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, @@ -146,97 +129,97 @@ 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: [], @@ -244,48 +227,48 @@ ? [ { 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: "姝e湪瀹℃牳涓�....", - type: "warning", - }); - return false; + message: '姝e湪瀹℃牳涓�....', + 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, @@ -295,30 +278,29 @@ 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, @@ -327,32 +309,32 @@ 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> @@ -382,7 +364,7 @@ overflow: hidden; .courseItem { float: left; - width: 46%; + width: 45%; margin: 0 2% 20px; border-radius: 8px; border: 1px solid #efefef; @@ -393,6 +375,7 @@ padding: 0 20px; // color: #fff; background-color: #f8f8f8; + box-sizing: border-box; .title { font-weight: 600; } @@ -432,6 +415,7 @@ .infoBox { flex: 1; font-size: 12px; + padding: 10px 0; p { margin-bottom: 10px; } diff --git a/src/views/personalCenter/course.vue b/src/views/personalCenter/course.vue index ecb2b1c..969624a 100644 --- a/src/views/personalCenter/course.vue +++ b/src/views/personalCenter/course.vue @@ -534,6 +534,7 @@ width: 90px; height: 120px; margin-right: 20px; + box-shadow: 0px 0px 20px 1px #ccc; } .infoBox { flex: 1; diff --git a/src/views/personalCenter/index.vue b/src/views/personalCenter/index.vue index bccd08a..acbc95b 100644 --- a/src/views/personalCenter/index.vue +++ b/src/views/personalCenter/index.vue @@ -69,14 +69,13 @@ }) 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) { diff --git a/src/views/personalCenter/myApply.vue b/src/views/personalCenter/myApply.vue index d5cb698..49971ef 100644 --- a/src/views/personalCenter/myApply.vue +++ b/src/views/personalCenter/myApply.vue @@ -5,9 +5,7 @@ <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"> @@ -82,7 +80,7 @@ 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"> @@ -108,6 +106,7 @@ 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') @@ -121,6 +120,7 @@ totalPage: 0, }) let inputPage = ref(1) +let description = ref('') const getTextBookList = () => { loading.value = true @@ -161,22 +161,47 @@ 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 @@ -220,8 +245,9 @@ } .pageBox { + display: flex; + justify-content: center; background-color: #fff; - margin-top: 50px; } .stageBtm { border: 1px solid #dcdcdc; @@ -260,20 +286,26 @@ 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; } } } diff --git a/src/views/personalCenter/myBook.vue b/src/views/personalCenter/myBook.vue index b7ec6bf..0f21fa7 100644 --- a/src/views/personalCenter/myBook.vue +++ b/src/views/personalCenter/myBook.vue @@ -16,14 +16,12 @@ </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> --> @@ -70,134 +68,134 @@ </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 { @@ -210,9 +208,8 @@ .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; @@ -258,14 +255,14 @@ } .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); @@ -278,6 +275,7 @@ width: 120px; height: 160px; background: #fff; + box-shadow: 0px 0px 20px 1px #ccc; } .newBookli .imgBox { position: relative; diff --git a/src/views/personalCenter/myCart.vue b/src/views/personalCenter/myCart.vue index 7100f53..e9ea084 100644 --- a/src/views/personalCenter/myCart.vue +++ b/src/views/personalCenter/myCart.vue @@ -3,16 +3,9 @@ <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"> @@ -24,8 +17,7 @@ <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"> @@ -53,10 +45,7 @@ <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" @@ -70,11 +59,7 @@ </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> @@ -119,9 +104,7 @@ 鎬讳环锛�<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> @@ -130,127 +113,127 @@ </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 = { @@ -258,124 +241,122 @@ 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> @@ -473,10 +454,6 @@ margin: 0 auto; } } -} - -.selectproduct { - margin-top: 30px; } ::v-deep { diff --git a/src/views/personalCenter/myMessage.vue b/src/views/personalCenter/myMessage.vue index 9d87747..c9ee998 100644 --- a/src/views/personalCenter/myMessage.vue +++ b/src/views/personalCenter/myMessage.vue @@ -33,7 +33,7 @@ </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> @@ -43,64 +43,64 @@ </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 @@ -109,11 +109,11 @@ }) .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> @@ -173,6 +173,10 @@ .messageDialog { width: 600px; + .messageContent { + padding: 15px; + box-sizing: border-box; + } .title { line-height: 22px; diff --git a/src/views/personalCenter/myOrder.vue b/src/views/personalCenter/myOrder.vue index 4752d61..a7ffeb7 100644 --- a/src/views/personalCenter/myOrder.vue +++ b/src/views/personalCenter/myOrder.vue @@ -38,7 +38,7 @@ pItem.orderSaleMethod.product.name, pItem.orderSaleMethod.product.cmsTypeRefCode, item.remarks, - pItem.orderSaleMethod.id + pItem.orderSaleMethod.id, ) " > @@ -46,11 +46,7 @@ <img :src=" pItem.orderSaleMethod.product.icon - ? getPublicImage( - pItem.orderSaleMethod.product.icon, - '', - '' - ) + ? getPublicImage(pItem.orderSaleMethod.product.icon, '', '') : bookCover " alt="" @@ -58,31 +54,28 @@ </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> @@ -95,27 +88,17 @@ <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 > @@ -145,76 +128,75 @@ </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, @@ -224,69 +206,69 @@ // ) 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 { @@ -365,7 +347,6 @@ .title { height: 180px; - line-height: 180px; } .state { -- Gitblit v1.9.1