杨磊
1 天以前 cabc1ce19c57a7c7388502952eaaafd558363145
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>