系统一共分为3个角色分别是:管理员,用户,工作人员
管理员
1、登录
2、用户管理
3、工作人员管理
4、汽车类型管理
5、汽车品牌管理
6、用车需求管理
7、实名认证管理
8、预约信息管理
9、汽车租赁管理
10、合同信息管理
11、个人信息管理
12、统计管理
工作人员
1、登录
2、个人信息管理
3、汽车管理
4、预约信息管理
5、汽车租赁管理
6、合同管理
用户
1、登录,注册
2、浏览汽车信息
3、查看汽车详情
4、用车需求提交
5、实名认证提交
6、个人信息管理
7、预约汽车
8、租赁汽车
9、订单信息管理
10、租赁合同下载

登录
- <%@ page language="java" contentType="text/html; charset=utf-8"
- pageEncoding="utf-8"%>
- <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
- <%
- String path = request.getContextPath();
- String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
- %>
- html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport"
- content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <title>登录title>
- <link rel="icon" href="<%=path%>/resource/static/favicon.ico">
- <link rel="stylesheet" href="<%=path%>/resource/static/bootstrap/css/bootstrap.min.css">
- <link rel="stylesheet" href="<%=path%>/resource/static/admin/css/login.css">
- <script src="<%=path%>/resource/static/js/vue.min.js">script>
- <script src="<%=path%>/resource/static/js/jquery-3.3.1.min.js">script>
- <script src="<%=path%>/resource/static/bootstrap/js/bootstrap.bundle.js">script>
- <script src="<%=path%>/layui/layui.js">script>
- head>
- <body>
- <div class="login">
- <form id="saveForm">
- <h2>汽车租赁系统h2>
- <div class="form-group">
- <label>用户名label>
- <input type="text" v-model="username" name="username" id="username" class="form-control form-control-lg">
- div>
- <div class="form-group">
- <label>密码label>
- <input type="password" v-model="password" name ="password" id="password" class="form-control form-control-lg" id="pwd">
- div>
- <div class="form-group form-check">
- <input type="radio" class="form-check-input" name="type" value="1" id="exampleCheck2" checked>
- <label class="form-check-label" for="exampleCheck2">管理员label>
- <input type="radio" class="form-check-input" name="type" value="2" id="exampleCheck1" >
- <label class="form-check-label" for="exampleCheck1">工作人员label>
- <input type="radio" class="form-check-input" name="type" value="3" id="exampleCheck1" >
- <label class="form-check-label" for="exampleCheck1">用户label>
- div>
-
- <button type="button" :disabled="loading" @click="login" id="login" class="btn btn-primary btn-lg btn-block">
- <span v-show="loading" class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true">span>
- 立即登录
- button>
- form>
- div>
-
-
- <div class="modal fade" id="myModal" aria-labelledby="myModallabel"
- aria-hidden="true" tabindex="-1" >
- <div class="modal-dialog">
- <div class="modal-content" >
- <div class="modal-header">
-
- <h5 class="modal-title" id="myModallabel">供应商注册h5>
- <button class="close" type="button" data-dismiss="modal"
- aria-hidden="true">×button>
- div>
- <form id="addForm" class="form-horizontal">
- <div class="modal-body">
- <div class="form-group">
- <label class="control-label col-lg-4">姓名:label>
- <div class="col-lg-9">
- <input type="text" name="uname" class="form-control">
- div>
- div>
- <div class="form-group">
- <label class="control-label col-lg-4">公司名:label>
- <div class="col-lg-9">
- <input type="text" name="company" id="company" class="form-control">
- div>
- div>
- <div class="form-group">
- <label class="control-label col-lg-4">密码:label>
- <div class="col-lg-9">
- <input type="password" name="pwd" id="pwd" class="form-control">
- div>
- div>
- <div class="form-group">
- <label class="control-label col-lg-4">主营产品:label>
- <div class="col-lg-9">
- <input type="text" name="address" id="address" class="form-control">
- div>
- div>
- <div class="form-group">
- <label class="control-label col-lg-4">手机号:label>
- <div class="col-lg-9">
- <input type="text" name="phone" id="phone" class="form-control">
- div>
- div>
- div>
-
- <div class="modal-footer">
- <button class="btn btn-default" type="button" data-dismiss="modal">关闭button>
- <a class="btn btn-success aaa" type="button" id="save" >提交a>
- div>
- form>
- div>
- div>
- div>
-
-
- <script>
- $("#save").click(function() {
- $.ajax({
- cache : true,
- type : "post",
- url : "addGys",
- data : $("#addForm").serialize(),
- async : false,
- success : function(e) {
- if (e) {
- alert("注册成功!");
- document.location.reload();//当前页面
- } else {
- alert("注册失败,手机号重复!");
- }
- }
- })
- });
- script>
-
- <script>
-
- layui.use([ 'form','jquery','layer','laydate','upload' ], function() {
- var form = layui.form,
- layer = layui.layer,
- laydate = layui.laydate,
- upload = layui.upload,
- $= layui.jquery;
- form.render();//这句一定要加,占坑
-
- /* laydate.render({
- elem: '#schoolTime'
- });
- laydate.render({
- elem: '#day'
- }); */
-
-
- var uploadInst = upload.render({
- elem: '#test1'
- ,url: 'upload2'
- ,accept:'images'
- ,size:50000
- ,before: function(obj){
-
- obj.preview(function(index, file, result){
-
- $('#demo1').attr('src', result);
- });
- }
- ,done: function(res){
- //如果上传失败
- if(res.code > 0){
- return layer.msg('上传失败');
- }
- //上传成功
- var demoText = $('#demoText');
- demoText.html('上传成功');
-
- var fileupload = $(".img");
- fileupload.attr("value",res.data.src);
- console.log(fileupload.attr("value"));
- }
- ,error: function(){
- //演示失败状态,并实现重传
- var demoText = $('#demoText');
- demoText.html('上传失败 重试');
- demoText.find('.demo-reload').on('click', function(){
- uploadInst.upload();
- });
- }
- });
-
-
-
- });
-
-
- script>
-
- <script>
- $("#login").click(function(){
- var username = $("#username").val();
- var password = $("#password").val();
- if(username == null || username == ""){
- alert("请填写用户名");
- return false;
- }if(password == null || password == ""){
- alert("请填写密码");
- return false;
- }
- //执行添加的操作ajax
- $.ajax({
- cache:true,
- type:"post",
- url:"login",
- data:$("#saveForm").serialize(),
- async:false,
- success:function(e){
- if(e == "toMain"){
- alert("登录成功");
- window.parent.location.href="toMain";
- }else if(e == "toIndex"){
- alert("登录成功");
- window.parent.location.href="toIndex";
- }else{
- alert("登录失败,账号或密码错误");
- }
- }
- })
- });
-
- script>
-
- body>
- html>
- /**
- * �登录
- * @param username
- * @param request
- * @param password
- * @param session
- * @param response
- * @param mv
- * @return
- * @throws ServletException
- * @throws IOException
- */
- @RequestMapping("/login")
- @ResponseBody
- public String login(@RequestParam("username")String username,
- HttpServletRequest request,@RequestParam("password")String password,
- HttpSession session,HttpServletResponse response,ModelAndView mv) throws ServletException, IOException {
- String message = "error";
- session.removeAttribute("admin");
- session.removeAttribute("user");
- String type=request.getParameter("type").toString();
- Admin admin = new Admin();
- request.getSession().setAttribute("type", type);
- boolean re = false;
- if(type != null && type.equals("1")){
- admin.setUsername(username);
- admin.setPassword(password);
- Admin admin1 = userService.selectAdmin(admin);
- if(admin1 != null){
- request.getSession().setAttribute("admin", admin1);
- session.setAttribute("admin", admin1);
- message = "toMain";
- }
- }
- else if(type != null && type.equals("2")){
- Employee data = new Employee();
- data.setEno(username);
- data.setPwd(password);
- Employee Employee = EmployeeService.selectEmployee(data);
- if(Employee != null){
- request.getSession().setAttribute("employee", Employee);
- session.setAttribute("employee", Employee);
- message = "toMain";
- }
- }
- else if(type != null && type.equals("3")){
- User u = new User();
- u.setPhone(username);
- u.setPassword(password);
- User user = userService.selectUser(u);
- if(user != null){
- request.getSession().setAttribute("user", user);
- session.setAttribute("user", user);
- message = "toIndex";
- }
- }
- return message;
-
- }