admin
2025-02-20 f537abe9f3646c739beaf15076246a2f71a347e9
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
<html lang="zh-cn">
 
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="referrer" content="never">
<title>榜首管理</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/maincontent.css" rel="stylesheet">
<style>
.search {
    display: inline;
    width: auto;
}
 
#hometype input[type=checkbox] {
    height: 20px;
    width: 20px;
}
 
#hometype ul li {
    line-height: 30px;
}
 
#hometype ul li span {
    height: 30px;
    vertical-align: middle;
    margin-left: 5px;
}
 
#hometype table td {
    padding: 5px;
}
 
#special input[type=checkbox] {
    height: 20px;
    width: 20px;
}
 
#special ul li {
    line-height: 30px;
}
 
#special ul li span {
    height: 30px;
    vertical-align: middle;
    margin-left: 5px;
}
 
#special table td {
    padding: 5px;
}
 
#hometype-sure {
    padding: 20px;
    display: none;
}
 
#hometype-sure span {
    width: 100px;
    text-align: right;
}
 
#hometype-sure input[type=text] {
    width: 360px;
    display: inline;
}
 
#hometype-sure div {
    margin-bottom: 20px;
}
 
td>.center {
    text-align: center !important;
    line-height: 105px !important;
}
</style>
</head>
 
<body>
    <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
    </nav>
    <div id="mainbody">
        <div id="sidebar">
            <dl>
            </dl>
        </div>
        <div id="neirong">
            <div class="erjidh search-div" style="padding: 10px;">
 
                <div class="search vt">
                    <select name="select" id="videotypes"
                        class="form-control roottype search">
 
                    </select>
 
                </div>
 
                </select>
                <div class="form-group search" role="search">
                    <input type="text" class="form-control search" id="searchKey"
                        style="width: 200px;" placeholder="搜索">
                </div>
                <button type="button" class="btn btn-default search-button">搜索</button>
 
                <div class="tianjia" class="search">
                    <a href="fenqu.html" class="btn btn-primary" role="button">添加&nbsp;+</a>
                </div>
            </div>
            <div class="zhuti">
                <div class="liebiao">
                    <table class="table">
                        <thead>
                            <th>选择</th>
                            <th>编号</th>
                            <th>名称</th>
                            <th>类型</th>
                            <th>权重</th>
                            <th>位置</th>
                            <th>创建时间</th>
                            <th>删除</th>
                            <th>编辑</th>
                        </thead>
                        <tbody>
                            <tr>
                                <td>
                                    <div class="xuanze">
                                        <label> <input type="checkbox" class="check-item"
                                            value="#">
                                        </label>
                                    </div>
                                </td>
                                <td>
                                    <div class="bianhao"></div>
                                </td>
                                <td>
                                    <div class="center mc"></div>
                                </td>
                                <td>
                                    <div class="center lx"></div>
                                </td>
                                <td>
                                    <div class="center qz"></div>
                                </td>
                                <td>
                                    <div class="center wz"></div>
                                </td>
                                <td>
                                    <div class="center createtime"></div>
                                </td>
                                <td>
                                    <div class="anniu delete">
                                        <img src="image/dustbin.png">
                                    </div>
                                </td>
                                <td>
                                    <div class="anniu">
                                        <a class="edit"><img src="image/bianji.png"></a>
                                    </div>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="bottom">
                <div class="qx">
                    <div class="checkbox">
                        <label> <input type="checkbox" class="check-all" value="#">
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;全选
                        </label>
                    </div>
                </div>
                <button class="btn btn-warning pl-del" type="button">批量删除</button>
 
                <div class="page">
                    <ul class="pagination">
                        <li class="disabled pre"><a href="#">&laquo;</a></li>
                        <li><a href="#" class="next">&raquo;</a></li>
                    </ul>
                    <div class="form-group">
                        <div class="tzan">
                            <button type="button" class="btn btn-primary">跳转</button>
                        </div>
                        <div class="tz">
                            <input class="form-control" type="text" placeholder="页数">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
 
 
    <div id="dialog-chooselink" style="display: none;">
        <div class="row" style="height: 690px;">
            <div class="col-lg-3 col-md-3" style="display: inline;">
                <select class="form-control addType">
 
                </select>
            </div>
 
            <div class="col-lg-9 col-md-9" style="display: inline;">
                <!--视频选择 -->
                <div id="container-video">
                    <div class="search">
                        <input type="text" class="form-control" placeholder="请输入关键字"
                            style="width: 200px; display: inline;" />
                        <button class="btn btn-info">搜索</button>
                    </div>
                    <!-- 搜索结果展示区域-->
                    <div class="search-result">
                        <table class="table">
                            <thead>
                                <th>编号</th>
                                <th>名称</th>
                                <th>封面</th>
                                <th>是否显示</th>
                                <th>选择</th>
                            </thead>
                            <tbody>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <div style="float: right;">
            <button class="btn btn-info sure">确定</button>
            <button class="btn btn-default cancel">取消</button>
        </div>
 
    </div>
 
    <script src="js/jquery-1.9.1.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/page.js"></script>
    <script src="js/nav.js"></script>
    <script src="layer/layer.js"></script>
    <script>
        var trHtml;
        $(function() {
 
            trHtml = $(".liebiao tbody").html();
            $(".liebiao tbody").empty();
            getVideoType(0, undefined);
 
            $(".search-button").bind("click", function() {
                getTopData(1);
            });
 
            $(".check-all").bind("click", function() {
                $(".check-item").prop("checked", this.checked);
            })
 
            $(".pl-del").bind("click", function() {
 
                layer.confirm('是否删除?', {
                    btn : [ '否', '是' ]
                }, function(index) {
                    layer.close(index);
                    return false;
                }, function() {
                    var arr = new Array();
                    $(".check-item:checked").each(function() {
                        var cid = $(this).attr("key");
                        arr.push(cid);
                    });
                    if (arr.length == 0) {
                        layer.msg("请先选中数据!");
                        return;
                    }
                    deleteTops(arr);
                });
 
            });
 
            //                $(".add").click(function() {
            //                    addIndex = layer.open({
            //                        type: 1,
            //                        title: '链接选择',
            //                        shadeClose: true,
            //                        shade: 0.8,
            //                        area: ['1200px', '800px'],
            //                        content: $("#dialog-chooselink")
            //                    });
            //                });    
            //                
            //                $("#dialog-chooselink .cancel").click(function() {
            //                    layer.close(addIndex);
            //                });
            //                
            //                $("#container-juhe .search button").click(function() {
            //                    var key = $("#container-juhe .search input").val();
            //                    var index = layer.load(0, {
            //                        'shade': false
            //                    });
            //                    $.post('api/common/searchvideo', {
            //                        'key': key
            //                    }, function(data) {
            //                        layer.close(index);
            //                        if(data.code == 0) {
            //                            $(".search-result table tbody").empty();
            //                            var html = "";
            //                            data.data.forEach(function(juhe) {
            //                                html += "<tr><td>" + juhe.id;
            //                                html += "</td><td>" + juhe.name + "</td><td><img style='width: 80px;' src=" + juhe.picture + "> </td><td>" + (juhe.show == 1 ? '显示' : '不显示') + "</td>";
            //                                html += "<td><input type='checkbox' name='choose-juhe' key=" + juhe.id + " value='"+juhe.name+"'></td></tr>";
            //                            });
            //                            $(".search-result table tbody").html(html);
            //                        }
            //
            //                    }, 'json');
            //                });
            //                
            //                $("#dialog-chooselink .sure").click(function() {
            //                    alert("1");
            //                });
 
        });
 
        function getTopData(page) {
            var index = layer.load(1, {
                shade : false
            });
            var videotype = $("#videotypes option:selected").val();
            var key = $("#searchKey").val();
            $.post("api/top/getTopList", {
                "videotype" : videotype,
                "page" : page,
                "pageSize" : 20,
                "key" : key
            }, function(data) {
                if (data.code == 0) {
                    setTopData(data.data.list);
                    fillPage(data.data.pe, function(page) {
                        window.location.href = "topManage.html?page=" + page+"&type="+$(".vt .roottype").val();
                    });
                }
                layer.close(index);
            }, 'json')
 
        }
 
        function getQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
            var reg_rewrite = new RegExp("(^|/)" + name + "/([^/]*)(/|$)", "i");
            var r = window.location.search.substr(1).match(reg);
            var q = window.location.pathname.substr(1).match(reg_rewrite);
            if (r != null) {
                return unescape(r[2]);
            } else if (q != null) {
                return unescape(q[2]);
            } else {
                return null;
            }
        }
 
        function getVideoType(pid, $parentselectitem) {
            $
                    .post(
                            'api/class/getnextclass',
                            {
                                "pid" : pid
                            },
                            function(data) {
                                if (data.data.length > 0) {
                                    if ($parentselectitem == undefined) { //第一级
                                        $(".vt .roottype").empty();
                                        $(".vt .roottype")
                                                .append(
                                                        "<option value='0'>全部</option>");
                                        for (var i = 0; i < data.data.length; i++) {
                                            $(".vt .roottype").append(
                                                    "<option value='" + data.data[i].id + "'>"
                                                            + data.data[i].name
                                                            + "</option>");
                                            $(".addType").append(
                                                    "<option value='" + data.data[i].id + "'>"
                                                            + data.data[i].name
                                                            + "</option>");
                                        }
                                        //获取当前页码
                                        var page = getQueryString("page");
                                        if (page == null || page == undefined
                                                || page == '')
                                            page = 1;
                                        var type = getQueryString("type");
                                        if (type == null || type == undefined
                                                || type == '')
                                            type = 0;
                                        for (var i = 0; i < $(".vt .roottype option").length; i++) {
                                            if ($(".vt .roottype option").eq(i)
                                                    .val() == type)
                                                $(".vt .roottype option").eq(i)
                                                        .attr("selected", true);
                                        }
 
                                        getTopData(page);
                                    }
                                }
 
                            }, 'json');
        }
 
        function setTopData(list) {
            $(".liebiao tbody").empty();
            for (var i = 0; i < list.length; i++) {
                $(".liebiao tbody").append(trHtml);
                var $curTr = $(".liebiao tbody tr").eq(i);
                var cid = list[i].id;
                var createtime = list[i].createtime;
                var name = list[i].videoInfo.name;
                var orderby = list[i].orderby;
                var type = list[i].videoType.name;
                var rank = list[i].rank;
                $curTr.find(".xuanze .check-item").attr("key", cid);
                $curTr.find(".bianhao").text(cid);
                $curTr.find(".mc").text(name);
                $curTr.find(".lx").text(type);
                $curTr.find(".qz").text(orderby);
                $curTr.find(".wz").text(rank);
                $curTr.find(".createtime").text(getCommonTime(createtime));
                $curTr.find(".edit").attr("href", "edit-top.html?key=" + cid);
                $curTr.find(".delete").attr("key", cid);
            }
 
            $(".liebiao tbody tr .delete").bind("click", function() {
                var $obj = $(this);
                layer.confirm('是否删除?', {
                    btn : [ '否', '是' ]
                }, function(index) {
                    layer.close(index);
                    return false;
                }, function() {
                    var arr = new Array();
                    var cid = $obj.attr("key");
                    arr.push(cid);
                    deleteTops(arr);
                });
            });
 
        }
 
        function getCommonTime(timestamp) {
            var newDate = new Date();
            newDate.setTime(timestamp);
            return newDate.getFullYear() + "-" + (newDate.getMonth() + 1) + "-"
                    + (newDate.getDate()) + " " + newDate.getHours() + ":"
                    + newDate.getMinutes();
        }
 
        function deleteTops(arr) {
            $.ajax({
                url : "api/top/deleteTop",
                type : "POST",
                traditional : true,
                data : {
                    "ids" : arr
                },
                dataType : "json",
                success : function(data) {
                    if (data.code == 0) {
                        alert("删除成功");
                        getTopData(1);
                    }
                },
                error : function() {
                    alert("删除失败");
                }
            });
        }
    </script>
</body>
 
</html>