学籍信息管理系统(二)

四、关键代码
  1.数据库的链接 
package util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class util {

    private static String mysqlname = "xueji";
    private static Connection con;
    private static Statement sta;
    private static ResultSet re;
    private static String coursename = "com.mysql.cj.jdbc.Driver";
    private static String url = "jdbc:mysql://localhost:3306/" + mysqlname + " ?serverTimezone=GMT%2B8";


    public static Connection getConnection() {
        try {
            Class.forName(coursename);
            System.out.println("连接成功");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        try {
            con = DriverManager.getConnection(url, "root", "123456");
            System.out.println("LIANJIE");
        } catch (Exception e) {
            e.printStackTrace();
            con = null;
        }
        return con;
    }

    public static void close(Statement state, Connection conn) {
        if (state != null) {
            try {
                state.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }

        if (conn != null) {
            try {
                conn.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }

    public static void close(ResultSet rs, Statement state, Connection conn) {
        if (rs != null) {
            try {
                rs.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }

        if (state != null) {
            try {
                state.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }

        if (conn != null) {
            try {
                conn.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }
}

2.dao层(数据库的增删改查)
package dao;
import bean.student;
import util.util;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;

public class dao {

//显示所有学生学籍信息
    public List<student> searchAll( ){
        List<student> list = new ArrayList<student>();
        try {
            Connection conn =  util.getConnection();
            Statement state = null;
            String sql="select * from student order by id";
            PreparedStatement  pstmt = conn.prepareStatement(sql);
            ResultSet rs = pstmt.executeQuery();
            System.out.println("查询所有学生—— ");
            while(rs.next()){
                student stu = new student();

                stu.setId(rs.getString("id"));
                stu.setName(rs.getString("name"));
                stu.setSex(rs.getString("sex"));
                stu.setBirth(rs.getString("birth"));
                stu.setXueyuan(rs.getString("xueyuan"));
                stu.setZhuanye(rs.getString("zhuanye"));

                list.add(stu);

            }
            rs.close();
            pstmt.close();
            conn.close();
        }catch(SQLException e) {

            System.out.println("发生错误");
            e.printStackTrace();
        }
        return list;
    }

//获取单个学生详细信息
    public static student getStudent(String id){
        student stu = new student();
        try {
            Connection conn =  util.getConnection();
            Statement state = null;
            String sql="select * from student where id=?";
            PreparedStatement  pstmt = conn.prepareStatement(sql);
            pstmt.setString(1,id);
            ResultSet rs = pstmt.executeQuery();
            System.out.println("查看单个学生详情——");
            while(rs.next()){

                stu.setId(rs.getString("id"));
                stu.setName(rs.getString("name"));
                stu.setSex(rs.getString("sex"));
                stu.setBirth(rs.getString("birth"));
                stu.setXueji(rs.getString("xueji"));
                stu.setXueyuan(rs.getString("xueyuan"));
                stu.setZhuanye(rs.getString("zhuanye"));
                stu.setBanji(rs.getString("banji"));
                stu.setJiguan(rs.getString("jiguan"));
                stu.setMianmao(rs.getString("mianmao"));
                stu.setMinzu(rs.getString("minzu"));
                stu.setShenfenid(rs.getString("shenfenid"));
                stu.setPhone(rs.getString("phone"));
                stu.setHome(rs.getString("home"));
                stu.setSchool(rs.getString("school"));
                stu.setRuxue(rs.getString("ruxue"));
                stu.setHuojiang(rs.getString("huojiang"));
                stu.setBeizhu(rs.getString("beizhu"));

            }
            rs.close();
            pstmt.close();
            conn.close();
        }
        catch(SQLException e) {

            e.printStackTrace();
        }
        return stu;

    }


//获取所有学生修改申请
public List<student> searchXiugai( ){
    List<student> list = new ArrayList<student>();
    try {
        Connection conn =  util.getConnection();
        Statement state = null;
        String sql="select * from studentdsh order by id";
        PreparedStatement  pstmt = conn.prepareStatement(sql);
        ResultSet rs = pstmt.executeQuery();
        System.out.println("查询所有申请—— ");
        while(rs.next()){
            student stu = new student();

            stu.setId(rs.getString("id"));
            stu.setName(rs.getString("name"));
            stu.setSex(rs.getString("sex"));
            stu.setBirth(rs.getString("birth"));
            stu.setXueyuan(rs.getString("xueyuan"));
            stu.setZhuanye(rs.getString("zhuanye"));

            list.add(stu);

        }
        rs.close();
        pstmt.close();
        conn.close();
    }catch(SQLException e) {

        System.out.println("发生错误");
        e.printStackTrace();
    }
    return list;
}

//查看单个学生修改申请
public static student getShenqing(String id){
    student stu = new student();
    try {
        Connection conn =  util.getConnection();
        Statement state = null;
        String sql="select * from studentdsh where id=?";
        PreparedStatement  pstmt = conn.prepareStatement(sql);
        pstmt.setString(1,id);
        ResultSet rs = pstmt.executeQuery();
        System.out.println("查看单个学生申请——");
        while(rs.next()){

            stu.setId(rs.getString("id"));
            stu.setName(rs.getString("name"));
            stu.setSex(rs.getString("sex"));
            stu.setBirth(rs.getString("birth"));
            stu.setXueji(rs.getString("xueji"));
            stu.setXueyuan(rs.getString("xueyuan"));
            stu.setZhuanye(rs.getString("zhuanye"));
            stu.setBanji(rs.getString("banji"));
            stu.setJiguan(rs.getString("jiguan"));
            stu.setMianmao(rs.getString("mianmao"));
            stu.setMinzu(rs.getString("minzu"));
            stu.setShenfenid(rs.getString("shenfenid"));
            stu.setPhone(rs.getString("phone"));
            stu.setHome(rs.getString("home"));
            stu.setSchool(rs.getString("school"));
            stu.setRuxue(rs.getString("ruxue"));
            stu.setHuojiang(rs.getString("huojiang"));
            stu.setBeizhu(rs.getString("beizhu"));

        }
        rs.close();
        pstmt.close();
        conn.close();
    }
    catch(SQLException e) {

        e.printStackTrace();
    }
    return stu;

}
//查询学生申请状态
public static String getzhuangtai(String id) {

    String shenhe = null;
    try {
        Connection conn = util.getConnection();
        Statement state = null;
        String sql = "select * from studentdsh where id=?";
        PreparedStatement pstmt = conn.prepareStatement(sql);
        pstmt.setString(1, id);
        ResultSet rs = pstmt.executeQuery();
        System.out.println("查看单个学生申请——");
        while (rs.next()) {

            shenhe = (rs.getString("shenhe"));

        }
        rs.close();
        pstmt.close();
        conn.close();
    } catch (SQLException e) {

        e.printStackTrace();
    }
    return shenhe;

}


//判断登录是否成功
    public static boolean judgelogin(String id ,String password){

            boolean flag=false;
            try {
                Connection connect = util.getConnection();
                Statement stmt = connect.createStatement();
                ResultSet rs = stmt.executeQuery("select * from user");
                while(rs.next())
                {
                    if((id.equals(rs.getString("id")))&& (password.equals(rs.getString("password"))))
                    {
                        flag=true;
                    }
                }
                rs.close();
                connect.close();
                stmt.close();
            }catch (SQLException e) {
                e.printStackTrace();
            }
            return  flag;
        }


//删除student表中信息
    public static boolean deletestu(String id) {
        boolean flag = false;
        Connection conn =  util.getConnection();
        Statement state = null;

        try {
            String sql = "delete from student where id = '"+id+"'";
            PreparedStatement pstmt = conn.prepareStatement(sql);
            int i = pstmt.executeUpdate();
            pstmt.close();
            conn.close();
            if(i>0) flag = true;
        } catch (SQLException e) {
            System.out.println("删除失败!");
            e.printStackTrace();
        }

        return flag;
    }

//删除studentdsh表中信息
     public static  boolean deletedsh(String  id) {
          boolean flag = false;
          Connection conn =  util.getConnection();
          Statement state = null;

    try {
        String sql = "delete from studentdsh where id = '"+id+"'";
        PreparedStatement pstmt = conn.prepareStatement(sql);
        int i = pstmt.executeUpdate();
        pstmt.close();
        conn.close();
        if(i>0) flag = true;
    } catch (SQLException e) {
        System.out.println("删除失败!");
        e.printStackTrace();
    }

    return flag;
}

//删除user表中信息
public boolean deleteuser(String  id) {
    boolean flag = false;
    Connection conn =  util.getConnection();
    Statement state = null;

    try {
        String sql = "delete from user where id = '"+id+"'";
        PreparedStatement pstmt = conn.prepareStatement(sql);
        int i = pstmt.executeUpdate();
        pstmt.close();
        conn.close();
        if(i>0) flag = true;
    } catch (SQLException e) {
        System.out.println("删除失败!");
        e.printStackTrace();
    }

    return flag;
}

//修改密码
public static void updatemima(String id,String password) {
    try {
        PreparedStatement preparedStatement = null;
        Connection connect = util.getConnection();
        preparedStatement = connect.prepareStatement("Update user set password=? where id=?");
        preparedStatement.setString(1,password);
        preparedStatement.setString(2,id);
        preparedStatement.executeUpdate();
        preparedStatement.execute();
        connect.close();
    } catch (SQLException e) {
        e.printStackTrace();
    }
}


//通过或修改单个学生信息
    public static void update(String id,String name,String sex,String birth,String xueji,String xueyuan,String zhuanye,String banji,String jiguan,String minzu,String mianmao,String shenfenid, String phone, String home,String school,String ruxue,String huojiang,String beizhu) {
        try {
            PreparedStatement preparedStatement = null;
            Connection connect = util.getConnection();
            preparedStatement = connect.prepareStatement("Update student set  name=?,sex=? ,birth=?,xueji=?,xueyuan=?,zhuanye=?,banji=?,jiguan=?,minzu=?,mianmao=?,shenfenid=?,phone=?,home=?,school=?,ruxue=?,huojiang=?,beizhu=? where id=?");
            preparedStatement.setString(1,name);
            preparedStatement.setString(2,sex);
            preparedStatement.setString(3,birth);
            preparedStatement.setString(4,xueji);
            preparedStatement.setString(5,xueyuan);
            preparedStatement.setString(6,zhuanye);
            preparedStatement.setString(7,banji);
            preparedStatement.setString(8,jiguan);
            preparedStatement.setString(9,minzu);
            preparedStatement.setString(10,mianmao);
            preparedStatement.setString(11,shenfenid);
            preparedStatement.setString(12,phone);
            preparedStatement.setString(13,home);
            preparedStatement.setString(14,school);
            preparedStatement.setString(15,ruxue);
            preparedStatement.setString(16,huojiang);
            preparedStatement.setString(17,beizhu);
            preparedStatement.setString(18,id);
            preparedStatement.executeUpdate();
            preparedStatement.execute();
            connect.close();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }


//驳回修改申请
public static void bohui(String id ,String s) {
    try {
        PreparedStatement preparedStatement = null;
        Connection connect = util.getConnection();
        preparedStatement = connect.prepareStatement("Update studentdsh set shenhe=? where id=?");
        preparedStatement.setString(1,s);
        preparedStatement.setString(2,id);
        preparedStatement.executeUpdate();
        preparedStatement.execute();
        connect.close();
    } catch (SQLException e) {
        e.printStackTrace();
    }
}
//学生提交修改申请
    public static boolean stuadd(String id,String name,String sex,String birth,String xueji,String xueyuan,String zhuanye,String banji,String jiguan,String minzu,String mianmao,String shenfenid, String phone, String home,String school,String ruxue,String huojiang,String beizhu )
    {
        boolean flag=false;
        try {
            PreparedStatement preparedStatement=null;
            Connection connect = util.getConnection();
            preparedStatement=connect.prepareStatement("insert into studentdsh (id,name,sex,birth,xueji,xueyuan,zhuanye,banji,jiguan,minzu,mianmao,shenfenid,phone,home,school,ruxue,huojiang,beizhu,shenhe) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
            preparedStatement.setString(1,id);
            preparedStatement.setString(2,name);
            preparedStatement.setString(3,sex);
            preparedStatement.setString(4,birth);
            preparedStatement.setString(5,xueji);
            preparedStatement.setString(6,xueyuan);
            preparedStatement.setString(7,zhuanye);
            preparedStatement.setString(8,banji);
            preparedStatement.setString(9,jiguan);
            preparedStatement.setString(10,minzu);
            preparedStatement.setString(11,mianmao);
            preparedStatement.setString(12,shenfenid);
            preparedStatement.setString(13,phone);
            preparedStatement.setString(14,home);
            preparedStatement.setString(15,school);
            preparedStatement.setString(16,ruxue);
            preparedStatement.setString(17,huojiang);
            preparedStatement.setString(18,beizhu);
            preparedStatement.setString(19,"待审核");
            preparedStatement.executeUpdate();
            connect.close();
            preparedStatement.close();
            flag=true;
        }catch(SQLException e){
            e.printStackTrace();
        }
        return flag;
    }

//管理员增添新学籍信息
public static boolean glyadd(String id,String name,String sex,String birth,String xueji,String xueyuan,String zhuanye,String banji,String jiguan,String minzu,String mianmao,String shenfenid, String phone, String home,String school,String ruxue,String huojiang,String beizhu)
{
    boolean flag=false;
    try {
        PreparedStatement preparedStatement=null;
        Connection connect = util.getConnection();
        preparedStatement=connect.prepareStatement("insert into student (id,name,sex,birth,xueji,xueyuan,zhuanye,banji,jiguan,minzu,mianmao,shenfenid,phone,home,school,ruxue,huojiang,beizhu) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
        preparedStatement.setString(1,id);
        preparedStatement.setString(2,name);
        preparedStatement.setString(3,sex);
        preparedStatement.setString(4,birth);
        preparedStatement.setString(5,xueji);
        preparedStatement.setString(6,xueyuan);
        preparedStatement.setString(7,zhuanye);
        preparedStatement.setString(8,banji);
        preparedStatement.setString(9,jiguan);
        preparedStatement.setString(10,minzu);
        preparedStatement.setString(11,mianmao);
        preparedStatement.setString(12,shenfenid);
        preparedStatement.setString(13,phone);
        preparedStatement.setString(14,home);
        preparedStatement.setString(15,school);
        preparedStatement.setString(16,ruxue);
        preparedStatement.setString(17,huojiang);
        preparedStatement.setString(18,beizhu);
        preparedStatement.executeUpdate();
        connect.close();
        preparedStatement.close();
        flag=true;
    }catch(SQLException e){
        e.printStackTrace();
    }
    return flag;
}
}

3.inde.jsp(登录页面)
<%--
  Created by IntelliJ IDEA.
  User: 榕宝
  Date: 2022/7/1
  Time: 16:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <script th:src="@{/layuimini/js/lay-module/echarts/echarts.js}"></script>
  <script th:src="@{/layuimini/js/lay-module/echarts/wordcloud.js}"></script>
  <link rel="stylesheet" type="text/css" href="https://www.layuicdn.com/layui/css/layui.css" />
  <script src="https://www.layuicdn.com/layui/layui.js"></script>
  <style>
    .success {
      background-color: rgba(199, 199, 199, 0.94);
    }

    .biaoti{
      font-family:"宋体";/*设置字体*/
      color: #00000;
      text-decoration:none;
      font-size:25px;/*设置字体大小*/
      font-weight:bold; /*调整字体粗细*/
    }

    .ziti{
      font-family:"宋体";/*设置字体*/
      font-size:20px;/*设置字体大小*/
      font-weight:5px;/*调整字体粗细*/
      color:#000000;
    }
    }

    a {
      font-family:"幼圆";/*设置字体*/
      color: #00000;
      text-decoration:none;
      font-size:28px;/*设置字体大小*/
      font-weight:10px;/*调整字体粗细*/

    }

    a:hover {
      color: #88001b;

      font-size: 28px;
    }
    .select{
      background:#fafdfe;
      width:300px;
      height:30px;


      line-height:28px;
      border:1px solid #000000;
      -moz-border-radius:2px;
      -webkit-border-radius:2px;
      border-radius:5px;
    }
    button { /* 按钮美化 */
      width: 150px; /* 宽度 */
      height: 40px; /* 高度 */
      border-width: 0px; /* 边框宽度 */
      border-radius: 10px; /* 边框半径 */
      background: #123134; /* 背景颜色 */
      cursor: pointer; /* 鼠标移入按钮范围时出现手势 */
      outline: none; /* 不显示轮廓线 */
      font-family: "宋体"; /* 设置字体 */
      color: white; /* 字体颜色 */
      font-size: 17px; /* 字体大小 */
    }
    button:hover { /* 鼠标移入按钮范围时改变颜色 */
      background: #c84d4f;
    }

    *{
      margin: 0;
      padding: 0;

    }
    div{
      width: 200px;
      height: 200px;

    }
    .center-in-center{
      position: absolute;
      top: 50%;
      left: 50%;
      -webkit-transform: translate(-50%, -50%);
      -moz-transform: translate(-50%, -50%);
      -ms-transform: translate(-50%, -50%);
      -o-transform: translate(-50%, -50%);
      transform: translate(-50%, -50%);
    }
  </style>


  <script language="javascript" type="text/javascript">

    var show_num = [];
    draw(show_num);

    function dj() {
      draw(show_num);
    }


    function validate ()
    {
      var inputCode = document.getElementById("text").value;
      if(inputCode.length <=0)
      {
        document.getElementById("ymz").innerText="请输入验证码!";
        return false;
      }
      else if(inputCode != code )
      {
        document.getElementById("ymz").innerText="验证码输入错误!";
        createCode();//刷新验证码
        return false;
      }

      else
      {

        window.location.href="login.php";//普通用户登录后网址

      }

    }

    function draw(show_num) {
      var canvas_width = document.getElementById('canvas').clientWidth;
      var canvas_height = document.getElementById('canvas').clientHeight;
      var canvas = document.getElementById("canvas"); //获取到canvas的对象,演员
      var context = canvas.getContext("2d"); //获取到canvas画图的环境,演员表演的舞台
      canvas.width = canvas_width;
      canvas.height = canvas_height;
      var sCode =
              "A,B,C,E,F,G,H,J,K,L,M,N,P,Q,R,S,T,W,X,Y,Z,1,2,3,4,5,6,7,8,9,0,q,w,e,r,t,y,u,i,o,p,a,s,d,f,g,h,j,k,l,z,x,c,v,b,n,m";
      var aCode = sCode.split(",");
      var aLength = aCode.length; //获取到数组的长度

      for (var i = 0; i <= 3; i++) {
        var j = Math.floor(Math.random() * aLength); //获取到随机的索引值
        var deg = Math.random() * 30 * Math.PI / 180; //产生0~30之间的随机弧度
        var txt = aCode[j]; //得到随机的一个内容
        show_num[i] = txt;
        var x = 10 + i * 20; //文字在canvas上的x坐标
        var y = 20 + Math.random() * 8; //文字在canvas上的y坐标
        context.font = "bold 23px 微软雅黑";

        context.translate(x, y);
        context.rotate(deg);

        context.fillStyle = randomColor();
        context.fillText(txt, 0, 0);

        context.rotate(-deg);
        context.translate(-x, -y);
      }
      for (var i = 0; i <= 5; i++) { //验证码上显示线条
        context.strokeStyle = randomColor();
        context.beginPath();
        context.moveTo(Math.random() * canvas_width, Math.random() * canvas_height);
        context.lineTo(Math.random() * canvas_width, Math.random() * canvas_height);
        context.stroke();
      }
      for (var i = 0; i <= 30; i++) { //验证码上显示小点
        context.strokeStyle = randomColor();
        context.beginPath();
        var x = Math.random() * canvas_width;
        var y = Math.random() * canvas_height;
        context.moveTo(x, y);
        context.lineTo(x + 1, y + 1);
        context.stroke();
      }
    }

    function randomColor() { //得到随机的颜色值
      var r = Math.floor(Math.random() * 256);
      var g = Math.floor(Math.random() * 256);
      var b = Math.floor(Math.random() * 256);
      return "rgb(" + r + "," + g + "," + b + ")";
    }

  </script>




</head>




<div  style="width:1520px;height:752px; background: url(1.jpg); background-size:cover ;text-align: center;">

  <div style=" width:300px;height:70px;float: left;background: url(swjtu_logo.gif); background-size:contain ;"> </div>
  <div class="center-in-center" style="width: 500px;height:400px;border-radius:10px; filter:alpha(Opacity=80);-moz-opacity:0.7;opacity: 0.7;background-color: white;">
    <p>&nbsp;</p>
    <p class="biaoti">学籍信息管理系统</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <form method="post" action="loginback.jsp">
      <p class="ziti">账号:<input type="text" name="zhanghao"  class="select" placeholder="学号"></p>
      <p>&nbsp;</p>
      <p class="ziti">密码:<input type="password" name="password"  class="select"></p>

      <p>&nbsp;</p>
      <p class="ziti">身份:<select id="shenfen" name="shenfen" class="select">
        <option value="">请选择您的身份</option>
        <option value="在校生">在校生</option>
        <option value="管理员">管理员</option>

      </select> </p>
      <p>&nbsp;</p>
      <p  ><input  type="text"   id="input1" placeholder="验证码" style="width: 100px;height: 25px;"/><canvas id="canvas" width="100" height="35" onclick="dj()" style="border: 1px solid #ccc;
        border-radius: 5px;"></canvas> </p>
      <label id="yzm" style="color:red;margin-left:15px"></label>


      <p>&nbsp;</p>
      <button type="submit">登录</button>

    </form>

  </div>


</div>

</html>

4.gly.html(管理员主页面)


<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>石铁大学籍信息管理系统</title>
    <script th:src="@{/layuimini/js/lay-module/echarts/echarts.js}"></script>
    <script th:src="@{/layuimini/js/lay-module/echarts/wordcloud.js}"></script>
    <link rel="stylesheet" type="text/css" href="https://www.layuicdn.com/layui/css/layui.css" />
    <script src="https://www.layuicdn.com/layui/layui.js"></script>
    <style>

        /*整个tab层居中,宽度为600px*/
        #tabDiv {
            width: 600px;
            margin: 1em auto;

            background-color:#f2eee5 ;

        }
        /*tab头的样式*/
        #tabsHead {

            height: 226px;
            background-color:#f2eee5 ;


        }
        /*已选tab头(超链接)的样式*/
        .curtab {
            padding-top: 10px;
            padding-right: 20px;
            padding-bottom: 0px;
            padding-left: 10px;
            border-right: #294224 1px solid;
            font-weight: bold;
            float: left;
            cursor: pointer;

        }
        /*未选tab头(超链接)的样式*/
        .tabs {
            border-right: #ffffff 1px solid;
            padding-top: 10px;
            padding-right: 20px;
            padding-bottom: 0px;
            padding-left: 10px;
            font-weight: normal;
            float: left;
            cursor: pointer;
        }
        a {
            color: #000000;
            text-decoration:none;
            font-size:15px;/*设置字体大小*/
            font-weight:500;/*调整字体粗细*/

        }

        a:hover {
            color: #254c37;

            font-size: 15px;
        }

    </style>
    <script type="text/jscript">
        //显示tab(tabHeadId:tab头中当前的超链接;tabContentId要显示的层ID)
        function showTab(tabHeadId,tabContentId)
        {
            //tab层
            var tabDiv = document.getElementById("tabDiv");
            //将tab层中所有的内容层设为不可见
            //遍历tab层下的所有子节点
            var taContents = tabDiv.childNodes;
            for(i=0; i<taContents.length; i++)
            {
                //将所有内容层都设为不可见
                if(taContents[i].id!=null && taContents[i].id != 'tabsHead')
                {
                    taContents[i].style.display = 'none';
                }
            }
            //将要显示的层设为可见
            document.getElementById(tabContentId).style.display = 'block';
            //遍历tab头中所有的超链接
            var tabHeads = document.getElementById('tabsHead').getElementsByTagName('a');
            for(i=0; i<tabHeads.length; i++)
            {
                //将超链接的样式设为未选的tab头样式
                tabHeads[i].className='tabs';
            }
            //将当前超链接的样式设为已选tab头样式
            document.getElementById(tabHeadId).className='curtab';
            document.getElementById(tabHeadId).blur();
        }
</script>





</head>

<div style="width:100%;height:110px;  background-color:#254c37 ;">
    <p>&nbsp;</p>
    <div  style="width: 305px;height: 80px;background: url(index_logo.png); background-size:cover ;text-align: center;float:left;"></div>

     <div  style="width:40px;height:40px;background: url(sousuo.png); background-size:cover ;text-align: center;float:right; margin:15px;"></div>

    <div class="layui-input-inline" style="float:right">
        <p>&nbsp;</p>
        <label>
            <input type="text" name="title"  class="layui-input">
        </label>
    </div>
</div>
<div id="tabDiv" style="width:100%;height:100%;margin: auto; ">


    <div id="tabsHead" style="float:left;width:100%;height:40px;text-align:center;   ">

        <a id="tabs1" class="curtab" href="javascript:showTab('tabs1','tabContent1')">学籍基本信息</a>
        <a id="tabs2" class="tabs" href="javascript:showTab('tabs2','tabContent2')">学籍信息添加</a>
        <a id="tabs3" class="tabs" href="javascript:showTab('tabs3','tabContent3')">学籍修改审核</a>
        <a id="tabs4" class="tabs" href="index.jsp">退出登录</a>


    </div>

    <div id="tabContent1"   style="width:100%;height:100%;float:left; position:relative;  ">
        <div class="container3">
            <iframe id="myIframe1" name="hideIframe1" style="" src="table1.jsp" frameborder="0" width="100%" height="780px"style="background-color: #f2eee5;"></iframe>
        </div>
    </div>

    <div id="tabContent2" class="main" style="width:100%;height:100%;float:left; position:relative;  display: none; ">

        <form class="layui-form"action="gladd.jsp" method="post" >
            <table class="layui-table"style="table-layout: fixed;word-wrap:break-word;width:90%;margin: auto;" >

                <tr>

                    <td>学生学号</td>
                    <td><input type="text" name="id" class="layui-input"></td>
                </tr>
                <tr>
                    <td>学生姓名</td>
                    <td><input type=" text" name="name" class="layui-input"></td>
                </tr>
                <tr>
                    <td>学生性别</td>
                    <td><input class="layui-input" type="radio" name="sex" checked ><input class="layui-input" type="radio" name="sex">女   </td>
                </tr>

                <tr>
                    <td>出生日期</td>
                    <td><input type=" text" name="birth" class="layui-input"></td>
                </tr>

                <tr>
                    <td>学籍状态</td>
                    <td><input class="layui-input" type="radio" name="xueji" checked >有学籍&nbsp;在读
                        <input class="layui-input" type="radio" name="xueji">无学籍 </td>
                </tr>

                <tr>
                    <td>专业学院</td>
                    <td><input type=" text" name="xueyuan" class="layui-input"></td>
                </tr>

                <tr>
                    <td>就读专业</td>
                    <td><input type=" text" name="zhuanye" class="layui-input"></td>
                </tr>

                <tr>
                    <td>专业班级</td>
                    <td><input type=" text" name="banji" class="layui-input"></td>
                </tr>

                <tr>
                    <td>学生籍贯</td>
                    <td><input type=" text" name="jiguan" class="layui-input"></td>
                </tr>

                <tr>
                    <td>学生民族</td>
                    <td><input type=" text" name="minzu" class="layui-input"></td>
                </tr>

                <tr>
                    <td>政治面貌</td>
                    <td> <select id="shenfen" name="shenfen" class="layui-select">
                        <option value="群众">群众</option>
                        <option value="共青团员">共青团员</option>
                        <option value="预备党员">预备党员</option>
                        <option value="党员">党员</option>

                    </select></td>
                </tr>

                <tr>
                    <td>身份证号</td>
                    <td><input type=" text" name="shenfenid" class="layui-input"></td>
                </tr>

                <tr>
                    <td>联系电话</td>
                    <td><input type=" text" name="phone" class="layui-input"></td>
                </tr>

                <tr>
                    <td>家庭住址</td>
                    <td><input type=" text" name="home" class="layui-input"></td>
                </tr>

                <tr>
                    <td>毕业学校</td>
                    <td><input type=" text" name="school" class="layui-input"></td>
                </tr>

                <tr>
                    <td>入学日期</td>
                    <td><input type=" text" name="ruxue" class="layui-input"></td>
                </tr>

                <tr>
                    <td>获奖记录</td>
                    <td><input type=" text" name="huojiang" class="layui-input"></td>
                </tr>

                <tr>
                    <td>备注</td>
                    <td><input type=" text" name="beizhu" class="layui-input"></td>
                </tr>

                <tr>

                    <td style="width: 150px"><button type="submit" class="layui-btn">添加</button></td>
                    <td><button type="reset" class="layui-btn" style="background-color: #dc143c" >重置</button></td>
                </tr>

            </table>
        </form>
    </div>


    <div id="tabContent3" class="main" style="width:100%;height:100%;float:left; position:relative;  display: none; ">
        <div class="container3">
            <iframe id="myIframe2" name="hideIframe1" style="" src="table2.jsp" frameborder="0" width="100%" height="780px"style="background-color: #f2eee5;"></iframe>
        </div>
    </div>
</html>

5.zxs.html(学生主页面)
<%--
  Created by IntelliJ IDEA.
  User: 榕宝
  Date: 2022/7/3
  Time: 19:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>




<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>石铁大学籍信息管理系统</title>
    <script th:src="@{/layuimini/js/lay-module/echarts/echarts.js}"></script>
    <script th:src="@{/layuimini/js/lay-module/echarts/wordcloud.js}"></script>
    <link rel="stylesheet" type="text/css" href="https://www.layuicdn.com/layui/css/layui.css" />
    <script src="https://www.layuicdn.com/layui/layui.js"></script>
    <style>
        .success {
            background-color: rgba(199, 199, 199, 0.94);
        }

        #container1 {
            box-shadow: 5px 5px 5px 5px #b6b6b6;
            border-radius: 20px;
        }

        #container2 {
            box-shadow: 5px 5px 5px 5px #b6b6b6;
            border-radius: 20px;
        }
        /*整个tab层居中,宽度为600px*/
        #tabDiv {
            width: 600px;
            margin: 1em auto;

            background-color:#f2eee5 ;

        }
        /*tab头的样式*/
        #tabsHead {

            height: 226px;
            background-color:#f2eee5 ;


        }
        /*已选tab头(超链接)的样式*/
        .curtab {
            padding-top: 10px;
            padding-right: 20px;
            padding-bottom: 0px;
            padding-left: 10px;
            border-right: #294224 1px solid;
            font-weight: bold;
            float: left;
            cursor: pointer;

        }
        /*未选tab头(超链接)的样式*/
        .tabs {
            border-right: #ffffff 1px solid;
            padding-top: 10px;
            padding-right: 20px;
            padding-bottom: 0px;
            padding-left: 10px;
            font-weight: normal;
            float: left;
            cursor: pointer;
        }
        a {
            color: #000000;
            text-decoration:none;
            font-size:16px;/*设置字体大小*/
            font-weight:500;/*调整字体粗细*/

        }

        a:hover {
            color: #254c37;

            font-size:17px;
        }

    </style>
    <script type="text/jscript">
        //显示tab(tabHeadId:tab头中当前的超链接;tabContentId要显示的层ID)
        function showTab(tabHeadId,tabContentId)
        {
            //tab层
            var tabDiv = document.getElementById("tabDiv");
            //将tab层中所有的内容层设为不可见
            //遍历tab层下的所有子节点
            var taContents = tabDiv.childNodes;
            for(i=0; i<taContents.length; i++)
            {
                //将所有内容层都设为不可见
                if(taContents[i].id!=null && taContents[i].id != 'tabsHead')
                {
                    taContents[i].style.display = 'none';
                }
            }
            //将要显示的层设为可见
            document.getElementById(tabContentId).style.display = 'block';
            //遍历tab头中所有的超链接
            var tabHeads = document.getElementById('tabsHead').getElementsByTagName('a');
            for(i=0; i<tabHeads.length; i++)
            {
                //将超链接的样式设为未选的tab头样式
                tabHeads[i].className='tabs';
            }
            //将当前超链接的样式设为已选tab头样式
            document.getElementById(tabHeadId).className='curtab';
            document.getElementById(tabHeadId).blur();
        }
</script>





</head>

<div style="width:100%;height:110px;  background-color:#254c37 ;">
    <p>&nbsp;</p>
    <div  style="width: 305px;height: 80px;background: url(index_logo.png); background-size:cover ;text-align: center;float:left;"></div>

    <div  style="width:40px;height:40px;background: url(sousuo.png); background-size:cover ;text-align: center;float:right; margin:15px;"></div>
    <div class="layui-input-inline" style="float:right">
        <p>&nbsp;</p>
        <input type="text" name="title"  class="layui-input">
    </div>
</div>
<div id="tabDiv" style="width:100%;height:100%;margin: auto; ">


    <div id="tabsHead" style="float:left;width:16%;height:660px;text-align:center;   ">

        <div  style="width:80px;height:80px;background: url(sousuo.gif); background-size:cover ;text-align: center;float:left; "></div>
        <div  style="width:150px;height:80px; margin:0; padding:0;float:left; "> <p>&nbsp;</p> <a id="tabs1" class="curtab" href="javascript:showTab('tabs1','tabContent1')">学籍基本信息</a></div>


        <div  style="width:80px;height:80px;background: url(dengpao.gif); background-size:cover ;text-align: center;float:left; "></div>
        <div  style="width:150px;height:80px; text-align: center;float:left; ">  <p>&nbsp;</p><a id="tabs2" class="tabs" href="javascript:showTab('tabs2','tabContent2')">学籍信息修改</a>  </div>


        <div  style="width:80px;height:80px;background: url(zuanshi.gif); background-size:cover ;text-align: center;float:left; "></div>
        <div  style="width:150px;height:80px; text-align: center;float:left; ">  <p>&nbsp;</p><a id="tabs3" class="tabs" href="javascript:showTab('tabs3','tabContent3')">修改申请状态</a>  </div>

        <div  style="width:80px;height:80px;background: url(kaiguan.gif); background-size:cover ;text-align: center;float:left; "></div>
        <div  style="width:150px;height:80px; text-align: center;float:left; ">  <p>&nbsp;</p><a id="tabs4" class="tabs" href="javascript:showTab('tabs4','tabContent4')">修改账户密码</a> </div>

        <div  style="width:80px;height:80px;background: url(huojian.gif); background-size:cover ;text-align: center;float:left; "></div>
        <div  style="width:150px;height:80px; text-align: center;float:left; ">  <p>&nbsp;</p><a id="tabs5" class="tabs" href="index.jsp ">退出登录</a>  </div>



    </div>

    <div id="tabContent1"   style="width:84%;height:660px;float:left; position:relative;  ">
        <div class="container3">

            <iframe id="myIframe1" name="hideIframe1" style="" src="stutable1.jsp" frameborder="0" width="100%" height="660px"style="background-color: #f2eee5;"></iframe>
        </div>
    </div>

    <div id="tabContent2" class="main" style="width:84%;height:660px;float:left; display: none;position:relative;margin: 30px auto">


        <div class="container3">
            <iframe id="myIframe2" name="hideIframe2" style="" src="stutable2.jsp" frameborder="0" width="100%" height="660px"></iframe>
        </div>
    </div>


    <div id="tabContent3" class="main" style="width:84%;height:660px;float:left;position:relative;display: none;margin: 30px auto">
        <div class="container3">
            <iframe id="myIframe3" name="hideIframe3" style="" src="stutable3.jsp" frameborder="0" width="100%" height="660px"></iframe>
        </div>
    </div>

    <div id="tabContent4" class="main" style="width:84%;height:660px;float:left;position:relative;display: none;margin: 30px auto">
        <div class="container3">
            <iframe id="myIframe4" name="hideIframe3" style="" src="stutable4.jsp" frameborder="0" width="100%" height="660px"></iframe>
        </div>
    </div>


</html>

其他详细功能代码另附源代码文件夹中。

 

posted @ 2022-07-07 20:12  zrswheart  阅读(69)  评论(1编辑  收藏  举报