Authored by dongjunjie

app图标管理,活动模板管理 输入框字符长度限制

<%include '../../../common/views/__ui/header'%>
<%include '../../../common/views/__partail/ListHeader'%>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">添加活动模板</h4>
</div><!-- panel-heading -->
<div class="panel-body" role="<%type%>" id="wrap-content" data-id="<%id%>" url="<%url%>">
<div class="row" id="content-template">
<div class="contentpanel">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">添加活动模板</h4>
</div><!-- panel-heading -->
<div class="panel-body" role="<%type%>" id="wrap-content" data-id="<%id%>" url="<%url%>">
<div class="row" id="content-template"></div><!-- row -->
</div><!-- panel-body -->
<div class="panel-footer">
<div class="row">
<div class="col-sm-9 col-sm-offset-3">
<a id="save_btn" class="btn btn-success mr5">保存</a>
<a href="/operations/activitytemplate/index" class="btn btn-primary mr5">取消</a>
</div>
</div><!-- row -->
</div><!-- panel-body -->
<div class="panel-footer">
<div class="row">
<div class="col-sm-9 col-sm-offset-3">
<a id="save_btn" class="btn btn-primary mr5">保存</a>
<a href="/operations/activitytemplate/index" class="btn btn-primary mr5">取消</a>
</div>
</div>
</div><!-- panel-footer -->
</div><!-- panel-footer -->
</div>
</div>
<script type="text/template" id="template">
<div class="form-group">
<label class="col-sm-1 control-label">模板标题</label>
<div class="col-sm-4">
<input type="text" name="title" class="form-control observe" placeholder="模板标题" required="" value="[[title]]" data-field="title">
<div class="col-sm-5">
<input type="text" name="title" class="form-control observe" placeholder="模板标题" required=""
value="[[title]]" data-field="title" maxlength="20">
<p style="color:#999; margin-top: 5px">注:标题不能超过20个字符</p>
</div>
</div><!-- form-group -->
<div class="form-group">
<label class="col-sm-1 control-label">上传图片</label>
<div class="col-sm-8">
<input type="text" name="image" id="image" class="form-control observe" placeholder="图片地址" value="[[image]]" data-field="image">
<input id="uploadBox" name="图片" type="file" style="position: absolute; top: 0;left: 0;z-index: -999">
<div id="chooseFile" class="file-name btn btn-success">请选择文件</div>
</div>
<input type="text" name="image" id="image" class="form-control observe" placeholder="图片地址" value="[[image]]"
data-field="image">
<input id="uploadBox" name="图片" type="file" style="position: absolute; top: 0;left: 0;z-index: -999">
<div style="margin: 10px 0 5px" id="chooseFile" class="file-name btn btn-success">请选择文件</div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-1 control-label">跳转链接</label>
<div class="col-sm-9">
<input type="text" name="url" id="url" class="form-control observe" placeholder="跳转链接" value="[[url.replace(/"/g, "&quot;")]]" data-field="url">
<button type="button" class="btn btn-info" id="addUrl">添加链接</button>
<div class="col-sm-8">
<input type="text" name="url" id="url" class="form-control observe" placeholder="跳转链接"
value="[[url.replace(/"/g, "&quot;")]]" data-field="url">
<button style="margin: 10px 0" type="button" class="btn btn-info" id="addUrl">添加链接</button>
<p style="color:#999">注:链接中不能有英文单引号</p>
</div>
</div><!-- form-group -->
<div class="form-group">
<label class="col-sm-1 control-label">分享ID</label>
<div class="col-sm-2">
<input type="text" name="share_id" class="form-control observe" placeholder="分享ID" required="" value="[[shareId]]" data-field="shareId">
<div class="col-sm-5">
<input type="text" name="share_id" class="form-control observe" placeholder="分享ID" required=""
value="[[shareId]]" data-field="shareId" maxlength="11">
<p style="color:#999; margin-top: 5px">注:分享ID必须为数字且长度不能超过11</p>
</div>
</div><!-- form-group -->
</script>
... ... @@ -62,17 +68,14 @@
<select name="goTo" id="goTo" class="form-control" value="[[action]]">
[[layout action_template]]
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">跳转地址:</label>
<div class="col-sm-8">
<textarea rows="2" id="goToUrl" class="form-control" placeholder="跳转地址">[[url]]</textarea>
</div>
</div>
</div>
</script>
... ...
... ... @@ -44,8 +44,9 @@
<label class="col-sm-2 control-label">名称</label>
<div class="col-sm-10">
<input type="text" name="ico_name" class="form-control observe" placeholder="名称" required
value="[[icoName]]" data-field="icoName">
value="[[icoName]]" data-field="icoName" maxlength="20">
<input type="hidden" name="id" class="form-control" value="[[id]]">
<p style="color:#999">注:名称不能超过20个字符</p>
</div>
</div><!-- form-group -->
<div class="form-group">
... ...
... ... @@ -68,17 +68,29 @@ $(document).on("change", ".observe", function () {
//保存
$(document).on("click", "#save_btn", function () {
if(edit.validate()) {
common.util.__ajax({
url: url,
data: Template
}, function () {
setTimeout(function () {
location.href = "/operations/activitytemplate/index";
}, 600);
});
if(checkShareId()){
common.util.__ajax({
url: url,
data: Template
}, function () {
setTimeout(function () {
location.href = "/operations/activitytemplate/index";
}, 600);
});
}
}
});
function checkShareId() {
var value = $('input[name="share_id"]').val();
if(isNaN(value)){
common.util.__tip("分享ID必须为数字!");
return false;
}else{
return true;
}
}
$(document).on("click", "#chooseFile", function () {
$("#uploadBox").click();
});
\ No newline at end of file
... ...