<style>
    p {
        font-size: 15px;
        margin: 20px 0;
    }
</style>
<h2 class="addBorder">我的设置</h2>
<form action="" method="POST" enctype="multipart/form-data">
    <p class="addBorder">
        <label for="time">入职时间：</label>
        <input type="date" name="time" value="{{ result.time }}">
    </p>
    <p class="addBorder">
        <label for="introduction" style="vertical-align: top;">诚信宣言：</label>
        <textarea name="introduction" placeholder="请输入诚信宣言" rows="10" cols="50" style="resize: none;">{{ result.introduction }}</textarea>
    </p>
    <div class="row addBorder" id="QRcodeDiv">
        <div class="col-md-2">
            <label for="QRcode" style="vertical-align: top;">微信二维码：</label>
        </div>
        {% if result.QRcodeImg %}
        <p class="col-md-4">
            <img src=" {{siteUrl}}{{result.QRcodeImg}}" height="300px" width="350px">
            <input type="hidden" name="oldImg" value="1">
        </p>
        {% endif %}
        <div class="col-md-2" id="addQRcode">
            <input type="file" name="files" id="file" style="display: none;">
            <a class="file-input-wrapper btn btn-default" onclick="$('#file').click();" style="margin-bottom: 10px;">
                <span id="name">修改二维码</span>
            </a>
        </div>

    </div>
    <p>
        <input type="hidden" name="user_id" value="{{ user_id }}">
        <input type="hidden" name="type" value="1">
        <input type="submit"  class="button">
    </p>
</form>
<script>
    (function ($) {
        $(document).ready(function () {
            $("#file").bind("change",function(){
                if (this.files && this.files[0]){
                    var reader = new FileReader();
                    reader.onload = function (e){
                        if($("#QRcodeDiv > p").length > 0){
                            $("#QRcodeDiv").find("p").remove();
                        }
                        var img = $("<img>").attr({"src":e.target.result,"height":"300px",width:"350px"});
                        var p = $("<p>").addClass("col-md-4").append(img);
                        $("#addQRcode").before(p);
                    }
                    reader.readAsDataURL(this.files[0]);
                }
            });
        });
    })(jQuery);
</script>