前臺使用技術:html,js,csscss
後臺使用技術:layUI框架以及MVC三層結構servlet+jsp開發html
數據庫:mysql數據庫java
總體來講就是一個購物系統,功能齊全,好比權限管理,操做記錄,管理前臺商品設置與屬性等功能mysql
源碼源碼下載地址:https://www.gaowenjx.com/?id=246jquery
失效了:請聯繫我:qq:1746272020web
後臺layUI代碼:ajax
<%-- Created by IntelliJ IDEA. User: Administrator Date: 2020/11/20 0020 Time: 下午 2:18 To change this template use File | Settings | File Templates. --%> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>員工信息</title> <meta name="renderer" content="webkit"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <link rel="stylesheet" href="layui/css/layui.css" media="all"> <!-- 注意:若是你直接複製全部代碼到本地,上述css路徑須要改爲你本地的 --> <script src="js/jquery-3.4.1.min.js"></script> <style type="text/css"> .layui-table-cell{ text-align: center; } </style> </head> <body> <div id="addDiv" style="display:none;padding-right: 30px;"> <form class="layui-form" lay-filter="formTest" id="addOrUpForm"> <div class="layui-form-item" style="margin-top: 20px;display: block;"> <label class="layui-form-label">評論id</label> <div class="layui-input-block"> <input type="text" style="width: 190px;" name="oserial" placeholder="請輸入員工id" autocomplete="off" class="layui-input"> </div> </div> <div class="layui-form-item" style="margin-top: 20px;"> <label class="layui-form-label">用戶帳號</label> <div class="layui-input-block"> <input type="text" style="width: 190px;" name="username" required lay-verify="required" placeholder="請輸入員工名" autocomplete="off" class="layui-input"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label">評論的內容</label> <div class="layui-input-inline"> <input type="text" name="content" required lay-verify="required" placeholder="請輸入職位" autocomplete="off" class="layui-input"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label">評論等級</label> <div class="layui-input-inline"> <input type="text" name="grade" required lay-verify="required" placeholder="請輸入上級id" autocomplete="off" class="layui-input"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label">訂單編號</label> <div class="layui-input-inline"> <input type="text" name="oserial" required lay-verify="required" placeholder="請輸入薪水" autocomplete="off" class="layui-input"> </div> </div> <div class="layui-form-item"> <div class="layui-input-block"> <button class="layui-btn" lay-submit lay-filter="formDemo">當即提交</button> <button type="reset" class="layui-btn layui-btn-primary">重置</button> </div> </div> </form> </div> <table class="layui-hide" id="test" lay-filter="test"></table> <script type="text/html" id="toolbarDemo"> <div class="layui-inline"> <button type="button" class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon"></i></button> <button type="button" class="layui-btn layui-btn-sm" lay-event="update"><i class="layui-icon"></i></button> <button type="button" class="layui-btn layui-btn-sm" lay-event="delete"><i class="layui-icon"></i></button> </div> 員工名: <div class="layui-inline"> <input class="layui-input" name="name" id="demoReload" autocomplete="off" placeholder="請輸入員工名"> </div> <button class="layui-btn" id="search" lay-event="search" data-type="reload">搜索</button> </script> <script src="layui/layui.js" charset="utf-8"></script> <!-- 注意:若是你直接複製全部代碼到本地,上述js路徑須要改爲你本地的 --> <script> layui.use(['table','form','laydate'], function(){//給layui中添加表格與表單組件 var table = layui.table; var form = layui.form; var laydate = layui.laydate; laydate.render({ elem: '#testDate' ,format: 'yyyy-MM-dd mm:HH:ss' //可任意組合 }); var method="";//申明方法記錄新增或修改 //監聽提交 form.on('submit(formDemo)', function(data){ var json=JSON.stringify(data.field); $.ajax({ type: "POST", url: method, dataType : "json", contentType: "application/json", data:json, success: function(msg){ layer.closeAll(); layer.msg(msg.msg); table.reload('testReload'); } }); return false; }); table.render({ elem: '#test' ,url:'comment/selecCommenttLimit' ,toolbar: '#toolbarDemo'//開啓頭部欄 ,defaultToolbar: ['filter', 'exports', 'print', { //自定義頭部工具欄右側圖標。如無需自定義,去除該參數便可 title: '提示' ,layEvent: 'LAYTABLE_TIPS' ,icon: 'layui-icon-tips' }] ,title: '員工數據表' ,cols: [[ {type:'checkbox',fixed:'true'} ,{field:'coid', title: '評論id', sort: true,align: 'center',fixed: 'true'} ,{field:'username', title: '用戶帳號',align: 'center'} ,{field:'content', title: '評論的內容', sort: true,align: 'center'} ,{field:'grade', title: '評論等級',align: 'center'} ,{field:'oserial', title: '訂單編號',align: 'center'} ]] ,page: true //開啓分頁 ,id:'testReload' }); //監聽頭工具欄事件 table.on('toolbar(test)', function(obj){ var checkStatus = table.checkStatus(obj.config.id) ,data = checkStatus.data; //獲取選中的數據 switch(obj.event){ case 'add': method="comment/insert"; //清空表單 $("#addOrUpForm") [0].reset(); layer.open({ type:1, title:'新增用戶', area: ['400px', '550px'], content: $('#addDiv') }); break; case 'update': if(data.length != 1){ layer.msg('請選擇一行'); } else { method="comment/update"; //給表單賦值 form.val("formTest", { "coid": JSON.stringify(data[0].coid) , "username":JSON.stringify(data[0].username).replace(/"/g, '') ,"content": JSON.stringify(data[0].content).replace(/"/g, '') ,"grade": JSON.stringify(data[0].grade) ,"oserial ": JSON.stringify(data[0].oserial ).replace(/"/g, '') }); //修改信息 layer.open({ type:1, title:'修改用戶', area: ['400px', '550px'], content: $('#addDiv') }); } break; case 'comment/delete': if(data.length < 1){ layer.msg('請選擇要刪除的數據'); } else { layer.confirm('真的刪除行麼', function(index){ var ids=""; for (var i = 0; i < data.length; i++) { ids=ids+data[i].chauffeurid+"-"; } $.ajax({ type: "POST", url: "comment/deleteById", data:"ids="+ids, success: function(msg){ layer.msg("刪除成功!"); table.reload('testReload'); } }); }); } break; case 'search'://搜索 var value=$("#demoReload").val(); table.reload('testReload',{ page: { curr: 1 //從新從第 1 頁開始 },where: { empname: value } }); $("#demoReload").val(value);//刷新完後從新設定input值 break; //自定義頭工具欄右側圖標 - 提示 case 'LAYTABLE_TIPS': layer.alert('這是工具欄右側自定義的一個圖標按鈕'); break; }; }); }); </script> </body> </html>