<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
    <head>
        <script th:replace="common/head"></script>
        <link xmlns:th="http://www.thymeleaf.org" rel="stylesheet" th:href="${'/css/estate/access.css'}" media="all">
        <link xmlns:th="http://www.thymeleaf.org" rel="stylesheet" th:href="${'/css/estate/server-user-open-permission.css'}" media="all">
        <style>
            .picture-img-list{
                padding: 0px;
            }
            .layer-photos-content{
                margin: 21px;
            }
            #video{
                width: 380px;
                height: 240px;
                line-height: 240px;
                border: 1px solid #ccc;
            }
        </style>
    </head>
    <body>
        <div class="layui-fluid">
            <div class="layui-form">
                <input type="hidden" name="id" id="user_id" th:value="${user.id}" />
                <div class="layui-form-item layui-row layui-col-space15">
                    <div class="layui-col-md4">
                        <div class="layui-upload-picture picture-bg">
                            <p class="name-info" th:text="'姓名：'+ ${user.name}"></p>
                            <div id="picture-img" class="picture-img">
                                <img id="default_img" th:src="@{'/images/picture.png'}" alt="">
<!--                                <div id="webcam"></div>-->
                                <canvas id="canvas" hidden="hidden"></canvas>
                            </div>
                            <video id="video" controls style="display: none"></video>
                            <div class="picture-btn">
                                <button type="button" class="layui-btn  layui-bg-cyan" id="photo_webcam">人脸采集</button>
                                <button type="button" class="layui-btn  layui-bg-cyan" id="photo_graph" style="display: none">点击拍照</button>
                                <button type="button" class="layui-btn layui-bg-cyan"  id="photo_upload">人脸上传</button>
                                <input type="file" id="btn_file"  accept="image/*" style="display:none">
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md8">
                        <div class="layui-upload-picture">
                            <p class="name-info">图片预览：</p>
                            <p id="tips" th:style="'padding: 88px 0;'+' text-align: center;'+'display:' +
                            @{(${user.imageUri == null || user.imageUri == ''  } ? 'block' : 'none')} +
                            ''" class="tips" ><i class="layui-icon layui-icon-tips"></i>暂时还没有图片</p>
                            <div th:if=" ${user.imageUri != null && user.imageUri != ''}"  class="picture-img-list">
                                <div class="layer-photos-content">
                                    <img class="layui-upload-img" th:src="${fastDfsServer + user.imageUri}">
                                    <span class="layui-layer-setwin"><a th:id="${user.id}" class="layui-layer-ico layui-layer-close layui-layer-close2"></a></span>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">人脸有效期：</label>
                                    <div class="layui-input-inline" style="width:316px;">
                                        <input type="text" class="layui-input date-icon" id="face_date" placeholder="请选择人脸有效期" autocomplete="off" >
                                        <input type="hidden" th:value="${#dates.format(user.faceBeginDate, 'yyyy-MM-dd HH:mm:ss')}" name="faceBeginDate" id="begin_date"/>
                                        <input type="hidden" th:value="${#dates.format(user.faceEndDate, 'yyyy-MM-dd HH:mm:ss')}" name="faceEndDate" id="end_date"/>
                                        <input type="hidden" readonly id="faceEnable" th:value="${user.faceEnable}">
                                    </div>
                                </div>
                            </div>
                            <div class="picture-btn">
                                <div class="layui-form-item">
                                    <!--<button class="layui-btn" lay-filter="submit_button" lay-submit>保存设置</button>-->
                                    <button class="layui-btn" id="face_save_btn" lay-filter="save_push_button" lay-submit>下发</button>
                                    <button class="layui-btn" id="extension_button" lay-filter="extension_button" lay-submit>延期</button>
                                    <!--<button class="layui-btn layui-btn-primary" lay-filter="enable_btn" lay-submit>启用</button>-->
                                </div>
                            </div>
                            <input type="hidden" id="image_uri" name="imageUri" th:value="${user.imageUri}">
                            <input type="hidden" id="face_code" name="faceCode" th:value="${user.faceCode}">

                        </div>
                    </div>
                    <div class="layui-col-md8">
                        <p class="name-info">人脸登记注意事项：</p>
                        <p class="name-info">1.保证背景为白色的情况下拍摄</p>
                        <p class="name-info">2.保证光线均匀，避免头像出现左右亮度不均</p>
                        <p class="name-info">3.刘海不要遮住眉毛，头发不要遮住脸部</p>
                        <p class="name-info">4.保持自然状态，请将人脸处于显示屏正中，注视摄像头</p>
                    </div>
                </div>
            </div>
        </div>
        <!-- javascript -->
        <script th:src="@{'/layui/layui.js'}"></script>
        <script>
            layui.config({
                base: '/' //静态资源所在路径
            });
        </script>
        <script th:src="@{'/js/estate/access-user-face-set.js'}"></script>
        <script th:src="@{'/lib/jquery-1.11.3.js'}"></script>
        <script th:src="@{'/lib/jquery.webcam.min.js'}"></script>
        <script th:src="@{'/js/util/base64image.js'}"></script>
        <script th:src="@{'/js/util/exif.js'}"></script>
    </body>
</html>
