<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
    <head>
        <script th:replace="common/head"></script>
    </head>
    <body>

        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-body">
                            <div class="layui-form">
                                <div class="layui-form-item" th:if="${bean.packageType != 2}">
                                    <label class="layui-form-label">
                                        <span class="must">*</span>
                                        <span>上传新包:</span>
                                    </label>
                                    <div class="layui-input-inline">
                                        <input   type="text" lay-verify="required" th:value="${fileName}" placeholder="请上传" autocomplete="off" class="layui-input" id="fileName" />
                                    </div>
                                    <div class="layui-input-inline layui-btn-container" style="width: auto;">
                                        <button type="button" class="layui-btn layui-btn-primary" id="fileUploadButton">
                                            <i class="layui-icon"></i>上传文件
                                        </button>
                                        <input name="downLoadUrl" type="hidden" id="downloadUrl" th:value="${bean?.downLoadUrl}"/>
                                        <input name="packageMd5" type="hidden" id="packageMd5" th:value="${bean?.packageMd5}" />
                                        <a  download="1" th:if="${bean?.downLoadUrl!=null}" class="downloadButton" th:href="${fastDfsServer}+${bean?.downLoadUrl}" target="_blank">
                                        <button class="layui-btn layui-btn-primary"  layadmin-event="avartatPreview" >下载文件</button>
                                        </a>
                                        <a  download="1" th:if="${bean?.downLoadUrl==null}" class="downloadButton" style="display: none;"  target="_blank">
                                            <button class="layui-btn layui-btn-primary"  layadmin-event="avartatPreview" >下载文件</button>
                                        </a>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">
                                        <span class="must">*</span>
                                        <span>版本名称:</span>
                                    </label>
                                    <div class="layui-input-inline">
                                        <input name="packageName" type="text" lay-verify="required" th:value="${bean?.packageName}" placeholder="请输入"  autocomplete="off"  class="layui-input" />
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">
                                        <span class="must">*</span>
                                        <span>版本号:</span>
                                    </label>
                                    <div class="layui-input-inline">
                                        <div class="layui-input-inline">
                                            <input name="version" type="text" lay-verify="required" th:value="${bean?.version}" placeholder="请输入" oninput = "value=value.replace(/[^\d]/g,'')" autocomplete="off" class="layui-input" />
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">
                                        <span>版本说明:</span>
                                    </label>
                                    <div class="layui-input-inline">
                                        <div class="layui-input-inline">
                                            <textarea name="description" th:text="${bean?.description}" placeholder="请输入" class="layui-textarea w500"></textarea>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">
                                        <span>强制升级:</span>
                                    </label>
                                    <div class="layui-input-inline">
                                        <div class="layui-input-inline">
                                            <input type="radio" th:checked="${bean?.isForceUpdate==1}" name="isForceUpdate" value="1" title="是"  checked>
                                            <input type="radio" th:checked="${bean?.isForceUpdate==2}" name="isForceUpdate" value="2" title="否"  >
                                        </div>
                                    </div>
                                </div>
                                <input id="fastDfsServer" type="hidden" th:value="${fastDfsServer}">
                                <input name="id" type="hidden" th:value="${bean?.id}">
                                <!-- 按钮 -->
                                <div class="layui-form-item">
                                    <div class="layui-input-block">
                                        <button class="layui-btn" lay-submit lay-filter="entity_submit_event">提交</button>
                                        <button type="reset" class="layui-btn layui-btn-primary">取消</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </body>
    <!-- javascript -->
    <script type="text/javascript" th:src="@{'/layui/layui.js'}" charset="utf-8"></script>
    <script type="text/javascript">
        layui.config({
            base: '/' //静态资源所在路径
        });
    </script>
    <script type="text/javascript" th:src="@{'/js/device/device-app-package-add.js'}" charset="utf-8"></script>
</html>