From cf7e71c6d0fb64eeb6b5deac540da843b4bb465c Mon Sep 17 00:00:00 2001 From: QYF-GitLab1 <1940665526@qq.com> Date: 星期二, 26 八月 2025 10:41:52 +0800 Subject: [PATCH] 关于我们-理念与品牌文化 --- src/views/bookStore/index.vue | 554 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 441 insertions(+), 113 deletions(-) diff --git a/src/views/bookStore/index.vue b/src/views/bookStore/index.vue index 7dcc190..c568d39 100644 --- a/src/views/bookStore/index.vue +++ b/src/views/bookStore/index.vue @@ -1,134 +1,462 @@ <template> - <div class="minWidth"> - <el-carousel :height="screenheight + 'px'" v-show="bannerState"> - <el-carousel-item v-for="item in bannerList" :key="item.id"> - <div class="bannerBox imgBox" :style="item.caupress_link ? 'cursor: pointer' : ''"> - <img class="bannerImg" :src="item.icon" @click="bannerLink(item)" /> - </div> - </el-carousel-item> - </el-carousel> - <div - :class="!bannerState ? 'show stow' : 'stow'" - @click="bannerState = !bannerState" - > - {{ bannerState ? "鏀惰捣" : "鏄剧ず" }} - 杞挱鍥� - <i - :class="bannerState ? 'el-icon-caret-top' : 'el-icon-caret-bottom'" - ></i> + <div class="homePage"> + <div class="bannerBox imgBox"> + <img class="bannerImg" :src="banner[0]?.icon" @click="bannerLink(item)" /> + <div class="bannerText"> + <div>鏁板瓧鏁欐潗</div> + <div class="enText">TEXT BOOK</div> + </div> </div> - <div class="contentBox"> - <List - :channel=" - this.$route.query.searchPath - ? this.$route.query.searchPath - : 'caupress_bookMall' - " - :searchOptionHidden="searchOptionHidden" - :detailRoute="detailRoute" - ></List> + <div class="contentBox" style="margin-top: 50px"> + <div class="imgBox"> + <img class="autoimg" src="@/assets/images/bookStore/feblei.png" /> + </div> + <div class="classificationBox"> + <div style="width: 100px; line-height: 60px">鍒嗙被锛�</div> + <div class="classificaListBox"> + <div class="classificaItem" :class="{ active: currentLevel == item.value }" + v-for="(item, index) in classfeild" :key="index" @click="changeLevel(item)"> + {{ item.name }} + </div> + </div> + </div> + + <div class="bookList"> + <div class="bookfilterList"> + <div class="listTitle"> + <div>缁撴灉锛氬叡璁{ total }}鏉�</div> + <div style="width: 340px"> + <el-input v-model="input3" placeholder="杈撳叆涔﹀悕銆佷綔鑰呫�佷功鍙锋悳绱�" class="input-with-select"> + <template #append> + <el-button :icon="Search" @click="getBookList" /> + </template> + </el-input> + </div> + </div> + + <div> + <div class="recommendList"> + <div class="recommendItem" v-for="item in bookListData" :key="item.id" @click="toDetail(item)"> + <div class="recommendItemImg"> + <img class="autoImg" :src="item.icon" /> + </div> + <div class="infoBox"> + <div class="bookName">{{ item.name }}</div> + <div class="author">{{ item.author ? item.author : '-' }} 钁�</div> + <div class="priceBox"> + <span class="price" v-if="item.price && item.price > 0"> + <span>楼 {{ item.price }}</span> + </span> + <span class="oldPrice" v-if="item.oldPrice > 0">楼 {{ item.oldPrice }}</span> + <span class="price" v-if="item.price && item.price == 0"> <span class="freePrice">鍏嶈垂</span> + </span> + </div> + </div> + </div> + </div> + </div> + <div v-if="!bookListData.length > 0"> + <el-empty class="noData" description="鏆傛棤鏁版嵁" /> + </div> + + <div class="pagingBox"> + <el-pagination layout="total, prev, pager, next" :total="total" v-model:current-page="currentPage1" + :page-size="20" @current-change="handleCurrentChange" hide-on-single-page="true" /> + </div> + </div> + <div class="recommendBox"> + <div class="recommendTitle">鎺ㄨ崘鏁欐潗</div> + <div class="newRecommendList"> + <div class="recommendItem" v-for="item in recommendBookListData" :key="item.id" @click="toDetail(item)"> + <div class="recommendItemImg"> + <img class="autoImg" :src="item.icon" /> + </div> + <div class="infoBox"> + <div class="bookName">{{ item.name }}</div> + <div class="author">{{ item.author ? item.author : '-' }} 钁�</div> + <div class="priceBox"> + <span class="price" v-if="item.price && item.price > 0"> + <span>楼 {{ item.price }}</span> + </span> + <span class="oldPrice" v-if="item.oldPrice > 0">楼 {{ item.oldPrice }}</span> + <span class="price" v-if="item.price && item.price == 0"> <span class="freePrice">鍏嶈垂</span> + </span> + </div> + </div> + </div> + </div> + </div> + </div> </div> </div> </template> -<script> -import List from "@/components/list"; -export default { - name: "bookStore-index", - components: { - List, - }, - data() { - return { - bannerList: [], - detailRoute: "bookStore-detail", - searchOptionHidden: this.$route.query.searchOptionHidden - ? this.$route.query.searchOptionHidden - : false, - bannerState: true, - screenheight: document.documentElement.clientWidth / 2.628, - }; - }, - created() { - window.onresize = () => { - let c = 2.628; - if (document.documentElement.clientWidth >= 1220) { - this.screenheight = document.documentElement.clientWidth / c; - } - }; - this.getBanner(); - setTimeout(() => { - this.bannerState = false; - }, 15000); - }, - methods: { - bannerLink(val) { - if (val.caupress_link) { - window.open(val.caupress_link); - } +<script setup> +import { ref, onBeforeMount, inject, reactive, onMounted } from 'vue' +import { useRouter, useRoute } from 'vue-router' + +const MG = inject('MG') +const toolClass = inject('toolClass') +const banner = reactive([]) +const feildList = reactive([]) +const classfeild = reactive([]) +import { Search } from '@element-plus/icons-vue' +const input3 = ref('') +let bookListData = ref([]) +let recommendBookListData = ref([]) +const total = ref(0) +const currentPage1 = ref(1) +const router = useRouter() +let currentLevel = ref('all') + +const toDetail = (item) => { + router.push({ + path: '/bookdetail', + query: { + bookId: item.id, }, - getBanner() { - this.MG.resource - .getItem({ - path: "caupress_banner\\caupress_mall", - fields: { - caupress_link: [], - }, - coverSize: { - height: 750, - }, - paging: { - start: 0, - size: 999, - }, - }) - .then((res) => { - this.bannerList = res.datas; - }); + }) +} + +const changeLevel = (item) => { + currentLevel.value = item.value + getBookList() +} + +const getBanner = () => { + MG.resource + .getItem({ + path: 'banner\\educationPublishing', + fields: { link: [] }, + paging: { start: 0, size: 20 }, + }) + .then((res) => { + banner.push(...res.datas) + console.log(res.datas) + }) +} + +const handleCurrentChange = (val) => { + currentPage1.value = val + getBookList() +} + +const getRecommendBookList = () => { + MG.store + .getProductList({ + path: 'recommendedTextbooks', + paging: { + start: 0, + size: 5, + }, + fields: { + author: [], + }, + }) + .then((res) => { + recommendBookListData.value = res.datas?.map(item => { + return { + ...item, + price: toolClass.toDecimal2(item.price), + oldPrice: toolClass.toDecimal2(item.oldPrice), + } + }) + }) +} + +const getBookList = () => { + const query = { + path: '*', + queryType: '*', + storeInfo: 'defaultGoodsStore1', + paging: { + start: (currentPage1.value - 1) * 20, + size: 20, }, - }, - // 濡傛灉璺宠浆椤甸潰涓嶆槸璇︽儏锛屽垯灏嗗綋鍓嶉〉闈笉缂撳瓨 - beforeRouteLeave(to, from, next) { - if (to.name != "bookStore-detail") { - this.$store.commit("delKeepAlive", from.name); - } - next(); - }, -}; + fields: { + author: [], + }, + } + if (currentLevel.value !== 'all') { + query.fields['teachingLevel='] = currentLevel.value + } + if (input3.value) { + query.fields['||Name*'] = input3.value + query.fields['||author*'] = input3.value + query.fields['||isbn*'] = input3.value + } + MG.store.getProductList(query).then((res) => { + bookListData.value = res.datas?.map(item => { + return { + ...item, + price: toolClass.toDecimal2(item.price), + oldPrice: toolClass.toDecimal2(item.oldPrice), + } + }) + total.value = res.total + }) +} + +const classifList = () => { + const query = { + refCodes: ['digitalTextbooks'], + } + MG.resource.getCmsTypeByRefCode(query).then((res) => { + const types = toolClass.handleTypeList(res) + const typeData = types[0].cmsTypeLinks[0].children + feildList.push(...typeData) + const temp_classfeild = typeData.find((item) => item.typeField.refCode === 'teachingLevel') + ?.typeField.cfg.option + classfeild.push({ name: '鍏ㄩ儴', value: 'all' }, ...temp_classfeild) + }) +} +onMounted(() => { + getBanner() + classifList() + getBookList() + getRecommendBookList() +}) </script> <style lang="less" scoped> -.autoImg { - max-height: none; -} -.minWidth { +.homePage { min-width: 1220px; + min-height: calc(100vh - 61.8%); + background-color: #fff; + padding-bottom: 100px; + + .bannerBox { + height: 380px; + position: relative; + + .bannerText { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + font-size: 36px; + font-weight: 700; + color: #fff; + text-shadow: 0px 0px 10px #000000; + text-align: center; + } + + .enText { + font-size: 28px; + opacity: 0.45; + margin-top: 20px; + } + } + + .classificationBox { + display: flex; + justify-content: space-between; + margin-top: 30px; + + .classificaListBox { + display: flex; + justify-content: space-between; + flex-wrap: wrap; + + .classificaItem { + display: flex; + align-items: center; + justify-content: center; + margin-right: 20px; + margin-bottom: 20px; + padding: 10px 16px; + width: 200px; + line-height: 20px; + background: #f5f5f5; + text-align: center; + } + } + } + + .bookList { + display: flex; + justify-content: space-between; + padding: 20px; + + .bookfilterList { + width: 80%; + border: 1px solid #e4e7ed; + height: 100%; + border-radius: 10px; + + .listTitle { + display: flex; + justify-content: space-between; + align-items: center; + padding: 20px 30px; + } + } + + .recommendBox { + width: 19%; + border: 1px solid #e4e7ed; + border-radius: 10px; + + .recommendTitle { + height: 29px; + font-family: PingFang SC, PingFang SC; + font-weight: bold; + font-size: 16px; + color: #333333; + line-height: 29px; + border-bottom: 1px solid #e4e7ed; + padding: 0px 10px; + box-sizing: border-box; + } + } + } } -.stow { - width: 160px; - margin: 0 auto; + +.recommendList { + display: flex; + padding: 20px; + padding-top: 0; + flex-wrap: wrap; + justify-content: start; + + .recommendItem { + margin-right: 10px; + width: 240px; + height: 357px; + background-repeat: no-repeat; + background-size: 100% 100%; + cursor: pointer; + border: 1px solid #dedede; + background: rgba(255, 255, 255, 0.73); + border-radius: 8px 8px 8px 8px; + border: 1px solid #DEDEDE; + padding-top: 10px; + padding: 30px 0; + box-sizing: border-box; + margin-bottom: 10px; + + &:last-child { + margin-right: 0; + } + + + &:hover { + background-image: url(@/assets/images/Mouse_fill.png); + background-position: center; + background-size: 100% 100%; + background-repeat: no-repeat; + } + + .recommendItemImg { + width: 139px; + height: 189px; + position: relative; + margin: 0 auto; + } + + } +} + +.infoBox { text-align: center; - border: 1px solid #b3b3b3; + padding: 20px 0; + box-sizing: border-box; + font-family: Microsoft YaHei UI, Microsoft YaHei UI; + box-sizing: border-box; +} + +.bookName { + font-weight: bold; + font-size: 18px; + color: #000000; + font-weight: 700; +} + +.author { + font-weight: 400; font-size: 16px; - line-height: 40px; - border-radius: 21px; - color: #b3b3b3; - cursor: pointer; - margin-top: 5px; + color: #333333; + padding: 15px 0; + box-sizing: border-box; } -.show { - margin-top: 20px; + +.priceBox { + font-family: DIN, DIN; + font-weight: 500; + font-size: 18px; + color: #D91523; + padding: 15px 0; + box-sizing: border-box; + + .oldPrice { + color: #999999; + text-decoration: line-through; + margin-left: 20px; + } + + .price { + span { + font-weight: bold; + color: #d91523; + } + } } -.bannerBox { - background: #f3f3f3; + +.newRecommendList { + padding-top: 0; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + + .recommendItem { + margin-right: 1%; + width: 240px; + height: 357px; + background-repeat: no-repeat; + background-size: 100% 100%; + cursor: pointer; + background-color: #fff; + padding-top: 10px; + margin-top: 10px; + + &:last-child { + margin-right: 0; + } + + .recommendItemImg { + width: 150px; + height: 200px; + position: relative; + margin: 0 auto; + } + + .recommendItem:hover { + background-image: url(@/assets/images/Mouse_fill.png); + background-position: center; + background-size: 100% 100%; + background-repeat: no-repeat; + } + } + } -.imgBox { - position: relative; - width: 100%; - height: 100%; + +.pagingBox { + display: flex; + justify-content: center; + margin: 20px 0; + padding-bottom: 30px; } -.contentBox { - background-color: rgb(241, 248, 244); - margin-top: 20px; + +.active { + background-color: #ebf8f8; + border: 1px solid #144941; + color: #144941; +} +</style> +<style> +.el-input-group__append { + background-color: #144941; + color: #fff; } </style> -- Gitblit v1.9.1