小黑小波比.根据判断显示对应的提示标签框

person.tpl

1.在html添加alert标签控件

<pre name="code" class="javascript"><div class="form-group">
    <label class="col-lg-3 col-sm-2 control-label" >认证证号:</label>
    <div class="col-lg-6">
        <input type="text" placeholder="认证证号" class="form-control" name="applycode">
    </div>
</div>
<div class="form-group">
    <label class="col-lg-3 col-sm-2 control-label" >认证扫描件:</label>
    <div class="col-lg-6">
        <span class="fileinput-button">
            <!-- <span class="alert-warning">选择上传文件</span>
            <br/> -->
            <span class="alert-success" name="alert-success"></span>
            <input id="fileupload"  type="file" name="file" multiple>
        </span>
    </div>
</div>

<div tpl="alert"> {@if info} <tpl name="alert"> <div class="alert alert-warning" role="alert">${info}</div> </tpl> {@/if}</div>

 
 


2.在客户端js

btnApplylicense:function(sender,arg){
    var cer = _("[name='applycode']");
    var file = _("[name='file']");
    cer = cer.val();
    file = file.val();
    if (cer === ""&& file !== "") {
        app.tpl("Admin->person.alert", function(tpl) {
            var infom = tpl({
                info: "认证码为空"
            }, {});
            _('[name="xcer"]').html(infom);
        });
        return;
    } else if (file === ""&&cer !== "") {
        app.tpl("Admin->person.alert", function(tpl) {
            var infom = tpl({
                info: "扫描件为空"
            }, {});
            _('[name="xcer"]').html(infom);
        });
        return;
    } else if (cer === "" && file === "") {
        app.tpl("Admin->person.alert", function(tpl) {
            var infom = tpl({
                info: "认证码和扫描件都为空"
            }, {});
            _('[name="xcer"]').html(infom);
        });
        return;
    }
    var form = sender.parents('form');
    //var form = events.parent;
    if(sending){//再点击"发送"按钮,提示文件发送中,在这之前要定义号var sending= false;
        form.find('.alert-warning').html('文件发送中...').show();
        return;
    }
3.效果图
小黑小波比.根据判断显示对应的提示标签框_第1张图片

你可能感兴趣的:(nodejs,小黑小波比,alert提示框)