创建角色js
This commit is contained in:
1 parent
9b3511851c
commit
bd00d57337
13 files changed
+508
-830
No files matched your search
@@ -1,136 +1,124 @@
|
||||
{extend name="common@create" /}
|
||||
{block name="formaa"}
|
||||
<form action="/authgroup" method="POST" class="form form-horizontal" id="form-member-add">
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>角色名称:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input type="text" class="input-text" value="" placeholder="角色名称" id="title" name="title">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>角色描述:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input type="text" class="input-text" value="" placeholder="说明角色有哪些权限" id="miaoshu" name="miaoshu">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-3">分配权限:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
{php}
|
||||
$rule = new app\admin\model\AuthRule;;
|
||||
$plist = $rule->getRule();
|
||||
{/php}
|
||||
{volist name="plist" id="p"}
|
||||
<dl class="permission-list">
|
||||
<dt>
|
||||
<label>
|
||||
<input type="checkbox" value="{$p.id}" name="rules[]" id="rule{$p.id}">
|
||||
{$p.title}
|
||||
</label>
|
||||
</dt>
|
||||
{php}
|
||||
$clist = $rule->getRule($p['id']);
|
||||
{/php}
|
||||
<dd>
|
||||
{volist name = "clist" id = "c" key = "k"}
|
||||
<dl class="cl permission-list2">
|
||||
<dt>
|
||||
<label class="">
|
||||
<input type="checkbox" value="{$c.id}" name="rules[]" id="rule{$c.id}">
|
||||
{$c.title}
|
||||
</label>
|
||||
</dt>
|
||||
{php}
|
||||
$slist = $rule->getRule($c['id']);
|
||||
{/php}
|
||||
<dd>
|
||||
{volist name="slist" id="s"}
|
||||
<label class="">
|
||||
<input type="checkbox" value="{$s.id}" name="rules[]" id="rule{$s.id}">
|
||||
{$s.title}</label>
|
||||
{/volist}
|
||||
</dd>
|
||||
</dl>
|
||||
{/volist}
|
||||
</dd>
|
||||
</dl>
|
||||
{/volist}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
|
||||
<input class="btn btn-primary radius" type="submit" value=" 提交 ">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{block name="form"}
|
||||
<form class="layui-form layui-form-pane" lay-filter="myform">
|
||||
<div class="layui-form-item">
|
||||
<label for="title" class="layui-form-label">
|
||||
<span class="x-red">*</span>角色名称
|
||||
</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="title" name="title" lay-verify="required"
|
||||
autocomplete="off" class="layui-input " value="{$list.data.title|default=''}" placeholder="中文2-25个字符">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="title" class="layui-form-label">
|
||||
<span class="x-red">*</span>角色描述
|
||||
</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="title" name="title" lay-verify="required"
|
||||
autocomplete="off" class="layui-input " value="{$list.data.title|default=''}" placeholder="中文2-25个字符">
|
||||
</div>
|
||||
</div>
|
||||
{php}
|
||||
$authrule = new \app\admin\model\AuthRule;
|
||||
$authrulelist = $authrule->all();
|
||||
{/php}
|
||||
<div class="layui-form-item">
|
||||
{volist name="authrulelist" id="vo"}
|
||||
<div style="background: #eeeeee">
|
||||
<input type="checkbox" name="rules" title="{$vo.title}" value="{$vo.id}" lay-skin="primary" id ="{$vo.id}" pid="0" action="topOnclick">
|
||||
</div>
|
||||
<div class="layui-form-item" id="{$vo.id}" style="padding-left: 10px;padding-right: 10px;">
|
||||
{volist name="vo.auth_cid" id="vc"}
|
||||
<div>
|
||||
<input type="checkbox" name="rules" title="{$vc.title}" value="{$vc.id}" lay-skin="primary" id ="{$vc.id}" pid="{$vo.id}" action="midOnclick">
|
||||
{volist name="vc.auth_cid" id="vd"}
|
||||
<input type="checkbox" name="rules" title="{$vd.title}" value="{$vd.id}" lay-skin="primary" id ="{$vd.id}" pid="{$vc.id}" action="btmOnclick">
|
||||
{/volist}
|
||||
</div>
|
||||
{/volist}
|
||||
</div>
|
||||
{/volist}
|
||||
</div>
|
||||
<div class="layui-form-item" style="text-align: right;">
|
||||
<button class="layui-btn" lay-filter="mysubmit" lay-submit="">
|
||||
{$list.set.butname}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
{/block}
|
||||
{block name="yanzheng"}
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$(".permission-list dt input:checkbox").click(function(){
|
||||
$(this).closest("dl").find("dd input:checkbox").prop("checked",$(this).prop("checked"));
|
||||
});
|
||||
$(".permission-list2 dd input:checkbox").click(function(){
|
||||
var l =$(this).parent().parent().find("input:checked").length;
|
||||
var l2=$(this).parents(".permission-list").find(".permission-list2 dd").find("input:checked").length;
|
||||
if($(this).prop("checked")){
|
||||
$(this).closest("dl").find("dt input:checkbox").prop("checked",true);
|
||||
$(this).parents(".permission-list").find("dt").first().find("input:checkbox").prop("checked",true);
|
||||
}
|
||||
else{
|
||||
if(l==0){
|
||||
$(this).closest("dl").find("dt input:checkbox").prop("checked",false);
|
||||
}
|
||||
if(l2==0){
|
||||
$(this).parents(".permission-list").find("dt").first().find("input:checkbox").prop("checked",false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$("#form-admin-role-add").validate({
|
||||
rules:{
|
||||
roleName:{
|
||||
required:true,
|
||||
},
|
||||
},
|
||||
onkeyup:false,
|
||||
focusCleanup:true,
|
||||
success:"valid",
|
||||
submitHandler:function(form){
|
||||
$(form).ajaxSubmit();
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
{block name="myjs"}
|
||||
<script type="text/javascript">
|
||||
|
||||
// 监测复选框按钮
|
||||
layui.use(['form'], function(){
|
||||
var form = layui.form;
|
||||
form.on('checkbox()', function(data){
|
||||
var myelem = data.elem
|
||||
,ischecked = data.elem.checked
|
||||
,action = $(myelem).attr('action')
|
||||
,pid = $(myelem).attr('pid')
|
||||
,id = $(myelem).attr('id');
|
||||
switch(action){
|
||||
case 'topOnclick':
|
||||
topOnclick(id,ischecked)
|
||||
break;
|
||||
case 'midOnclick':
|
||||
midOnclick(id,pid,ischecked);
|
||||
break;
|
||||
case 'btmClick':
|
||||
cjgl.add('添加单位','/school/create','650','500');
|
||||
break;
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
// 顶层按钮
|
||||
function topOnclick(id,ischecked)
|
||||
{
|
||||
if(ischecked == true){
|
||||
$('#'+id).parent().next().find('div.layui-form-checkbox').each(function(){
|
||||
$(this).attr('class','layui-unselect layui-form-checkbox layui-form-checked')
|
||||
});
|
||||
}else{
|
||||
$('#'+id).parent().next().find('div.layui-form-checkbox').each(function(){
|
||||
$(this).attr('class','layui-unselect layui-form-checkbox')
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 中层按钮
|
||||
function midOnclick(id,pid,ischecked)
|
||||
{
|
||||
if(ischecked == true){
|
||||
$('#'+id).parent().parent().prev().find('div.layui-form-checkbox').each(function(){
|
||||
$(this).attr('class','layui-unselect layui-form-checkbox layui-form-checked')
|
||||
});
|
||||
$('#'+id).siblings('div.layui-form-checkbox').each(function(){
|
||||
$(this).attr('class','layui-unselect layui-form-checkbox layui-form-checked')
|
||||
});
|
||||
}else{
|
||||
// $('#'+id).parent().parent().prev().find('div.layui-form-checkbox').each(function(){
|
||||
// $(this).attr('class','layui-unselect layui-form-checkbox layui-form-checked')
|
||||
// });
|
||||
$('#'+id).siblings('div.layui-form-checkbox').each(function(){
|
||||
$(this).attr('class','llayui-unselect layui-form-checkbox')
|
||||
});
|
||||
var checkboxs = $('#'+id).parent().parent().find('div.layui-form-checkbox').lenght;
|
||||
|
||||
each(function(){
|
||||
$(this).attr('class','layui-unselect layui-form-checkbox layui-form-checked')
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 匹配用户名
|
||||
$.validator.addMethod("zh",function(value,element){
|
||||
var tel = /^[\u4e00-\u9fa5]*$/;
|
||||
return this.optional(element) || tel.test(value);
|
||||
}, "请输入中文");
|
||||
|
||||
|
||||
// 设置表单验证规则
|
||||
var myrules = {
|
||||
title:{
|
||||
required:true,
|
||||
zh:true,
|
||||
rangelength:[2,6]
|
||||
},
|
||||
miaoshu:{
|
||||
required:true,
|
||||
rangelength:[1,200]
|
||||
},
|
||||
rule:{
|
||||
digits:true,
|
||||
max:999
|
||||
},
|
||||
};
|
||||
|
||||
// 设置表单提交方式
|
||||
var mytype = 'POST';
|
||||
</script>
|
||||
{/block}
|
||||
</script>
|
||||
{/block}
|
||||
|
||||
@@ -1,120 +1,146 @@
|
||||
|
||||
{extend name="common@list" /}
|
||||
{block name="topnav"}
|
||||
<nav class="breadcrumb">
|
||||
<i class="Hui-iconfont"></i> 首页
|
||||
<span class="c-gray en">></span> 管理员管理
|
||||
<span class="c-gray en">></span> 角色列表
|
||||
<a class="btn btn-success radius r"
|
||||
style="line-height:1.6em;margin-top:3px"
|
||||
href="javascript:location.replace(location.href);"
|
||||
title="刷新" >
|
||||
<i class="Hui-iconfont"></i>
|
||||
</a>
|
||||
</nav>
|
||||
{block name="jsset"}
|
||||
|
||||
{/block}
|
||||
{block name="bouttons"}
|
||||
<div class="cl pd-5 bg-1 bk-gray mt-20">
|
||||
<span class="l">
|
||||
<!-- 删除按钮 -->
|
||||
<a href="javascript:;" onclick="dels('/authgroup/m')" class="btn btn-danger radius">
|
||||
<i class="Hui-iconfont"></i>
|
||||
批量删除
|
||||
</a>
|
||||
<!-- 添加按钮 -->
|
||||
<a href="javascript:;" onclick=addfull('添加角色',"/authgroup/create") class="btn btn-primary radius">
|
||||
<i class="Hui-iconfont"></i>
|
||||
添加角色
|
||||
</a>
|
||||
</span>
|
||||
<span class="r">
|
||||
共有数据:<strong>{$list.count}</strong> 条
|
||||
</span>
|
||||
{block name="nav"}
|
||||
<span class="layui-breadcrumb">
|
||||
<a href="">管理员管理</a>
|
||||
<a href="">角色管理</a>
|
||||
<a><cite>角色列表</cite></a>
|
||||
</span>
|
||||
{/block}
|
||||
{block name="search"}
|
||||
<div class="layui-form layui-form-pane layui-col-md12 x-so" id="search" lay-filter="search">
|
||||
<div class="layui-form-item">
|
||||
<label for="searchval" class="layui-form-label">
|
||||
关键字
|
||||
</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="searchval" name="searchval"
|
||||
autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
{block name="tables"}
|
||||
<table id="table1" class="display" cellspacing="0" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><input type="checkbox" name="" value=""></th>
|
||||
<th>角色名称</th>
|
||||
<th>描述</th>
|
||||
<th>状态</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
{block name="table"}
|
||||
<table id="tabledemo" lay-filter="mytable" lay-size="sm"></table>
|
||||
{/block}
|
||||
{block name="myjs"}
|
||||
<script type="text/javascript">
|
||||
<!-- 表格上面按钮模板 -->
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container">
|
||||
<button class="layui-btn layui-btn-danger" lay-event="dels">
|
||||
<i class="iconfont"></i>批量删除
|
||||
</button>
|
||||
<button class="layui-btn" lay-event="add">
|
||||
<i class="iconfont"></i>添加
|
||||
</button>
|
||||
</div>
|
||||
</script>
|
||||
<!-- 记录操作按钮模板 -->
|
||||
<script type="text/html" id="barDemo">
|
||||
<a class="layui-btn-xs" lay-event="status" title="{{ d.status == 1 ? '禁用' : '启用' }}">
|
||||
<i class="layui-icon {{ d.status == 1 ? 'layui-icon-close' : 'layui-icon-ok' }}"></i>
|
||||
</a>
|
||||
<a class="layui-btn-xs" lay-event="edit" title="编辑"><i class="layui-icon"></i></a>
|
||||
<a class="layui-btn-xs" lay-event="del" title="删除"><i class="layui-icon"></i></a>
|
||||
</script>
|
||||
<!-- 表格操作 -->
|
||||
<script>
|
||||
layui.use(['table','laypage','form','cjgl'], function(){
|
||||
|
||||
// 声明变量
|
||||
var table = layui.table
|
||||
,form = layui.form
|
||||
,cjgl = layui.cjgl;
|
||||
|
||||
// 定义DTajax参数
|
||||
var myajax = {
|
||||
url: "{:url('ajaxdata')}",
|
||||
type: "get",
|
||||
data: {},
|
||||
};
|
||||
|
||||
// 定义列参数
|
||||
var mycolumns = [
|
||||
{ "data": "id" },
|
||||
{ "data": "title" },
|
||||
{ "data": "miaoshu" },
|
||||
{ "data": "status" },
|
||||
{ "data": "id" },
|
||||
];
|
||||
// 实例化表格
|
||||
var tableIns = table.render({
|
||||
elem: '#tabledemo',
|
||||
toolbar: '#toolbarDemo',
|
||||
url:"{:url('ajaxdata')}",
|
||||
method:"POST", //数据接口
|
||||
page: true, //开启分页
|
||||
loading:true,
|
||||
autoSort:false,
|
||||
id:'mytable',
|
||||
defaultToolbar:'',
|
||||
cols: [[ //表头
|
||||
{type:'checkbox', fixed: 'left'},
|
||||
{field: 'title', title: '名称',sort: true, minWidth:240},
|
||||
{field: "miaoshu",title: '描述',sort: true},
|
||||
{field: 'status', title: '状态',templet:'#status', sort: true},
|
||||
{field: 'id', title: '操作',toolbar: '#barDemo',minWidth:140}
|
||||
]],
|
||||
});
|
||||
|
||||
// 定义修改列参数
|
||||
var mycolumnDefs =[
|
||||
// 对象格式
|
||||
{
|
||||
"targets": 0,
|
||||
"render": function(data, type, row, meta) {
|
||||
return '<input type="checkbox" name="test" value="' + row.id + '" />'
|
||||
}
|
||||
},
|
||||
{
|
||||
"targets": -1,
|
||||
"className":'.td-manage',
|
||||
"render": function(data, type, row, meta) {
|
||||
// 停用按钮
|
||||
stopbut = '<a style="text-decoration:none" onClick="stop(this,'+ row.id +')" href="javascript:;" title="停用"><i class="Hui-iconfont"></i></a>';
|
||||
// 启用按钮
|
||||
startbut = '<a style="text-decoration:none" onClick="start(this,'+ row.id +')" href="javascript:;" title="启用"><i class="Hui-iconfont"></i></a>';
|
||||
// 编辑按钮
|
||||
editbut = '<a title="编辑" href="javascript:void(0);" onclick=addfull("编辑","/authgroup/'+row.id+'/edit") class="ml-5" style="text-decoration:none"><i class="Hui-iconfont"></i></a>';
|
||||
delbut = '<a title="删除" href="javascript:void(0);" onclick=del(this,"/authgroup/'+row.id+'") class="ml-5" style="text-decoration:none"><i class="Hui-iconfont"></i></a>';
|
||||
if(row.status == '已停用')
|
||||
{
|
||||
buts = startbut + editbut + delbut;
|
||||
}else{
|
||||
buts = stopbut + editbut + delbut;
|
||||
}
|
||||
|
||||
return buts;
|
||||
}
|
||||
},
|
||||
{
|
||||
"targets": -2,
|
||||
"className":'.td-status',
|
||||
"render": function(data, type, row, meta) {
|
||||
if(row.status == '已停用')
|
||||
{
|
||||
d = "<span class='label label-error radius'>" + row.status + "</span>";
|
||||
}else{
|
||||
d = "<span class='label label-success radius'>" + row.status + "</span>";
|
||||
}
|
||||
//监听排序事件
|
||||
table.on('sort(mytable)', function(obj){ //注:tool是工具条事件名,mytable是table原始容器的属性
|
||||
// 获取表单值
|
||||
var formval = cjgl.getSearchVal('#search');
|
||||
// 获取排序字段及排序方式
|
||||
var mydata = {};
|
||||
mydata['field']=obj.field;
|
||||
mydata['order']=obj.type;
|
||||
//合并参数
|
||||
var wheredata = $.extend(formval,mydata);
|
||||
// 重载表格
|
||||
tableIns.reload({
|
||||
where: wheredata
|
||||
,page:{
|
||||
curr: 1 //重新从第 1 页开始
|
||||
}
|
||||
,done:function(){
|
||||
for(x in formval)
|
||||
{
|
||||
delete this.where[x];
|
||||
}
|
||||
}
|
||||
,page:{
|
||||
curr:1
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return d;
|
||||
},
|
||||
},
|
||||
{
|
||||
"orderable": false,
|
||||
"targets": [0,-1]
|
||||
},
|
||||
];
|
||||
|
||||
//头工具栏事件
|
||||
table.on('toolbar(mytable)', function(obj){
|
||||
switch(obj.event){
|
||||
case 'dels':
|
||||
var checkStatus = table.checkStatus('mytable'); //idmytable 即为基础参数 id 对应的值
|
||||
cjgl.delAll(checkStatus,'/authgroup','mytable');
|
||||
break;
|
||||
case 'add':
|
||||
cjgl.add('添加角色','/authgroup/create','','',true);
|
||||
break;
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
//监听行工具条
|
||||
table.on('tool(mytable)', function(obj){ //注:tool是工具条事件名,mytable是table原始容器的属性 lay-filter="对应的值"
|
||||
var data = obj.data; //获得当前行数据
|
||||
var layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值)
|
||||
var tr = obj.tr; //获得当前行 tr 的DOM对象
|
||||
|
||||
switch(layEvent){
|
||||
case 'detail':// 查看
|
||||
layer.msg('查看' + data.id);
|
||||
break;
|
||||
case 'del':// 删除
|
||||
cjgl.del(obj,"/authgroup");
|
||||
break;
|
||||
case 'edit':// 编辑
|
||||
cjgl.add('编辑角色','/authgroup/'+obj.data.id+'/edit','650','500');
|
||||
break;
|
||||
case 'status':// 状态
|
||||
cjgl.status(obj,"{:url('setstatus')}");
|
||||
break;
|
||||
};
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
@@ -1,128 +1,53 @@
|
||||
{extend name="common@create" /}
|
||||
{block name="formaa"}
|
||||
<form action="/admin" method="POST" class="form form-horizontal" id="form-member-add">
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>用户姓名:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input type="text" class="input-text" value="" placeholder="建议使用真实姓名" id="xingming" name="xingming">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>用户帐号:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input type="text" class="input-text" value="" placeholder="由小写英语字母、数字-_组成,首字符为字母" id="username" name="username">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>所在单位:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9 f-l">
|
||||
<span class="select-box f-l" style="width:300px;">
|
||||
{php} $school = schlist('校级','区级');{/php}
|
||||
<select class="select" id="school" name="school" size="1" required>
|
||||
<option value="">--请选择所在单位--</option>
|
||||
{volist name="school" id="vo"}
|
||||
<option value="{$vo.id}">{$vo.title}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>分配角色:</label>
|
||||
{php}
|
||||
$group = db('auth_group')->where('status',true)->field('id,title')->all();
|
||||
{/php}
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<dt>{foreach $group as $key=>$vo }
|
||||
<label class="ml-10">
|
||||
<input type="checkbox" value="{$vo.id}" name="group_id[]" id="group_id{$key}">
|
||||
{$vo.title}
|
||||
</label>{/foreach}
|
||||
</dt>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>性别:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9 skin-minimal">
|
||||
<div class="radio-box">
|
||||
<input name="sex" type="radio" id="sex-1" value="1" required="true">
|
||||
<label for="sex-1">男</label>
|
||||
</div>
|
||||
<div class="radio-box">
|
||||
<input type="radio" id="sex-2" value="0" name="sex">
|
||||
<label for="sex-2">女</label>
|
||||
</div>
|
||||
<div class="radio-box">
|
||||
<input type="radio" id="sex-3" value="2" name="sex" checked>
|
||||
<label for="sex-3">保密</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-3">出生日期:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input type="text" class="input-text Wdate" value="" placeholder="" id="shengri" name="shengri" onclick="WdatePicker({isShowClear:false,readOnly:true})">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-3">手机:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<input type="text" class="input-text" value="" placeholder="" id="phone" name="phone">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-3">备注:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<textarea name="beizhu" cols="" rows="" class="textarea" placeholder="说点什么...最少输入10个字符,最多80个字符" onKeyUp="$.Huitextarealength(this,100)"></textarea>
|
||||
<p class="textarea-numberbar"><em class="textarea-length">0</em>/80</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
|
||||
<input class="btn btn-primary radius" type="submit" value=" 提交 ">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{block name="form"}
|
||||
<form class="layui-form layui-form-pane" lay-filter="myform">
|
||||
<div class="layui-form-item">
|
||||
<label for="title" class="layui-form-label">
|
||||
<span class="x-red">*</span>类别名称
|
||||
</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="title" name="title" lay-verify="required"
|
||||
autocomplete="off" class="layui-input " value="{$list.data.title|default=''}" placeholder="中文2-25个字符">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="pid" class="layui-form-label"><span class="x-red">*</span>父级类别</label>
|
||||
<div class="layui-input-block">
|
||||
{php} $category = getCategory(0);{/php}
|
||||
<select name="pid">
|
||||
<option value=""></option>
|
||||
{volist name="category" id="vo"}
|
||||
<option value="{$vo.id}"
|
||||
{present name="$list.data.pid"}
|
||||
{eq name="$list.data.pid" value="$vo.id" }
|
||||
selected
|
||||
{/eq}
|
||||
{/present}>
|
||||
{$vo.title}
|
||||
</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="paixu" class="layui-form-label">
|
||||
排序
|
||||
</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="input" id="paixu" name="paixu" lay-verify=""
|
||||
autocomplete="off" class="layui-input" value="" placeholder="数字1-999">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" style="text-align: right;">
|
||||
<button class="layui-btn" lay-filter="mysubmit" lay-submit="">
|
||||
{$list.set.butname}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
{/block}
|
||||
{block name="yanzheng"}
|
||||
<script type="text/javascript">
|
||||
|
||||
// 匹配用户名
|
||||
$.validator.addMethod("zh",function(value,element){
|
||||
var tel = /^[\u4e00-\u9fa5]*$/;
|
||||
return this.optional(element) || tel.test(value);
|
||||
}, "请输入中文");
|
||||
{block name="myjs"}
|
||||
|
||||
{/block}
|
||||
|
||||
// 匹配帐号
|
||||
$.validator.addMethod("ustr",function(value,element){
|
||||
var tel = /^[a-z][a-z0-9-_]*$/;
|
||||
return this.optional(element) || tel.test(value);
|
||||
}, "用户名由小写字母和 _ - 组成,首字符为字母");
|
||||
|
||||
// 设置表单验证规则
|
||||
var myrules = {
|
||||
xingming:{
|
||||
required:true,
|
||||
zh:true,
|
||||
rangelength:[2,6]
|
||||
},
|
||||
username:{
|
||||
required:true,
|
||||
ustr:true,
|
||||
rangelength:[5,20]
|
||||
},
|
||||
sex:{
|
||||
required:true,
|
||||
},
|
||||
shengri:{
|
||||
dateISO:true
|
||||
},
|
||||
phone:{
|
||||
isMobile:true,
|
||||
},
|
||||
};
|
||||
|
||||
// 设置表单提交方式
|
||||
var mytype = 'POST';
|
||||
</script>
|
||||
{/block}
|
||||
Loaded 3 of 13 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user