123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- layui.use([ 'laypage', 'layer', 'table', 'element','form','upload'], function(){
- var laypage = layui.laypage
- ,$ = layui.jquery
- ,layer = layui.layer
- ,table = layui.table
- ,element = layui.element
- ,form = layui.form
- ,upload = layui.upload;
- var tableIds = 'videolist';
-
- var indexTtable=table.render({
- elem: '#'+tableIds
- ,url: '/dictionaryb/videohomeform'
- ,where:{token:csrfToken}
- ,method:'post'
- ,page: true
- ,text:'数据加载中'
- ,id:'tablerReload'
- ,cols: [[
-
- {type:'numbers'},
- {field: 'type_name', title: '分类名称', align:'center'},
- {field: 'is_recommend', title: '是否推荐',width:150, align:'center'}
- ,{field: 'create_at', title: '添加时间',width:200, align:'center'}
- ,{fixed: 'right',title:'操作', width: 165, align:'center', toolbar: '#operate'}
- ]]
- });
- indexTtable.reload('tablerReload');
-
- table.on('tool('+tableIds+')', function(obj){
- var layEvent = obj.event,
- data = obj.data;
- if(layEvent === 'edit'){
- layer.open({
- type: 2,
- title: '修改视频分类',
- area: ['600px','550px'],
- anim: 2,
- content: '/dictionaryb/videoedit?id='+data.id
- });
- } else if(layEvent === 'del') {
- layer.confirm('您确定要删除吗?',{ btn: ['确定', '取消']},function () {
- $.post('/dictionaryb/videodel',{'id':data.id},function (data) {
- if(data.code == 200)
- {
- layer.msg(data.msg);
- table.reload('tablerReload');
- } else if(data.code == 300 ) {
- layer.msg(data.msg);
- }
- })
- })
- }
- });
- var $ = layui.$, active = {
- addData: function(){
- layer.open({
- type: 2,
- title: '添加视频类目',
- shade: [0],
- area: ['600px','550px'],
- content: '/dictionaryb/videoadd'
- });
- }
- };
- $('.demoTable .layui-btn').on('click', function(){
- var type = $(this).data('type');
- active[type] ? active[type].call(this) : '';
- });
-
- form.on('submit(save_video_type_name)', function(data){
- $.post('/dictionaryb/videoeditform',{'data':data.field},function (data) {
- if(data.code == 200)
- {
- layer.msg(data.msg);
- parent.layui.table.reload('tablerReload');
- } else if(data.code == 300 ) {
- layer.msg(data.msg);
- layer.msg(ReturnInfo(data.data),{icon:5});
- }
- })
- return false;
- });
-
- form.on('submit(add_video_type_name)', function(data){
- $.post('/dictionaryb/videoaddform',{'data':data.field},function (data) {
- if(data.code == 200)
- {
- layer.msg(data.msg);
- parent.layui.table.reload('tablerReload');
- } else if(data.code == 300 ) {
- layer.msg(data.msg);
- layer.msg(ReturnInfo(data.data),{icon:5});
- }
- })
- return false;
- });
- });
|