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
<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>分区Banner设置</title>
        <link href="css/bootstrap.min.css" rel="stylesheet">
        <link href="css/maincontent.css" rel="stylesheet">
        <link href="css/tablestyle.css" rel="stylesheet">
        <style>
            .form-group {
                margin-bottom: 30px;
            }
            
            .checkbox input[type=checkbox] {
                top: 6px;
            }
            
            #container-video {
                display: block;
            }
            
            #container-web {
                display: none;
            }
            
            #container-special {
                display: none;
            }
            
            #dialog-chooselink {
                padding: 20px;
            }
            
            #dialog-chooselink select {
                width: 100px;
            }
            
            #dialog-chooselink label {
                display: inline;
            }
            
            #dialog-chooselink input[type=text] {
                display: inline;
                width: 500px;
            }
            
            #dialog-chooselink ul {
                display: block;
                list-style: none;
            }
            
            #dialog-chooselink ul li {
                display: inline;
                list-style: none;
                width: 33%;
                float: left;
            }
            
            #dialog-chooselink input[type=radio] {
                width: 20px;
                height: 20px;
            }
            
            #dialog-chooselink .search-result {
                height: 630px;
                overflow-y: scroll;
            }
        </style>
    </head>
 
    <body>
        <nav class="navbar navbar-default navbar-fixed-top">
        </nav>
        <div id="mainbody">
            <div id="sidebar">
                <dl>
                </dl>
            </div>
            <div id="neirong">
                <div class="erjidh">
                    <ol class="breadcrumb">
                        <li>
                            <a href="#">分区Banner设置</a>
                        </li>
                    </ol>
                </div>
                <form class="form-horizontal">
                    <div class="form-group">
                        <label for="input1" class="changdu1 control-label">图片</label>
                        <div class="col-sm-7">
                            <img id="img" src="#" style="width: 234px; height: 125px;"/>
                            <input type="text" id="input1" class="form-control" value="" />
                        </div>
                    </div>
 
                    <div class="form-group">
                        <label for="input2" class="changdu1 control-label">排序值</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" id="orderby" placeholder="排序值">
                        </div>
                    </div>
 
                    <div class="form-group">
                        <label for="input3" class="changdu1 control-label">简要介绍</label>
                        <div class="col-sm-7">
                            <input type="text" class="form-control" id="desc" placeholder="">
                        </div>
                    </div>
                    
                    <div class="form-group">
                        <label for="input3" class="changdu1 control-label">视频分类</label>
                        <div class="col-sm-7">
                            <select id="classtype">
                                <option style="display: none;"></option>
                            </select>
                        </div>
                    </div>
 
                    <div class="form-group">
                        <label for="input4" class="changdu1 control-label">视频</label>
                        <div class="col-sm-7">
                            <label id="jump-detail"></label>
                            <input type="hidden" id="linkType" />
                            <input type="hidden" id="linkValue" />
                            <input type="text" readonly="true" id="videoSelect"/>
                            <a href="javascript:void(0)" class="btn btn-info" id="choose-link">选择</a>
                        </div>
                    </div>
 
                    <div class="form-group">
                        <label for="input5" class="changdu1 control-label">备注</label>
                        <div class="col-sm-7">
                            <textarea class="form-control" id="beizhu"></textarea>
                        </div>
                    </div>
 
                    <div class="button0">
                        <div class="button">
                            <button type="button" id="save" class="btn btn-primary save">保存</button>
                        </div>
                        <div class="button">
                            <input type="reset" class="btn btn-default" value="重置" />
                        </div>
                    </div>
                </form>
 
            </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">
                            <option value="1">视频</option>
                            <option value="2" style="display: none;">网页</option>
                            <option value="3" style="display: none;">合集</option>
                        </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 id="container-web">
                            <label>网页链接:</label>
                            <input type="text" class="form-control" />
                        </div>
                        <!--合集选择 -->
                        <div id="container-special">
                            <label>合集列表</label>
                            <ul>
                                <li>
                                    <div class="checkbox"><label><input type="checkbox" value="46" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;布丸影视大全Web1</label></div>
                                </li>
                                <li>
                                    <div class="checkbox"><label><input type="checkbox" value="46" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;布丸影视大全Web2</label></div>
                                </li>
 
                            </ul>
 
                        </div>
                    </div>
 
                </div>
 
                <div style="float: right;">
                    <button class="btn btn-info sure">确定</button>
                    <button class="btn btn-default cancel">取消</button>
                </div>
 
            </div>
 
        </div>
 
        <script src="js/jquery-1.9.1.min.js"></script>
        <script src="js/bootstrap.min.js"></script>
        <script src="js/nav.js"></script>
        <script src="js/common.js"></script>
        <script src="layer/layer.js"></script>
        
        <script>
            $(function(){
                $.post("api/class/getAllFirstClass", { 'pid': 0 }, function(data) {
                    if(data.code == 0) {
                        var alldata = data.data;
                        var selectType = $("#classtype");
                        for(var edata in alldata) {
                            selectType.append("<option value='" + alldata[edata].id + "'>" + alldata[edata].name + "</option>");
                        }
                    }
                }, 'json');
                
            var url = window.location.href;
            var key = "key";
            var id = getArgsFromHref(url,key);
            $.post("api/class/getCategoryRecommendVideo", { 'id': id }, function(data) {
                    if(data.code == 0) {
                        var srcPath = data.crv.picture; //图片路径
                        var orderby = data.crv.orderby; //排序
                        var desc = data.crv.desc; //简介
                        var beizhu = data.crv.beizhu; //备注
                        var videoType = data.crv.videoType.id; //视频类型id
                        var vid = data.crv.videoInfo.id; //视频ID
                        var name = data.crv.videoInfo.name; //视频名称
                        $("#img").attr("src",srcPath);
                        $("#img + input").val(srcPath);
                        $("#orderby").val(orderby);
                        $("#desc").val(desc);
                        $("#beizhu").val(beizhu);
                        $("#videoSelect").val(vid+" "+name);
                        $("#videoSelect").attr("key",vid);
                        $("#classtype > option[value='"+videoType+"']").attr("selected","selected");
                    }
                }, 'json');
                
                $("#choose-link").click(function() {
                    index = layer.open({
                        type: 1,
                        title: '链接选择',
                        shadeClose: true,
                        shade: 0.8,
                        area: ['1000px', '800px'],
                        content: $("#dialog-chooselink")
                    });
                });    
                
                //搜索点击
                $("#container-video .search button").click(function() {
                    var key = $("#container-video .search input").val();
                    var index = layer.load(0, {
                        'shade': false
                    });
                    $.post('/BuWan/admin/new/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(video) {
                                html += "<tr><td>" + video.id;
                                html += "</td><td>" + video.name + "</td><td><img style='width: 80px;' src=" + video.picture + "> </td><td>" + (video.show == 1 ? '显示' : '不显示') + "</td>";
                                html += "<td><input type='radio' name='choose-video' key=" + video.id + " value='"+video.name+"'></td></tr>";
                            });
                            $(".search-result table tbody").html(html);
                        }
 
                    }, 'json');
                });
                
                $("#dialog-chooselink .sure").click(function() {
                    var type = $("#dialog-chooselink select").eq(0).val();
                    var value;
                    if(type == 1) {
                        var videoid = $('#dialog-chooselink .search-result input[name="choose-video"]:checked').attr("key");
                        var name = $('#dialog-chooselink .search-result input[name="choose-video"]:checked').val();
                        console.log(videoid);
                        if(videoid == undefined || videoid == null) {
                            layer.msg("请选择视频");
                            return;
                        }
                        value = videoid;
                        $("#videoSelect").val(videoid+" "+name);
                        $("#videoSelect").attr("key",videoid);
                    }
 
                    $("#linkType").val(type);
                    $("#linkValue").val(value);
                    layer.close(index);
 
                });
                
                $("#dialog-chooselink .cancel").click(function() {
                    layer.close(index);
                });
                
                $("#save").click(function(){
                    var imgPath = $("#img + input").val(); //图片路径
                    var orderby = $("#orderby").val(); //排序值
                    var desc = $("#desc").val(); //简介
                    var beizhu = $("#beizhu").val(); //备注
                    var vid = $("#videoSelect").attr("key"); //所选视频ID
                    var videoType = $("#classtype > option:selected").val(); //视频类型
                    var reg = new RegExp("^[0-9]*$");
                    if(!reg.test(orderby)){
                        layer.msg("排序值只能为正整数!");
                        return;
                    }
                    $.post('api/class/setCategoryRecommendVideo', {
                        'id': id , "beizhu":beizhu , "desc":desc , "orderby":orderby , "picture":imgPath , "videoid":vid ,"videotype":videoType 
                    }, function(data) {
                        if(data == "yes") {
                            layer.alert('保存成功!', {
                              icon: 1,
                              skin: 'layer-ext-seaing' 
                    })
                        }
                    }, 'text');
                });
                
                $("#input1").bind("focusout",function(){
                    $("#img").attr("src",$(this).val());
                });
                
            });
            
        </script>
        
        <script>
        
        function getArgsFromHref(sHref, sArgName){
          var args    = sHref.split("?");
          var retval = "";
        
          if(args[0] == sHref) /*参数为空*/
          {
               return retval; /*无需做任何处理*/
          }  
          var str = args[1];
          args = str.split("&");
          for(var i = 0; i < args.length; i ++)
          {
              str = args[i];
              var arg = str.split("=");
              if(arg.length <= 1) continue;
              if(arg[0] == sArgName) retval = arg[1]; 
          }
          return retval;
        }
        </script>
        
        
 
    </body>
 
</html>