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
478
479
480
481
<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;
        }
 
        .h-picture {
 
            width: 120px;
        }
 
        .v-picture {
            height: 120px;
        }
 
        .form-group {
            margin-bottom: 20px;
        }
 
        .bianhao {
            margin: 0;
        }
    </style>
 
</head>
 
<body>
<nav class="navbar navbar-default navbar-fixed-top">
 
</nav>
<div id="mainbody">
    <div id="sidebar">
 
    </div>
    <div id="neirong">
        <div class="erjidh search-div" style="padding: 10px;">
 
            <select name="select" class="form-control search select-state">
 
                <option value="-1">全部</option>
                <option value="1">显示</option>
                <option value="0">隐藏</option>
 
            </select>
 
            <div class="form-group search" role="search">
                <input type="text" class="form-control search" id="kw" style="width: 200px;" placeholder="搜索">
            </div>
            <button type="button" class="btn btn-default search-button">搜索</button>
 
            <div class="tianjia" class="search">
                <a href="tvlive_channel_add.html" class="btn btn-primary" role="button">添加频道&nbsp;+</a>
            </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-primary  pl-add-to-category" type="button">添加到分类</button>
            <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 class="active">
                        <a href="#">1</a>
                    </li>
                    <li>
                        <a href="#">2</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 class="zhuti">
            <div class="zhutisousuo">
                <table class="table">
                    <thead>
                    <th width="5%">选择</th>
                    <th width="10%">编号</th>
                    <th width="9%">频道名称</th>
                    <th width="9%">封面横图</th>
                    <th width="9%">封面竖图</th>
                    <th width="9%">当前节目信息</th>
                    <th width="9%">下个节目信息</th>
                    <th width="8%">状态</th>
                    <th width="12%">创建时间</th>
                    <th width="12%">更新时间</th>
                    <th width="12%">操作</th>
                    <th width="5%">删除</th>
                    <th width="5%">编辑</th>
                    </thead>
 
                    <tbody>
                    <tr v-for="(item,index) in list">
                        <td>
                            <div class="xuanze">
                                <label>
                                    <input type="checkbox" class="check-item" v-bind:keys="item.id"
                                           value="#">
                                </label>
                            </div>
                        </td>
                        <td>
                            <div class="bianhao">{{item.id}}</div>
                        </td>
                        <td>
                            <div class="bianhao name">
                                <a href="#">{{item.name}}</a>
                            </div>
                        </td>
 
                        <td>
                            <img class="h-picture" v-bind:src="item.hPicture" v-if="item.hPicture">
                        </td>
 
                        <td>
                            <img class="v-picture" v-bind:src="item.vPicture" v-if="item.vPicture">
                        </td>
 
 
                        <td>
                            <div class="bianhao">
                                {{item.nowProgramTime}}
                                <br>
                                {{item.nowProgram}}
                            </div>
                        </td>
 
                        <td>
                            <div class="bianhao">
                                {{item.nextProgramTime}}
                                <br>
                                {{item.nextProgram}}
                            </div>
                        </td>
 
                        <td>{{item.state==1?'显示':'隐藏'}}</td>
                        <td class="">{{item.createTime}}</td>
                        <td class="">{{item.updateTime}}</td>
 
                        <td class="">
 
                            <!--<div class="btn btn-primary" v-on:click="showCategorySelect(item.id)">添加到分类</div>-->
                            <!--<div class="btn btn-primary" style="margin-top: 10px;" v-on:click="showCategorySelect(item.id)">来源管理</div>-->
                            <!-- Single button -->
                            <div class="btn-group">
                                <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                    操作 <span class="caret"></span>
                                </button>
                                <ul class="dropdown-menu">
                                    <li><a href="#" v-on:click="showCategorySelect(item.id)">添加到分类</a></li>
                                    <li><a v-bind:href="'tvlive_channel_resource.html?id='+item.id">来源管理</a></li>
                                </ul>
                            </div>
 
 
                        </td>
                        <td>
                            <div class="anniu"><img src="image/dustbin.png" class="delete"
                                                    v-on:click="deleteSpecial(item.id,index)">
                            </div>
                        </td>
                        <td>
                            <div class="anniu">
                                <a v-bind:keys="item.id" href="javascript:void(0)" class="edit"
                                   v-on:click="edit(item.id)"><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-primary  pl-add-to-category" type="button">添加到分类</button>
            <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 class="active">
                        <a href="#">1</a>
                    </li>
                    <li>
                        <a href="#">2</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 class="modal fade" id="categoryDialog" tabindex="-1" role="dialog" aria-hidden="true" style="width: ">
        <input type="hidden" class="channelids"/>
        <div class="modal-dialog">
            <div class="modal-content" style="width: 500px;margin: 0 auto">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">分类选择</h4>
                </div>
                <div class="modal-body ">
                    <div class="form-horizontal">
                        <div class="form-group">
                            <label for="input1" class="changdu1 control-label col-sm-2">分类</label>
                            <div class="col-sm-10">
                                <select class="form-control category">
                                    <option>分类1</option>
                                </select>
                            </div>
 
                        </div>
                        <div class="form-group">
                            <label for="input1" class="changdu1 control-label col-sm-2">权重</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control weight" placeholder="可不填写">
                            </div>
 
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary">确定</button>
                </div>
            </div>
        </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="js/common.js"></script>
    <script src="js/vue.min.js"></script>
    <script src="layer/layer.js"></script>
    <script>
        $(function () {
 
            var app = new Vue({
                el: "#neirong",
                data: {
                    list: [],
                },
                methods: {
                    specialList: function (page) {
                        var index = layer.load(1, {
                            shade: false
                        })
 
                        var data = {
                            "page": page,
                            "key": $("#kw").val()
                        };
                        if (parseInt($(".search-div .select-state").val()) > 0) {
                            data.state = $(".search-div .select-state").val();
                        }
 
                        $.post('api/tvlive/channel/getChannelList', data, function (data) {
                            layer.close(index);
                            if (data.code != 0)
                                return;
                            app.list = data.data.data;
 
                            fillPage(data.data.pageEntity, function (pageIndex) {
                                app.specialList(pageIndex);
                            });
                        }, 'json');
                    },
                    changeSuper: function (id, detailSystemId, e) {
                        if ($(e.target).is(":checked")) {
                            $.post('api/homerecommend/addSuperSpecial', {
                                "id": id,
                                "detailSystemId": detailSystemId
                            }, function (data) {
                                if (data.code != 0) {
                                    layer.msg(data.msg);
                                } else {
                                    layer.msg("操作成功");
                                }
                            }, 'json');
                        } else {
                            $.post('api/homerecommend/deleteSuperSpecial', {
                                "id": id,
                                "detailSystemId": detailSystemId
                            }, function (data) {
                                if (data.code != 0) {
                                    layer.msg(data.msg);
                                } else {
                                    layer.msg("操作成功");
                                }
                            }, 'json');
                        }
                    },
                    deleteSpecial: function (id, index) {
                        var indexDialog = layer.confirm('是否删除该条目?', {
                            btn: ['是', '否'] //按钮
                        }, function () {
                            $.post('api/homerecommend/deleteSpcial', {
                                'ids': id
                            }, function (data) {
                                layer.close(indexDialog);
                                if (data.code == 0) {
                                    if (index > -1) {
                                        app.list.splice(index, 1);
                                    } else {
                                        var ids = id.split(",");
                                        console.log(ids);
                                        for (var i = 0; i < ids.length; i++) {
                                            for (var j = 0; j < app.list.length; j++) {
                                                console.log(app.list[j].special.id + ":" + ids[i])
                                                if (app.list[j].special.id == ids[i]) {
                                                    app.list.splice(j, 1);
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                    layer.msg("删除成功");
                                } else {
                                    layer.msg(data.msg);
                                }
                            }, 'json');
                        }, function () {
 
                        });
                    },
                    edit: function (id) {
                        window.location.href = "edit-tuijian-home-labels.html?id=" + id;
                    },
                    showCategorySelect: function (ids) {
                        $("#categoryDialog .btn-primary").unbind();
                        $("#categoryDialog .channelids").val(ids);
                        $("#categoryDialog .btn-primary").bind("click", function () {
                            var data = {
                                channelIds: ids,
                                categoryId: $("#categoryDialog select").val()
                            };
                            if ($("#categoryDialog .weight").val()) {
                                data.weight = $("#categoryDialog .weight").val();
                            }
 
                            $.post('api/tvlive/channel/addCategoryChannel', data, function (data) {
                                if (data.code == 0) {
                                    layer.msg("添加成功")
                                } else {
                                    layer.msg(data.msg);
                                }
                            }, 'json');
                        })
                        $("#categoryDialog").modal("show");
                    },
 
                    getCategorys: function () {
                        $.post('api/tvlive/category/getCategoryList', {page: 1}, function (data) {
                            if (data.code != 0)
                                return;
                            data = data.data.data;
                            $("#categoryDialog .category").empty();
                            for (var i = 0; i < data.length; i++) {
                                $("#categoryDialog .category").append("<option value='" + data[i].category.id + "'>" + data[i].category.name + "</option>");
                            }
                        }, 'json');
 
                    }
                }
 
 
            });
 
            $(".search-div .search-button").click(function () {
                app.specialList(1);
            });
 
            app.specialList(1);
            app.getCategorys();
 
            function getCheckedItems() {
                var ids = "";
                for (var i = 0; i < $(".check-item").length; i++) {
                    if ($(".check-item").eq(i).is(':checked')) {
                        ids += $(".check-item").eq(i).attr("keys") + ",";
                    }
                }
                if (ids.length > 0)
                    ids = ids.substr(0, ids.length - 1);
                return ids;
            }
 
            $(".check-all").change(function () {
                if (this.checked) {
                    $(".check-item").each(function () {
                        this.checked = true;
                    })
                }
                else {
                    $(".check-item").each(function () {
                        this.checked = false;
                    })
                }
            });
 
            $(".pl-del").click(function () {
                var ids = getCheckedItems();
                if (ids.length < 1) {
                    layer.msg("请选择栏目");
                    return;
                }
 
                app.deleteSpecial(ids, -1);
 
            });
 
 
            $(".pl-add-to-category").click(function () {
                var ids = getCheckedItems();
                if (ids.length < 1) {
                    layer.msg("请选择栏目");
                    return;
                }
                app.showCategorySelect(ids);
            });
 
 
        });
    </script>
 
</body>
 
</html>