修改admin的username字段长度用户添加与保存与IE11兼容

This commit is contained in:
巴掌 committed 2018-10-19 13:11:02 +08:00
1 parent 22c866253e
commit f0bd8ead5d
7 files changed
+128 -46

No files matched your search

+31 -4
View File
@@ -57,7 +57,7 @@ class Index extends Base
//查询数据
$data = $admin
->field('id,xingming,sex,username,phone,denglucishu,status,create_time')
->field('id,xingming,sex,username,phone,shengri,denglucishu,status,create_time')
->where('id','>','1')
->order([$order_field=>$order])
->limit($limit_start,$limit_length)
@@ -68,7 +68,7 @@ class Index extends Base
// 如果需要查询
if($search){
$data = $admin
->field('id,xingming,sex,username,phone,denglucishu,status,create_time')
->field('id,xingming,sex,username,phone,shengri,denglucishu,status,create_time')
->where('id','>','1')
->order([$order_field=>$order])
->limit($limit_start,$limit_length)
@@ -128,9 +128,9 @@ class Index extends Base
if($data == 1)
{
$data =['msg'=>'添加成功'];
$data =['msg'=>'添加成功','val'=>1];
}else{
$data =['msg'=>'数据处理错误'];
$data =['msg'=>'数据处理错误','val'=>0];
}
@@ -194,4 +194,31 @@ class Index extends Base
{
//
}
// 修改管理员状态
public function setStatus()
{
// 实例化管理员数据模型类
$admin = new Admin();
// 获取id变量
$id = request()->post('id');
$value = request()->post('value');
// 获取管理员信息
$list = $admin->get($id);
// 修改状态值
$list->status = $value;
// 更新数据
$data = $list->save();
// 根据更新结果设置返回提示信息
$data ? $data=['msg'=>'操作成功'] : $data=['msg'=>'数据处理错误'];
// 返回信息
return json($data);
}
}
+28
View File
@@ -23,4 +23,32 @@ class Admin extends Model
{
return strtotime($value);
}
// 生日获取器
public function getShengriAttr($value)
{
return date('Y-m-d',$value);
}
// 创建时间获取器
public function getCreateTimeAttr($value)
{
return date('Y-m-d',$value);
}
// 性别获取器
public function getSexAttr($value)
{
$sex = array('0'=>'女','1'=>'男','2'=>'保密');
return $sex[$value];
}
// 状态获取器
public function getStatusAttr($value)
{
$status =array('1'=>'已启用','0'=>'已停用');
return $status[$value];
}
}
+3 -6
View File
@@ -1,6 +1,6 @@
{extend name="common@create" /}
{block name="formaa"}
<form action="/admin" method="post" class="form form-horizontal" id="form-member-add">
<form action="{:url('admin/index/save')}" 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">
@@ -46,7 +46,7 @@
<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">10</em>/80</p>
<p class="textarea-numberbar"><em class="textarea-length">0</em>/80</p>
</div>
</div>
<div class="row cl">
@@ -81,7 +81,7 @@
username:{
required:true,
ustr:true,
rangelength:[5,12]
rangelength:[5,20]
},
sex:{
required:true,
@@ -92,9 +92,6 @@
phone:{
isMobile:true,
},
beizhu:{
rangelength:[10,80]
},
};
</script>
{/block}
Loaded 3 of 7 files, more files were not shown because too many files have changed in this diff. Show more