修改系统用户界面

This commit is contained in:
Anyon 2020-02-28 10:55:41 +08:00
parent 8276a98f5b
commit 99e8d12619
6 changed files with 172 additions and 89 deletions

View File

@ -42,8 +42,19 @@ class User extends Controller
public function index() public function index()
{ {
$this->title = '系统用户管理'; $this->title = '系统用户管理';
$query = $this->_query($this->table)->like('username,phone,mail')->equal('status'); $query = $this->_query($this->table)->like('username,phone,mail');
$query->dateBetween('login_at,create_at')->where(['is_deleted' => '0'])->order('sort desc,id desc')->page(); $query->equal('status')->dateBetween('login_at,create_at');
// 加载对应数据列表
$this->template = $this->request->get('type', 'index');
if ($this->template === 'index') {
$query->where(['is_deleted' => '0', 'status' => '1']);
} elseif ($this->template === 'recycle') {
$query->where(['is_deleted' => '0', 'status' => '0']);
} else {
$this->error("无法加载{$this->template}数据列表!");
}
// 列表排序并显示
$query->order('sort desc,id desc')->page(true, true, false, 0, $this->template);
} }
/** /**

View File

@ -6,86 +6,79 @@
<button data-modal='{:url("add")}' data-title="添加用户" class='layui-btn layui-btn-sm layui-btn-primary'>添加用户</button> <button data-modal='{:url("add")}' data-title="添加用户" class='layui-btn layui-btn-sm layui-btn-primary'>添加用户</button>
{/if} {/if}
{if auth("remove")} {if auth("state")}
<button data-action='{:url("remove")}' data-rule="id#{key}" data-csrf="{:systoken('remove')}" data-confirm="确定要删除这些用户吗?" class='layui-btn layui-btn-sm layui-btn-primary'>删除用户</button> <a data-confirm="确定要启用该用户吗?" data-action="{:url('state')}" data-rule="id#{key};status#0" data-csrf="{:systoken('state')}" class='layui-btn layui-btn-sm layui-btn-primary'>批量禁用</a>
{/if} {/if}
{/block} {/block}
{block name="content"} {block name="content"}
<div class="think-box-shadow"> <div class="layui-tab layui-tab-card think-bg-white">
{include file='user/index_search'} {include file='user/index_tab'}
<table class="layui-table margin-top-10" lay-skin="line"> <div class="layui-tab-content think-box-shadow">
{notempty name='list'} {include file='user/index_search'}
<thead> <table class="layui-table margin-top-10" lay-skin="line">
<tr> {notempty name='list'}
<th class='list-table-check-td think-checkbox'> <thead>
<label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label> <tr>
</th> <th class='list-table-check-td think-checkbox'>
<th class='list-table-sort-td'> <label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
<button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button> </th>
</th> <th class='list-table-sort-td'>
<th class='text-left nowrap' width="25%">账号信息</th> <button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
<th class='text-left nowrap'>账号状态</th> </th>
<th></th> <th class='text-left nowrap' width="25%">账号信息</th>
</tr> <th class='text-left nowrap'>账号状态</th>
</thead> <th></th>
{/notempty} </tr>
<tbody> </thead>
{foreach $list as $key=>$vo} {/notempty}
<tr data-dbclick> <tbody>
<td class='list-table-check-td think-checkbox'> {foreach $list as $key=>$vo}
<label><input class="list-check-box" value='{$vo.id}' type='checkbox'></label> <tr data-dbclick>
</td> <td class='list-table-check-td think-checkbox'>
<td class='list-table-sort-td'> <label><input class="list-check-box" value='{$vo.id}' type='checkbox'></label>
<label><input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input"></label> </td>
</td> <td class='list-table-sort-td'>
<td class='text-left nowrap'> <label><input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input"></label>
<img alt="img" width="40px" height="40px" class="text-top margin-right-10" data-tips-image src="{$vo.headimg|default=''}"> </td>
<div class="inline-block"> <td class='text-left nowrap'>
用户账号 <b class="color-blue">{$vo.username|default=''}</b>,账号昵称 <b class="color-blue">{$vo.nickname|default='<span class="color-desc">未配置账号昵称</span>'|raw}</b><br> <img alt="img" width="40px" height="40px" class="text-top margin-right-10" data-tips-image src="{$vo.headimg|default=''}">
联系手机 <span class="color-blue">{$vo.contact_phone|default='<i class="color-desc">未配置联系手机</i>'|raw}</span> <div class="inline-block sub-span-blue">
联系邮箱 <span class="color-blue">{$vo.contact_mail|default='<i class="color-desc">未配置联系邮箱</i>'|raw}</span> 用户账号 <span><b>{$vo.username|default=''}</b></span> 用户昵称 <span><b>{$vo.nickname|default='-'|raw}</b></span><br>
</div> 联系手机 <span>{$vo.contact_phone|default='<i class="color-desc">未配置</i>'|raw}</span>
</td> 联系邮箱 <span>{$vo.contact_mail|default='<i class="color-desc">未配置</i>'|raw}</span>
<td class='text-left nowrap'> </div>
账号创建于 <span class="color-blue">{$vo.create_at|format_datetime}</span>,共登录了 <span class="color-blue">{$vo.login_num|default=0}</span><br> </td>
{if $vo.login_at} <td class='text-left nowrap sub-span-blue'>
最近于 <span class="color-blue">{$vo.login_at|format_datetime}</span> 通过 <span class="color-blue">{$vo.login_ip|default='--'}</span> 登录,{else} 账号创建于 <span>{$vo.create_at|format_datetime}</span> 共登录了 <span>{$vo.login_num|default=0}</span><br>
<span class="color-desc">该账号还没有登录过哦,登录之后才会有记录!</span> {if $vo.login_at}
{/if} 最近于 <span>{$vo.login_at|format_datetime}</span> 通过 <span>{$vo.login_ip|default='--'}</span> 登录,{else}
{eq name='vo.status' value='0'}<b class="color-red">已禁用</b>{else}<b class="color-green">使用中</b>{/eq} <span class="color-desc">该账号还没有登录过哦,登录之后才会有记录!</span>
</td> {/if}
<td class='text-left nowrap'> {eq name='vo.status' value='0'}<b class="color-red">已禁用</b>{else}<b class="color-green">使用中</b>{/eq}
</td>
<td class='text-left nowrap'>
{if auth("pass")} {if auth("pass")}
<a class="layui-btn layui-btn-sm layui-btn-normal" data-title="设置密码" data-modal='{:url("pass")}?id={$vo.id}'> </a> <a class="layui-btn layui-btn-sm layui-btn-normal" data-modal='{:url("pass")}?id={$vo.id}'>设置密码</a>
{/if} {/if}
{if auth("edit")} {if auth("edit")}
<a data-dbclick class="layui-btn layui-btn-sm" data-title="编辑用户资料" data-modal='{:url("edit")}?id={$vo.id}'> </a> <a data-dbclick class="layui-btn layui-btn-sm" data-modal='{:url("edit")}?id={$vo.id}'>编辑资料</a>
{/if} {/if}
{if auth("state") and $vo.status eq 1} {if auth("state") and $vo.status eq 1}
<a class="layui-btn layui-btn-sm layui-btn-warm" data-confirm="确定要禁用该用户吗?" data-action="{:url('state')}" data-value="id#{$vo.id};status#0" data-csrf="{:systoken('state')}"> </a> <a class="layui-btn layui-btn-sm layui-btn-warm" data-confirm="确定要禁用该禁用账号吗?" data-action="{:url('state')}" data-value="id#{$vo.id};status#0" data-csrf="{:systoken('state')}">禁用账号</a>
{/if} {/if}
{if auth("state") and $vo.status eq 0} </td>
<a class="layui-btn layui-btn-sm layui-btn-warm" data-confirm="确定要启用该用户吗?" data-action="{:url('state')}" data-value="id#{$vo.id};status#1" data-csrf="{:systoken('state')}">启 用</a> </tr>
{/if} {/foreach}
</tbody>
{if auth("remove")} </table>
<a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除该用户吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('remove')}">删 除</a>
{/if}
</td>
</tr>
{/foreach}
</tbody>
</table>
{empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
{empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
</div>
</div> </div>
{/block} {/block}

View File

@ -25,21 +25,6 @@
</div> </div>
</div> </div>
<div class="layui-form-item layui-inline">
<label class="layui-form-label">使用状态</label>
<div class="layui-input-inline">
<select class="layui-select" name="status">
{foreach [''=>'-- 全部状态 --','0'=>'已禁用的账号','1'=>'使用中的账号'] as $k=>$v}
{if input('get.status') eq $k.""}
<option selected value="{$k}">{$v}</option>
{else}
<option value="{$k}">{$v}</option>
{/if}
{/foreach}
</select>
</div>
</div>
<div class="layui-form-item layui-inline"> <div class="layui-form-item layui-inline">
<label class="layui-form-label">登录时间</label> <label class="layui-form-label">登录时间</label>
<div class="layui-input-inline"> <div class="layui-input-inline">

View File

@ -0,0 +1,13 @@
<ul class="layui-tab-title">
{foreach ['index'=>'用户账号','recycle'=>'回收站'] as $k=>$v}
{if $template eq $k}
<li data-open="{:url('index')}?type={$k}" class="layui-this">{$v}</li>
{else}
<li data-open="{:url('index')}?type={$k}">{$v}</li>
{/if}
{/foreach}
</ul>
<style>
body{min-width:1000}
</style>

View File

@ -38,7 +38,7 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="relative block"> <label class="relative block">
<span class="color-green font-w7">重复登录密码</span> <span class="color-green font-w7">重复登录密码</span>
<span class="color-desc margin-left-5">Retype Password</span> <span class="color-desc margin-left-5">Repeat Password</span>
<input type="password" name="repassword" maxlength="32" pattern="^(?![\d]+$)(?![a-zA-Z]+$)(?![^\da-zA-Z]+$).{6,32}$" required placeholder="请重复输入登录密码" class="layui-input"> <input type="password" name="repassword" maxlength="32" pattern="^(?![\d]+$)(?![a-zA-Z]+$)(?![^\da-zA-Z]+$).{6,32}$" required placeholder="请重复输入登录密码" class="layui-input">
</label> </label>
<p class="color-desc">密码必需包含大小写字母、数字、符号的任意两者组合。</p> <p class="color-desc">密码必需包含大小写字母、数字、符号的任意两者组合。</p>

View File

@ -0,0 +1,81 @@
{extend name='main'}
{block name="button"}
{if auth("state")}
<a data-confirm="确定要恢复这些账号吗?" data-action="{:url('state')}" data-rule="id#{key};status#1" data-csrf="{:systoken('state')}" class='layui-btn layui-btn-sm layui-btn-primary'>批量恢复</a>
{/if}
{if auth("remove")}
<a data-confirm="确定要永久删除这些账号吗?" data-action='{:url("remove")}' data-rule="id#{key}" data-csrf="{:systoken('remove')}" class='layui-btn layui-btn-sm layui-btn-primary'>批量删除</a>
{/if}
{/block}
{block name="content"}
<div class="layui-tab layui-tab-card think-bg-white">
{include file='user/index_tab'}
<div class="layui-tab-content think-box-shadow">
{include file='user/index_search'}
<table class="layui-table margin-top-10" lay-skin="line">
{notempty name='list'}
<thead>
<tr>
<th class='list-table-check-td think-checkbox'>
<label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
</th>
<th class='list-table-sort-td'>
<button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
</th>
<th class='text-left nowrap' width="25%">账号信息</th>
<th class='text-left nowrap'>账号状态</th>
<th></th>
</tr>
</thead>
{/notempty}
<tbody>
{foreach $list as $key=>$vo}
<tr data-dbclick>
<td class='list-table-check-td think-checkbox'>
<label><input class="list-check-box" value='{$vo.id}' type='checkbox'></label>
</td>
<td class='list-table-sort-td'>
<label><input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input"></label>
</td>
<td class='text-left nowrap'>
<img alt="img" width="40px" height="40px" class="text-top margin-right-10" data-tips-image src="{$vo.headimg|default=''}">
<div class="inline-block sub-span-blue">
用户账号 <span><b>{$vo.username|default=''}</b></span> 用户昵称 <span><b>{$vo.nickname|default='-'|raw}</b></span><br>
联系手机 <span>{$vo.contact_phone|default='<i class="color-desc">未配置</i>'|raw}</span>
联系邮箱 <span>{$vo.contact_mail|default='<i class="color-desc">未配置</i>'|raw}</span>
</div>
</td>
<td class='text-left nowrap sub-span-blue'>
账号创建于 <span>{$vo.create_at|format_datetime}</span> 共登录了 <span>{$vo.login_num|default=0}</span><br>
{if $vo.login_at}
最近于 <span>{$vo.login_at|format_datetime}</span> 通过 <span>{$vo.login_ip|default='--'}</span> 登录,{else}
<span class="color-desc">该账号还没有登录过哦,登录之后才会有记录!</span>
{/if}
{eq name='vo.status' value='0'}<b class="color-red">已禁用</b>{else}<b class="color-green">使用中</b>{/eq}
</td>
<td class='text-left nowrap'>
{if auth("state") and $vo.status eq 0}
<a class="layui-btn layui-btn-sm layui-btn-warm" data-confirm="确定要恢复该账号吗?" data-action="{:url('state')}" data-value="id#{$vo.id};status#1" data-csrf="{:systoken('state')}">恢复账号</a>
{/if}
{if auth("remove")}
<a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要永久删除此账号吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('remove')}">永久删除</a>
{/if}
</td>
</tr>
{/foreach}
</tbody>
</table>
{empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
</div>
</div>
{/block}