<!doctype html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head th:include="baseHeader :: baseHeader">
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.css">
</head>
<body>
<div class="top">
    <div class="top_right">
        <input type="hidden" id="userId" th:value="${session.userInfo.userId}">
        <ul>
            <a>
                <li class="show_list">
                    <span th:text="${session.userInfo.userName}" style="display: flex;
                                 flex-wrap: nowrap;
                                 align-content: center;
                                 justify-content: center;
                                 align-items: center;"></span>
                    <ul class="move_list" style="padding-inline-start: 0px;margin-top: 0px;">
                        <li>
                            <span class="exit_login">退出</span>
                        </li>

                    </ul>
                </li>
            </a>
        </ul>
    </div>
</div>
<nav th:if="${session.userInfo.userLv != '0'}" class="navbar navbar-vertical-left" th:include="base :: baseLeft"></nav>

<div class="show-div" >
    <div th:fragment="userList">
        <header class="htmleaf-header">
            <h1 th:if="${session.userInfo.userLv != '0'}">个 人 信 息 修 改<span>Personal information modification</span></h1>
            <h1 th:if="${session.userInfo.userLv == '0'}">用 户 信 息 管 理<span>User information management</span></h1>
        </header>



        <div class="add-search-div" th:if="${session.userInfo.userLv == '0'}">
            <div class="serach-div" style="
                    display: flex;
                    align-items: flex-start;
                    justify-content: flex-start;
                    flex-direction: row;
                 ">
                <label class="select" for="slct" style=";margin-right: 10px">
                    <select id="slct" required="required" class="user_search_select">
                        <option value="false" disabled="disabled" selected="selected">搜索：</option>
                        <option value="userAccount">搜索账号</option>
                        <option value="userName">搜索昵称</option>

                    </select>
                    <svg>
                        <use xlink:href="#select-arrow-down"></use>
                    </svg>
                </label>
                <!-- SVG Sprites-->
                <svg class="sprites">
                    <symbol id="select-arrow-down" viewbox="0 0 10 6">
                        <polyline points="1 1 5 5 9 1"></polyline>
                    </symbol>
                </svg>

                <input   required='' name="cssinput" type='text'  class="user_search_value" style="height: 37.37px;width: 200px;margin-right: 10px">
                <button class="btn-shine user_search_button" name="cssbutton" style="height: 37.37px;;margin-right: 10px">
                    <span>搜索</span>
                </button>
            </div>
        </div>

        <div class="htmleaf-container" style="margin-top: 40px;">
            <div th:if="${session.userInfo.userLv == '0'}" style="display: flex;justify-content: space-between;align-items: center;margin-bottom: 10px">
                <p style="margin-left: 0%;margin-bottom: 0px">
                    <span th:if="${#httpServletRequest.queryString != null && #httpServletRequest.queryString.contains('userAccount')}">按用户账号</span>
                    <span th:if="${#httpServletRequest.queryString != null && #httpServletRequest.queryString.contains('userName')}">按用户昵称</span>
                    搜索：
                    <label class="display_search_name">
                        <script>
                            var url = window.location.search;

                            var searchParam = url.indexOf("=")+1;
                            var searchParamEnd = url.indexOf("&");
                            var pageNumParam = url.indexOf("pageNum");
                            if (searchParamEnd == -1){
                                url = url.substring(searchParam);
                            }else{
                                url = url.substring(searchParam,searchParamEnd);
                            }

                            if(pageNumParam == -1 || pageNumParam > searchParam){
                                document.write(decodeURI(url));
                            }

                        </script>
                    </label>
                </p>

                <div id="pageChange" th:if="${pageInfo.pageCount} != '-1'" style="display: flex;align-items: center;justify-content: flex-end;">
                    <button class="btn-shine prevPage"  th:value="${pageInfo.prevPage}" name="cssbutton" style="height: 30px;width: 80px;">
                        <span>前一页</span>
                    </button>
                    <div style="margin-right:10px;margin-left: 10px">
                        第
                        <input type="hidden" class="url" value="">
                        <input type="hidden" class="pageNum" value="1">
                        <label class="display_search_name" th:text="${pageInfo.displayPage}"></label>
                        页 / 共
                        <label th:text="${pageInfo.pageCount}"></label>
                        页
                    </div>
                    <button class="btn-shine nextPage" th:value="${pageInfo.nextPage}" name="cssbutton" style="height: 30px;width: 80px">
                        <span>后一页</span>
                    </button>
                    <script>
                        var searchParam = window.location.search;
                        var url = window.location.href;
                        if (searchParam.indexOf("pageNum") == -1){
                            searchParam = 1;
                        }else{
                            searchParam = searchParam.substring(searchParam.indexOf("pageNum")+8);
                            url = url.substring(0,url.indexOf("pageNum"));
                        }
                        $('.url').val(url);

                        $('.prevPage').attr('disabled',false);
                        $('.nextPage').attr('disabled',false);
                        if ($('.prevPage').val()==-1){
                            $('.prevPage').attr('disabled',true);
                        }
                        if ($('.nextPage').val()==-1){
                            $('.nextPage').attr('disabled',true);
                        }

                    </script>
                </div>
            </div>
        </div>
        <div class="htmleaf-container table-wrapper" style="margin-top: 10px;overflow-x:scroll;">
            <table th:if="${session.userInfo.userLv != '0'}" class="fl-table">
                <thead>
                <tr>
                    <th>账号</th>
                    <th>昵称</th>
                    <th>性别</th>
                    <th>手机</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="user:${userList}">
                    <td th:text="${user.userAccount}"></td>
                    <td th:text="${user.userName}"></td>
                    <td th:text="${user.userSex}"></td>
                    <td th:text="${user.userIphone}"></td>
                    <td>
                        <button class="user_up btn-slide-line" name="tablebutton"
                               th:attr="userId=${user.userId},
                            userAccount=${user.userAccount},
                            userName=${user.userName},
                            userPw=${user.userPw},
                            userSex=${user.userSex},
                            userIphone=${user.userIphone}" value="修改"><span>修改</span></button>
                    </td>
                </tr>
                </tbody>
            </table>
            <table th:if="${session.userInfo.userLv == '0'}" class="fl-table">
                <thead>
                <tr>
                    <th>账号</th>
                    <th>昵称</th>
                    <th>性别</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="user:${userList}">
                    <td th:text="${user.userAccount}"></td>
                    <td th:text="${user.userName}"></td>
                    <td th:text="${user.userSex}"></td>
                    <td th:if="${ user.userLv != '0' }">
                        <button class="admin_user_up btn-slide-line" name="tablebutton"
                               th:attr="userId=${user.userId},
                            userAccount=${user.userAccount},
                            userName=${user.userName},
                            userPw=${user.userPw},
                            userSex=${user.userSex},
                            userIphone=${user.userIphone}" value="重置密码"><span>重置密码</span></button>
                    </td>
                    <td th:if="${ user.userLv == '0' && user.userId == session.userInfo.userId}">
                        <button class="user_up btn-slide-line" name="tablebutton"
                               th:attr="userId=${user.userId},
                            userAccount=${user.userAccount},
                            userName=${user.userName},
                            userPw=${user.userPw},
                            userSex=${user.userSex},
                            userIphone=${user.userIphone}" value="修改"><span>修改</span></button>
                    </td>
                    <td th:if="${user.userLv == '0' && user.userId != session.userInfo.userId}"></td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>

</body>
</html>




