|  |  | 
 |  |  |                                             </select> | 
 |  |  |                                         </div> | 
 |  |  |                                     </div> | 
 |  |  |  | 
 |  |  |                                     <div class="layui-inline"> | 
 |  |  |                                         <label class="layui-form-label layui-form-label-sm">是否会员</label> | 
 |  |  |                                         <div class="layui-input-inline"> | 
 |  |  |                                             <select name="isUp"> | 
 |  |  |                                                 <option value=""></option> | 
 |  |  |                                                 <option value="1">免费</option> | 
 |  |  |                                                 <option value="2">会员</option> | 
 |  |  |                                             </select> | 
 |  |  |                                         </div> | 
 |  |  |                                     </div> | 
 |  |  |                                 </div> | 
 |  |  |                             </div> | 
 |  |  |                             <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area"> | 
 |  |  | 
 |  |  |         </div> | 
 |  |  |     </div> | 
 |  |  | </div> | 
 |  |  | <script type="text/html" id="user-status"> | 
 |  |  | <style> | 
 |  |  |     .layui-table-cell { | 
 |  |  |         height: 100%; | 
 |  |  |     } | 
 |  |  | </style> | 
 |  |  | <script type="text/html" id="thumbFormat"> | 
 |  |  |     <img src="{{d.thumb}}" /> | 
 |  |  | </script> | 
 |  |  | <script type="text/html" id="is-up-format"> | 
 |  |  |     {{# | 
 |  |  |     var status = { | 
 |  |  |     1: {title: '有效', color: 'green'}, | 
 |  |  |     0: {title: '禁用', color: 'volcano'} | 
 |  |  |     }[d.status]; | 
 |  |  |     1: {title: '上架', color: 'green'}, | 
 |  |  |     2: {title: '下架', color: 'volcano'} | 
 |  |  |     }[d.isUp]; | 
 |  |  |     }} | 
 |  |  |     <span class="layui-badge febs-bg-{{status.color}}">{{ status.title }}</span> | 
 |  |  | </script> | 
 |  |  | <script type="text/html" id="user-sex"> | 
 |  |  | <script type="text/html" id="is-free-format"> | 
 |  |  |     {{# | 
 |  |  |     var sex = { | 
 |  |  |     2: {title: '保密'}, | 
 |  |  |     1: {title: '女'}, | 
 |  |  |     0: {title: '男'} | 
 |  |  |     }[d.sex]; | 
 |  |  |     var free = { | 
 |  |  |     2: {title: '会员'}, | 
 |  |  |     1: {title: '免费'} | 
 |  |  |     }[d.isFree]; | 
 |  |  |     }} | 
 |  |  |     <span>{{ sex.title }}</span> | 
 |  |  |     <span>{{ free.title }}</span> | 
 |  |  | </script> | 
 |  |  | <script type="text/html" id="user-option"> | 
 |  |  |     <span shiro:lacksPermission="user:view,user:update,user:delete"> | 
 |  |  |     <span shiro:lacksPermission="video:view,video:update,video:delete"> | 
 |  |  |         <span class="layui-badge-dot febs-bg-orange"></span> 无权限 | 
 |  |  |     </span> | 
 |  |  |     <a lay-event="edit" shiro:hasPermission="user:update"><i | 
 |  |  |     {{# if(d.isUp == 1) { }} | 
 |  |  |     <button lay-event="isUp" type="button" class="layui-btn layui-btn-xs layui-btn-danger isUp">下架</button> | 
 |  |  |     {{# } else { }} | 
 |  |  |     <button lay-event="isUp" type="button" class="layui-btn layui-btn-xs layui-btn-normal isUp">上架</button> | 
 |  |  |     {{# } }} | 
 |  |  |     <a lay-event="edit" shiro:hasPermission="video:update"><i | 
 |  |  |             class="layui-icon febs-edit-area febs-blue"></i></a> | 
 |  |  |     <a lay-event="del" shiro:hasPermission="user:delete"><i class="layui-icon febs-edit-area febs-red"></i></a> | 
 |  |  |     <a lay-event="del" shiro:hasPermission="video:delete"><i class="layui-icon febs-edit-area febs-red"></i></a> | 
 |  |  | </script> | 
 |  |  | <script data-th-inline="none" type="text/javascript"> | 
 |  |  |     layui.use(['dropdown', 'jquery', 'laydate', 'form', 'table', 'febs', 'treeSelect'], function () { | 
 |  |  | 
 |  |  |             click: function (name, elem, event) { | 
 |  |  |                 var checkStatus = table.checkStatus('videoTable'); | 
 |  |  |                 if (name === 'add') { | 
 |  |  |                     febs.modal.open('新增用户', 'system/user/add', { | 
 |  |  |                     febs.modal.view('新增视频', 'video/add', { | 
 |  |  |                         btn: ['提交', '重置'], | 
 |  |  |                         area: $(window).width() <= 750 ? '95%' : '50%', | 
 |  |  |                         offset: '30px', | 
 |  |  |                         area: ['100%', '100%'], | 
 |  |  |                         yes: function (index, layero) { | 
 |  |  |                             $('#video-add').find('#submit').trigger('click'); | 
 |  |  |                         }, | 
 |  |  | 
 |  |  |                 } | 
 |  |  |                 if (name === 'delete') { | 
 |  |  |                     if (!checkStatus.data.length) { | 
 |  |  |                         febs.alert.warn('请选择需要删除的用户'); | 
 |  |  |                         febs.alert.warn('请选择需要删除的视频'); | 
 |  |  |                     } else { | 
 |  |  |                         febs.modal.confirm('删除用户', '确定删除该用户?', function () { | 
 |  |  |                         febs.modal.confirm('删除视频', '确定删除该视频?', function () { | 
 |  |  |                             var userIds = []; | 
 |  |  |                             layui.each(checkStatus.data, function (key, item) { | 
 |  |  |                                 userIds.push(item.userId) | 
 |  |  | 
 |  |  |             }, | 
 |  |  |             options: [{ | 
 |  |  |                 name: 'add', | 
 |  |  |                 title: '新增用户', | 
 |  |  |                 title: '新增视频', | 
 |  |  |                 perms: 'user:add' | 
 |  |  |             }, { | 
 |  |  |                 name: 'delete', | 
 |  |  |                 title: '删除用户', | 
 |  |  |                 title: '删除视频', | 
 |  |  |                 perms: 'user:delete' | 
 |  |  |             }] | 
 |  |  |         }); | 
 |  |  | 
 |  |  |         table.on('tool(videoTable)', function (obj) { | 
 |  |  |             var data = obj.data, | 
 |  |  |                 layEvent = obj.event; | 
 |  |  |             if (layEvent === 'detail') { | 
 |  |  |                 febs.modal.view('用户信息', 'system/user/detail/' + data.name, { | 
 |  |  |                     area: $(window).width() <= 750 ? '95%' : '660px' | 
 |  |  |                 }); | 
 |  |  |             } | 
 |  |  |             if (layEvent === 'del') { | 
 |  |  |                 febs.modal.confirm('删除用户', '确定删除该用户?', function () { | 
 |  |  |                 febs.modal.confirm('删除视频', '确定删除该视频?', function () { | 
 |  |  |                     deleteUsers(data.userId); | 
 |  |  |                 }); | 
 |  |  |             } | 
 |  |  |             if (layEvent === 'edit') { | 
 |  |  |                 febs.modal.open('修改用户', 'system/user/update/' + data.name, { | 
 |  |  |                     area: $(window).width() <= 750 ? '90%' : '50%', | 
 |  |  |                     offset: '30px', | 
 |  |  |                 febs.modal.open('修改视频', 'video/update/' + data.id, { | 
 |  |  |                     area: ['100%', '100%'], | 
 |  |  |                     btn: ['提交', '取消'], | 
 |  |  |                     yes: function (index, layero) { | 
 |  |  |                         $('#user-update').find('#submit').trigger('click'); | 
 |  |  |                         $('#video-update').find('#submit').trigger('click'); | 
 |  |  |                     }, | 
 |  |  |                     btn2: function () { | 
 |  |  |                         layer.closeAll(); | 
 |  |  |                     } | 
 |  |  |                 }); | 
 |  |  |             } | 
 |  |  |             if (layEvent === 'isUp') { | 
 |  |  |                 var text; | 
 |  |  |                 if (data.isUp == 1) { | 
 |  |  |                     text = "下架"; | 
 |  |  |                 } else { | 
 |  |  |                     text = "上架"; | 
 |  |  |                 } | 
 |  |  |                 febs.modal.confirm('是否' + text + "该视频", '确定' + text + '该视频?', function () { | 
 |  |  |                     febs.post(ctx + 'video/video/changeIsUp/' + data.id, null, function () { | 
 |  |  |                         febs.alert.success(text + '视频成功'); | 
 |  |  |                         $query.click(); | 
 |  |  |                     }); | 
 |  |  |                 }); | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  | 
 |  |  |             tableIns = febs.table.init({ | 
 |  |  |                 elem: $view.find('table'), | 
 |  |  |                 id: 'videoTable', | 
 |  |  |                 url: ctx + 'user/list', | 
 |  |  |                 url: ctx + 'video/video/list', | 
 |  |  |                 cols: [[ | 
 |  |  |                     {type: 'checkbox'}, | 
 |  |  |                     {field: 'name', title: '用户名', minWidth: 100}, | 
 |  |  |                     {title: '性别', templet: '#user-sex'}, | 
 |  |  |                     {field: 'deptName', title: '部门'}, | 
 |  |  |                     {field: 'mobile', title: '手机', minWidth: 165}, | 
 |  |  |                     {field: 'email', title: '邮箱', minWidth: 180}, | 
 |  |  |                     {title: '状态', templet: '#user-status'}, | 
 |  |  |                     {field: 'createTime', title: '创建时间', minWidth: 180, sort: true}, | 
 |  |  |                     {title: '操作', toolbar: '#user-option', minWidth: 140} | 
 |  |  |                     {field: 'title', title: '视频名', minWidth: 100}, | 
 |  |  |                     {templet: '#thumbFormat', title: '缩略图'}, | 
 |  |  |                     {title: '是否上架', templet: '#is-up-format'}, | 
 |  |  |                     {title: '会员', templet: '#is-free-format'}, | 
 |  |  |                     {field: 'playCnt', title: '播放量'}, | 
 |  |  |                     {field: 'collectCnt', title: '收藏量'}, | 
 |  |  |                     {field: 'starCnt', title: '点赞量'}, | 
 |  |  |                     {field: 'createdTime', title: '创建时间', minWidth: 180}, | 
 |  |  |                     {title: '操作', toolbar: '#user-option'} | 
 |  |  |                 ]] | 
 |  |  |             }); | 
 |  |  |         } | 
 |  |  | 
 |  |  |             return { | 
 |  |  |                 name: $searchForm.find('input[name="name"]').val().trim(), | 
 |  |  |                 isUp: $searchForm.find("select[name='isUp']").val(), | 
 |  |  |                 isFree: $searchForm.find("select[name='isFree']").val(), | 
 |  |  |                 invalidate_ie_cache: new Date() | 
 |  |  |             }; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         function deleteUsers(userIds) { | 
 |  |  |             var currentUserId = currentUser.userId + ''; | 
 |  |  |             if (('' + userIds).split(',').indexOf(currentUserId) !== -1) { | 
 |  |  |                 febs.alert.warn('所选用户包含当前登录用户,无法删除'); | 
 |  |  |                 return; | 
 |  |  |             } | 
 |  |  |             febs.get(ctx + 'user/delete/' + userIds, null, function () { | 
 |  |  |                 febs.alert.success('删除用户成功'); | 
 |  |  |         function deleteUsers(ids) { | 
 |  |  |             febs.get(ctx + 'video/delete/' + ids, null, function () { | 
 |  |  |                 febs.alert.success('删除视频成功'); | 
 |  |  |                 $query.click(); | 
 |  |  |             }); | 
 |  |  |         } |