mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
77 lines
4.0 KiB
PHP
77 lines
4.0 KiB
PHP
{extend name="table"}
|
|
|
|
{block name="button"}
|
|
<!--{if auth("black")}-->
|
|
<button data-action='{:url("black")}' data-table-id="UserData" data-rule="openid#{openid};black#1" class='layui-btn layui-btn-sm layui-btn-primary'>拉入黑名单</button>
|
|
<button data-action='{:url("black")}' data-table-id="UserData" data-rule="openid#{openid};black#0" class='layui-btn layui-btn-sm layui-btn-primary'>移出黑名单</button>
|
|
<!--{/if}-->
|
|
|
|
<!--{if auth("truncate")}-->
|
|
<button data-load='{:url("truncate")}' data-confirm="确定要清空所有用户数据吗?" class='layui-btn layui-btn-sm layui-btn-primary'>清空用户数据</button>
|
|
<!--{/if}-->
|
|
|
|
<!--{if auth("sync")}-->
|
|
<button data-queue='{:url("sync")}' data-table-id="UserData" data-confirm="确定要创建同步用户数据的后台任务?" class='layui-btn layui-btn-sm layui-btn-primary'>同步用户数据</button>
|
|
<!--{/if}-->
|
|
{/block}
|
|
|
|
{block name="content"}
|
|
<div class="think-box-shadow">
|
|
{include file='fans/index_search'}
|
|
<table id="UserData" data-url="{:request()->url()}" data-target-search="form.form-search"></table>
|
|
</div>
|
|
{/block}
|
|
|
|
{block name='script'}
|
|
<script>
|
|
$(function () {
|
|
$('#UserData').layTable({
|
|
even: true, height: 'full',
|
|
sort: {field: 'id', type: 'desc'},
|
|
cols: [[
|
|
{checkbox: true},
|
|
{field: 'id', hide: true},
|
|
{field: 'headimg', title: '头像', width: 65, align: "center", templet: '<div>{{-$.layTable.showImage(d.headimgurl)}}</div>'},
|
|
{field: 'nickname', title: '微信昵称', align: "center", minWidth: 100, templet: '<div>{{d.nickname||"-"}}</div>'},
|
|
{field: 'province', title: '所在区域', align: "center", minWidth: 120, templet: '<div>{{d.country||"-"}} {{d.province}} {{d.city}}</div>'},
|
|
{field: 'sex', title: '性别', align: 'center', minWidth: 80, templet: '<div>{{d.sex==1 ? "男" : (d.sex==2 ? "女" : "未知")}}</div>'},
|
|
{field: 'language', title: '使用语言', align: 'center', minWidth: 100, templet: '<div>{{d.language}}</div>'},
|
|
{
|
|
field: 'subscribe', title: '订阅状态', align: "center", minWidth: 90, templet: function (d) {
|
|
return d.subscribe > 0 ? '<span class="layui-badge layui-bg-green">已订阅</span>' : '<span class="layui-badge">未订阅</span>';
|
|
}
|
|
},
|
|
{field: 'subscribe_time', title: '订阅时间', minWidth: 170, align: 'center', sort: true, templet: '<div>{{d.subscribe_at}}</div>'},
|
|
{field: 'is_black', title: '是否黑名单', align: 'center', minWidth: 110, templet: '#StatusSwitchTpl'},
|
|
{toolbar: '#toolbar', title: '操作面板', align: 'center', fixed: 'right', minWidth: 80}
|
|
]]
|
|
});
|
|
|
|
// 数据状态切换操作
|
|
layui.form.on('switch(StatusSwitch)', function (obj) {
|
|
var data = {openid: obj.value, black: obj.elem.checked > 0 ? 1 : 0};
|
|
$.form.load("{:url('black')}", data, 'post', function (ret) {
|
|
if (ret.code < 1) $.msg.error(ret.info, 3, function () {
|
|
$('#UserData').trigger('reload'); // 操作异常时重载数据
|
|
});
|
|
return false;
|
|
}, false);
|
|
});
|
|
});
|
|
</script>
|
|
|
|
<!-- 数据状态切换模板 -->
|
|
<script type="text/html" id="StatusSwitchTpl">
|
|
<!--{if auth("black")}-->
|
|
<input type="checkbox" value="{{d.openid}}" lay-skin="switch" lay-text="已拉黑|未拉黑" lay-filter="StatusSwitch" {{d.is_black>0?'checked':''}}>
|
|
<!--{else}-->
|
|
{{-d.status ? '<b class="color-red">已拉黑</b>' : '<b class="color-green">未拉黑</b>'}}
|
|
<!--{/if}-->
|
|
</script>
|
|
|
|
<script type="text/html" id="toolbar">
|
|
<!--{if auth("remove")}-->
|
|
<a class="layui-btn layui-btn-sm layui-btn-danger" data-action="{:url('remove')}" data-value="id#{{d.id}}" data-confirm="确定要删除该用户吗?">删 除</a>
|
|
<!--{/if}-->
|
|
</script>
|
|
{/block} |