sex status

This commit is contained in:
zhao 2020-02-13 13:18:17 +08:00
parent 34ada257ea
commit e0e5b7a0bb
6 changed files with 17 additions and 17 deletions

View File

@ -26,16 +26,16 @@ class User extends AdminController
public function list()
{
if(Request::isAjax()){
$data = Request::only(['id','name','email','sex']);
$map = array_filter($data);
$datas = Request::only(['id','name','email','sex']);
$map = array_filter($datas);
$user = Db::name('user')->where(['delete_time'=>0])->where($map)->order('id desc')->select();
$count = $user->count();
$res = [];
if($count){
$res = ['code'=>0,'msg'=>'','count'=>$count];
foreach($user as $k => $v){
$data = ['id'=>$v['id'],'username'=>$v['name'],'avatar'=>$v['user_img'],'phone'=>$v['phone'],'email'=>$v['email'],'sex'=>$v['sex'],'ip'=>$v['last_login_ip'],'jointime'=>date("Y-m-d",$v['create_time']),'check'=>$v['status'],'auth'=>$v['auth']];
//$res['data'][] = $data;
$res = ['code'=>0,'msg'=>'','count'=>$count,'data'=>[$data]];
$res['data'][] = $data;
}
} else {
$res = ['code'=>-1,'msg'=>'没有查询结果!'];

View File

@ -36,8 +36,8 @@
<div class="layui-form-item">
<label class="layui-form-label">性别</label>
<div class="layui-input-block">
<input type="radio" name="sex" value="1" {if condition="$admin['sex'] eq 1"} checked {/if} title="男">
<input type="radio" name="sex" value="0" {if condition="$admin['sex'] eq 0"} checked {/if} title="女">
<input type="radio" name="sex" value="0" {if condition="$admin['sex'] eq 1"} checked {/if} title="男">
<input type="radio" name="sex" value="1" {if condition="$admin['sex'] eq 0"} checked {/if} title="女">
</div>
</div>
<!--div class="layui-form-item">

View File

@ -28,9 +28,9 @@
<label class="layui-form-label">性别</label>
<div class="layui-input-block">
<select name="sex">
<option value="0">不限</option>
<option value="1"></option>
<option value="2"></option>
<option value="">不限</option>
<option value="0"></option>
<option value="1"></option>
</select>
</div>
</div>
@ -53,7 +53,7 @@
<img style="display: inline-block; width: 50%; height: 100%;" src= {{ d.avatar }}>
</script>
<script type="text/html" id="sex">
{{# if(d.sex == 1){ }}
{{# if(d.sex == 0){ }}
<button class="layui-btn layui-btn-normal layui-btn-xs" ></button>
{{# } else { }}
<button class="layui-btn layui-btn-danger layui-btn-xs"></button>
@ -96,7 +96,7 @@
//监听搜索
form.on('submit(LAY-user-front-search)', function(data){
var field = data.field;
console.log(field);
//console.log(field);
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({

View File

@ -34,8 +34,8 @@
<div class="layui-form-item" lay-filter="sex">
<label class="layui-form-label">选择性别</label>
<div class="layui-input-block">
<input type="radio" name="sex" value="1" title="男" {if condition="$user['sex'] eq 1"} checked {/if}>
<input type="radio" name="sex" value="0" title="女" {if condition="$user['sex'] eq 0"} checked {/if}>
<input type="radio" name="sex" value="0" title="男" {if condition="$user['sex'] eq 0"} checked {/if}>
<input type="radio" name="sex" value="1" title="女" {if condition="$user['sex'] eq 1"} checked {/if}>
</div>
</div>
<div class="layui-form-item layui-hide">

View File

@ -31,8 +31,8 @@
<div class="layui-form-item" lay-filter="sex">
<label class="layui-form-label">选择性别</label>
<div class="layui-input-block">
<input type="radio" name="sex" value="1" title="男" checked>
<input type="radio" name="sex" value="0" title="女">
<input type="radio" name="sex" value="0" title="男" checked>
<input type="radio" name="sex" value="1" title="女">
</div>
</div>
<div class="layui-form-item layui-hide">

View File

@ -26,8 +26,8 @@
</div>
<div class="layui-inline">
<div class="layui-input-inline">
<input type="radio" name="sex" value="1" {if condition="$user['sex'] eq 1"} checked {/if} title="男">
<input type="radio" name="sex" value="0" {if condition="$user['sex'] eq 0"} checked {/if} title="女">
<input type="radio" name="sex" value="0" {if condition="$user['sex'] eq 0"} checked {/if} title="男">
<input type="radio" name="sex" value="1" {if condition="$user['sex'] eq 1"} checked {/if} title="女">
</div>
</div>
</div>