vest.php
2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
use yii\web\View;
$this->title = '管理后台首页';
?>
<div class="col-md-6">
<p><span>剩余马甲数:</span><?php echo $imVestNums?></p>
<div class="panel panel-default">
<div class="panel-heading">
<h5 class="panel-title">导入马甲</h5>
</div>
<div class="panel-body">
<form class="form-inline">
<div class="form-group">
<label class="sr-only" for="offset">offset</label>
<input type="text" class="form-control" id="offset" placeholder="offset">
</div><!-- form-group -->
<div class="form-group">
<label class="sr-only" for="limit">limit</label>
<input type="text" class="form-control" id="limit" placeholder="limit">
</div><!-- form-group -->
<div class="form-group" id="btn_bar">
<button type="button" class="btn btn-primary mr5" id="import">导入</button>
</div>
</form>
</div>
</div>
</div>
<script>
$(function(){
$('#import').live("click",function(){
var offset = $('#offset').val();
var limit = $('#limit').val();
var loading_html = "<img src='/images/loaders/loader6.gif'>";
var import_html = "<button type='button' class='btn btn-primary mr5' id='import'>导入</button>";
if(limit > 1000){
alert('每次导入条数不得超过1000');return;
}
$("#btn_bar").html(loading_html);
$.get("/system/vest",{offset:offset,limit:limit},function(data){
// alert(stat);return;
if(data.code==200){
$('#offset').val(Number(offset)+Number(limit));
alert('成功导入'+data.data+'条');
}else{
alert('设置失败');
}
$("#btn_bar").html(import_html);
},'json');
});
});
</script>