199 lines
6.3 KiB
HTML
199 lines
6.3 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Title</title>
|
|
<!-- 引入样式 -->
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
</head>
|
|
<body>
|
|
|
|
<div class="container">
|
|
<div class="row align-items-start" style="margin-top: 30px">
|
|
<h3 style="margin: 0 auto;width: 20%">搜索结果</h3>
|
|
|
|
|
|
<button type="button" class="btn btn-primary" style="width: 150px" id="goback">返回学生列表</button>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row align-items-start" style="padding:20px">
|
|
<div class="col">
|
|
<div class="col">
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">sid</th>
|
|
<th scope="col">name</th>
|
|
<th scope="col">native</th>
|
|
<th scope="col">operation</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="col">
|
|
|
|
|
|
{% for item in info %}
|
|
<tr id="user">
|
|
<th scope="col">{{ item.sid }}</th>
|
|
<th scope="col">{{ item.name }}</th>
|
|
<th scope="col">{{ item.native }}</th>
|
|
<th scope="col">
|
|
<button type="button" class="btn btn-outline-dark btn-sm updateStd" data-bs-toggle="modal" value="{{ item.sid }}"
|
|
data-bs-target="#staticBackdrop">update
|
|
</button>
|
|
<button type="button" class="btn btn-outline-danger btn-sm remove" value="{{ item.sid }}" data-bs-toggle="modal"
|
|
data-bs-target="#staticBackdropRemove">
|
|
remove
|
|
</button>
|
|
</th>
|
|
</tr>
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<!-- 修改信息-->
|
|
<div class="modal fade" id="staticBackdrop" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1"
|
|
aria-labelledby="staticBackdropLabel" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="staticBackdropLabel">修改学生户籍信息</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="layui-form-item" style="display: flex">
|
|
<label class="layui-form-label" style="width: 100px;margin-top: 10px">用户名</label>
|
|
<div class="layui-input-block">
|
|
<input type="text" id="changename" name="name" lay-verify="title" autocomplete="off"
|
|
placeholder="请输入姓名"
|
|
class="layui-input">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="layui-form-item" style="display: flex;margin-top: 10px">
|
|
<label class="layui-form-label" style="width: 100px">籍贯</label>
|
|
<div class="layui-input-block">
|
|
<input type="text" id="changenative" name="native" placeholder="请输入籍贯" autocomplete="off"
|
|
class="layui-input"
|
|
|
|
>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
|
|
<button type="button" class="btn btn-primary" id="update">确定</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<!-- 确认删除?-->
|
|
<div class="modal" tabindex="-1" id="staticBackdropRemove">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">确认删除该用户信息?</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
|
|
<button type="button" class="btn btn-primary" id="Remove">确定</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</body>
|
|
</html>
|
|
|
|
<!-- 引入组件库 -->
|
|
<script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
|
|
|
|
<script>
|
|
var deleteSid;
|
|
var updateSid;
|
|
//返回学生列表
|
|
$("#goback").click(function () {
|
|
window.location.href = '/'
|
|
})
|
|
|
|
|
|
//修改学生信息
|
|
let updatenoteList = document.querySelectorAll(".updateStd")
|
|
console.log(updatenoteList,"222")
|
|
for(let i = 0; i < updatenoteList.length; i++){
|
|
updatenoteList[i].addEventListener("click",function () {
|
|
updateSid = this.getAttribute("value")
|
|
updateSid = updateSid.slice(2, -3)
|
|
|
|
})
|
|
}
|
|
|
|
$("#update").click(function () {
|
|
ajax('/update',{username:$("#changename").val(),native: $("#changenative").val(),usid:updateSid})
|
|
|
|
window.location.href = '/searchBySid'+'/'+updateSid
|
|
var myModal = $("#staticBackdrop")
|
|
myModal.hide()
|
|
})
|
|
|
|
|
|
//删除
|
|
let noteList = document.querySelectorAll(".remove")
|
|
for(let i = 0; i < noteList.length; i++){
|
|
noteList[i].addEventListener("click",function () {
|
|
deleteSid = this.getAttribute("value")
|
|
deleteSid = deleteSid.slice(2, -3)
|
|
})
|
|
}
|
|
|
|
$("#Remove").click(function () {
|
|
ajax('/delete',{sid:deleteSid})
|
|
|
|
window.location.href = '/'
|
|
var myModal = $("#staticBackdropRemove")
|
|
myModal.hide()
|
|
|
|
})
|
|
|
|
|
|
</script>
|
|
|
|
|
|
<script>
|
|
function ajax(url, data, fun) {
|
|
$.ajax({
|
|
url: url,
|
|
type: 'post',
|
|
data: data,
|
|
dataType: 'json',
|
|
success: function (data) {
|
|
console.log(data, "111")
|
|
if(data.code===500){
|
|
|
|
}else {
|
|
window.location.href = '/'
|
|
}
|
|
}
|
|
})
|
|
}
|
|
</script>
|
|
|