QYF-GitLab1
20 小时以前 cf7e71c6d0fb64eeb6b5deac540da843b4bb465c
src/views/home/search.vue
@@ -23,17 +23,6 @@
        <div class="bookfilterList">
          <div class="listTitle">
            <div>结果:共计{{ total }}条</div>
            <div style="width: 300px">
              <el-input
                v-model="input3"
                placeholder="输入教材名称、作者姓名、出品方名称搜索"
                class="input-with-select"
              >
                <template #append>
                  <el-button :icon="Search" @click="getBookList" />
                </template>
              </el-input>
            </div>
          </div>
          <div>
@@ -79,37 +68,13 @@
            />
          </div>
        </div>
        <div class="recommendBox">
          <div class="recommendTitle">推荐教材</div>
          <div class="newRecommendList">
            <div class="recommendItem" v-for="item in recommendBookListData" :key="item.id">
              <div class="recommendItemImg">
                <img class="autoImg" :src="item.icon" />
              </div>
              <div class="infoBox">
                <div class="bookName">{{ item.name }}</div>
                <div class="author">
                  作者:{{ item.authorcaupress_author ? item.caupress_author : '-' }}
                </div>
                <div class="priceBox">
                  <span class="oldPrice" v-if="item.oldPrice">原价:¥{{ item.oldPrice }}</span>
                  <span class="price" v-if="item.price && item.price > 0">
                    定价:¥
                    <span>{{ item.price }}</span>
                  </span>
                  <span class="price" v-else> 定价:<span class="freePrice">免费</span> </span>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script setup>
import { ref, onBeforeMount, inject, reactive, onMounted } from 'vue'
import { ref, onBeforeMount, inject, reactive, onMounted, watch } from 'vue'
import { useRouter, useRoute } from 'vue-router'
const MG = inject('MG')
@@ -126,6 +91,15 @@
const route = useRoute()
const router = useRouter()
let currentLevel = ref('all')
watch(
  () => route.query, // 监听 path 变化
  (newPath, oldPath) => {
    console.log('路由路径从', oldPath, '变为', newPath)
    input3.value = newPath.key
    getBookList()
  },
)
const toDetail = (item) => {
  router.push({
@@ -282,7 +256,7 @@
    padding: 20px;
    .bookfilterList {
      width: 80%;
      width: 100%;
      border: 1px solid #e4e7ed;
      height: 100%;
      border-radius: 10px;
@@ -330,6 +304,9 @@
      margin-right: 0;
    }
  }
  .recommendItem:hover {
    background-image: url(@/assets/images/Mouse_fill.png);
  }
  .recommendItemImg {
    width: 150px;
    height: 200px;