审计记录

WebContent/WEB-INF/jsp/pc/report/fans.jsp 3.4 KB
zxt@theyeasy.com committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta http-equiv="X-UA-Compatible" content="ie=edge">
		<title>粉丝列表</title>
		<link rel="stylesheet" href="/zzhnc/res/plugins/layui/css/layui.css">
		<link rel="stylesheet" href="/zzhnc/res/css/basic.css">
	</head>

	<body class="wrap">
		<form class="layui-form">
16
			<div class="layui-form-item">
17
				<div class="layui-input-inline">
zxt@theyeasy.com committed
18 19 20 21
					<input class="layui-input" name="keyword" placeholder="关键字" />
				</div>
				<button class="layui-btn" lay-submit lay-filter="querybtn">查询</button>
				<button class="layui-btn layui-btn-primary" lay-submit lay-filter="resetbtn">重置</button>
22
			</div>
zxt@theyeasy.com committed
23 24 25 26
		</form>
		<table class="layui-table">
			<thead>
				<tr>
27 28 29 30
					<th>No</th>
					<th>头像昵称</th>
					<th>地区</th>
					<th>小程序 openid</th>
31 32
					<th style="min-width: 84px;">创建时间</th>
					<th style="min-width: 84px;">上次登录时间</th>
zxt@theyeasy.com committed
33 34 35
				</tr>
			</thead>
			<tbody id="fanslist">
36

zxt@theyeasy.com committed
37 38
			</tbody>
		</table>
39
		<div class="nodata">暂无数据</div>
zxt@theyeasy.com committed
40
		<div id="page"></div>
41

zxt@theyeasy.com committed
42 43
	</body>
	<script src='/zzhnc/res/js/jquery.min.js'></script>
44 45
	<script src="/zzhnc/res/plugins/layui/layui.js"></script>
	<script src="/zzhnc/res/js/me.js"></script>
zxt@theyeasy.com committed
46
	<script>
47 48 49
		layui.use(['form', 'element', 'laypage'], function() {
			var form = layui.form,
				element = layui.element,
zxt@theyeasy.com committed
50
				laypage = layui.laypage;
51

52 53 54 55
			var queryObj = {
				page: 1,
				keyword: null
			};
56

57 58
			//初始化方法
			function initData(queryObj) {
59
				$.get("/zzhnc/fans/search", queryObj, function(data) {
zxt@theyeasy.com committed
60 61
					console.log(data)
					$("#fanslist").html("")
62 63 64 65
					if(data.rows.length < 1) {
						$(".nodata").show();
					} else {
						$(".nodata").hide();
66 67
						var str = "";
						for(var i = 0; i < data.rows.length; i++) {
68
							str += '<tr>' +
69
								'<td>' + ((data.page - 1) * data.pageSize + i + 1) + '</td>' +
70
								'<td><img class="fansImg" src="' + data.rows[i].logo + '" />' + data.rows[i].nickname + '</td>' +
71 72 73 74 75
								'<td>' + ToAddress(data.rows[i]) + '</td>' +
								'<td>' + data.rows[i].miniopenid + '</td>' +
								'<td>' + toTime_G(data.rows[i].createdtime) + '</td>' +
								'<td>' + toTime_G(data.rows[i].lastlogintime) + '</td>' +
								'</tr>'
zxt@theyeasy.com committed
76 77
						}
						$("#fanslist").html(str)
78
						form.render()
zxt@theyeasy.com committed
79 80
						toNull_G();
					}
81 82 83 84 85 86 87 88 89 90 91 92 93
					laypage.render({
						elem: 'page',
						count: data.total,
						limit: 10,
						curr: queryObj.page,
						layout: ['count', 'prev', 'page', 'next', 'skip'],
						jump: function(obj, first) {
							if(!first) {
								queryObj.page = obj.curr
								initData(queryObj)
							}
						}
					})
zxt@theyeasy.com committed
94 95
				})
			}
96

97 98 99 100
			//初始化数据
			initData(queryObj)

			//查询操作
101
			form.on("submit(querybtn)", function(e) {
102 103 104
				queryObj.page = 1;
				queryObj.keyword = e.field.keyword;
				initData(queryObj)
zxt@theyeasy.com committed
105 106
				return false
			})
107

108
			//重置操作
109
			form.on("submit(resetbtn)", function(e) {
zxt@theyeasy.com committed
110
				$("[name=keyword]").val("")
111 112 113
				queryObj.page = 1;
				queryObj.keyword = null;
				initData(queryObj)
zxt@theyeasy.com committed
114 115
				return false
			})
116 117

			function ToAddress(data) {
zxt@theyeasy.com committed
118 119 120
				var p = data.province || ""
				var c = data.city || ""
				var d = data.district || ""
121
				return !!(p + c + d) ? (p + c + d) : "未知城市"
zxt@theyeasy.com committed
122
			}
123

zxt@theyeasy.com committed
124 125 126 127
		})
	</script>

</html>