当前位置: 首页 > web >正文

典籍知识问答典籍查询界面前端界面设计效果实现

根据组内负责前端界面设计的同学的界面设计,进行典籍查询前端界面的实现

1.实现效果

2.前端代码

ClassicView.vue

<template>

  <div class="classics">

    <img

        className="back"

        alt="Back"

        src="https://c.animaapp.com/m9pqi0c3GNaMeT/img/back.png"

      />

    <div class="hero-section">

      <div class="main-area">

        <div class="frame">

          <div class="text-wrapper">中医典籍</div>

        </div>

        <div class="frame-wrapper">

          <div class="div">

            <button

              v-for="tab in tabs"

              :key="tab"

              @click="selectedTab = tab"

              :class="['text-wrapper-3', { 'text-wrapper-2': selectedTab === tab }]"

            >

              {{ tab }}

            </button>

          </div>

        </div>

        <div class="div-wrapper">

          <div class="frame-2">

            <div

              class="frame-3"

              v-for="book in store.books"

              :key="book.id"

            >

              <img class="rectangle" :src="book.coverUrl" alt="cover" />

              <div class="text-wrapper-6">{{ book.title }}</div>

              <div class="text-wrapper-7">{{ book.author }}</div>

              <div class="text-wrapper-8">{{ book.summary }}</div>

              <button class="button-blue-instance text-wrapper-15" @click="goToDetail(book.id)">

                学习

              </button>

            </div>

          </div>

        </div>

        <div class="pagination-list">

          <div class="pagination-page">

            <div class="text-wrapper-9" @click="prevPage" :disabled="page === 1">‹</div>

          </div>

          <div class="element-wrapper">

            <div class="element">{{ page }}</div>

          </div>

          <div class="pagination-page">

            <div class="text-wrapper-9" @click="nextPage">›</div>

          </div>

        </div>

        <div class="tabs" style="position: absolute; top: 20px; right: 150px;">

          <input

  v-model="searchQuery"

  placeholder="搜索标题或作者"

  class="search-input text-wrapper-14"

  style="

    margin-right: 20px;

    padding: 8px 16px;

    border: 2px solid var(--huilan);

    border-radius: 24px;

    background-color: var(--grayswhite);

    transition: all 0.3s ease;

    width: 240px;

  "

/>

          <button

            class="button-blue text-wrapper-15"

            @click="$router.push('/admin-classics')"

          >

            后台管理

          </button>

        </div>

      </div>

    </div>

  </div>

</template>

<script setup>

import { ref, onMounted, watch } from 'vue'

import { useRouter } from 'vue-router'

import { useClassicStore } from '@/stores/classic'

import { tabs, formatCategory } from '@/utils/classic'

const router = useRouter()

const store = useClassicStore()

const page = ref(1)

const pageSize = 12

const searchQuery = ref('')

const selectedTab = ref('所有类型')

const fetchBooks = async () => {

  await store.loadBooks({

    page: page.value - 1,

    size: pageSize,

    category: formatCategory(selectedTab.value),

    keyword: searchQuery.value || null

  })

}

const goToDetail = (bookId) => {

  router.push({ path: '/classic-detail', query: { book_id: bookId } })

}

const nextPage = () => {

  if (page.value < store.totalPages) page.value++

}

const prevPage = () => {

  if (page.value > 1) page.value--

}

onMounted(fetchBooks)

watch([selectedTab, searchQuery, page], fetchBooks)

</script>

<style>

/* 覆盖可能需要调整的样式 */

.classics {

  position: relative;

  height: 100vh;

  overflow: hidden;

}

.main-area {

  overscroll-behavior: contain; /* 防止滚动穿透 */

}

</style>
其余store、api、utils、css代码就不做展示了

http://www.xdnf.cn/news/1227.html

相关文章:

  • MySQL:如何用关系型数据库征服NoSQL核心战场?
  • 【STL】unordered_map
  • iptables
  • MYOJ_7443《洛谷 U556408 》【模板】二叉树基础训练 (自己上传的题,想上主题库qwq)(二叉树基础操作模板)
  • 【c语言】指针和数组笔试题解析
  • 科研小白可以做哪些准备
  • 推公式——耍杂技的牛
  • 每日OJ_牛客_AOE还是单体?_贪心_C++_Java
  • MyBatis 和 MyBatis-Plus 在 Spring Boot 中的配置、功能对比及 SQL 日志输出的详细说明,重点对比日志输出的配置差异
  • 如何使用 Spring Boot 实现统一功能处理:从零开始打造高效、可扩展的后台系统
  • Feign 深度解析:Java 声明式 HTTP 客户端的终极指南
  • 乐视系列玩机---乐视1s x500 x501 x502等系列线刷救砖以及刷写第三方twrp 卡刷第三方固件步骤解析
  • 纽约大学具身智能体在城市空间中的视觉导航之旅!CityWalker:从海量网络视频中学习城市导航
  • 第六章 QT基础:1、入门操作:文件操作与信号槽机制笔记
  • StarRocks 异常 Table creation timed out.
  • 小白训练日记——2025/4/22
  • 虚拟机的网络配置
  • 美团外卖霸王餐接口该如何对接?
  • C++STL(七) :unordered_set、unordered_map的介绍及使用
  • transformer-位置编码
  • Lawrence Krauss 的“从无中诞生的宇宙”(Universe from Nothing)
  • MCP Host、MCP Client、MCP Server全流程实战
  • 耀百岁中医养生与上海隽生中医药研究中心达成战略合作——共筑中医养生科研创新高地
  • 乐视系列玩机---乐视1 x600系列线刷救砖以及刷写第三方twrp 卡刷第三方固件步骤解析
  • RK3588 ubuntu20禁用自带的TF卡挂载,并设置udev自动挂载
  • 学习思路分享---从0开始搭建基本web服务器
  • (一)初始Linux---------Linux的背景
  • spring中使用netty-socketio部署到服务器(SSL、nginx转发)
  • 【FPGA开发】Vivado开发中的LUTRAM占用LUT资源吗
  • 入门-C编程基础部分:17、typedef