优化表单组件验证
This commit is contained in:
@@ -255,9 +255,9 @@ class Form extends Base {
|
||||
$config = \think\facade\Cache::get('system_config_data');
|
||||
return array(
|
||||
array('name' => 'id', 'title' => 'id', 'help' => '', 'type' => 'hidden'),
|
||||
array('name' => 'form_id', 'title' => 'model_id', 'help' => '', 'type' => 'hidden'),
|
||||
array('name' => 'name', 'title' => '字段名', 'help' => '英文字母开头,长度不超过30', 'type' => 'text'),
|
||||
array('name' => 'title', 'title' => '字段标题', 'help' => '请输入字段标题,用于表单显示', 'type' => 'text'),
|
||||
array('name' => 'form_id', 'title' => 'form_id', 'help' => '', 'is_must'=> true, 'type' => 'hidden'),
|
||||
array('name' => 'name', 'title' => '字段名', 'help' => '英文字母开头,长度不超过30', 'is_must'=> true, 'type' => 'text'),
|
||||
array('name' => 'title', 'title' => '字段标题', 'help' => '请输入字段标题,用于表单显示', 'is_must'=> true, 'type' => 'text'),
|
||||
array('name' => 'type', 'title' => '字段类型', 'help' => '用于表单中的展示方式', 'type' => 'select', 'option' => $config['config_type_list'], 'help' => ''),
|
||||
array('name' => 'length', 'title' => '字段长度', 'help' => '字段的长度值', 'type' => 'text'),
|
||||
array('name' => 'extra', 'title' => '参数', 'help' => '布尔、枚举、多选字段类型的定义数据', 'type' => 'textarea'),
|
||||
|
||||
@@ -1 +1 @@
|
||||
<input type="text" class="form-control" name="{$name}" id="{$name}" autocomplete="false" value="">
|
||||
<input type="text" class="form-control" name="{$name}" id="{$name}" autocomplete="false" value="" data-rule="password;{if isset($is_must) && $is_must}required{/if}">
|
||||
@@ -32,12 +32,12 @@ class AdPlace extends \think\Model{
|
||||
|
||||
public static $keyList = [
|
||||
['name' => 'id', 'title' => 'ID', 'type' => 'hidden', 'help' => '', 'option' => ''],
|
||||
['name' => 'title', 'title' => '广告位名称', 'type' => 'text', 'help' => '', 'option' => ''],
|
||||
['name' => 'name', 'title' => '广告位标识', 'type' => 'text', 'help' => '调用使用{:ad("广告位标识",参数)}', 'option' => ''],
|
||||
['name' => 'title', 'title' => '广告位名称', 'type' => 'text', 'is_must'=> true, 'help' => '', 'option' => ''],
|
||||
['name' => 'name', 'title' => '广告位标识', 'type' => 'text', 'is_must'=> true, 'help' => '调用使用{:ad("广告位标识",参数)}', 'option' => ''],
|
||||
['name' => 'show_type', 'title' => '类型', 'type' => 'select', 'help' => '', 'option' => ''],
|
||||
['name' => 'show_num', 'title' => '显示条数', 'type' => 'num', 'help' => '', 'option' => ''],
|
||||
['name' => 'start_time', 'title' => '开始时间', 'type' => 'datetime', 'help' => '', 'option' => ''],
|
||||
['name' => 'end_time', 'title' => '结束时间', 'type' => 'datetime', 'help' => '', 'option' => ''],
|
||||
['name' => 'start_time', 'title' => '开始时间', 'type' => 'datetime', 'is_must'=> true, 'help' => '', 'option' => ''],
|
||||
['name' => 'end_time', 'title' => '结束时间', 'type' => 'datetime', 'is_must'=> true, 'help' => '', 'option' => ''],
|
||||
['name' => 'template', 'title' => '广告模版', 'type' => 'text', 'help' => '', 'option' => ''],
|
||||
['name' => 'status', 'title' => '状态', 'type' => 'select', 'help' => '', 'option' => [['key' => '0', 'label'=>'禁用'],['key' => '1', 'label'=>'启用']]],
|
||||
];
|
||||
|
||||
@@ -173,8 +173,8 @@ class Attribute extends \think\Model {
|
||||
'基础' => [
|
||||
['name' => 'id', 'title' => 'id', 'help' => '', 'type' => 'hidden'],
|
||||
['name' => 'model_id', 'title' => 'model_id', 'help' => '', 'type' => 'hidden'],
|
||||
['name' => 'name', 'title' => '字段名', 'help' => '英文字母开头,长度不超过30', 'type' => 'text'],
|
||||
['name' => 'title', 'title' => '字段标题', 'help' => '请输入字段标题,用于表单显示', 'type' => 'text'],
|
||||
['name' => 'name', 'title' => '字段名', 'help' => '英文字母开头,长度不超过30', 'is_must'=> true, 'type' => 'text'],
|
||||
['name' => 'title', 'title' => '字段标题', 'help' => '请输入字段标题,用于表单显示', 'is_must'=> true, 'type' => 'text'],
|
||||
['name' => 'type', 'title' => '字段类型', 'help' => '用于表单中的展示方式', 'type' => 'select', 'option' => $config['config_type_list'], 'help' => ''],
|
||||
['name' => 'length', 'title' => '字段长度', 'help' => '字段的长度值', 'type' => 'text'],
|
||||
['name' => 'extra', 'title' => '参数', 'help' => '布尔、枚举、多选字段类型的定义数据', 'type' => 'textarea'],
|
||||
|
||||
@@ -19,7 +19,7 @@ class AuthGroup extends Model{
|
||||
public $keyList = [
|
||||
['name'=>'id', 'title'=>'ID', 'type'=>'hidden', 'help'=>'', 'option'=>''],
|
||||
['name'=>'module', 'title'=>'所属模块', 'type'=>'hidden', 'help'=>'', 'option'=>''],
|
||||
['name'=>'title', 'title'=>'用户组名', 'type'=>'text', 'help'=>'', 'option'=>''],
|
||||
['name'=>'title', 'title'=>'用户组名', 'type'=>'text', 'is_must'=> true, 'help'=>'', 'option'=>''],
|
||||
['name'=>'description', 'title'=>'分组描述', 'type'=>'textarea', 'help'=>'', 'option'=>''],
|
||||
['name'=>'status', 'title'=>'状态', 'type'=>'select', 'help'=>'', 'option'=> [['key' => 0, 'label' => '禁用'],['key' => 1, 'label' => '启用']]],
|
||||
];
|
||||
|
||||
@@ -23,12 +23,12 @@ class Form extends \think\Model {
|
||||
];
|
||||
|
||||
public $addField = [
|
||||
['name' => 'name', 'title' => '标识', 'type' => 'text', 'help' => ''],
|
||||
['name' => 'title', 'title' => '标题', 'type' => 'text', 'help' => ''],
|
||||
['name' => 'name', 'title' => '标识', 'type' => 'text', 'is_must'=> true, 'help' => ''],
|
||||
['name' => 'title', 'title' => '标题', 'type' => 'text', 'is_must'=> true, 'help' => ''],
|
||||
['name' => 'logo', 'title' => '显示Logo', 'type' => 'image', 'help' => ''],
|
||||
['name' => 'cover', 'title' => 'banner图片', 'type' => 'image', 'help' => ''],
|
||||
['name' => 'content', 'title' => '内容', 'type' => 'editor', 'help' => ''],
|
||||
['name' => 'list_grid', 'title' => '列表定义', 'type' => 'textarea', 'help' => ''],
|
||||
['name' => 'list_grid', 'title' => '列表定义', 'type' => 'textarea', 'is_must'=> true, 'help' => ''],
|
||||
];
|
||||
|
||||
public $editField = [
|
||||
|
||||
@@ -35,10 +35,10 @@ class Member extends Model {
|
||||
];
|
||||
|
||||
public $addfield = [
|
||||
['name'=>'username','title'=>'用户名','type'=>'text','help'=>'用户名会作为默认的昵称'],
|
||||
['name'=>'username','title'=>'用户名','type'=>'text', 'is_must'=> true,'help'=>'用户名会作为默认的昵称'],
|
||||
['name'=>'nickname','title'=>'昵称','type'=>'text','help'=>''],
|
||||
['name'=>'password','title'=>'密码','type'=>'password','help'=>'用户密码不能少于6位'],
|
||||
['name'=>'repassword','title'=>'确认密码','type'=>'password','help'=>'确认密码'],
|
||||
['name'=>'password','title'=>'密码','type'=>'password', 'is_must'=> true, 'help'=>'用户密码不能少于6位'],
|
||||
['name'=>'repassword','title'=>'确认密码','type'=>'password', 'is_must'=> true, 'help'=>'确认密码'],
|
||||
['name'=>'email','title'=>'邮箱','type'=>'text','help'=>'用户邮箱,用于找回密码等安全操作'],
|
||||
];
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<div class="form-group" style="display: none;">
|
||||
<label class="col-sm-2 control-label">上级分类</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control selectpicker" style="width: auto" name="pid">
|
||||
<select class="form-control selectpicker" style="width: auto; min-width: 200px;" name="pid">
|
||||
<option value="">请选择</option>
|
||||
{volist name="category" id="item"}
|
||||
<option value="{$item['id']}" {if isset($info['pid']) && $item['id'] == $info['pid']}selected{/if}>{$item['title_show']|raw}</option>
|
||||
@@ -30,7 +30,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">分类名称</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="title" class="form-control" value="{$info.title|default=''}">
|
||||
<input type="text" name="title" class="form-control" value="{$info.title|default=''}" data-rule="required">
|
||||
<span class="help-block">(名称不能为空)</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -50,7 +50,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">绑定模型</label>
|
||||
<div class="col-sm-8">
|
||||
<select name="model_id" class="form-control selectpicker" style="width: auto;">
|
||||
<select name="model_id" class="form-control selectpicker" style="width: auto; min-width: 200px;" data-rule="required">
|
||||
<option value="">--请选择--</option>
|
||||
{volist name="model_list" id="item"}
|
||||
<option value="{$item['id']}" {if isset($info['model_id']) && $info['model_id'] == $item['id']}selected{/if}>{$item['title']}</option>
|
||||
@@ -89,8 +89,8 @@
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">可见性</label>
|
||||
<div class="col-sm-3">
|
||||
<select name="display" class="form-control selectpicker">
|
||||
<div class="col-sm-10">
|
||||
<select name="display" class="form-control selectpicker" style="width: auto; min-width: 200px;">
|
||||
<option value="1">所有人可见</option>
|
||||
<option value="0">不可见</option>
|
||||
<option value="2">管理员可见</option>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">导航标题</label>
|
||||
<div class="col-lg-6">
|
||||
<input type="text" class="form-control" name="title" value="{$info.title|default=''}">
|
||||
<input type="text" class="form-control" name="title" value="{$info.title|default=''}" data-rule="required">
|
||||
<span class="help-block">(用于显示的文字)</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -23,7 +23,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">导航连接</label>
|
||||
<div class="col-lg-8">
|
||||
<input type="text" class="form-control" name="url" value="{$info.url|default=''}">
|
||||
<input type="text" class="form-control" name="url" value="{$info.url|default=''}" data-rule="required">
|
||||
<span class="help-block">(用于调转的URL,支持带http://的URL或U函数参数格式)</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -11,14 +11,14 @@
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">客户端名称</label>
|
||||
<div class="col-md-10">
|
||||
<input type="text" class="form-control" style="width:400px;" name="title" value="{$info['title']|default=''}">
|
||||
<input type="text" class="form-control" style="width:400px;" name="title" value="{$info['title']|default=''}" data-rule="required">
|
||||
<span class="help-block"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">APPID</label>
|
||||
<div class="col-md-10">
|
||||
<input type="text" class="form-control" style="width:400px;" name="appid" value="{$info['appid']|default=''}">
|
||||
<input type="text" class="form-control" style="width:400px;" name="appid" value="{$info['appid']|default=''}" data-rule="required">
|
||||
<span class="help-block"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">标题</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="title" value="{$info.title|default=''}" style="width: 80%">
|
||||
<input type="text" class="form-control" name="title" value="{$info.title|default=''}" style="width: 80%" data-rule="required">
|
||||
<span class="help-block">(用于后台显示的配置标题)</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -10,27 +10,27 @@
|
||||
<div class="box-body">
|
||||
|
||||
<!-- 表单 -->
|
||||
<form method="post" class="form-horizontal form">
|
||||
<form method="post" class="form-horizontal form" role=form>
|
||||
<!-- 基础 -->
|
||||
<div id="tab1" class="tab-pane in tab1">
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">模型标识</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
<input type="text" class="form-control " name="name" value="">
|
||||
<input type="text" class="form-control " name="name" value="" data-rule="required">
|
||||
<span class="help-block">(请输入文档模型标识)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">模型名称</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
<input type="text" class="form-control " name="title" value="">
|
||||
<input type="text" class="form-control " name="title" value="" data-rule="required">
|
||||
<span class="help-block">(请输入模型的名称)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">文档模型</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
<select class="form-control" name="is_doc">
|
||||
<select class="form-control selectpicker" name="is_doc" style="width: auto; min-width: 100px;" data-rule="required">
|
||||
<option value="1">是</option>
|
||||
<option value="0">否</option>
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user