Authored by 邱骏

增加页面

... ... @@ -47,6 +47,15 @@ const userController = {
});
},
prizeUsersListPage(req, res) {
console.log('prize-list-page');
res.render('user/prize-users-list', {
bodyClass: 'nav-md',
module: 'admin',
page: 'prize-users-list'
});
},
/**
* 用户列表
* @param req
... ...
... ... @@ -21,6 +21,7 @@ router.get('/activity/createArticle', activity.createArticlePage);
// 用户管理[page]
router.get('/user/list', user.userListPage);
router.get('/user/users_list', user.usersListPage);
router.get('/user/prize_users_list', user.prizeUsersListPage);
// 用户登录日志[page]
router.get('/user/login-log', user.userLoginLog);
... ...
<!-- page content -->
<div class="right_col" role="main">
<div class="">
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
<button class="btn btn-primary btn-export-user-list" data-id="{{id}}">导出用户列表</button>
<div class="clearfix"></div>
</div>
<div class="x_content">
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr class="headings">
<th width="8%" class="column-title">ID</th>
<th width="14%" class="column-title">昵称</th>
<th width="12%" class="column-title">手机号</th>
<th width="16%" class="column-title">email</th>
<th width="15%" class="column-title">省份城市</th>
<th width="15%" class="column-title">生日</th>
<th width="8%" class="column-title">性别</th>
<th width="12%" class="column-title">操作</th>
</tr>
</thead>
<tbody class="user-list">
</tbody>
</table>
</div>
<div class="table-pagination user-pagination pull-right"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /page content -->
... ...
... ... @@ -57,6 +57,7 @@
<ul class="nav child_menu">
<li><a href="/admin/user/list">用户列表</a></li>
<li><a href="/admin/user/users_list">用户信息收集</a></li>
<li><a href="/admin/user/prize_users_list">中奖用户信息</a></li>
<li><a href="/admin/user/login-log">用户登录日志</a></li>
</ul>
</li>
... ...
require('admin/user.page.css');
require('bootpag/lib/jquery.bootpag.min');
const _ = require('lodash');
const moment = require('moment');
function bind_delete_user() {
const deleteFn = function() {
const userId = $(this).data('id');
$.ajax({
method: 'post',
url: '/admin/api/user/deleteInfoUser',
data: {
userId
}
})
.then(() => {
location.reload();
});
};
$(document).on('click', '.btn-delete-user', deleteFn);
}
function bind_export_user_list() {
const exportFn = function() {
window.open('/admin/api/user/exportInfoUserList', '_blank');
};
$('.btn-export-user-list').on('click', exportFn);
}
function bind_table_pagination() {
const $ul = $('.user-list');
const $up = $('.user-pagination');
const fetchRender = (pageNo, pageSize) => {
$.ajax({
url: '/admin/api/user/users_list',
data: {
pageNo,
pageSize
}
})
.then(result => {
console.log(result);
const list = result.data;
const totalPage = result.totalPage;
let html = '';
_.each(list, item => {
item.userBirthday = moment(item.userBirthday).format('YYYY-MM-DD');
item.userGender = ['男', '女'][item.userGender];
html += `
<tr class="even pointer">
<td class="">${item.id}</td>
<td class="">${item.userName}</td>
<td class="">${item.userPhone}</td>
<td class="">${item.userEmail}</td>
<td class="">${item.userProvince}-${item.userCity}</td>
<td class="">${item.userBirthday}</td>
<td class="">${item.userGender}</td>
<td class="">
<button class="btn btn-danger btn-delete-user" data-id="${item.id}">删除用户
</button>
</td>
</tr>`;
});
$ul.html(html);
if (pageNo === 1) {
$up.bootpag({
total: totalPage,
page: 1,
maxVisible: 10,
}).on('page', function(event, num) {
fetchRender(num, 20);
});
}
});
};
fetchRender(1, 20);
}
(function() {
bind_delete_user();
bind_export_user_list();
bind_table_pagination();
}());
... ...