123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <title>绑定列表</title>
- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
- </head>
- <body class="p-3">
- <div class="container">
- <h1>绑定列表</h1>
- <table class="table table-bordered">
- <thead>
- <tr>
- <th>ID</th>
- <th>UUID</th>
- <th>简历ID</th>
- <th>状态</th>
- <th>创建时间</th>
- <th>绑定时间</th>
- <th>操作人</th>
- <th>操作</th>
- </tr>
- </thead>
- <tbody>
- {{range .Bindings}}
- <tr>
- <td>{{.ID}}</td>
- <td>{{.UUID}}</td>
- <td>{{.ResumeID}}</td>
- <td>{{.Status}}</td>
- <td>{{.CreatedAt}}</td>
- <td>{{.BoundAt}}</td>
- <td>{{.Operator}}</td>
- <td>
- <form class="unbindForm" method="post" action="/admin/unbind">
- <input type="hidden" name="id" value="{{.ID}}">
- <input type="hidden" name="resume_id" value="{{.ResumeID}}">
- <button type="submit" class="btn btn-danger btn-sm">解绑</button>
- </form>
- </td>
- </tr>
- {{end}}
- </tbody>
- </table>
- <!-- 分页导航 start -->
- <nav aria-label="Page navigation">
- <ul class="pagination">
- <!-- 上一页 -->
- <li class="page-item {{if eq .CurrPage 1}}disabled{{end}}">
- <a class="page-link" href="/admin/list?page={{dec .CurrPage}}" aria-label="Previous">
- <span aria-hidden="true">«</span>
- </a>
- </li>
- {{/* 使用自定义模板函数 dec 和 inc 来计算当前页的前后页码 */}}
- {{range $i := seq 1 .TotalPage}}
- <li class="page-item {{if eq $.CurrPage $i}}active{{end}}">
- <a class="page-link" href="/admin/list?page={{$i}}">{{$i}}</a>
- </li>
- {{end}}
- <!-- 下一页 -->
- <li class="page-item {{if eq .CurrPage .TotalPage}}disabled{{end}}">
- <a class="page-link" href="/admin/list?page={{inc .CurrPage}}" aria-label="Next">
- <span aria-hidden="true">»</span>
- </a>
- </li>
- </ul>
- </nav>
- <!-- 分页导航 end -->
- <a href="/admin/search" class="btn btn-secondary">返回搜索页</a>
- </div>
- <script>
- document.querySelectorAll('.unbindForm').forEach(form => {
- form.addEventListener('submit', function(e) {
- e.preventDefault();
- if(confirm("确定解绑吗?")) {
- var formData = new FormData(this);
- fetch("/admin/unbind", {
- method: "POST",
- body: formData
- })
- .then(response => response.json())
- .then(data => {
- if(data.error) {
- alert(data.error);
- } else {
- alert(data.message);
- location.reload();
- }
- })
- .catch(err => {
- console.error(err);
- });
- }
- });
- });
- </script>
- </body>
- </html>
|