parent
e1c6dd3497
commit
4ace44e6b0
@ -0,0 +1,8 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 数据源本地存储已忽略文件
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/libarary_management.iml" filepath="$PROJECT_DIR$/.idea/libarary_management.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/vue" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,23 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
@ -0,0 +1,19 @@
|
||||
# vue
|
||||
|
||||
## Project setup
|
||||
```
|
||||
yarn install
|
||||
```
|
||||
|
||||
### Compiles and hot-reloads for development
|
||||
```
|
||||
yarn serve
|
||||
```
|
||||
|
||||
### Compiles and minifies for production
|
||||
```
|
||||
yarn build
|
||||
```
|
||||
|
||||
### Customize configuration
|
||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
presets: [
|
||||
'@vue/cli-plugin-babel/preset'
|
||||
]
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "esnext",
|
||||
"baseUrl": "./",
|
||||
"moduleResolution": "node",
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"src/*"
|
||||
]
|
||||
},
|
||||
"lib": [
|
||||
"esnext",
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"scripthost"
|
||||
]
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "vue",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^1.7.2",
|
||||
"core-js": "^3.8.3",
|
||||
"echarts": "^5.5.0",
|
||||
"element-ui": "^2.15.14",
|
||||
"js-cookie": "^3.0.5",
|
||||
"vue": "^2.6.14",
|
||||
"vue-router": "^3.5.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "~5.0.0",
|
||||
"@vue/cli-plugin-router": "~5.0.0",
|
||||
"@vue/cli-service": "~5.0.0",
|
||||
"vue-template-compiler": "^2.6.14"
|
||||
},
|
||||
"browserslist": [
|
||||
"> 1%",
|
||||
"last 2 versions",
|
||||
"not dead"
|
||||
]
|
||||
}
|
After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
<style>
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,8 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<!-- 只显示一级路由-->
|
||||
<router-view />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
After Width: | Height: | Size: 8.2 KiB |
@ -0,0 +1,9 @@
|
||||
body{
|
||||
pardding: 0;
|
||||
margin: 0;
|
||||
background-image: url("shouye1.png");
|
||||
background-size: cover;
|
||||
}
|
||||
*{
|
||||
box-sizing: border-box;
|
||||
}
|
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 590 KiB |
@ -0,0 +1,58 @@
|
||||
<template>
|
||||
<div class="hello">
|
||||
<h1>{{ msg }}</h1>
|
||||
<p>
|
||||
For a guide and recipes on how to configure / customize this project,<br>
|
||||
check out the
|
||||
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
|
||||
</p>
|
||||
<h3>Installed CLI Plugins</h3>
|
||||
<ul>
|
||||
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
|
||||
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router" target="_blank" rel="noopener">router</a></li>
|
||||
</ul>
|
||||
<h3>Essential Links</h3>
|
||||
<ul>
|
||||
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
|
||||
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
|
||||
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
|
||||
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
|
||||
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
|
||||
</ul>
|
||||
<h3>Ecosystem</h3>
|
||||
<ul>
|
||||
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
|
||||
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
|
||||
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
|
||||
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
|
||||
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'HelloWorld',
|
||||
props: {
|
||||
msg: String
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped>
|
||||
h3 {
|
||||
margin: 40px 0 0;
|
||||
}
|
||||
ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
li {
|
||||
display: inline-block;
|
||||
margin: 0 10px;
|
||||
}
|
||||
a {
|
||||
color: #42b983;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,13 @@
|
||||
import Vue from 'vue'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import ElementUI from 'element-ui';
|
||||
import 'element-ui/lib/theme-chalk/index.css';
|
||||
import '@/assets/global.css'
|
||||
Vue.config.productionTip = false
|
||||
Vue.use(ElementUI,{size: 'small'});
|
||||
|
||||
new Vue({
|
||||
router,
|
||||
render: h => h(App)
|
||||
}).$mount('#app')
|
@ -0,0 +1,5 @@
|
||||
<template>
|
||||
<div class="about">
|
||||
<h1>This is an about page</h1>
|
||||
</div>
|
||||
</template>
|
@ -0,0 +1,105 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- 头部-->
|
||||
<div class="top1">
|
||||
<div style="width: 300px">
|
||||
<img src="@/assets/logo.png" alt="" style="width: 30px;position: relative;top: 10px;left: 20px;">
|
||||
<span style="margin-left: 30px;font-size: 24px;">图书管理系统</span>
|
||||
</div>
|
||||
<div style="flex: 1; text-align: right; padding-right: 20px">
|
||||
|
||||
<el-dropdown size="medium">
|
||||
<img src="@/assets/girl.png" alt="" style="width: 30px;position: relative;top: 10px;right: 5px;">
|
||||
<span class="el-dropdown-link" style="cursor: pointer">
|
||||
管理员<i class="el-icon-arrow-down el-icon--right"></i>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown" style="margin-top: -5px">
|
||||
<el-dropdown-item><div style="width: 50px; text-align: center;" @click="logout">退出</div></el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 侧边栏和主体-->
|
||||
<div style="display: flex">
|
||||
<!-- 侧边栏-->
|
||||
<div class="leftbar">
|
||||
<el-menu :default-active="$route.path" router class="el-menu-demo">
|
||||
<el-menu-item index="/" class="leftmenubotton">
|
||||
<i class="el-icon-coffee-cup"></i>
|
||||
<span>首页</span>
|
||||
</el-menu-item>
|
||||
<el-submenu index="user">
|
||||
<template slot="title">
|
||||
<i class="el-icon-cold-drink"></i>
|
||||
<span>会员管理</span>
|
||||
</template>
|
||||
<el-menu-item index="/userList"><i class="el-icon-coffee-cup"></i><span>会员列表</span></el-menu-item>
|
||||
</el-submenu>
|
||||
<el-submenu index="category">
|
||||
<template slot="title">
|
||||
<i class="el-icon-s-operation"></i>
|
||||
<span>图书分类管理</span>
|
||||
</template>
|
||||
<el-menu-item index="/addCategory">图书分类添加</el-menu-item>
|
||||
<el-menu-item index="/categoryList">图书分类列表</el-menu-item>
|
||||
</el-submenu>
|
||||
<el-submenu index="book">
|
||||
<template slot="title">
|
||||
<i class="el-icon-notebook-1"></i>
|
||||
<span>图书管理</span>
|
||||
</template>
|
||||
<el-menu-item index="/addBook">图书添加</el-menu-item>
|
||||
<el-menu-item index="/bookList">图书列表</el-menu-item>
|
||||
</el-submenu>
|
||||
</el-menu>
|
||||
</div>
|
||||
<!-- 主体-->
|
||||
<div class="bodyshow">
|
||||
<router-view/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Cookies from 'js-cookie'
|
||||
export default{
|
||||
name:"Layout.vue",
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
logout() {
|
||||
// 清除浏览器用户数据
|
||||
Cookies.remove('admin')
|
||||
this.$router.push('/login')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.top1{
|
||||
height: 60px;
|
||||
line-height: 60px;
|
||||
display: flex;
|
||||
background-color: rgba(248,248,255,0.8);
|
||||
border-radius: 0px 0px 10px 10px;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
.leftbar{
|
||||
width: 200px;
|
||||
min-height: calc(100vh - 62px);
|
||||
overflow: hidden;
|
||||
margin-right: 2px;
|
||||
background-color: rgba(248,248,255,0.8);
|
||||
}
|
||||
.bodyshow{
|
||||
flex: 1;
|
||||
width: 0;
|
||||
background-color: rgba(248,248,255,0.8);
|
||||
padding: 10px;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,164 @@
|
||||
<template>
|
||||
<div style="width: 80%">
|
||||
<div style="margin-bottom: 30px">新增图书</div>
|
||||
<el-form :inline="true" :rules="rules" ref="ruleForm" :model="form" label-width="100px">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input style="width: 400px" type="textarea" v-model="form.description" placeholder="请输入描述"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="出版日期" prop="publishDate">
|
||||
<el-date-picker
|
||||
v-model="form.publishDate"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择出版日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="作者" prop="author">
|
||||
<el-input v-model="form.author" placeholder="请输入作者"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="出版社" prop="publisher">
|
||||
<el-input v-model="form.publisher" placeholder="请输入出版社"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="分类" prop="category">
|
||||
<el-cascader
|
||||
style="width: 220px"
|
||||
:props="{ value: 'name', label: 'name'}"
|
||||
v-model="form.categories"
|
||||
:options="categories"></el-cascader>
|
||||
</el-form-item>
|
||||
<el-form-item label="标准码" prop="bookNo">
|
||||
<el-input v-model="form.bookNo" placeholder="请输入标准码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="借书积分" prop="cover">
|
||||
<el-input-number v-model="form.score" :min="10" :max="30" label="所需积分"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量" prop="nums">
|
||||
<el-input v-model="form.nums" placeholder="请输入数量"></el-input>
|
||||
</el-form-item>
|
||||
<br>
|
||||
<el-form-item label="封面" prop="cover">
|
||||
<el-upload
|
||||
class="avatar-uploader"
|
||||
:action="'http://localhost:9090/api/book/file/upload?token=' + this.admin.token"
|
||||
:show-file-list="false"
|
||||
:on-success="handleCoverSuccess"
|
||||
>
|
||||
<img v-if="form.cover" :src="form.cover" class="avatar">
|
||||
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div style="text-align: center; margin-top: 30px">
|
||||
<el-button class="botton1" @click="save" size="medium">提交</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import request from "@/utils/request";
|
||||
import Cookies from "js-cookie";
|
||||
|
||||
export default {
|
||||
name: 'AddBook',
|
||||
data() {
|
||||
const checkNums = (rule, value, callback) => {
|
||||
value = parseInt(value)
|
||||
if (value < 0 || value >= 1000) {
|
||||
callback(new Error('请输入大于等于0小于1000的整数'));
|
||||
}
|
||||
callback()
|
||||
};
|
||||
return {
|
||||
admin: Cookies.get('admin') ? JSON.parse(Cookies.get('admin')) : {},
|
||||
form: { score: 10, cover: '' },
|
||||
categories: [],
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: '请输入图书名称', trigger: 'blur'}
|
||||
],
|
||||
bookNo: [
|
||||
{ required: true, message: '请输入图书标准码', trigger: 'blur'}
|
||||
],
|
||||
score: [
|
||||
{ validator: checkNums, trigger: 'blur' }
|
||||
],
|
||||
nums: [
|
||||
{ required: true, message: '请输入数量', trigger: 'blur'},
|
||||
{ validator: checkNums, trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
request.get('/category/tree').then(res => {
|
||||
this.categories = res.data
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
handleCoverSuccess(res) {
|
||||
if (res.code === '200') {
|
||||
console.log(res.data)
|
||||
// this.$set(this.form, 'cover', res.data)
|
||||
this.form.cover = res.data
|
||||
}
|
||||
},
|
||||
save() {
|
||||
this.$refs['ruleForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
request.post('/book/save', this.form).then(res => {
|
||||
if (res.code === '200') {
|
||||
this.$notify.success('新增成功')
|
||||
this.$refs['ruleForm'].resetFields()
|
||||
} else {
|
||||
this.$notify.error(res.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.avatar-uploader .el-upload {
|
||||
border: 1px dashed #d9d9d9;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.avatar-uploader .el-upload:hover {
|
||||
border-color: #409EFF;
|
||||
}
|
||||
.avatar-uploader-icon {
|
||||
font-size: 28px;
|
||||
color: #8c939d;
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
line-height: 178px;
|
||||
text-align: center;
|
||||
}
|
||||
.avatar {
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
display: block;
|
||||
}
|
||||
.botton1{
|
||||
color: white;
|
||||
margin-left: 5px;
|
||||
border-radius: 10px;
|
||||
background-color: #4169E1;
|
||||
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
|
||||
|
||||
}
|
||||
.botton1:hover{
|
||||
background-color: lightblue;
|
||||
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
</style>
|
@ -0,0 +1,153 @@
|
||||
<template>
|
||||
<div style="width: 80%">
|
||||
<div style="margin-bottom: 30px">编辑图书</div>
|
||||
<el-form :inline="true" :rules="rules" ref="ruleForm" :model="form" label-width="100px">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input style="width: 400px" type="textarea" v-model="form.description" placeholder="请输入描述"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="出版日期" prop="publishDate">
|
||||
<el-date-picker
|
||||
v-model="form.publishDate"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择出版日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="作者" prop="author">
|
||||
<el-input v-model="form.author" placeholder="请输入作者"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="出版社" prop="publisher">
|
||||
<el-input v-model="form.publisher" placeholder="请输入出版社"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="分类" prop="category">
|
||||
<el-cascader
|
||||
style="width: 220px"
|
||||
:props="{ value: 'name', label: 'name'}"
|
||||
v-model="form.categories"
|
||||
:options="categories"></el-cascader>
|
||||
</el-form-item>
|
||||
<el-form-item label="标准码" prop="bookNo">
|
||||
<el-input v-model="form.bookNo" placeholder="请输入标准码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="借书积分" prop="cover">
|
||||
<el-input-number v-model="form.score" :min="10" :max="30" label="所需积分"></el-input-number>
|
||||
</el-form-item>
|
||||
<br>
|
||||
<el-form-item label="封面" prop="cover">
|
||||
<el-upload
|
||||
class="avatar-uploader"
|
||||
:action="'http://localhost:9090/api/book/file/upload?token=' + this.admin.token"
|
||||
:show-file-list="false"
|
||||
:on-success="handleCoverSuccess"
|
||||
>
|
||||
<img v-if="form.cover" :src="form.cover" class="avatar">
|
||||
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div style="text-align: center; margin-top: 30px">
|
||||
<el-button class="botton1" @click="save" size="medium">提交</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import request from "@/utils/request";
|
||||
import Cookies from "js-cookie";
|
||||
|
||||
export default {
|
||||
name: 'EditBook',
|
||||
data() {
|
||||
return {
|
||||
admin: Cookies.get('admin') ? JSON.parse(Cookies.get('admin')) : {},
|
||||
form: { score: 10 },
|
||||
categories: [],
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: '请输入图书名称', trigger: 'blur'}
|
||||
],
|
||||
bookNo: [
|
||||
{ required: true, message: '请输入图书标准码', trigger: 'blur'}
|
||||
],
|
||||
score: [
|
||||
{ required: true, message: '请输入借书积分', trigger: 'blur'}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
request.get('/category/tree').then(res => {
|
||||
this.categories = res.data
|
||||
})
|
||||
|
||||
const id = this.$route.query.id
|
||||
request.get("/book/" + id).then(res => {
|
||||
this.form = res.data
|
||||
if (this.form.category) {
|
||||
this.form.categories = this.form.category.split(' > ')
|
||||
console.log(this.form.categories)
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
handleCoverSuccess(res) {
|
||||
if (res.code === '200') {
|
||||
this.form.cover = res.data
|
||||
}
|
||||
},
|
||||
save() {
|
||||
request.put('/book/update', this.form).then(res => {
|
||||
if (res.code === '200') {
|
||||
this.$notify.success('更新成功')
|
||||
this.$router.push("/bookList")
|
||||
} else {
|
||||
this.$notify.error(res.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.avatar-uploader .el-upload {
|
||||
border: 1px dashed #d9d9d9;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.avatar-uploader .el-upload:hover {
|
||||
border-color: #409EFF;
|
||||
}
|
||||
.avatar-uploader-icon {
|
||||
font-size: 28px;
|
||||
color: #8c939d;
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
line-height: 178px;
|
||||
text-align: center;
|
||||
}
|
||||
.avatar {
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
display: block;
|
||||
}
|
||||
.botton1{
|
||||
margin-left: 5px;
|
||||
border-radius: 10px;
|
||||
background-color: #4169E1;
|
||||
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
|
||||
|
||||
}
|
||||
.botton1:hover{
|
||||
background-color: lightblue;
|
||||
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
</style>
|
||||
|
@ -0,0 +1,122 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- 搜索表单-->
|
||||
<div style="margin-bottom: 20px">
|
||||
<el-input style="width: 240px" placeholder="请输入图书名称" v-model="params.name"></el-input>
|
||||
<el-input style="width: 240px; margin-left: 5px" placeholder="请输入图书标准码" v-model="params.bookNo"></el-input>
|
||||
<el-button style="margin-left: 5px" type="primary" @click="load"><i class="el-icon-search"></i> 搜索</el-button>
|
||||
<el-button style="margin-left: 5px" type="warning" @click="reset"><i class="el-icon-refresh"></i> 重置</el-button>
|
||||
</div>
|
||||
|
||||
<el-table :data="tableData" stripe row-key="id" default-expand-all>
|
||||
<el-table-column prop="id" label="编号" width="80"></el-table-column>
|
||||
<el-table-column prop="name" label="图书名称"></el-table-column>
|
||||
<el-table-column prop="bookNo" label="标准码"></el-table-column>
|
||||
<el-table-column prop="description" width="200" label="描述"></el-table-column>
|
||||
<el-table-column prop="publishDate" label="出版日期"></el-table-column>
|
||||
<el-table-column prop="author" label="作者"></el-table-column>
|
||||
<el-table-column prop="publisher" label="出版社"></el-table-column>
|
||||
<el-table-column prop="category" label="分类"></el-table-column>
|
||||
<el-table-column prop="score" label="借书积分"></el-table-column>
|
||||
<el-table-column prop="nums" label="数量"></el-table-column>
|
||||
<el-table-column prop="cover" label="封面">
|
||||
<template v-slot="scope">
|
||||
<el-image :src="scope.row.cover" :preview-src-list="[scope.row.cover]"></el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createtime" label="创建时间"></el-table-column>
|
||||
<el-table-column prop="updatetime" label="更新时间"></el-table-column>
|
||||
<el-table-column label="操作" width="140">
|
||||
<template v-slot="scope">
|
||||
<!-- scope.row 就是当前行数据-->
|
||||
<el-button type="primary" @click="$router.push('/editBook?id=' + scope.row.id)">编辑</el-button>
|
||||
<el-popconfirm
|
||||
style="margin-left: 5px"
|
||||
title="您确定删除这行数据吗?"
|
||||
@confirm="del(scope.row.id)"
|
||||
>
|
||||
<el-button type="danger" slot="reference">删除</el-button>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页-->
|
||||
<div style="margin-top: 20px">
|
||||
<el-pagination
|
||||
background
|
||||
:current-page="params.pageNum"
|
||||
:page-size="params.pageSize"
|
||||
layout="prev, pager, next"
|
||||
@current-change="handleCurrentChange"
|
||||
:total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import request from "@/utils/request";
|
||||
import Cookies from 'js-cookie'
|
||||
|
||||
export default {
|
||||
name: 'BookList',
|
||||
data() {
|
||||
return {
|
||||
admin: Cookies.get('admin') ? JSON.parse(Cookies.get('admin')) : {},
|
||||
tableData: [],
|
||||
total: 0,
|
||||
params: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
name: '',
|
||||
bookNo: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.load()
|
||||
},
|
||||
methods: {
|
||||
load() {
|
||||
request.get('/book/page', {
|
||||
params: this.params
|
||||
}).then(res => {
|
||||
if (res.code === '200') {
|
||||
this.tableData = res.data.list
|
||||
this.total = res.data.total
|
||||
}
|
||||
})
|
||||
},
|
||||
reset() {
|
||||
this.params = {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
name: '',
|
||||
bookNo: ''
|
||||
}
|
||||
this.load()
|
||||
},
|
||||
handleCurrentChange(pageNum) {
|
||||
// 点击分页按钮触发分页
|
||||
this.params.pageNum = pageNum
|
||||
this.load()
|
||||
},
|
||||
del(id) {
|
||||
request.delete("/book/delete/" + id).then(res => {
|
||||
if (res.code === '200') {
|
||||
this.$notify.success('删除成功')
|
||||
this.load()
|
||||
} else {
|
||||
this.$notify.error(res.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@ -0,0 +1,53 @@
|
||||
<template>
|
||||
<div style="width: 80%">
|
||||
<div style="margin-bottom: 30px">新增分类</div>
|
||||
<el-form :inline="true" :rules="rules" ref="ruleForm" :model="form" label-width="100px">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div style="text-align: center; margin-top: 30px">
|
||||
<el-button type="primary" @click="save" size="medium">提交</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import request from "@/utils/request";
|
||||
|
||||
export default {
|
||||
name: 'AddCategory',
|
||||
data() {
|
||||
return {
|
||||
form: {},
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: '请输入分类名称', trigger: 'blur'}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
save() {
|
||||
this.$refs['ruleForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
request.post('/category/save', this.form).then(res => {
|
||||
if (res.code === '200') {
|
||||
this.$notify.success('新增成功')
|
||||
this.$refs['ruleForm'].resetFields()
|
||||
} else {
|
||||
this.$notify.error(res.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@ -0,0 +1,55 @@
|
||||
<template>
|
||||
<div style="width: 80%">
|
||||
<div style="margin-bottom: 30px">编辑分类</div>
|
||||
<el-form :inline="true" :rules="rules" ref="ruleForm" :model="form" label-width="100px">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div style="text-align: center; margin-top: 30px">
|
||||
<el-button type="primary" @click="save" size="medium">提交</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import request from "@/utils/request";
|
||||
|
||||
export default {
|
||||
name: 'EditCategory',
|
||||
data() {
|
||||
return {
|
||||
form: {},
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: '请输入分类名称', trigger: 'blur'}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const id = this.$route.query.id
|
||||
request.get("/category/" + id).then(res => {
|
||||
this.form = res.data
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
save() {
|
||||
request.put('/category/update', this.form).then(res => {
|
||||
if (res.code === '200') {
|
||||
this.$notify.success('更新成功')
|
||||
this.$router.push("/categoryList")
|
||||
} else {
|
||||
this.$notify.error(res.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@ -0,0 +1,154 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- 搜索表单-->
|
||||
<div style="margin-bottom: 20px">
|
||||
<el-input style="width: 240px" placeholder="请输入分类名称" v-model="params.name"></el-input>
|
||||
<el-button style="margin-left: 5px" type="primary" @click="load"><i class="el-icon-search"></i> 搜索</el-button>
|
||||
<el-button style="margin-left: 5px" type="warning" @click="reset"><i class="el-icon-refresh"></i> 重置</el-button>
|
||||
</div>
|
||||
|
||||
<el-table :data="tableData" stripe row-key="id" default-expand-all>
|
||||
<el-table-column prop="id" label="编号" width="80"></el-table-column>
|
||||
<el-table-column prop="name" label="名称"></el-table-column>
|
||||
<el-table-column prop="remark" label="备注"></el-table-column>
|
||||
<el-table-column prop="createtime" label="创建时间"></el-table-column>
|
||||
<el-table-column prop="updatetime" label="更新时间"></el-table-column>
|
||||
<el-table-column label="操作" width="280">
|
||||
<template v-slot="scope">
|
||||
<!-- scope.row 就是当前行数据-->
|
||||
<el-button type="success" v-if="!scope.row.pid" @click="handleAdd(scope.row)">添加二级分类</el-button>
|
||||
<el-button type="primary" @click="$router.push('/editCategory?id=' + scope.row.id)">编辑</el-button>
|
||||
<el-popconfirm
|
||||
style="margin-left: 5px"
|
||||
title="您确定删除这行数据吗?"
|
||||
@confirm="del(scope.row.id)"
|
||||
>
|
||||
<el-button type="danger" slot="reference">删除</el-button>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页-->
|
||||
<div style="margin-top: 20px">
|
||||
<el-pagination
|
||||
background
|
||||
:current-page="params.pageNum"
|
||||
:page-size="params.pageSize"
|
||||
layout="prev, pager, next"
|
||||
@current-change="handleCurrentChange"
|
||||
:total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
<el-dialog title="添加二级分类" :visible.sync="dialogFormVisible" width="30%">
|
||||
<el-form :model="form" label-width="100px" ref="ruleForm" :rules="rules" style="width: 85%">
|
||||
<el-form-item label="分类名称" prop="name">
|
||||
<el-input v-model="form.name" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="分类备注" prop="remark">
|
||||
<el-input v-model="form.remark" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="save">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import request from "@/utils/request";
|
||||
import Cookies from 'js-cookie'
|
||||
|
||||
export default {
|
||||
name: 'CategoryList',
|
||||
data() {
|
||||
return {
|
||||
admin: Cookies.get('admin') ? JSON.parse(Cookies.get('admin')) : {},
|
||||
tableData: [],
|
||||
total: 0,
|
||||
dialogFormVisible: false,
|
||||
form: {},
|
||||
pid: null,
|
||||
params: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
name: '',
|
||||
},
|
||||
rules: {
|
||||
name: [
|
||||
{required: true, message: '请输入分类名称', trigger: 'blur'}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.load()
|
||||
},
|
||||
methods: {
|
||||
load() {
|
||||
request.get('/category/page', {
|
||||
params: this.params
|
||||
}).then(res => {
|
||||
if (res.code === '200') {
|
||||
this.tableData = res.data.list
|
||||
this.total = res.data.total
|
||||
}
|
||||
})
|
||||
},
|
||||
reset() {
|
||||
this.params = {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
name: ''
|
||||
}
|
||||
this.load()
|
||||
},
|
||||
handleCurrentChange(pageNum) {
|
||||
// 点击分页按钮触发分页
|
||||
this.params.pageNum = pageNum
|
||||
this.load()
|
||||
},
|
||||
del(id) {
|
||||
request.delete("/category/delete/" + id).then(res => {
|
||||
if (res.code === '200') {
|
||||
this.$notify.success('删除成功')
|
||||
this.load()
|
||||
} else {
|
||||
this.$notify.error(res.msg)
|
||||
}
|
||||
})
|
||||
},
|
||||
handleAdd(row) {
|
||||
// 将当前行的id作为二级分类的pid
|
||||
this.pid = row.id
|
||||
this.dialogFormVisible = true
|
||||
},
|
||||
save() {
|
||||
this.$refs['ruleForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
// 给二级分类赋值 pid
|
||||
this.form.pid = this.pid
|
||||
request.post('/category/save', this.form).then(res => {
|
||||
if (res.code === '200') {
|
||||
this.$notify.success('新增二级分类成功')
|
||||
this.$refs['ruleForm'].resetFields()
|
||||
this.dialogFormVisible = false
|
||||
this.load()
|
||||
} else {
|
||||
this.$notify.error(res.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@ -0,0 +1,96 @@
|
||||
<template>
|
||||
<div>
|
||||
<div style="margin: 20px 0">
|
||||
<el-select class="input" v-model="timeRange" placeholder="请选择" > <!-- 从后台加载最新的数据 -->
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<el-card>
|
||||
<div id="line" style="width: 100%; height: 400px"><div class="echart" id="mychart" :style="myChartStyle"></div></div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Cookies from 'js-cookie'
|
||||
import request from "@/utils/request";
|
||||
import * as echarts from 'echarts'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
myChart: {},
|
||||
xData: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], //横坐标
|
||||
yData: [23, 24, 18, 25, 27, 28, 25], //人数数据
|
||||
taskData: [10, 11, 9, 17, 14, 13, 14], //任务数据
|
||||
myChartStyle: { float: "left", width: "100%", height: "400px" }, //图表样式
|
||||
options: [
|
||||
{label: '最近一周', value: 'week'},
|
||||
{label: '最近一个月', value: 'month'},
|
||||
{label: '最近两个月', value: 'month2'},
|
||||
{label: '最近三个月', value: 'month3'},
|
||||
]
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.initEcharts();
|
||||
},
|
||||
methods: {
|
||||
initEcharts() {
|
||||
const option = {
|
||||
xAxis: {
|
||||
data: this.xData
|
||||
},
|
||||
legend: { // 图例
|
||||
data: ["人数", "任务"],
|
||||
bottom: "0%"
|
||||
},
|
||||
yAxis: {},
|
||||
series: [
|
||||
{
|
||||
name: "人数",
|
||||
data: this.yData,
|
||||
type: "line", // 类型设置为折线图
|
||||
label: {
|
||||
show: true,
|
||||
position: "top",
|
||||
textStyle: {
|
||||
fontSize: 16
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "任务",
|
||||
data: this.taskData,
|
||||
type: "line", // 类型设置为折线图
|
||||
label: {
|
||||
show: true,
|
||||
position: "bottom",
|
||||
textStyle: {
|
||||
fontSize: 16
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
this.myChart = echarts.init(document.getElementById("mychart"));
|
||||
this.myChart.setOption(option);
|
||||
//随着屏幕大小调节图表
|
||||
window.addEventListener("resize", () => {
|
||||
this.myChart.resize();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.input {
|
||||
width: 300px;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,106 @@
|
||||
<template>
|
||||
<div class="box1">
|
||||
<div class="box2">
|
||||
<div style="margin-top: 50px;text-align: center;font-size: 40px;color: white;margin-bottom: 50px;font-family: Yuanti SC;">L O G I N</div>
|
||||
<el-form :model="admin" :rules="rules" ref="loginForm">
|
||||
<el-form-item prop="username">
|
||||
<el-input placeholder="请输入账号" prefix-icon="el-icon-user" v-model="admin.username"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input placeholder="请输入密码" prefix-icon="el-icon-user" v-model="admin.password" show-password></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button class="button1-hover" size="medium" @click="Login">登 录</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import request from "@/utils/request";
|
||||
import Cookies from 'js-cookie'
|
||||
|
||||
export default{
|
||||
name:'LOGIN',
|
||||
data(){
|
||||
return{
|
||||
loginAdmin: {},
|
||||
admin: {},
|
||||
rules: {
|
||||
username: [
|
||||
{ required: true, message: '请输入用户名', trigger: 'blur'},
|
||||
{ min: 3, max: 10, message: '长度在3-10个字符', trigger: 'blur'}
|
||||
],
|
||||
password: [
|
||||
{ required: true, message: '请输入密码', trigger: 'blur'},
|
||||
{ min: 3, max: 10, message: '长度在3-10个字符', trigger: 'blur'}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
login(){
|
||||
this.$refs['loginForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
request.post('/admin/login', this.admin).then(res => {
|
||||
if (res.code === '200') {
|
||||
this.loginAdmin = res.data // 滑块组件就出现了
|
||||
} else {
|
||||
this.$notify.error(res.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
onSuccess() { // 滑块验证通过之后触发的
|
||||
Cookies.set('admin', JSON.stringify(this.loginAdmin))
|
||||
this.$notify.success("登录成功")
|
||||
this.$router.push('/')
|
||||
},
|
||||
onFail() {
|
||||
console.log('onFail')
|
||||
},
|
||||
onRefresh() {
|
||||
console.log('refresh')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.box1{
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background: url("background.png");
|
||||
background-size: cover;
|
||||
|
||||
}
|
||||
.box2{
|
||||
width: 450px;
|
||||
height: 500px;
|
||||
background-color: rgba(60,60,60,0.5);
|
||||
border-radius: 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin: 100px auto;
|
||||
align-items: center;
|
||||
padding: 40px;
|
||||
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.button1-hover {
|
||||
margin-top: 15px;
|
||||
width: 100%;
|
||||
background-color: rgb(30, 27, 248);
|
||||
color: white;
|
||||
border-radius: 15px;
|
||||
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
|
||||
transition: box-shadow 0.3s ease;
|
||||
}
|
||||
.button1-hover:hover {
|
||||
background-color: #1E90FF;
|
||||
box-shadow: 0px 8px 10px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
</stylescoped>
|
After Width: | Height: | Size: 762 KiB |
@ -0,0 +1,99 @@
|
||||
<template>
|
||||
<div>
|
||||
<div style="margin-bottom: 20px;">
|
||||
<!-- 搜索表单-->
|
||||
<el-input style="width: 240px" placeholder="请输入名称" v-model="params.name"></el-input>
|
||||
<el-input style="width: 240px;margin-left: 5px;" placeholder="请输入联系方式" v-model="params.phone"></el-input>
|
||||
<el-button class="botton1" type="primary" @click="load"><i class="el-icon-search"></i>搜 索</el-button>
|
||||
<el-button class="botton1" type="primary" @click="reset"><i class="el-icon-magic-stick"></i>重 置</el-button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<el-table :data="tableData" stripe>
|
||||
<el-table-column prop="name" label="名称"></el-table-column>
|
||||
<el-table-column prop="age" label="年龄"></el-table-column>
|
||||
<el-table-column prop="address" label="地址"></el-table-column>
|
||||
<el-table-column prop="phone" label="电话"></el-table-column>
|
||||
<el-table-column prop="sex" label="性别"></el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<!-- 分页-->
|
||||
<div style="margin-top: 20px;">
|
||||
<el-pagination
|
||||
background
|
||||
:current-page="params.pageNum"
|
||||
:page-size="params.pageSize"
|
||||
layout="prev, pager, next"
|
||||
@current-change="handleCurrentChange"
|
||||
:total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import request from "@/utils/request";
|
||||
|
||||
|
||||
export default {
|
||||
name: 'User',
|
||||
data(){
|
||||
return {
|
||||
tableData:[
|
||||
{name:'kkkk',age: 40,address:'dsfasf',phone: 'safjhsiafhs',sex: 'sjf'},
|
||||
{name:'kkkk',age: 40,address:'dsfasf',phone: 'safjhsiafhs',sex: 'sjf'},
|
||||
{name:'kkkk',age: 40,address:'dsfasf',phone: 'safjhsiafhs',sex: 'sjf'},
|
||||
{name:'kkkk',age: 40,address:'dsfasf',phone: 'safjhsiafhs',sex: 'sjf'},
|
||||
],
|
||||
total: 0,
|
||||
params:{
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
name:'',
|
||||
phone:''
|
||||
}
|
||||
}
|
||||
},
|
||||
created(){
|
||||
this.load()
|
||||
},
|
||||
methods: {
|
||||
load(){
|
||||
request.get( '/user/page', {
|
||||
params: this.params
|
||||
}).then(res => {
|
||||
if(res.code==='200'){
|
||||
this.tableData=res.data.list
|
||||
this.total=res.data.total
|
||||
}
|
||||
})
|
||||
},
|
||||
reset(){
|
||||
this.params={
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
name: '',
|
||||
phone: ''
|
||||
}
|
||||
this.load()
|
||||
},
|
||||
handleCurrentChange(pageNum){
|
||||
//点击分页按钮触发分页
|
||||
this.params.pageNum=pageNum
|
||||
this.load()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.botton1{
|
||||
margin-left: 5px;
|
||||
border-radius: 10px;
|
||||
background-color: #4169E1;
|
||||
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
|
||||
|
||||
}
|
||||
.botton1:hover{
|
||||
background-color: lightblue;
|
||||
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
</style>
|
@ -0,0 +1,4 @@
|
||||
const { defineConfig } = require('@vue/cli-service')
|
||||
module.exports = defineConfig({
|
||||
transpileDependencies: true
|
||||
})
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue