|
|
/*
|
|
|
|--------------------------------------------------------------------------
|
|
|
| SkyCaiji (蓝天采集器)
|
|
|
|--------------------------------------------------------------------------
|
|
|
| Copyright (c) 2018 https://www.skycaiji.com All rights reserved.
|
|
|
|--------------------------------------------------------------------------
|
|
|
| 使用协议 https://www.skycaiji.com/licenses
|
|
|
|--------------------------------------------------------------------------
|
|
|
*/
|
|
|
'use strict';function MyStoreClass(){}
|
|
|
MyStoreClass.prototype={constructor:MyStoreClass,init_rules:function(){var $_o=this;$('table.datatable thead th[data-order]').bind('click',function(){var order=$(this).attr('data-order');if(!order){return!1}
|
|
|
var className=$(this).attr('class');var sort='desc';if(className=='sorting_desc'){sort='asc'}
|
|
|
window.location.href=ulink('Mystore/rule?order='+order+'&sort='+sort);return!1});$('#deleteall').bind('click',function(){var obj=$(this);confirmRight(window.tpl_lang.confirm_delete,function(){ajaxOpen({type:"POST",url:ulink('Mystore/ruleOp?op=deleteall'),dataType:"json",data:$('#form_list').serialize(),success:function(data){data.code==1?toastr.success(data.msg):toastr.error(data.msg);setTimeout("window.location.reload();",2500)}})})});$('#list_table .delete').bind('click',function(){var obj=$(this);confirmRight(window.tpl_lang.confirm_delete,function(){ajaxOpen({type:"GET",url:obj.attr('url'),dataType:"json",success:function(data){data.code==1?toastr.success(data.msg):toastr.error(data.msg);if(data.code==1){obj.parents('tr').eq(0).remove()}}})})});$('#list_table').on('click','.store-detail',function(){openStoreUrl($(this).attr('data-url'))});$('#check_update').bind('click',function(){$_o.check_rules_update()});$('#auto_check').bind('click',function(){var auto=$(this).is(':checked')?1:0;ajaxOpen({type:"GET",url:ulink('Mystore/ruleOp?op=auto_check&auto='+auto),dataType:"json",success:function(data){data.code==1?toastr.success(data.msg):toastr.error(data.msg)}})});if($('#auto_check').is(':checked')){$_o.check_rules_update()}},check_rules_update:function(){var ids=new Array();$('#list_table').find('tr[data-rule-id]').each(function(){ids.push($(this).attr('data-rule-id'))});if(ids.length>0){$('.nav-check-update #check_update').html('<div class="loading-sm"></div> 正在检测更新');$('.store-detail').find('.new-version').remove();ajaxOpen({type:"get",url:ulink('Mystore/ruleOp?op=check_store_update'),dataType:"json",async:!0,data:{ids:ids},success:function(data){if(data.code==1){for(var id in data.data){var storeDetail=$('tr[data-rule-id="'+data.data[id]+'"]').find('.store-detail');storeDetail.append('<span class="new-version">新</span>')}}},complete:function(){$('.nav-check-update #check_update').html('检测更新')}})}},init_releaseapp:function(){var $_o=this;$('table.datatable thead th[data-order]').bind('click',function(){var order=$(this).attr('data-order');if(!order){return!1}
|
|
|
var className=$(this).attr('class');var sort='desc';if(className=='sorting_desc'){sort='asc'}
|
|
|
window.location.href=ulink('Mystore/releaseApp?order='+order+'&sort='+sort);return!1});$('#deleteall').bind('click',function(){var obj=$(this);confirmRight(window.tpl_lang.confirm_delete,function(){ajaxOpen({type:"POST",url:ulink('Mystore/releaseAppOp?op=deleteall'),dataType:"json",data:$('#form_list').serialize(),success:function(data){data.code==1?toastr.success(data.msg):toastr.error(data.msg);setTimeout("window.location.reload();",2500)}})})});$('#list_table .delete').bind('click',function(){var obj=$(this);confirmRight(window.tpl_lang.confirm_delete,function(){ajaxOpen({type:"GET",url:obj.attr('url'),dataType:"json",success:function(data){data.code==1?toastr.success(data.msg):toastr.error(data.msg);if(data.code==1){obj.parents('tr').eq(0).remove()}}})})});$('#list_table').on('click','.store-detail',function(){openStoreUrl($(this).attr('data-url'))});$('#check_update').bind('click',function(){$_o.check_releaseapp_update()});$('#auto_check').bind('click',function(){var auto=$(this).is(':checked')?1:0;ajaxOpen({type:"GET",url:ulink('Mystore/releaseAppOp?op=auto_check&auto='+auto),dataType:"json",success:function(data){data.code==1?toastr.success(data.msg):toastr.error(data.msg)}})});if($('#auto_check').is(':checked')){$_o.check_releaseapp_update()}},check_releaseapp_update:function(){var ids=new Array();$('#list_table').find('tr[data-app-id]').each(function(){ids.push($(this).attr('data-app-id'))});if(ids.length>0){$('.nav-check-update #check_update').html('<div class="loading-sm"></div> 正在检测更新');$('.store-detail').find('.new-version').remove();ajaxOpen({type:"get",url:ulink('Mystore/releaseAppOp?op=check_store_update'),dataType:"json",async:!0,data:{ids:ids},success:function(data){if(data.code==1){for(var id in data.data){var storeDetail=$('tr[data-app-id="'+data.data[id]+'"]').find('.store-detail');storeDetail.append('<span class="new-version">新</span>')}}},complete:function(){$('.nav-check-update #check_update').html('检测更新')}})}},init_funcapp:function(){var $_o=this;$('table.datatable thead th[data-order]').bind('click',function(){var order=$(this).attr('data-order');if(!order){return!1}
|
|
|
var className=$(this).attr('class');var sort='desc';if(className=='sorting_desc'){sort='asc'}
|
|
|
window.location.href=ulink('Mystore/funcApp?order='+order+'&sort='+sort);return!1});$('#deleteall').bind('click',function(){var obj=$(this);confirmRight(window.tpl_lang.confirm_delete,function(){ajaxOpen({type:"POST",url:ulink('Mystore/funcAppOp?op=deleteall'),dataType:"json",data:$('#form_list').serialize(),success:function(data){data.code==1?toastr.success(data.msg):toastr.error(data.msg);setTimeout("window.location.reload();",2500)}})})});$('#list_table .delete').bind('click',function(){var obj=$(this);var id=$(this).parents('tr[data-app-id]').attr('data-app-id');confirmRight(window.tpl_lang.confirm_delete,function(){ajaxOpen({type:"GET",url:ulink('Mystore/funcAppOp?op=delete'),dataType:"json",data:{id:id},success:function(data){data.code==1?toastr.success(data.msg):toastr.error(data.msg);if(data.code==1){obj.parents('tr').eq(0).remove()}}})})});$('#list_table .enable').bind('click',function(){var obj=$(this);var id=$(this).parents('tr[data-app-id]').attr('data-app-id');var enable=$(this).attr('data-val');enable=(enable==1)?0:1;ajaxOpen({type:'GET',url:ulink('Mystore/funcAppOp?op=enable'),dataType:'json',data:{id:id,enable:enable},success:function(data){if(data.code){obj.attr('data-val',enable?1:0);obj.text(enable?'已启用':'已禁用');obj.css('color',(enable?'green':'red'))}else{toastr.error(data.msg)}}})});$('#list_table .methods .dropdown-toggle').bind('click',function(){var obj=$(this);var id=$(this).parents('tr[data-app-id]').attr('data-app-id');var box=obj.parents('.methods');box.find('.dropdown-menu').html('<li style="padding-left:15px;"><div class="loading-sm"></div></li>');ajaxOpen({type:'GET',url:ulink('Mystore/funcAppOp?op=detail'),dataType:'json',data:{id:id},success:function(data){if(data.code&&data.data){var methods=data.data.methods;var html='';for(var m in methods){var mMethod=methods[m];mMethod=mMethod?mMethod:{};html+='<li><a href="javascript:;" data-func-method="'+m+'">'+m+':'+(mMethod.comment_cut?mMethod.comment_cut:'')+'</a></li>'}
|
|
|
if(!html){html='<li><a href="javascript:;">无方法</a></li>'}
|
|
|
box.find('.dropdown-menu').html(html);box.find('.dropdown-menu [data-func-method]').bind('click',function(){var funcMethod=$(this).attr('data-func-method');windowModal('方法:'+funcMethod,ulink('Mystore/funcAppOp?op=method&id=_id_&name=_name_',{'_id_':id,'_name_':funcMethod}),{lg:1})})}}})});$('#list_table').on('click','.store-detail',function(){openStoreUrl($(this).attr('data-url'))});$('#check_update').bind('click',function(){$_o.check_funcapp_update()});$('#auto_check').bind('click',function(){var auto=$(this).is(':checked')?1:0;ajaxOpen({type:"GET",url:ulink('Mystore/funcAppOp?op=auto_check&auto='+auto),dataType:"json",success:function(data){data.code==1?toastr.success(data.msg):toastr.error(data.msg)}})});if($('#auto_check').is(':checked')){$_o.check_funcapp_update()}},check_funcapp_update:function(){var ids=new Array();$('#list_table').find('tr[data-app-id]').each(function(){ids.push($(this).attr('data-app-id'))});if(ids.length>0){$('.nav-check-update #check_update').html('<div class="loading-sm"></div> 正在检测更新');$('.store-detail').find('.new-version').remove();ajaxOpen({type:"get",url:ulink('Mystore/funcAppOp?op=check_store_update'),dataType:"json",async:!0,data:{ids:ids},success:function(data){if(data.code==1){for(var id in data.data){var storeDetail=$('tr[data-app-id="'+data.data[id]+'"]').find('.store-detail');storeDetail.append('<span class="new-version">新</span>')}}},complete:function(){$('.nav-check-update #check_update').html('检测更新')}})}}}
|
|
|
var myStoreClass=new MyStoreClass() |