guochao.page.js
1.39 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
/* eslint-disable eqeqeq */
require('admin/user.page.css');
require('bootpag/lib/jquery.bootpag.min');
const _ = require('lodash');
function bind_table_pagination() {
const $ul = $('.guochao-list');
const fetchRender = () => {
$.ajax({
url: '/admin/api/guochao/list',
}).then(result => {
const list = result;
let html = '';
_.each(list, item => {
if (item.place) {
item.placeText = '下';
} else {
item.placeText = '上';
}
html += `
<tr class="even pointer">
<td class="">${item.id}</td>
<td class=""><img src="${item.logo}" style="background: #000000" width="100" height="50"/></td>
<td class="">${item.shop_name}</td>
<td class="">${item.sort}</td>
<td class="">${item.placeText}</td>
<td class="">${item.collect_count}</td>
<td class="">
<a class="btn btn-info btn-update" href="/admin/guochao/update?id=${item.id}">修改</a>
</td>
</tr>`;
});
$ul.html(html);
});
};
fetchRender();
}
(function() {
bind_table_pagination();
}());