From cabc1ce19c57a7c7388502952eaaafd558363145 Mon Sep 17 00:00:00 2001 From: 杨磊 <505174330@qq.com> Date: 星期五, 22 八月 2025 18:18:51 +0800 Subject: [PATCH] 数字教材相关 --- src/views/bookStore/index.vue | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 52 insertions(+), 8 deletions(-) diff --git a/src/views/bookStore/index.vue b/src/views/bookStore/index.vue index 0c89bff..1bdca0d 100644 --- a/src/views/bookStore/index.vue +++ b/src/views/bookStore/index.vue @@ -14,7 +14,13 @@ <div class="classificationBox"> <div style="width: 100px">鍒嗙被锛�</div> <div class="classificaListBox"> - <div class="classificaItem" v-for="(item, index) in classfeild" :key="index"> + <div + class="classificaItem" + :class="{ active: currentLevel == item.value }" + v-for="(item, index) in classfeild" + :key="index" + @click="changeLevel(item)" + > {{ item.name }} </div> </div> @@ -23,7 +29,7 @@ <div class="bookList"> <div class="bookfilterList"> <div class="listTitle"> - <div>缁撴灉锛氬叡璁�***鏉�</div> + <div>缁撴灉锛氬叡璁{ total }}鏉�</div> <div style="width: 300px"> <el-input v-model="input3" @@ -31,7 +37,7 @@ class="input-with-select" > <template #append> - <el-button :icon="Search" /> + <el-button :icon="Search" @click="getBookList" /> </template> </el-input> </div> @@ -83,7 +89,7 @@ <div class="recommendBox"> <div class="recommendTitle">鎺ㄨ崘鏁欐潗</div> <div class="newRecommendList"> - <div class="recommendItem" v-for="item in bookListData" :key="item.id"> + <div class="recommendItem" v-for="item in recommendBookListData" :key="item.id"> <div class="recommendItemImg"> <img class="autoImg" :src="item.icon" /> </div> @@ -121,9 +127,11 @@ import { Search } from '@element-plus/icons-vue' const input3 = ref('') let bookListData = ref([]) -const total = ref(50) +let recommendBookListData = ref([]) +const total = ref(0) const currentPage1 = ref(1) const router = useRouter() +let currentLevel = ref('all') const toDetail = (item) => { router.push({ @@ -134,12 +142,17 @@ }) } +const changeLevel = (item) => { + currentLevel.value = item.value + getBookList() +} + const getBanner = () => { MG.resource .getItem({ path: 'banner\\educationPublishing', fields: { link: [] }, - paging: { start: 0, size: 9 }, + paging: { start: 0, size: 20 }, }) .then((res) => { banner.push(...res.datas) @@ -152,7 +165,7 @@ getBookList() } -const getBookList = () => { +const getRecommendBookList = () => { MG.store .getProductList({ path: 'recommendedTextbooks', @@ -166,8 +179,32 @@ }) .then((res) => { console.log(res, '鎺ㄨ崘鏁欐潗') - bookListData.value = res.datas + recommendBookListData.value = res.datas }) +} + +const getBookList = () => { + const query = { + path: '*', + queryType: '*', + storeInfo: 'defaultGoodsStore1', + paging: { + start: (currentPage1.value - 1) * 20, + size: 20, + }, + fields: {}, + } + if (currentLevel.value !== 'all') { + query.fields['teachingLevel='] = currentLevel.value + } + if (input3.value) { + query.fields['Name*'] = input3.value + } + MG.store.getProductList(query).then((res) => { + console.log(res, '11111111111') + bookListData.value = res.datas + total.value = res.total + }) } const classifList = () => { @@ -190,6 +227,7 @@ getBanner() classifList() getBookList() + getRecommendBookList() }) </script> @@ -380,4 +418,10 @@ margin: 20px 0; padding-bottom: 30px; } + +.active { + background-color: #ebf8f8; + border: 1px solid #144941; + color: #144941; +} </style> -- Gitblit v1.9.1