首页 > 其他分享 >11.14

11.14

时间:2023-11-13 21:11:50浏览次数:33  
标签:username console border 11.14 let document data

本次我们连着上次的代码继续实现,剩下最后一个教学副院长类

后端

PresidentController

package com.example.controller;

import com.example.pojo.Result;
import com.example.service.PresidentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/president")
public class PresidentController {
    @Autowired
    private PresidentService presidentService;

    @GetMapping("/getCollege/{username}")
    public Result getCollege(@PathVariable("username") String username) {
        return Result.success(presidentService.getCollege(username));
    }

    @GetMapping("/getTest/{pro}")
    public Result getTest(@PathVariable("pro") String pro) {
        return Result.success(presidentService.getTest(pro));
    }

    @PostMapping("/pass/{cardID}/{professional}/{f}/{audi}")
    public Result pass(@PathVariable("cardID") String cardID, @PathVariable("professional") String professional, @PathVariable("f") String f, @PathVariable("audi") int audi) {
        presidentService.pass(cardID, professional, f, audi);
        return Result.success(presidentService.getById(cardID));
    }
}

PresidentService

package com.example.service;


import com.example.mapper.PresidentMapper;
import com.example.pojo.Result;
import com.example.pojo.Teacher;
import com.example.pojo.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PresidentService {
    @Autowired
    private PresidentMapper presidentMapper;

    public Teacher getCollege(String username) {
        return presidentMapper.getCollege(username);
    }

    public List<Test> getTest(String pro) {
        return presidentMapper.getTest(pro);
    }

    public void pass(String cardID, String professional, String f, int audi) {
        presidentMapper.pass(cardID, professional, f, audi);
    }

    public Test getById(String cardID) {
        return presidentMapper.getById(cardID);
    }
}

PresidentMapper

package com.example.mapper;

import com.example.pojo.Teacher;
import com.example.pojo.Test;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface PresidentMapper {
    @Select("select * from test.testteacher where TeacherID=#{username}")
    Teacher getCollege(String username);

    @Select("select * from test.test1 where CourseCollege=#{pro}")
    List<Test> getTest(String pro);

    @Update("update  test.test1 set Reasonable=#{professional},ReasonableConclusion=#{f},AuditStatus=#{audi} where CardId=#{cardID}")
    void pass(String cardID, String professional, String f, int audi);

    @Select("select * from test.test1 where CardId=#{cardID}")
    Test getById(String cardID);
}

前端

1selectAll,html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>浏览审批卡</title>
    <style>
        .reSet {
            background-color: #4CAF50;
            color: white;
            border: none;
            padding: 10px 20px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 16px;
            margin: 4px 2px;
            cursor: pointer;
        }

        .form table tr td {
            width: 100px;
            height: 30px;
            border: 1px solid #000;
            text-align: center;
        }

        button {
            display: block;
            margin-top: 10px;
            padding: 10px;
            background-color: #007bff;
            color: #fff;
            border: none;
            border-radius: 3px;
            cursor: pointer;
        }
    </style>
</head>
<body>
<h1 style="text-align: center">浏览审批卡信息</h1>
<div class="centered-form">
    <div class="bordered-form">
        <div class="form">
            <div id="container">

            </div>
        </div>
    </div>
</div>
</body>
<script>
    var urlParams = new URLSearchParams(window.location.search);
    var username = urlParams.get('username');
    console.log("用户名为:" + username);
    const requestUrl = `http://localhost:8080/president/getCollege/${username}`;
    fetch(requestUrl,
        {
            method: 'GET',
            headers: {
                'Content-Type': 'application/json'
            },
        })
        .then(response => response.json())
        .then(data => {
            if (data.msg === 'success') {
                console.log(data.data.college);
                getAll(data.data.college);
            } else {
                alert("找不到所对应的学院");
            }
        })
        .catch(error => {
            alert("请求失败,请重试");
            console.error(error);
        });
</script>
<script>
    function getAll(pro) {
        console.log("pro  " + pro);
        const requestUrl = `http://localhost:8080/president/getTest/${pro}`;
        fetch(requestUrl,
            {
                method: 'GET',
                headers: {
                    'Content-Type': 'application/json'
                },
            })
            .then(response => response.json())
            .then(data => {
                if (data.msg === 'success') {
                    console.log("555");
                    generateTable(data.data);
                } else {
                    alert("当前不存在结果");
                }
            })
            .catch(error => {
                alert("请求失败2,请重试");
                console.error(error);
            });
    }
</script>
<script>
    function generateTable(data) {
        const tableContainer = document.getElementById("container");
        // 清空 tableContainer 中的所有子节点
        while (tableContainer.hasChildNodes()) {
            tableContainer.removeChild(tableContainer.firstChild);
        }
        const table = document.createElement("table");
        const tableBody = document.createElement("tbody");
        let row = document.createElement("tr");
        row.innerHTML = '<td>试卷审批卡编号</td><td>申请日期</td><td>课程名称</td><td>任课教师</td><td>课程编号</td><td>课程性质</td><td>学分</td><td>授课班级</td><td>授课专业</td><td>考试方式</td><td>考试日期</td><td>考试人数</td><td>出题方式</td><td>成绩组成</td><td>考核与评价方式</td><td>考核内容合理性分析</td><td>专业审查意见</td><td>专业审查结论</td><td>合理性审查意见</td><td>合理性审查结果</td><td>审核状态</td>';
        tableBody.appendChild(row);
        // 查询方式是按姓名查询或多条查询
        for (let i = 0; i < data.length; i++) {
            let s;
            if (data[i].auditStatus === 0) {
                s = "待审核";
            } else if (data[i].auditStatus === -1) {
                s = "未通过";
            } else if (data[i].auditStatus === 1) {
                s = "已符合";
            } else if (data[i].auditStatus === 2) {
                s = "已通过";
            }
            row = document.createElement("tr");
            let p1 = data[i].professional;
            let p2 = data[i].professionalConclusion;
            if (data[i].professional === null) {
                p1 = "未进行";
                p2 = "未进行";
            }
            let r1 = data[i].reasonable;
            let r2 = data[i].reasonableConclusion;
            if (data[i].reasonable === undefined || data[i].reasonable === null) {
                r1 = "未进行";
                r2 = "未进行";
            }
            console.log("9 " + data[i].auditStatus);
            console.log(s);
            row.innerHTML = `<td>${data[i].cardId}</td><td>${data[i].cardDate}</td><td>${data[i].courseName}</td><td>${data[i].courseTeacher}</td><td>${data[i].courseID}</td><td>${data[i].courseNature}</td><td>${data[i].credit}</td><td>${data[i].courseClass}</td><td>${data[i].courseMajor}</td><td>${data[i].testWay}</td><td>${data[i].testDate}</td><td>${data[i].testCount}</td><td>${data[i].testMethod}</td><td>${data[i].testGrade}</td><td>${data[i].testEvaluation}</td><td>${data[i].testAnalysis}</td><td>${p1}</td><td>${p2}</td><td>${r1}</td><td>${r2}</td><td>${s}</td>`;
            tableBody.appendChild(row);
            table.appendChild(tableBody);
            tableContainer.appendChild(table);
        }
    }
</script>
</html>

3Pass.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>合理性审查</title>
    <style>
        .reSet {
            background-color: #4CAF50;
            color: white;
            border: none;
            padding: 10px 20px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 16px;
            margin: 4px 2px;
            cursor: pointer;
        }

        .form {
            width: 600px;
            margin: 0 auto;
            /*border: 1px solid red;*/
        }

        .form table {
            margin: 0 auto;
        }

        .form table tr td {
            width: 100px;
            height: 30px;
            border: 1px solid #000;
            text-align: center;
        }

        button {
            display: block;
            margin-top: 10px;
            padding: 10px;
            background-color: #007bff;
            color: #fff;
            border: none;
            border-radius: 3px;
            cursor: pointer;
        }

        .centered-form {
            text-align: center;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100vh;
        }

        .bordered-form {
            border: 2px solid #000; /* 边框样式 */
            padding: 150px; /* 可选的内边距 */
            background-color: #f0f0f0; /* 可选的背景颜色 */
        }
    </style>
</head>
<body>
<h1 style="text-align: center">专业性审查</h1>
<!--边框居中-->
<div class="centered-form">
    <!--    增加边框-->
    <div class="bordered-form">
        <!--        调整边框大小-->
        <div class="form">
            <form id="pass">
                <label for="cardID">请输入要审查的id号</label>
                <input type="text" id="cardID" name="cardID" required>
                <br>
                <label>学院意见</label>
                <br>
                <label for="class1">考核内容与各课程目标要求掌握的内容的覆盖度:</label>
                <div id="class1">
                    <label><input type="radio" name="class1" value="全覆盖">全覆盖</label>
                    <label><input type="radio" name="class1" value="部分">部分</label>
                    <label><input type="radio" name="class1" value="基本覆盖">基本覆盖</label>
                    <label><input type="radio" name="class1" value="有待提高">有待提高</label>
                </div>
                <label for="purpose">考核方式课程目标要求达到的能力的有效性:</label>
                <div id="purpose">
                    <label><input type="radio" name="purpose" value="非常有效">非常有效</label>
                    <label><input type="radio" name="purpose" value="有效">有效</label>
                    <label><input type="radio" name="purpose" value="基本有效">基本有效</label>
                    <label><input type="radio" name="purpose" value="有待提高">有待提高</label>
                </div>
                <label for="final">试卷合理性审查最终意见:</label>
                <div id="final">
                    <label><input type="radio" name="final" value="通过">通过</label>
                    <label><input type="radio" name="final" value="不通过">不通过</label>
                </div>
                <br>
                <button type="submit" style="display: block; margin: 0 auto;">审批</button>
            </form>
        </div>
    </div>
</div>
</body>
<script>
    document.getElementById('pass').addEventListener('submit', function (event) {
        event.preventDefault();
        const cardID = document.getElementById('cardID').value;
        const class1 = document.querySelectorAll('input[name="class1"]');
        let c;
        class1.forEach(radio => {
            if (radio.checked) {
                c = radio.value;
                console.log(c);
            }
        });
        const purpose = document.querySelectorAll('input[name="purpose"]');
        let p;
        purpose.forEach(radio => {
            if (radio.checked) {
                p = radio.value;
                console.log(p);
            }
        });
        const professional = c + "," + p;
        console.log(professional);
        const final = document.querySelectorAll('input[name="final"]');
        let f;
        final.forEach(radio => {
            if (radio.checked) {
                f = radio.value;
                console.log(f);
            }
        });
        let audi;
        if (f === "通过") {
            audi = 2;

        } else {
            audi = -1;
        }
        const requestUrl = `http://localhost:8080/president/pass/${cardID}/${professional}/${f}/${audi}`;
        fetch(requestUrl,
            {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json'
                },
            })
            .then(res => res.json())
            .then(data => {
                if (data.msg === 'success') {
                    alert("已完成信息的审查");
                    console.log(data);
                } else {
                    alert("审查失败 " + data.msg);
                }
            })
            .catch(error => {
                alert("请求失败,请重试");
                console.error(error);
            });
    })
</script>
</html>

president.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>教学副院长页面</title>
    <style>
        .form {
            width: 600px;
            margin: 0 auto;
            /*border: 1px solid red;*/
        }

        .form table {
            margin: 0 auto;
        }

        .form table tr td {
            width: 100px;
            height: 30px;
            border: 1px solid #000;
            text-align: center;
        }

        button {
            display: block;
            margin-top: 10px;
            padding: 10px;
            background-color: #007bff;
            color: #fff;
            border: none;
            border-radius: 3px;
            cursor: pointer;
        }
    </style>
</head>
<body>
<h1 style="text-align: center">教学副院长信息管理</h1>
<div class="form">
    <table border="1px" cellspacing="0" width="600px">
        <tr>
            <th>编号</th>
            <th>功能</th>
        </tr>
        <tr>
            <td>1</td>
            <td>
                <button id="selectAll">浏览审批卡</button>
            </td>
        </tr>
        <tr>
            <td>2</td>
            <td>
                <button id="selectTest">查询考试信息</button>
            </td>
        </tr>
        <tr>
            <td>3</td>
            <td>
                <button id="pass">试卷专业性审查</button>
            </td>
        </tr>
    </table>
</div>
</body>
<script>
    var urlParams = new URLSearchParams(window.location.search);
    var username = urlParams.get('username');
    console.log(username);
    document.getElementById("selectAll").addEventListener("click", function () {
        window.location.href = "1seleceAll.html?username=" + encodeURIComponent(username);
    });
    document.getElementById("selectTest").addEventListener("click", function () {
        window.location.href = "../STUDENT/student3.html";
    });
    document.getElementById('pass').addEventListener('click', function () {
        window.location.href = "3Pass.html?username=" + encodeURIComponent(username);
    });
</script>
</html>

test.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>查询考试信息</title>
    <style>
        .reSet {
            background-color: #4CAF50;
            color: white;
            border: none;
            padding: 10px 20px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 16px;
            margin: 4px 2px;
            cursor: pointer;
        }

        .form table tr td {
            width: 100px;
            height: 30px;
            border: 1px solid #000;
            text-align: center;
        }

        button {
            display: block;
            margin-top: 10px;
            padding: 10px;
            background-color: #007bff;
            color: #fff;
            border: none;
            border-radius: 3px;
            cursor: pointer;
        }
    </style>
</head>
<body>
<div class="centered-form">
    <!--    增加边框-->
    <div class="bordered-form">
        <!--        调整边框大小-->
        <div class="form">
            <div id="container">

            </div>
        </div>
    </div>
</div>
</body>
<script>
    var urlParams = new URLSearchParams(window.location.search);
    var courseName = urlParams.has('courseName') ? decodeURI(urlParams.get('courseName')) : '';
    var courseClass = urlParams.has('courseClass') ? decodeURI(urlParams.get('courseClass')) : '';
    var courseMajor = urlParams.has('courseMajor') ? decodeURI(urlParams.get('courseMajor')) : '';

    console.log("用户名为:" + courseName);
    const requestUrl = `http://localhost:8080/user/selectTest/${courseName}/${courseClass}/${courseMajor}`;
    fetch(requestUrl,
        {
            method: 'GET',
            headers: {
                'Content-Type': 'application/json'
            },
        })
        .then(response => response.json())
        .then(data => {
            if (data.msg === 'success') {
                alert("查询成功");
                generateTable(data.data);
            } else {
                alert("查询失败");
            }
        })
        .catch(error => {
            alert("请求失败,请重试");
            console.error(error);
        });
</script>
<script>
    function generateTable(data) {
        const tableContainer = document.getElementById("container");
        // 清空 tableContainer 中的所有子节点
        while (tableContainer.hasChildNodes()) {
            tableContainer.removeChild(tableContainer.firstChild);
        }
        const table = document.createElement("table");
        const tableBody = document.createElement("tbody");
        let row = document.createElement("tr");
        row.innerHTML = '<td>试卷审批卡编号</td><td>申请日期</td><td>课程名称</td><td>任课教师</td><td>课程编号</td><td>课程性质</td><td>学分</td><td>授课班级</td><td>授课专业</td><td>授课学院</td><td>考试方式</td><td>考试日期</td><td>考试人数</td><td>出题方式</td><td>成绩组成</td><td>考核与评价方式</td><td>考核内容合理性分析</td><td>专业审查意见</td><td>专业审查结论</td><td>合理性审查意见</td><td>合理性审查结果</td><td>审核状态</td>';
        tableBody.appendChild(row);
        // 查询方式是按姓名查询或多条查询
        for (let i = 0; i < data.length; i++) {
            let s;
            console.log("222   " + data[i].auditStatus);
            if (data[i].auditStatus === 0) {
                s = "待审核";
            } else if (data[i].auditStatus === -1) {
                s = "未通过";
            } else if (data[i].auditStatus === 1) {
                s = "已符合";
            } else if (data[i].auditStatus === 2) {
                s = "已通过";
            }
            row = document.createElement("tr");
            let p1 = data[i].professional;
            let p2 = data[i].professionalConclusion;
            if (data[i].professional === null) {
                p1 = "未进行";
                p2 = "未进行";
            }
            let r1 = data[i].reasonable;
            let r2 = data[i].reasonableConclusion;
            if (data[i].reasonable === undefined) {
                r1 = "未进行";
                r2 = "未进行";
            }
            row.innerHTML = `<td>${data[i].cardId}</td><td>${data[i].cardDate}</td><td>${data[i].courseName}</td><td>${data[i].courseTeacher}</td><td>${data[i].courseID}</td><td>${data[i].courseNature}</td><td>${data[i].credit}</td><td>${data[i].courseClass}</td><td>${data[i].courseMajor}</td><td>${data[i].courseCollege}</td><td>${data[i].testWay}</td><td>${data[i].testDate}</td><td>${data[i].testCount}</td><td>${data[i].testMethod}</td><td>${data[i].testGrade}</td><td>${data[i].testEvaluation}</td><td>${data[i].testAnalysis}</td><td>${p1}</td><td>${p2}</td><td>${r1}</td><td>${r2}</td><td>${s}</td>`;
            tableBody.appendChild(row);
            table.appendChild(tableBody);
            tableContainer.appendChild(table);
        }
    }
</script>
</html>

 

标签:username,console,border,11.14,let,document,data
From: https://www.cnblogs.com/zzqq1314/p/17830199.html

相关文章

  • 上周热点回顾(11.14-11.20)
    热点随笔:· SpringBoot框架下实现Excel服务端导入导出 (葡萄城技术团队)· 当xxl-job遇上docker→它晕了,我也乱了! (青石路)· C#多线程(三)线程高级篇 (xiaolip......
  • 考研记录Week26【11.14~11.20】
    一、本周总结:使用时间:总计14h21min,政治8h10min,英语6h11min.完成任务:英语:1.真题复习政治:1.肖秀荣8套卷完成7套卷二、下周规划:数学:1.【高数强化】高数辅导讲义+【线代强化......
  • cv学习总结(11.14-11.20)
     本周主要完成了assignment2中的connected_layer部分的代码,跟assignment1中的two_layer_net相比,虽然整体思路都是实现全连接的网络,但是connect_layer可以实现任意多层的......
  • 2022.11.14模拟赛题解
    树的覆盖\(dp_{i,j,0/1/2}\)表示以\(i\)为根的子树中覆盖\(j\)个点的方案数。其中\(0/1/2\)分别表示了\(3\)种情况。\(0\)表示示当前节点和子节点都没被选中......
  • 11.14 解题报告
    T1考场用时:\(1\)h期望得分:\(70\)pts实际得分:\(20\)pts有一个地方的\(m\)写成了\(n\),直接T飞。对于\(70\)分的做法,考虑设\(dp_{i,j}\)表示分了\(i\)段,现......
  • 11.14.12
    #include<stdio.h>#include<string.h>intmain(){inti,j,l1,l2; chara[100],b[100]; gets(a); gets(b); l1=strlen(a);l2=strlen(b); for(i=l1,j=0;i<l1+l2,j<l2......
  • Java学习——11.14
    将近4天没更新啊,为什么呢,主要是面向过程太难太抽象了,不过好在我用四天还是将他理解了。1.封装(关键字:private)保护私有的方法和属性。set直接修改private  ......
  • 11.14.8
    #include<stdio.h>intmain(){ intn,m,i,j,sum=0,count=0; scanf("%d%d",&m,&n); for(i=m;i<=n;i++) {for(j=1;j<i;j++) {if(i%j==0){sum+=j; } } if(sum==i){p......
  • 11.14.9
    #include<stdio.h>intmain(){ intn,m,i,j,count=0; inta[100][100],b[100][100],c[100][100]; scanf("%d%d",&m,&n); for(i=0;i<m;i++) {for(j=0;j<n;j++) {scan......
  • 闲话 22.11.14
    闲话我不理解为什么我能现在写完所有题的题解。我们仍然回忆数据结构专题(话说回来我说“蒜”能有几个人知道我在说什么呢(就是那个《石蒜物语》(我反正不是很习惯这个......