243 lines
8.4 KiB
HTML
Executable File
243 lines
8.4 KiB
HTML
Executable File
{extend name='public/base' /}
|
|
{block name='content'}
|
|
{include file='public/content_header' /}
|
|
<section class="content">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="box box-primary">
|
|
<!-- 表单头部 -->
|
|
<div class="box-header with-border">
|
|
<div class="btn-group">
|
|
<a class="btn flat btn-sm btn-default BackButton">
|
|
<i class="fa fa-arrow-left"></i>
|
|
返回
|
|
</a>
|
|
</div>
|
|
</div>
|
|
<!-- 表单 -->
|
|
<form id="dataForm" class="form-horizontal dataForm" action="" method="post" enctype="multipart/form-data">
|
|
<!-- 表单字段区域 -->
|
|
<div class="box-body">
|
|
<div class="form-group">
|
|
<label for="name" class="col-sm-2 control-label">标题</label>
|
|
<div class="col-sm-10 col-md-4">
|
|
<input id="name" name="name" value="{$data.name|default=''}" placeholder="请输入标题" type="text" class="form-control field-text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="user_id" class="col-sm-2 control-label">发布人</label>
|
|
<div class="col-sm-10 col-md-4">
|
|
<select name="user_id" id="user_id" class="form-control field-select" data-placeholder="请选择发布人">
|
|
<option value=""></option>
|
|
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
$('#user_id').select2();
|
|
</script>
|
|
<div class="form-group">
|
|
<label for="article_category_id" class="col-sm-2 control-label">所属分类</label>
|
|
<div class="col-sm-10 col-md-4">
|
|
<select name="article_category_id" id="article_category_id" class="form-control field-select" data-placeholder="请选择所属分类">
|
|
<option value=""></option>
|
|
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
$('#article_category_id').select2();
|
|
</script>
|
|
<div class="form-group">
|
|
<label for="description" class="col-sm-2 control-label">简介</label>
|
|
<div class="col-sm-10 col-md-4">
|
|
<input id="description" name="description" value="{$data.description|default=''}" placeholder="请输入简介" type="text" class="form-control field-text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="content" class="col-sm-2 control-label">内容</label>
|
|
<div class="col-sm-10">
|
|
<script id="content" name="content" type="text/plain">{$data.content|raw|default=''}</script>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
UE.delEditor('content');
|
|
var UE_content = UE.getEditor('content',{
|
|
serverUrl :UEServer
|
|
});
|
|
</script>
|
|
<div class="form-group">
|
|
<label for="is_top" class="col-sm-2 control-label">是否置顶</label>
|
|
<div class="col-sm-10 col-md-4">
|
|
<input class="input-switch" id="is_top" value="1" {if(!isset($data) ||$data.is_top==1)}checked{/if} type="checkbox" />
|
|
<input class="switch field-switch" placeholder="是否置顶" name="is_top" value="{$data.is_top|default='1'}" hidden />
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
$('#is_top').bootstrapSwitch({
|
|
onText: "是",
|
|
offText: "否",
|
|
onColor: "success",
|
|
offColor: "danger",
|
|
onSwitchChange: function (event, state) {
|
|
$(event.target).closest('.bootstrap-switch').next().val(state ? '1' : '0').change();
|
|
}
|
|
});
|
|
</script><div class="form-group">
|
|
<label for="is_hot" class="col-sm-2 control-label">是否热门</label>
|
|
<div class="col-sm-10 col-md-4">
|
|
<input class="input-switch" id="is_hot" value="1" {if(!isset($data) ||$data.is_hot==1)}checked{/if} type="checkbox" />
|
|
<input class="switch field-switch" placeholder="是否热门" name="is_hot" value="{$data.is_hot|default='1'}" hidden />
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
$('#is_hot').bootstrapSwitch({
|
|
onText: "是",
|
|
offText: "否",
|
|
onColor: "success",
|
|
offColor: "danger",
|
|
onSwitchChange: function (event, state) {
|
|
$(event.target).closest('.bootstrap-switch').next().val(state ? '1' : '0').change();
|
|
}
|
|
});
|
|
</script> <div class="form-group">
|
|
<label for="img" class="col-sm-2 control-label">缩略图</label>
|
|
<div class="col-sm-10 col-md-4">
|
|
<input id="img" name="img" placeholder="请上传缩略图" {if isset($data.img)}data-initial-preview="{$data.img}"{/if} type="file" class="form-control field-image" >
|
|
</div>
|
|
</div>
|
|
<script>
|
|
$('#img').fileinput({
|
|
language: 'zh',
|
|
overwriteInitial: true,
|
|
browseLabel: '浏览',
|
|
initialPreviewAsData: true,
|
|
dropZoneEnabled: false,
|
|
showUpload:false,
|
|
showRemove: false,
|
|
allowedFileTypes:['image'],
|
|
maxFileSize:10240,
|
|
});
|
|
</script>
|
|
<div class="form-group">
|
|
<label for="sort_number" class="col-sm-2 control-label">排序</label>
|
|
<div class="col-sm-10 col-md-4">
|
|
<input id="sort_number" name="sort_number" value="{$data.sort_number|default='1000'}" placeholder="请输入排序" type="text" class="form-control field-text">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="view_count" class="col-sm-2 control-label">浏览数</label>
|
|
<div class="col-sm-10 col-md-4">
|
|
<div class="input-group">
|
|
<input id="view_count" name="view_count" value="{$data.view_count|default='0'}" placeholder="请输入浏览数" type="number" class="form-control field-number">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
$('#view_count')
|
|
.bootstrapNumber({
|
|
upClass: 'success',
|
|
downClass: 'primary',
|
|
center: true
|
|
});
|
|
</script>
|
|
|
|
</div>
|
|
<!-- 表单底部 -->
|
|
<div class="box-footer">
|
|
{:token()}
|
|
<div class="col-sm-2">
|
|
</div>
|
|
<div class="col-sm-10 col-md-4">
|
|
{if !isset($data)}
|
|
<div class="btn-group pull-right">
|
|
<label class="createContinue">
|
|
<input type="checkbox" value="1" id="_create" name="_create"
|
|
title="继续添加数据">继续添加</label>
|
|
</div>
|
|
{/if}
|
|
<div class="btn-group">
|
|
<button type="submit" class="btn flat btn-info dataFormSubmit">
|
|
保存
|
|
</button>
|
|
</div>
|
|
<div class="btn-group">
|
|
<button type="reset" class="btn flat btn-default dataFormReset">
|
|
重置
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<script>
|
|
/** 表单验证 **/
|
|
$('#dataForm').validate({
|
|
rules: {
|
|
'name': {
|
|
required: true,
|
|
},
|
|
'user_id': {
|
|
required: true,
|
|
},
|
|
'article_category_id': {
|
|
required: true,
|
|
},
|
|
'description': {
|
|
required: true,
|
|
},
|
|
'content': {
|
|
required: true,
|
|
},
|
|
'is_top': {
|
|
required: true,
|
|
},
|
|
'is_hot': {
|
|
required: true,
|
|
},
|
|
'sort_number': {
|
|
required: true,
|
|
},
|
|
'view_count': {
|
|
required: true,
|
|
},
|
|
|
|
},
|
|
messages: {
|
|
'name': {
|
|
required: "标题不能为空",
|
|
},
|
|
'user_id': {
|
|
required: "发布人不能为空",
|
|
},
|
|
'article_category_id': {
|
|
required: "所属分类不能为空",
|
|
},
|
|
'description': {
|
|
required: "简介不能为空",
|
|
},
|
|
'content': {
|
|
required: "内容不能为空",
|
|
},
|
|
'is_top': {
|
|
required: "是否置顶不能为空",
|
|
},
|
|
'is_hot': {
|
|
required: "是否热门不能为空",
|
|
},
|
|
'sort_number': {
|
|
required: "排序不能为空",
|
|
},
|
|
'view_count': {
|
|
required: "浏览数不能为空",
|
|
},
|
|
|
|
}
|
|
});
|
|
</script>
|
|
{/block} |