hotfix_form.hbs 4.06 KB

<div class="pageheader">
    <div class="media">
        <div class="pageicon pull-left">
            <i class="fa fa-th-list"></i>
        </div>
        <div class="media-body">
            <ul class="breadcrumb">
                <li><a href=""><i class="glyphicon glyphicon-home"></i></a></li>
                <li><a href="">Hotfix</a></li>
                <li>{{type}}</li>
            </ul>
            <h4>新增补丁信息</h4>
        </div>
    </div>
    <!-- media -->
</div>
<!-- pageheader -->
<div class="panel panel-default">
    <div class="panel-heading">
        <p>&nbsp;</p>
    </div>
    <form id="hotfix-form" action="/hotfix/save/{{type}}" method="POST" enctype="multipart/form-data" data-pjax>
        <input type="hidden" name="_id" value="{{_id}}">
        <div class="panel-body">
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="control-label">App名称</label>
                        <select id="appName" name="appName" data-placeholder="Choose a Host..." class="form-control" style="height: 40px;">
                            <option value="yohobuy">yohobuy</option>
                        </select>
                    </div>
                    <!-- form-group -->
                </div>
                <!-- col-sm-6 -->
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="control-label">App版本</label>
                        <input type="text" name="appVersion" value="{{appVersion}}" class="form-control" placeholder="App version. (必填)">
                    </div>
                    <!-- form-group -->
                </div>
                <!-- col-sm-6 -->
            </div>
            <!-- row -->
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="control-label">补丁版本</label>
                        <input type="text" name="patchVersion" value="{{patchVersion}}" class="form-control" placeholder="patch version (可为空)">
                    </div>
                    <!-- form-group -->
                </div>
                <!-- col-sm-6 -->
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="control-label">补丁文件</label>
                        <input type="file" name="batch" class="form-control" placeholder="upload the patch file (必填)">
                    </div>
                    <!-- form-group -->
                </div>
            </div>
            <!-- row -->
        </div>
        <!-- panel-body -->
        <div class="panel-footer">
            <button type="submit" class="btn btn-primary">保存</button>
            <button type="button" class="btn btn-default ml20 go-back">取消</button>
        </div>
    </form>
    <!-- panel-footer -->
</div>

<div class="panel panel-default">
    <div class="panel-heading">
        <h4 class="panel-title">参数说明</h4>
    </div><!-- panel-heading -->
    <div class="panel-body">
        <div class="alert alert-danger">App版本必须和调用接口时app_version一致</div>
    </div>
</div>

<script>
    $(document).on('ready pjax:success', function() {
//        $('#hotfix-form').off().on('submit', function(event) {
//            event.preventDefault(); // stop default submit behavior
//            $.pjax.submit(event, '#pjax-container', {
//                type: 'POST',
//                dataType: 'json',
//                push: false
//            });
//        }).on('pjax:success', function(e, data) {
//            console.log(111)
//            return false;
//        });

//        $('#appName').select2();

        $('#hotfix-form').ajaxForm(function(d) {
            if (d && d.code === 200) {
                location.href = '/hotfix/{{type}}';
            } else {
                alert(d.message);
            }
        });


        $('.go-back').click(function() {
            window.history.go(-1);
        });
    });
</script>