<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('添加正在现场App版本')"/>
    <th:block th:include="include :: select2-css"/>
    <th:block th:include="include :: datetimepicker-css"/>
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-post-add">
        <div class="form-group">
            <label class="col-sm-2 control-label is-required">名称：</label>
            <div class="col-sm-10">
                <input class="form-control" type="text" name="name" id="name" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label is-required">版本号：</label>
            <div class="col-sm-10">
                <input class="form-control" type="text" name="version" id="version" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label is-required">最小版本号：</label>
            <div class="col-sm-10">
                <input class="form-control" type="text" name="minVersion" id="minVersion" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">类型</label>
            <div class="col-sm-10">
                <div class="radio check-box">
                    <label>
                        <input type="radio" value="1" name="type" checked=""> IOS
                    </label>
                </div>
                <div class="radio check-box">
                    <label>
                        <input type="radio" value="2" name="type"> Android
                    </label>
                </div>
            </div>
        </div>
        <!--<div class="form-group">
            <label class="col-sm-2 control-label">是否生产环境</label>
            <div class="col-sm-10">
                <div class="radio check-box">
                    <label>
                        <input type="radio" value="1" name="isProduction" checked=""> 是
                    </label>
                </div>
                <div class="radio check-box">
                    <label>
                        <input type="radio" value="2" name="isProduction"> 否
                    </label>
                </div>
            </div>
        </div>-->
        <div class="form-group">
            <label class="col-sm-2 control-label">是否强制升级</label>
            <div class="col-sm-10">
                <div class="radio check-box">
                    <label>
                        <input type="radio" value="1" name="isForce"> 是
                    </label>
                </div>
                <div class="radio check-box">
                    <label>
                        <input type="radio" value="2" name="isForce" checked=""> 否
                    </label>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-2 control-label">升级描述：</label>
            <div class="col-xs-10">
                <textarea name="content" maxlength="500" class="form-control" rows="3"></textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="font-noraml">Android请上传apk文件</label>
            <div class="file-loading">
                <input id="fileinput-demo-1" type="file" name="files" data-browse-on-zone-click="true"
                       data-msg-placeholder="Select {files} for upload...">
            </div>
        </div>
        <input hidden id="filePath" name="filePath">

    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: datetimepicker-js"/>
<th:block th:include="include :: bootstrap-fileinput-js"/>
<th:block th:include="include :: bootstrap-suggest-js"/>
<script type="text/javascript">
    var prefix = ctx + "kylin/zhengzaiAppVersion";
    var platformUrl = "[[${platformUrl}]]";

    function submitHandler() {
        if ($.validate.form()) {
            var data = $('#form-post-add').serializeArray();

            $.operate.save(prefix + "/create", data);
        }
    }

    $(function () {
        $("#fileinput-demo-1").fileinput({
            'theme': 'explorer-fas',
            // 'uploadUrl': "http://127.0.0.1:9003" + "/platform/basicServices/alOss/upload",
            'uploadUrl': platformUrl + "/platform/basicServices/alOss/upload",
            "uploadExtraData": {
                "pathName" : "zhengzaiAppVersion",
                "buckType" : 2
            },
            autoReplace: true,
            dropZoneTitle: "请上传文件",
            maxFileCount: 1
        });
        $("#fileinput-demo-1").on("fileuploaded", function (event, data, previewId, index) {
            $("#filePath").val(data.response.ossPath)
        });
    })
</script>
</body>
</html>
