var lvid = getParameter('lvid');
var sign = getParameter('sign');
var type = Number($('body').attr('type'));
var printDate = {
	lvid:lvid,
	sign:sign,
	noticemode:type,
	pageindex:1,
	pagesize:20
}

function goPage(num) {
   printDate['pageindex'] = num ++ ;
   verifyNotice();
}
function verifyNotice(){
	var html = '';
	$.ajax({
		url:requestUrlMap['noticeList']['url'],
		data:printDate,
		dataType:'jsonp',
		success:function(data){
			if (data.errorid != 0) {
				return;
			}
			if (data.zongcount == 0) {
				$('.cont').addClass('nothingbg');
				return;
			}
			$('.cont').removeClass('nothingbg');
			var pageTotal = Math.ceil(data.zongcount / 20);
			var json = data.noticelist.collearray;
			var msgObj='',tip;
			var userid = data.loginuserid;
			for(var i = 0;i<json.length;i++){
				msgObj = json[i];
				var user = msgObj.user;
				var userSend = msgObj.user;
				var notice = json[i].notice;
				var cooperate = json[i].cooperate;
				var time = $.formatDateStyle3(new Date(json[i].notice.createtime * 1000));
				html += '<li>';
				html += '<dt class="news_left clearfix">';
				html += 	'<p class="paper">';
				var txt='';
				var status;
				var noticeType = notice.noticetype;
				var projecttype = cooperate.projecttype;
				var noticeTxt = '';
				if(noticeType > 0){
					noticeTxt = notice.verifymsg;
				}else{
					switch (projecttype){
						case 0:
						if(cooperate.transcodestatus == 1){
							noticeTxt = '转码成功'
						}else if(cooperate.transcodestatus == 2){
							noticeTxt = '转码失败&nbsp;&nbsp;&nbsp;'+cooperate.errmsg
						}
						break;
						case 1:
						noticeTxt = '上传项目';
						break;
						case 2:
						noticeTxt = '删除项目';
						break;
						case 3:
						noticeTxt = '新增硫酸纸';
						break;
						case 4:
						noticeTxt = '更新硫酸纸';
						break;
						case 5:
						noticeTxt = '删除硫酸纸';
						break;
					}
				}
				if(cooperate.projectType == 1){
					txt = '三维模型：'
				}
				var name = cooperate.cloudgroupname ? cooperate.cloudgroupname : '';
				var proName = cooperate.projectname ? cooperate.projectname : '';
				html += 		'<a  class="col" onclick="lookGroupView('+cooperate.groupid+')" href="javascript:">'+name+'('+cooperate.groupid+')</a><b>&nbsp;&nbsp;&nbsp;&nbsp;'+txt+'</b><a href="javascript:">'+proName+'</a>';
				html += 	'</p><p class="time">'+time+'</p></dt>';
				html += '<dd>';
				html += '<span class="file">'+noticeTxt+'</span>';
				html += '</dd>';
				html += '</li>';
			}
			$('.news').html(html)
			printPage(pageTotal);
		}
	})
} 
function lookGroupView(groupid) {
	var params = "{command:3002,params:{groupid:" + groupid + "}}";
	sendCommand(params);
}; 
$(document).ready(function(){
	verifyNotice();
})