(function(){
	var that=$.extend(true,{}, admin_module);
	// 后台文件夹安全提示
	M.component.modal_options['.admin-folder-safe-modal']={
		modalType:'centered',
		modalTitle:METLANG.help2,
		modalBodyclass:'text-center',
		modalBody:'<p class="text-danger">'+METLANG.tips8_v6+'！</p>'
		    +'<div>'
		        +'<button type="button" class="btn btn-default no-prompt" data-url="'+M.url.admin+'?n=index&c=index&a=do_no_prompt" data-dismiss="modal">'+METLANG.nohint+'</button>'
		        +'<a href="#/safe" class="btn btn-success ml-5 btn-adminfolder-change" title="'+METLANG.safety_efficiency+'">'+METLANG.tochange+'</a>'
		    +'</div>',
		modalRefresh:'one',
		modalFooterok:0
    };
	M.admin_folder_safe=parseInt(that.obj.find('[name="admin_folder_safe"]').val());
	if(!M.admin_folder_safe){
		that.obj.find('[name="admin_folder_safe"]').click();
		$('.admin-folder-safe-modal .no-prompt').click(function(event) {
			 metui.ajax({
	            url: $(this).data('url')
	        });
		});
		$('.admin-folder-safe-modal .btn-adminfolder-change').click(function(event) {
			$('.admin-folder-safe-modal').modal('hide');
		});
	}
	var $home_app_list=that.obj.find('.home-app-list'),
		$home_news_list=that.obj.find('.home-news-list');
	// 推荐应用
	if($home_app_list.length){
		metui.ajax({
			url:M.url.api+'n=platform&c=platform&a=dotable_applist_json&type=dlist',
			type:'GET',
			dataType:'jsonp'
		},function(result){
			var html='';
			$.each(result, function(index, val) {
				var url='https://www.metinfo.cn/appstore/app'+val.id+'.html';
				html+='<div class="col-12 col-sm-6 col-md-4 py-2 list-group-item-action">'
					+'<div class="media">'
						+'<a href="'+url+'" target="_blank" class="mr-3">'
							+'<img class="media-object" src="'+val.icon+'" width="80">'
						+'</a>'
						+'<div class="media-body">'
							+'<a href="'+url+'" target="_blank">'
								+'<h4 class="mt-0 text-dark h6">'+val.appname+'</h4>'
								+'<div class="text-grey">'+val.info+'</div>'
							+'</a>'
						+'</div>'
					+'</div>'
				+'</div>';
			});
			$home_app_list.html(html);
		});
	}
	// MetInfo 新闻
	if($home_news_list.length){
		metui.ajax({
			url:$home_news_list.data('url'),
			type:'GET',
			dataType:'jsonp',
			jsonp: 'jsoncallback'
		},function(result){
			$home_news_list.html(result.msg).find('ul').addClass('list-unstyled mb-0').find('li').addClass('my-2').find('span').addClass('float-right text-grey');
			$home_news_list.find('li a').addClass('text-content');
		});
	}
})();