Browse Source

完善用户管理功能。

索隆 6 years ago
parent
commit
8d6a5223a9
2 changed files with 19 additions and 12 deletions
  1. 8 1
      js/management.js
  2. 11 11
      management.html

+ 8 - 1
js/management.js

@@ -3,7 +3,7 @@ function getList(page){
3 3
 	data['page'] = page || 1;
4 4
 	data['size'] = 20;
5 5
 	$("#list, #page").empty();
6
-	ajax(apiUrl+"forecast/list",data,function(res){
6
+	ajax(apiUrl+"user/list",data,function(res){
7 7
 		if(res.code == 1){
8 8
 			if(res.data.length > 0){
9 9
 				$("#list").html($.Template7.renderTpl("tempaltelist",res.data));
@@ -20,6 +20,13 @@ function getList(page){
20 20
 pageGo = getList;
21 21
 
22 22
 function updateStatus(obj, id){
23
+	var $this = $(obj), status = $this.data("status"), statusTxt=status.toString().decode(0,'禁用','-1','启用');
23 24
 	confirm("禁用该用户将无法在小程序中进行操作,是否继续?",function(){
25
+		ajax(apiUrl+"user/forbid",{"id": id,"status": status},function(res){
26
+			if(res.code == 1){
27
+				$this.text(statusTxt);
28
+				$this.data("status", (status == -1 ? 0 : -1));
29
+			}
30
+		});
24 31
 	});
25 32
 }

+ 11 - 11
management.html

@@ -28,8 +28,8 @@ $(function(){
28 28
 		<script type="text/javascript" src="js/guid.js" data-info="用户管理"></script>
29 29
 		<div class="mainContent">
30 30
 			<form id="saerchFrm">
31
-				微信昵称:<input type="text" class="text {text:'请输入预测ID'}" name="" size="20" />
32
-				授权时间:<input type="text" icon="date" class="text {text:'开始日期'}" name="begin_time" id="begin_time" size="12" /> - <input type="text" icon="date" class="text {text:'结束日期'}" name="end_time" id="end_time" size="12" />
31
+				微信昵称:<input type="text" class="text {text:'请输入微信昵称'}" name="nickName" size="20" />
32
+				授权时间:<input type="text" icon="date" class="text {text:'开始日期'}" name="startDate" id="begin_time" size="12" /> - <input type="text" icon="date" class="text {text:'结束日期'}" name="endDate" id="end_time" size="12" />
33 33
 				<input type="button" class="btn" value="搜索" onclick="getList(1);" />
34 34
 			</form>
35 35
 			<table cellpadding="0" cellspacing="0" border="0" class="table mTop10">
@@ -53,16 +53,16 @@ $(function(){
53 53
 			<script type="text/html" id="tempaltelist">
54 54
 				{{#each this}}
55 55
 					<tr>
56
-						<td>{{id}}</td>
57 56
 						<td>{{crtTime}}</td>
58
-						<td>{{endDate}}</td>
59
-						<td></td>
60
-						<td>{{stockCode}}</td>
61
-						<td>{{js "this.expect == 1 ? '空':'多'"}}</td>
62
-						<td>{{bet}}</td>
63
-						<td>{{vnum}}</td>
64
-						<td>{{voteBet}}</td>
65
-						<td><a href="javascript:void(0);" onclick="updateStatus(this, {{Id}});">{{js "this.on_frame == -1 ? '上架':(this.on_frame == 0 ? '下架':'')"}}</a></td>
57
+						<td>{{nickname}}</td>
58
+						<td>{{fnum}}</td>
59
+						<td>{{forecastRateSuccess}}</td>
60
+						<td>{{voteNum}}</td>
61
+						<td>{{voteRateSuccess}}</td>
62
+						<td>{{amount}}</td>
63
+						<td>{{cnum}}</td>
64
+						<td>{{js "this.status == -1 ? '已禁用':(this.status == 0 ? '正常':'未知状态')"}}</td>
65
+						<td><a href="javascript:void(0);" onclick="updateStatus(this, {{id}});" data-status="{{js "this.status == -1 ? '0':'-1'"}}">{{js "this.status == -1 ? '启用':(this.status == 0 ? '禁用':'')"}}</a></td>
66 66
 					</tr>
67 67
 				{{/each}}
68 68
 			</script>