|  |  | <%--
 | 
						
						
						
							|  |  |   Created by IntelliJ IDEA.
 | 
						
						
						
							|  |  |   User: hkw
 | 
						
						
						
							|  |  |   Date: 2018/10/31
 | 
						
						
						
							|  |  |   Time: 14:06
 | 
						
						
						
							|  |  |   To change this template use File | Settings | File Templates.
 | 
						
						
						
							|  |  | --%>
 | 
						
						
						
							|  |  | <%@ page contentType="text/html;charset=UTF-8" language="java"  import="com.itheima.po.Class" %>
 | 
						
						
						
							|  |  | <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | <html>
 | 
						
						
						
							|  |  | <head>
 | 
						
						
						
							|  |  |     <!-- 设置页面标题 -->
 | 
						
						
						
							|  |  |     <title>后台登录</title>
 | 
						
						
						
							|  |  |     <!-- 设置浏览器渲染模式 -->
 | 
						
						
						
							|  |  |     <meta name="renderer" content="webkit|ie-comp|ie-stand">
 | 
						
						
						
							|  |  |     <!-- 设置IE浏览器兼容性 -->
 | 
						
						
						
							|  |  |     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
 | 
						
						
						
							|  |  |     <!-- 设置视图窗口属性,包括宽度、缩放比例等 -->
 | 
						
						
						
							|  |  |     <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
 | 
						
						
						
							|  |  |     <!-- 禁止百度转码 -->
 | 
						
						
						
							|  |  |     <%--<meta http-equiv="Cache-Control" content="no-siteapp" />--%>
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |     <!-- 引入页面的图标 -->
 | 
						
						
						
							|  |  |     <link rel="icon" href="/images/favicon.ico" sizes="32x32" />
 | 
						
						
						
							|  |  |     <!-- 引入字体样式文件 -->
 | 
						
						
						
							|  |  |     <link rel="stylesheet" href="./css/font.css">
 | 
						
						
						
							|  |  |     <!-- 引入xadmin的样式文件 -->
 | 
						
						
						
							|  |  |     <link rel="stylesheet" href="./css/xadmin.css">
 | 
						
						
						
							|  |  |     <!-- 引入jQuery库,版本为1.3.2 -->
 | 
						
						
						
							|  |  |     <script type="text/javascript" src="./js/jquery-1.3.2.min.js"></script>
 | 
						
						
						
							|  |  |     <!-- 引入layui库 -->
 | 
						
						
						
							|  |  |     <script src="lib/layui/layui.js"></script>
 | 
						
						
						
							|  |  |     <!-- 引入xadmin的脚本文件 -->
 | 
						
						
						
							|  |  |     <script type="text/javascript" src="./js/xadmin.js"></script>
 | 
						
						
						
							|  |  |     <!-- 引入layui的扩展插件,用于导出Excel -->
 | 
						
						
						
							|  |  |     <script src="/layui_exts/excel.js"></script>
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |     <!-- 自定义样式,设置表格内容居中 -->
 | 
						
						
						
							|  |  |     <style type="text/css">
 | 
						
						
						
							|  |  |         .layui-table{
 | 
						
						
						
							|  |  |             text-align: center;
 | 
						
						
						
							|  |  |         }
 | 
						
						
						
							|  |  |         .layui-table th{
 | 
						
						
						
							|  |  |             text-align: center;
 | 
						
						
						
							|  |  |         }
 | 
						
						
						
							|  |  |     </style>
 | 
						
						
						
							|  |  | </head>
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | <body>
 | 
						
						
						
							|  |  | <!-- 顶部导航 -->
 | 
						
						
						
							|  |  | <div class="x-nav">
 | 
						
						
						
							|  |  |     <!-- 面包屑导航 -->
 | 
						
						
						
							|  |  |     <span class="layui-breadcrumb">
 | 
						
						
						
							|  |  |             <a href="">首页</a>
 | 
						
						
						
							|  |  |             <a href="/findClass">班级信息</a>
 | 
						
						
						
							|  |  |         </span>
 | 
						
						
						
							|  |  |     <!-- 刷新按钮 -->
 | 
						
						
						
							|  |  |     <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="/findClass" title="刷新">
 | 
						
						
						
							|  |  |         <i class="layui-icon" style="line-height:30px">ဂ</i></a>
 | 
						
						
						
							|  |  | </div>
 | 
						
						
						
							|  |  | <!-- 页面主体内容区域 -->
 | 
						
						
						
							|  |  | <div class="x-body">
 | 
						
						
						
							|  |  |     <!-- 搜索表单 -->
 | 
						
						
						
							|  |  |     <div class="layui-row">
 | 
						
						
						
							|  |  |         <form class="layui-form layui-col-md12 x-so" action="/findClass" >
 | 
						
						
						
							|  |  |             <!-- 班级编号输入框 -->
 | 
						
						
						
							|  |  |             <input class="layui-input" placeholder="请输入班级编号" name="c_classid" id="c_classid">
 | 
						
						
						
							|  |  |             <!-- 班级名输入框 -->
 | 
						
						
						
							|  |  |             <input class="layui-input" placeholder="请输入班级名" name="c_classname" id="c_classname">
 | 
						
						
						
							|  |  |             <!-- 辅导员姓名输入框 -->
 | 
						
						
						
							|  |  |             <input class="layui-input" placeholder="请输入辅导员姓名" name="c_counsellor" id="c_counsellor">
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |             <!-- 隐藏的页码和页面大小输入框 -->
 | 
						
						
						
							|  |  |             <input class="layui-input" type="hidden" name="pageIndex" value="1">
 | 
						
						
						
							|  |  |             <input class="layui-input" type="hidden" name="pageSize" value="3">
 | 
						
						
						
							|  |  |             <!-- 搜索按钮 -->
 | 
						
						
						
							|  |  |             <button class="layui-btn"  lay-submit="" lay-filter="search"><i class="layui-icon"></i></button>
 | 
						
						
						
							|  |  |         </form>
 | 
						
						
						
							|  |  |     </div>
 | 
						
						
						
							|  |  |     <!-- 操作按钮区域 -->
 | 
						
						
						
							|  |  |     <xblock>
 | 
						
						
						
							|  |  |         <!-- 添加班级按钮 -->
 | 
						
						
						
							|  |  |         <button id="addStudnetBtn" class="layui-btn layui-btn-normal"> <i class="layui-icon"></i>添加 </button>
 | 
						
						
						
							|  |  |         <!-- 导出按钮 -->
 | 
						
						
						
							|  |  |         <button class="layui-btn layui-btn-warm" lay-filter="toolbarDemo" lay-submit=""><i class="layui-icon"></i>导出</button>
 | 
						
						
						
							|  |  |         <!-- 显示数据总数 -->
 | 
						
						
						
							|  |  |         <span class="x-right" style="line-height:40px">共有数据:${ci.totalCount} 条</span>
 | 
						
						
						
							|  |  |     </xblock>
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |     <%-- 添加模态框的HTML结构 --%>
 | 
						
						
						
							|  |  |     <div class="layui-row" id="test" style="display: none;">
 | 
						
						
						
							|  |  |         <!-- 模态框内容区域,宽度为10/12 -->
 | 
						
						
						
							|  |  |         <div class="layui-col-md10">
 | 
						
						
						
							|  |  |             <!-- 添加班级信息的表单 -->
 | 
						
						
						
							|  |  |             <form class="layui-form" id="addEmployeeForm">
 | 
						
						
						
							|  |  |                 <!-- 班级编号输入项 -->
 | 
						
						
						
							|  |  |                 <div class="layui-form-item">
 | 
						
						
						
							|  |  |                     <label class="layui-form-label">班级编号:</label>
 | 
						
						
						
							|  |  |                     <!-- 输入框块 -->
 | 
						
						
						
							|  |  |                     <div class="layui-input-block">
 | 
						
						
						
							|  |  |                         <input type="text" name="c_classid" class="layui-input" placeholder="请输入班级编号">
 | 
						
						
						
							|  |  |                     </div>
 | 
						
						
						
							|  |  |                 </div>
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |                 <!-- 班级名输入项 -->
 | 
						
						
						
							|  |  |                 <div class="layui-form-item">
 | 
						
						
						
							|  |  |                     <label class="layui-form-label">班级名:</label>
 | 
						
						
						
							|  |  |                     <!-- 输入框块,并设置必填校验 -->
 | 
						
						
						
							|  |  |                     <div class="layui-input-block">
 | 
						
						
						
							|  |  |                         <input type="text" lay-verify="required" name="c_classname" class="layui-input" placeholder="请输入班级名">
 | 
						
						
						
							|  |  |                     </div>
 | 
						
						
						
							|  |  |                 </div>
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |                 <!-- 辅导员姓名输入项 -->
 | 
						
						
						
							|  |  |                 <div class="layui-form-item">
 | 
						
						
						
							|  |  |                     <label class="layui-form-label">辅导员:</label>
 | 
						
						
						
							|  |  |                     <!-- 输入框块 -->
 | 
						
						
						
							|  |  |                     <div class="layui-input-block">
 | 
						
						
						
							|  |  |                         <input type="text" name="c_counsellor" class="layui-input" placeholder="请输入辅导员姓名">
 | 
						
						
						
							|  |  |                     </div>
 | 
						
						
						
							|  |  |                 </div>
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |                 <!-- 提交和重置按钮 -->
 | 
						
						
						
							|  |  |                 <div class="layui-form-item">
 | 
						
						
						
							|  |  |                     <div class="layui-input-block">
 | 
						
						
						
							|  |  |                         <!-- 提交按钮,绑定表单提交事件 -->
 | 
						
						
						
							|  |  |                         <button type="button" class="layui-btn layui-btn-normal" lay-submit lay-filter="formDemo">提交</button>
 | 
						
						
						
							|  |  |                         <!-- 重置按钮,用于重置表单 -->
 | 
						
						
						
							|  |  |                         <button type="reset" class="layui-btn layui-btn-primary">重置</button>
 | 
						
						
						
							|  |  |                     </div>
 | 
						
						
						
							|  |  |                 </div>
 | 
						
						
						
							|  |  |             </form>
 | 
						
						
						
							|  |  |         </div>
 | 
						
						
						
							|  |  |     </div>
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |     <%-- 表格数据展示区域 --%>
 | 
						
						
						
							|  |  |     <table class="layui-table">
 | 
						
						
						
							|  |  |         <!-- 表格头部,定义列名 -->
 | 
						
						
						
							|  |  |         <thead>
 | 
						
						
						
							|  |  |         <th>ID</th>
 | 
						
						
						
							|  |  |         <!-- ID列 -->
 | 
						
						
						
							|  |  |         <th>班级编号</th>
 | 
						
						
						
							|  |  |         <!-- 班级编号列 -->
 | 
						
						
						
							|  |  |         <th>班级名</th>
 | 
						
						
						
							|  |  |         <!-- 班级名列 -->
 | 
						
						
						
							|  |  |         <th>辅导员</th>
 | 
						
						
						
							|  |  |         <!-- 辅导员列 -->
 | 
						
						
						
							|  |  |         <th>操作</th>
 | 
						
						
						
							|  |  |         <!-- 操作列 -->
 | 
						
						
						
							|  |  |         </thead>
 | 
						
						
						
							|  |  |         <tbody>
 | 
						
						
						
							|  |  |         <!-- 使用JSTL的forEach标签遍历班级信息列表 -->
 | 
						
						
						
							|  |  |         <c:forEach items="${ci.list}" var="ci">
 | 
						
						
						
							|  |  |             <tr>
 | 
						
						
						
							|  |  |                 <!-- 显示每行的数据 -->
 | 
						
						
						
							|  |  |                 <td>${ci.c_id}</td>
 | 
						
						
						
							|  |  |                 <!-- 显示ID -->
 | 
						
						
						
							|  |  |                 <td>${ci.c_classid}</td>
 | 
						
						
						
							|  |  |                 <!-- 显示班级编号 -->
 | 
						
						
						
							|  |  |                 <td>${ci.c_classname}</td>
 | 
						
						
						
							|  |  |                 <!-- 显示班级名 -->
 | 
						
						
						
							|  |  |                 <td>${ci.c_counsellor}</td>
 | 
						
						
						
							|  |  |                 <!-- 显示辅导员 -->
 | 
						
						
						
							|  |  |                 <td>
 | 
						
						
						
							|  |  |                     <!-- 编辑操作链接,点击后跳转到编辑页面 -->
 | 
						
						
						
							|  |  |                     <a title="编辑" id="updateEdit" href="/findClassById?c_id=${ci.c_id}">
 | 
						
						
						
							|  |  |                         <i class="layui-icon"></i>
 | 
						
						
						
							|  |  |                         <!-- layui的编辑图标 -->
 | 
						
						
						
							|  |  |                     </a>
 | 
						
						
						
							|  |  |                     <!-- 删除操作链接,点击后执行JavaScript函数 -->
 | 
						
						
						
							|  |  |                     <a title="删除" onclick="member_del(this,'${ci.c_id}')" href="javascript:;">
 | 
						
						
						
							|  |  |                         <i class="layui-icon"></i>
 | 
						
						
						
							|  |  |                         <!-- layui的删除图标 -->
 | 
						
						
						
							|  |  |                     </a>
 | 
						
						
						
							|  |  |                 </td>
 | 
						
						
						
							|  |  |             </tr>
 | 
						
						
						
							|  |  |         </c:forEach>
 | 
						
						
						
							|  |  |         </tbody>
 | 
						
						
						
							|  |  |     </table>
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |     <div class="" >
 | 
						
						
						
							|  |  |         <!-- 隐藏的输入框,存储总页数 -->
 | 
						
						
						
							|  |  |         <input type="hidden" id="totalPageCount" value="${ci.pageTotalCount}"/>
 | 
						
						
						
							|  |  |         <!-- 导入分页按钮的JSP文件 -->
 | 
						
						
						
							|  |  |         <c:import url="pageBtn.jsp">
 | 
						
						
						
							|  |  |             <!-- 传递参数给分页按钮JSP -->
 | 
						
						
						
							|  |  |             <c:param name="totalCount" value="${ci.totalCount}"/>
 | 
						
						
						
							|  |  |             <!-- 总记录数 -->
 | 
						
						
						
							|  |  |             <c:param name="currentPageNo" value="${ci.pageIndex}"/>
 | 
						
						
						
							|  |  |             <!-- 当前页码 -->
 | 
						
						
						
							|  |  |             <c:param name="totalPageCount" value="${ci.pageTotalCount}"/>
 | 
						
						
						
							|  |  |             <!-- 总页数 -->
 | 
						
						
						
							|  |  |         </c:import>
 | 
						
						
						
							|  |  |     </div>
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |     <script>
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |         // 配置layui的扩展模块路径
 | 
						
						
						
							|  |  |         layui.config({
 | 
						
						
						
							|  |  |             base: 'layui_exts/',
 | 
						
						
						
							|  |  |             // 设置扩展模块的基础路径
 | 
						
						
						
							|  |  |         }).extend({
 | 
						
						
						
							|  |  |             excel: 'excel',
 | 
						
						
						
							|  |  |             // 注册excel模块
 | 
						
						
						
							|  |  |         });
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |         // 使用layui模块
 | 
						
						
						
							|  |  |         layui.use(['jquery', 'excel', 'form', 'layer', 'laydate'], function(){
 | 
						
						
						
							|  |  |             var form = layui.form,
 | 
						
						
						
							|  |  |                 // 获取layui的表单模块
 | 
						
						
						
							|  |  |                 $ = layui.jquery,
 | 
						
						
						
							|  |  |                 // 获取jQuery模块
 | 
						
						
						
							|  |  |                 laydate = layui.laydate;
 | 
						
						
						
							|  |  |             // 获取layui的日期模块
 | 
						
						
						
							|  |  |             var excel = parent.layui.excel;
 | 
						
						
						
							|  |  |             // 获取父页面的excel模块
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |             // 初始化日期选择器
 | 
						
						
						
							|  |  |             laydate.render({
 | 
						
						
						
							|  |  |                 elem: '#start'
 | 
						
						
						
							|  |  |                 // 指定绑定的元素
 | 
						
						
						
							|  |  |             });
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |             // 监听表单提交事件
 | 
						
						
						
							|  |  |             form.on('submit(toolbarDemo)', function(){
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |                 // 发起AJAX请求导出班级列表
 | 
						
						
						
							|  |  |                 $.ajax({
 | 
						
						
						
							|  |  |                     url: '/exportclasslist',
 | 
						
						
						
							|  |  |                     // 请求的URL
 | 
						
						
						
							|  |  |                     type: 'post',
 | 
						
						
						
							|  |  |                     // 请求类型
 | 
						
						
						
							|  |  |                     dataType: 'json',
 | 
						
						
						
							|  |  |                     // 预期服务器返回的数据类型
 | 
						
						
						
							|  |  |                     contentType: "application/json; charset=utf-8",
 | 
						
						
						
							|  |  |                     // 发送信息至服务器时内容编码类型
 | 
						
						
						
							|  |  |                     success: function (data) {
 | 
						
						
						
							|  |  |                         // 请求成功后的回调函数
 | 
						
						
						
							|  |  |                         console.log(data);
 | 
						
						
						
							|  |  |                         // 在控制台打印服务器返回的数据
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |                         // 1. 如果需要调整导出数据的顺序,请执行梳理函数
 | 
						
						
						
							|  |  |                         var dt = excel.filterExportData(data, [
 | 
						
						
						
							|  |  |                             'c_id',
 | 
						
						
						
							|  |  |                             // ID列
 | 
						
						
						
							|  |  |                             'c_classid',
 | 
						
						
						
							|  |  |                             // 班级编号列
 | 
						
						
						
							|  |  |                             'c_classname',
 | 
						
						
						
							|  |  |                             // 班级名列
 | 
						
						
						
							|  |  |                             'c_counsellor'
 | 
						
						
						
							|  |  |                             // 辅导员列
 | 
						
						
						
							|  |  |                         ]);
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |                         // 2. 在数组头部新增表头
 | 
						
						
						
							|  |  |                         dt.unshift({c_id: 'ID', c_classid: '班级编号', c_classname: '班级名', c_counsellor: '辅导员'});
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |                         // 配置列宽,A列40px,B列60px(默认),C列120px,D、E、F等均未定义
 | 
						
						
						
							|  |  |                         var colConf = excel.makeColConfig({
 | 
						
						
						
							|  |  |                             'C': 90,
 | 
						
						
						
							|  |  |                             // C列宽度
 | 
						
						
						
							|  |  |                             'D': 80
 | 
						
						
						
							|  |  |                             // D列宽度
 | 
						
						
						
							|  |  |                         }, 60);
 | 
						
						
						
							|  |  |                         // 默认列宽
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |                         var timestart = Date.now();
 | 
						
						
						
							|  |  |                         // 记录开始时间
 | 
						
						
						
							|  |  |                         // 3. 执行导出函数,系统会弹出保存文件的弹框
 | 
						
						
						
							|  |  |                         excel.exportExcel({
 | 
						
						
						
							|  |  |                             sheet1: dt
 | 
						
						
						
							|  |  |                             // 数据
 | 
						
						
						
							|  |  |                         }, '班级数据.xlsx', 'xlsx', {
 | 
						
						
						
							|  |  |                             // 文件名和格式
 | 
						
						
						
							|  |  |                             extend: {
 | 
						
						
						
							|  |  |                                 '!cols': colConf
 | 
						
						
						
							|  |  |                                 // 列配置
 | 
						
						
						
							|  |  |                             }
 | 
						
						
						
							|  |  |                         });
 | 
						
						
						
							|  |  |                         var timeend = Date.now();
 | 
						
						
						
							|  |  |                         // 记录结束时间
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |                         var spent = (timeend - timestart) / 1000;
 | 
						
						
						
							|  |  |                         // 计算耗时
 | 
						
						
						
							|  |  |                         layer.alert('导出耗时 '+spent+' s');
 | 
						
						
						
							|  |  |                         // 弹出提示框显示耗时
 | 
						
						
						
							|  |  |                         //setTimeout(function () {window.location.href='/findAdmin';},2000); // 2秒后跳转页面,此行被注释掉了
 | 
						
						
						
							|  |  |                     },
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |                     error: function () {
 | 
						
						
						
							|  |  |                         // 请求失败后的回调函数
 | 
						
						
						
							|  |  |                         //console.log(data);
 | 
						
						
						
							|  |  |                         // 在控制台打印错误信息,此行被注释掉了
 | 
						
						
						
							|  |  |                         setTimeout(function () {window.location.href='/findClass';},2000); // 2秒后跳转到班级列表页面
 | 
						
						
						
							|  |  |                     }
 | 
						
						
						
							|  |  |                 });
 | 
						
						
						
							|  |  |             });
 | 
						
						
						
							|  |  |         });
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |         /* 添加弹出框 */
 | 
						
						
						
							|  |  |         // 当点击添加学生按钮时触发事件
 | 
						
						
						
							|  |  |         $("#addStudnetBtn").click(function () {
 | 
						
						
						
							|  |  |             // 使用layer.open方法打开一个弹出层
 | 
						
						
						
							|  |  |             layer.open({
 | 
						
						
						
							|  |  |                 type: 1,
 | 
						
						
						
							|  |  |                 // 类型为页面层
 | 
						
						
						
							|  |  |                 title: "添加班级",
 | 
						
						
						
							|  |  |                 // 弹出层标题
 | 
						
						
						
							|  |  |                 skin: "myclass",
 | 
						
						
						
							|  |  |                 // 自定义皮肤样式
 | 
						
						
						
							|  |  |                 area: ["50%"],
 | 
						
						
						
							|  |  |                 // 弹出层宽高,这里只设置了宽度为50%
 | 
						
						
						
							|  |  |                 anim: 2,
 | 
						
						
						
							|  |  |                 // 弹出动画效果
 | 
						
						
						
							|  |  |                 content: $("#test").html()
 | 
						
						
						
							|  |  |                 // 弹出层内容,这里是获取id为test的元素的HTML内容
 | 
						
						
						
							|  |  |             });
 | 
						
						
						
							|  |  |             // 重置表单
 | 
						
						
						
							|  |  |             $("#addEmployeeForm")[0].reset();
 | 
						
						
						
							|  |  |             // 监听表单提交事件
 | 
						
						
						
							|  |  |             form.on('submit(formDemo)', function(data) {
 | 
						
						
						
							|  |  |                 // 弹出消息提示,这里被注释掉了
 | 
						
						
						
							|  |  |                 // layer.msg('aaa',{icon:1,time:3000});
 | 
						
						
						
							|  |  |                 var param = data.field;
 | 
						
						
						
							|  |  |                 // 获取表单数据
 | 
						
						
						
							|  |  |                 // console.log(JSON.stringify(param));
 | 
						
						
						
							|  |  |                 // 打印表单数据,这里被注释掉了
 | 
						
						
						
							|  |  |                 // 发起AJAX请求添加班级
 | 
						
						
						
							|  |  |                 $.ajax({
 | 
						
						
						
							|  |  |                     url: '/addClass',
 | 
						
						
						
							|  |  |                     // 请求URL
 | 
						
						
						
							|  |  |                     type: "post",
 | 
						
						
						
							|  |  |                     // 请求类型
 | 
						
						
						
							|  |  |                     data: JSON.stringify(param),
 | 
						
						
						
							|  |  |                     // 发送的数据,转换为JSON字符串
 | 
						
						
						
							|  |  |                     contentType: "application/json; charset=utf-8",
 | 
						
						
						
							|  |  |                     // 发送数据的类型
 | 
						
						
						
							|  |  |                     success: function() {
 | 
						
						
						
							|  |  |                         // 请求成功回调函数
 | 
						
						
						
							|  |  |                         layer.msg('添加成功', {icon: 1, time: 3000});
 | 
						
						
						
							|  |  |                         // 弹出成功消息
 | 
						
						
						
							|  |  |                         setTimeout(function () {window.location.href='/findClass';},2000);
 | 
						
						
						
							|  |  |                         // 2秒后跳转到班级列表页面
 | 
						
						
						
							|  |  |                     },
 | 
						
						
						
							|  |  |                     error: function() {
 | 
						
						
						
							|  |  |                         // 请求失败回调函数
 | 
						
						
						
							|  |  |                         layer.msg('添加失败',{icon:0,time:3000});
 | 
						
						
						
							|  |  |                         // 弹出失败消息
 | 
						
						
						
							|  |  |                         setTimeout(function () {window.location.href='/findClass';},2000);
 | 
						
						
						
							|  |  |                         // 2秒后跳转到班级列表页面
 | 
						
						
						
							|  |  |                     }
 | 
						
						
						
							|  |  |                 });
 | 
						
						
						
							|  |  |                 // 阻止表单默认提交行为
 | 
						
						
						
							|  |  |                 // return false;
 | 
						
						
						
							|  |  |             });
 | 
						
						
						
							|  |  |         });
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |         // 删除班级的函数
 | 
						
						
						
							|  |  |         function member_del(obj, c_id) {
 | 
						
						
						
							|  |  |             // 弹出确认框
 | 
						
						
						
							|  |  |             layer.confirm('确认要删除吗?', function(index) {
 | 
						
						
						
							|  |  |                 // 发起GET请求删除班级
 | 
						
						
						
							|  |  |                 $.get("/deleteClass", {"c_id": c_id}, function (data) {
 | 
						
						
						
							|  |  |                     if(data === true) {
 | 
						
						
						
							|  |  |                         // 如果删除成功
 | 
						
						
						
							|  |  |                         layer.msg('删除成功!', {icon: 1, time: 2000});
 | 
						
						
						
							|  |  |                         // 弹出成功消息
 | 
						
						
						
							|  |  |                         setTimeout(function () {window.location.href='/findClass';},2000);
 | 
						
						
						
							|  |  |                         // 2秒后跳转到班级列表页面
 | 
						
						
						
							|  |  |                     } else {
 | 
						
						
						
							|  |  |                         // 如果删除失败
 | 
						
						
						
							|  |  |                         layer.msg('删除失败!', {icon: 1, time: 2000});
 | 
						
						
						
							|  |  |                         // 弹出失败消息
 | 
						
						
						
							|  |  |                         setTimeout(function () {window.location.href='/findClass';},2000); // 2秒后跳转到班级列表页面
 | 
						
						
						
							|  |  |                     }
 | 
						
						
						
							|  |  |                 });
 | 
						
						
						
							|  |  |                 // 关闭确认框
 | 
						
						
						
							|  |  |                 layer.close(index);
 | 
						
						
						
							|  |  |             });
 | 
						
						
						
							|  |  |         }
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  |     </script>
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | </body>
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | 
 | 
						
						
						
							|  |  | </html>
 |