基于java,SpringBoot和Vue流浪动物救助领养管理系统设计
摘要
本论文聚焦于基于Java、Spring Boot和Vue技术栈开发的流浪动物救助领养管理系统。随着流浪动物数量的不断增加,建立高效的救助领养管理系统变得至关重要。该系统后端采用Java语言结合Spring Boot框架,利用其强大的依赖注入、自动配置等特性,快速搭建稳定且可扩展的服务器端应用,实现对流浪动物信息管理、救助流程跟踪、领养申请处理等核心业务逻辑的处理。前端基于Vue框架构建用户界面,凭借其组件化开发、数据双向绑定等优势,为用户提供流畅、直观的交互体验,涵盖救助者、领养者及管理员不同角色的操作界面。通过前后端分离架构,系统实现了高内聚、低耦合,提高了开发效率与系统的可维护性。经测试,该系统有效提升了流浪动物救助领养流程的管理效率,促进了动物救助资源的合理分配,为解决流浪动物问题提供了有力的信息化支持。
功能介绍
管理员、普通用户、自愿者三种用户角色;
管理员:个人中心、管理员管理、基础数据管理、公告信息管理、论坛管理、自愿者管理、用户管理、宠物信息管理、宠物寄养管理、宠物领养管理、宠物领养审核管理等;
自愿者:个人中心、公告信息管理、论坛管理、宠物信息管理、宠物寄养管理、宠物领养管理等;
普通用户:个人中心、首页信息查看、宠物信息查看、论坛、公告查看、后台管理等。
技术介绍
后端:Java语言的Spring Boot框架、MySQL数据库、Maven依赖管理等;
前端:管理员后台使用Vue、element-ui、axios等,用户前台使用HTML、layUI、element-ui等。
代码展示
<template>
<div>
<div class="container loginIn" style="backgroundImage: url(/liulangdongwubeihua/img/back-img-bg.jpg)">
<div :class="2 == 1 ? 'left' : 2 == 2 ? 'left center' : 'left right'" style="backgroundColor: rgba(225, 225, 225, 1)">
<el-form class="login-form" label-position="left" :label-width="3 == 3 ? '56px' : '0px'">
<div class="title-container"><h3 class="title" style="color: rgba(255, 69, 0, 1)">流浪动物管理系统</h3></div>
<el-form-item :label="3 == 3 ? '用户名' : ''" :class="'style'+3">
<span v-if="3 != 3" class="svg-container" style="color:rgba(255, 69, 0, 1);line-height:50px"><svg-icon icon-class="user" /></span>
<el-input placeholder="请输入用户名" name="username" type="text" v-model="rulesForm.username" />
</el-form-item>
<el-form-item :label="3 == 3 ? '密码' : ''" :class="'style'+3">
<span v-if="3 != 3" class="svg-container" style="color:rgba(255, 69, 0, 1);line-height:50px"><svg-icon icon-class="password" /></span>
<el-input placeholder="请输入密码" name="password" type="password" v-model="rulesForm.password" />
</el-form-item>
<el-form-item v-if="0 == '1'" class="code" :label="3 == 3 ? '验证码' : ''" :class="'style'+3">
<span v-if="3 != 3" class="svg-container" style="color:rgba(255, 69, 0, 1);line-height:50px"><svg-icon icon-class="code" /></span>
<el-input placeholder="请输入验证码" name="code" type="text" v-model="rulesForm.code" />
<div class="getCodeBt" @click="getRandCode(4)" style="height:50px;line-height:50px">
<span v-for="(item, index) in codes" :key="index" :style="{color:item.color,transform:item.rotate,fontSize:item.size}">{{ item.num }}</span>
</div>
</el-form-item>
<el-form-item label="角色" prop="loginInRole" class="role">
<el-radio
v-for="item in menus"
v-if="item.hasBackLogin=='是'"
v-bind:key="item.roleName"
v-model="rulesForm.role"
:label="item.roleName"
>{{item.roleName}}</el-radio>
</el-form-item>
<el-button type="primary" @click="login()" class="loginInBt" style="padding:0;font-size:16px;border-radius:15px;height:44px;line-height:44px;width:100%;backgroundColor:rgba(255, 69, 0, 1); borderColor:rgba(255, 69, 0, 1); color:rgba(255, 255, 255, 1)">{{'2' == '1' ? '登录' : 'login'}}</el-button>
<el-form-item class="setting">
<div style="color:rgba(25, 169, 123, 1)" class="register" @click="register('yonghu')">用户注册</div>
<div style="color:rgba(25, 169, 123, 1)" class="register" @click="register('ziyuanzhe')">自愿者注册</div>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script>
import menu from "@/utils/menu";
export default {
data() {
return {
rulesForm: {
username: "",
password: "",
role: "",
code: '',
},
menus: [],
tableName: "",
codes: [{
num: 1,
color: '#000',
rotate: '10deg',
size: '16px'
},{
num: 2,
color: '#000',
rotate: '10deg',
size: '16px'
},{
num: 3,
color: '#000',
rotate: '10deg',
size: '16px'
},{
num: 4,
color: '#000',
rotate: '10deg',
size: '16px'
}],
};
},
mounted() {
let menus = menu.list();
this.menus = menus;
},
created() {
this.setInputColor()
this.getRandCode()
},
methods: {
setInputColor(){
this.$nextTick(()=>{
document.querySelectorAll('.loginIn .el-input__inner').forEach(el=>{
el.style.backgroundColor = "rgba(194, 189, 189, 0.39)"
el.style.color = "rgba(51, 51, 51, 1)"
el.style.height = "50px"
el.style.lineHeight = "50px"
el.style.borderRadius = "15px"
})
document.querySelectorAll('.loginIn .style3 .el-form-item__label').forEach(el=>{
el.style.height = "50px"
el.style.lineHeight = "50px"
})
document.querySelectorAll('.loginIn .el-form-item__label').forEach(el=>{
el.style.color = "rgba(255, 69, 0, 1)"
})
setTimeout(()=>{
document.querySelectorAll('.loginIn .role .el-radio__label').forEach(el=>{
el.style.color = "rgba(255, 69, 0, 1)"
})
},350)
})
},
register(tableName){
this.$storage.set("loginTable", tableName);
this.$router.push({path:'/register'})
},
// 登陆
login() {
let code = ''
for(let i in this.codes) {
code += this.codes[i].num
}
if ('0' == '1' && !this.rulesForm.code) {
this.$message.error("请输入验证码");
return;
}
if ('0' == '1' && this.rulesForm.code.toLowerCase() != code.toLowerCase()) {
this.$message.error("验证码输入有误");
this.getRandCode()
return;
}
if (!this.rulesForm.username) {
this.$message.error("请输入用户名");
return;
}
if (!this.rulesForm.password) {
this.$message.error("请输入密码");
return;
}
if (!this.rulesForm.role) {
this.$message.error("请选择角色");
return;
}
let menus = this.menus;
for (let i = 0; i < menus.length; i++) {
if (menus[i].roleName == this.rulesForm.role) {
this.tableName = menus[i].tableName;
}
}
this.$http({
url: `${this.tableName}/login?username=${this.rulesForm.username}&password=${this.rulesForm.password}`,
method: "post"
}).then(({ data }) => {
if (data && data.code === 0) {
this.$storage.set("Token", data.token);
this.$storage.set("userId", data.userId);
this.$storage.set("role", this.rulesForm.role);
this.$storage.set("sessionTable", this.tableName);
this.$storage.set("adminName", this.rulesForm.username);
this.$router.replace({ path: "/index/" });
} else {
this.$message.error(data.msg);
}
});
},
getRandCode(len = 4){
this.randomString(len)
},
randomString(len = 4) {
let chars = [
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",
"w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G",
"H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R",
"S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2",
"3", "4", "5", "6", "7", "8", "9"
]
let colors = ["0", "1", "2","3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"]
let sizes = ['14', '15', '16', '17', '18']
let output = [];
for (let i = 0; i < len; i++) {
// 随机验证码
let key = Math.floor(Math.random()*chars.length)
this.codes[i].num = chars[key]
// 随机验证码颜色
let code = '#'
for (let j = 0; j < 6; j++) {
let key = Math.floor(Math.random()*colors.length)
code += colors[key]
}
this.codes[i].color = code
// 随机验证码方向
let rotate = Math.floor(Math.random()*60)
let plus = Math.floor(Math.random()*2)
if(plus == 1) rotate = '-'+rotate
this.codes[i].rotate = 'rotate('+rotate+'deg)'
// 随机验证码字体大小
let size = Math.floor(Math.random()*sizes.length)
this.codes[i].size = sizes[size]+'px'
}
},
}
};
</script>
演示视频
Java,SpringBoot,Vue流浪动物救助领养系统