first commit

This commit is contained in:
萌狼蓝天 2025-03-11 17:40:48 +08:00
commit 26d0e1fd28
18 changed files with 1851 additions and 0 deletions

24
.gitignore vendored Normal file
View File

@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

3
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"recommendations": ["Vue.volar"]
}

5
README.md Normal file
View File

@ -0,0 +1,5 @@
# Vue 3 + Vite
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
Learn more about IDE Support for Vue in the [Vue Docs Scaling up Guide](https://vuejs.org/guide/scaling-up/tooling.html#ide-support).

13
index.html Normal file
View File

@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Vue</title>
</head>
<body>
<div id="app" style="height: 100%;width:100%;margin: 0;padding: 0;box-sizing: border-box"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>

1458
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

21
package.json Normal file
View File

@ -0,0 +1,21 @@
{
"name": "libroro-web",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"@ant-design/icons-vue": "^7.0.1",
"ant-design-vue": "^4.2.6",
"vue": "^3.5.13",
"vue-router": "^4.5.0"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.2.1",
"vite": "^6.2.0"
}
}

1
public/vite.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

12
src/App.vue Normal file
View File

@ -0,0 +1,12 @@
<script setup>
</script>
<template style="width: 100%;height: 100%;margin: 0;padding: 0">
<router-view style="width: 100%;height: 100%"></router-view>
</template>
<style scoped>
</style>

1
src/assets/vue.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>

After

Width:  |  Height:  |  Size: 496 B

View File

@ -0,0 +1,43 @@
<script setup>
import { ref } from 'vue'
defineProps({
msg: String,
})
const count = ref(0)
</script>
<template>
<h1>{{ msg }}</h1>
<div class="card">
<button type="button" @click="count++">count is {{ count }}</button>
<p>
Edit
<code>components/HelloWorld.vue</code> to test HMR
</p>
</div>
<p>
Check out
<a href="https://vuejs.org/guide/quick-start.html#local" target="_blank"
>create-vue</a
>, the official Vue + Vite starter
</p>
<p>
Learn more about IDE Support for Vue in the
<a
href="https://vuejs.org/guide/scaling-up/tooling.html#ide-support"
target="_blank"
>Vue Docs Scaling up Guide</a
>.
</p>
<p class="read-the-docs">Click on the Vite and Vue logos to learn more</p>
</template>
<style scoped>
.read-the-docs {
color: #888;
}
</style>

9
src/main.js Normal file
View File

@ -0,0 +1,9 @@
import { createApp } from 'vue'
import './style.css'
import router from "./router/index.js";
import Antd from 'ant-design-vue';
import App from './App.vue'
import 'ant-design-vue/dist/reset.css';
let app = createApp(App)
app.use(router).use(Antd).mount('#app')

167
src/pages/IndexPage.vue Normal file
View File

@ -0,0 +1,167 @@
<script setup>
import {ref} from 'vue';
//
const searchValue = ref('');
const onSearch = searchValue => {
console.log('use value', searchValue);
console.log('or use this.value', value.value);
};
//
const books = ref([
{
title: 'Vue.js设计与实现',
author: '霍春阳',
publisher: '人民邮电出版社',
cover: 'https://img1.doubanio.com/view/subject/l/public/s34351329.jpg'
},
{
title: 'JavaScript高级程序设计',
author: '马特·弗里斯比',
publisher: '人民邮电出版社',
cover: 'https://img2.doubanio.com/view/subject/l/public/s33624615.jpg'
}
]);
const handleBorrow = (book) => {
console.log('借阅书籍:', book.title);
};
</script>
<template>
<div style="padding: 1em;box-sizing: border-box">
<!-- 板块1-->
<a-row>
<a-col :span="6">
<div class="block01">
<a-card class="card">
<p class="c-title">借书</p>
<p>已借出</p>
<p>可借出</p>
</a-card>
</div>
</a-col>
<a-col :span="6">
<div class="block01">
<a-card class="card">
<p class="c-title">还书</p>
<p>已归还</p>
<p>库余量</p>
</a-card>
</div>
</a-col>
<a-col :span="6">
<div class="block01">
<a-card class="card">
<p class="c-title">帮助</p>
<p>借书相关</p>
<p>其他服务</p>
</a-card>
</div>
</a-col>
<a-col :span="6">
<div class="block01">
<a-card class="card" v-if="isLogin">
<p class="c-title">个人</p>
<p>当前借书</p>
<p>逾期</p>
</a-card>
<a-card class="card" v-else>
<p class="c-title">未登录</p>
<p>我要登录</p>
<p>我要注册</p>
</a-card>
</div>
</a-col>
</a-row>
<!-- 板块1 结束-->
<br>
<!-- 板块2 找书-->
<div style="width: 50%;margin: auto;max-width: 500px;min-width: 200px">
<a-input-search
style="width: 100%;height: 24px;font-size: 20px"
v-model:value="searchValue"
placeholder="请输入关键词"
enter-button
@search="onSearch"
/>
</div>
<!-- 板块2 结束-->
<!-- 板块3 书籍展示 -->
<!-- 板块3 书籍展示 -->
<a-row :gutter="[24, 24]" style="margin-top: 2em">
<a-col :span="24">
<a-card title="分类" style="width: 100%">
<a-row :gutter="16">
<a-col
v-for="(book, index) in books"
:key="index"
:xl="6" :lg="8" :md="12" :sm="24"
>
<div class="book-card">
<a-card hoverable style="width: 100%; margin-bottom: 16px">
<template #cover>
<img
alt="封面"
:src="book.cover"
style="height: 200px; object-fit: cover"
/>
</template>
<a-card-meta :title="book.title">
<template #description>
<p style="margin: 4px 0">作者{{ book.author }}</p>
<p>出版社{{ book.publisher }}</p>
<a-button
type="primary"
block
style="margin-top: 12px"
@click="handleBorrow(book)"
>
借阅
</a-button>
</template>
</a-card-meta>
</a-card>
</div>
</a-col>
</a-row>
</a-card>
</a-col>
</a-row>
<!-- 板块3结束-->
</div>
</template>
<style scoped>
.block01 {
width: 95%;
height: 100%;
margin: 0 auto;
}
.block01 .card {
width: 100%;
margin: auto;
}
.card p {
margin: 0.25em auto;
}
.c-title {
font-size: 20px;
font-weight: bold;
}
/* 书籍展示 */
.ant-card {
margin-top: 20px;
}
.ant-row-flex {
padding: 12px;
border-bottom: 1px solid #f0f0f0;
}
.ant-col-18 {
padding-left: 20px;
}
</style>

28
src/router/index.js Normal file
View File

@ -0,0 +1,28 @@
import { createRouter, createWebHistory } from 'vue-router';
// 定义路由
const routes = [
//在这里配置路由
{
path: '/',
name: 'IndexView',
component: () => import('../views/IndexView.vue'),
redirect: 'index',
children: [
{
path: 'index',
name: 'IndexPage',
component: () => import('../pages/IndexPage.vue'),
},
]
},
];
// 创建路由实例
const router = createRouter({
history: createWebHistory(),
routes,
});
export default router;

3
src/style.css Normal file
View File

@ -0,0 +1,3 @@
:root {
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
}

11
src/views/AuthView.vue Normal file
View File

@ -0,0 +1,11 @@
<script setup>
</script>
<template>
</template>
<style scoped>
</style>

11
src/views/BackView.vue Normal file
View File

@ -0,0 +1,11 @@
<script setup>
</script>
<template>
</template>
<style scoped>
</style>

34
src/views/IndexView.vue Normal file
View File

@ -0,0 +1,34 @@
<template>
<a-layout style="height: 100vh">
<a-layout-header>Header</a-layout-header>
<a-layout-content> <router-view style="width: 100%;height: 100%"></router-view> </a-layout-content>
<a-layout-footer>
@xrilang
</a-layout-footer>
</a-layout>
</template>
<script setup>
// JavaScript
</script>
<style scoped>
/* 设置布局容器的显示方式为 flex 布局 */
a-layout {
display: flex;
flex-direction: column;
}
/* 设置 header 和 footer 的高度和固定高度 */
a-layout-header,
a-layout-footer {
flex-shrink: 0;
height: 60px; /* 可以根据需要调整高度 */
}
/* 设置 content 部分填满剩余空间 */
a-layout-content {
flex-grow: 1;
overflow-y: auto; /* 如果内容超出,添加滚动条 */
}
</style>

7
vite.config.js Normal file
View File

@ -0,0 +1,7 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vite.dev/config/
export default defineConfig({
plugins: [vue()],
})