Browse Source

资源修改及失去联系人

jack 7 years ago
parent
commit
6bcbc8d929
2 changed files with 123 additions and 88 deletions
  1. 5 4
      cmp-portal/js/resourceIssue.js
  2. 118 84
      cmp-portal/js/resourceList.js

+ 5 - 4
cmp-portal/js/resourceIssue.js

532
	var osting=""
532
	var osting=""
533
	for(var i = 0; i < $res.length; i++) {
533
	for(var i = 0; i < $res.length; i++) {
534
		var img;
534
		var img;
535
		var styC="";
535
		//var styC="";
536
		var oClass = autho($res[i].authType, $res[i].orgAuth, $res[i].authStatus);
536
		var oClass = autho($res[i].authType, $res[i].orgAuth, $res[i].authStatus);
537
		var oTitle="";
537
		var oTitle="";
538
		if(!resourceId) {
538
		if(!resourceId) {
539
				if(i<5) {
539
				/*if(i<5) {
540
				styC="selectAdd";
540
				styC="selectAdd";
541
				oProfessor.push($res[i].id);
541
				oProfessor.push($res[i].id);
542
			}
542
			}*/
543
		}
543
		}
544
		
544
		
545
		if($res[i].title) {
545
		if($res[i].title) {
562
		oSt += '</p>'
562
		oSt += '</p>'
563
		oSt += '<p class="h2Font ellipsisSty">'+oTitle+'</p>'
563
		oSt += '<p class="h2Font ellipsisSty">'+oTitle+'</p>'
564
		oSt += '</div>'
564
		oSt += '</div>'
565
		oSt += '<div class="selectNull '+styC+'" flag=1></div>'
565
		oSt += '<div class="selectNull " flag=1></div>'
566
		oSt += '</li>'
566
		oSt += '</li>'
567
		osting+=oSt;
567
		osting+=oSt;
568
	}
568
	}
574
		var oSel=$(this).find(".selectAdd").length;
574
		var oSel=$(this).find(".selectAdd").length;
575
		var oId=$(this).attr("id");
575
		var oId=$(this).attr("id");
576
		$("#linkman").text("");
576
		$("#linkman").text("");
577
		
577
		if(oSel == 0) {
578
		if(oSel == 0) {
578
			if(userL == 5) {
579
			if(userL == 5) {
579
				$("#linkman").text("最多可选5个负责人");
580
				$("#linkman").text("最多可选5个负责人");

+ 118 - 84
cmp-portal/js/resourceList.js

1
$(document).ready(function(){
1
$(document).ready(function() {
2
	$(".onlogin .headnavbtn li").eq(0).addClass("navcurrent");
2
	$(".onlogin .headnavbtn li").eq(0).addClass("navcurrent");
3
	var orgId = $.cookie('orgId');
3
	var orgId = $.cookie('orgId');
4
	if(orgId == "" || orgId == null || orgId == "null"){
5
    	location.href = "cmp-settled-log.html";
6
    }
4
	if(orgId == "" || orgId == null || orgId == "null") {
5
		location.href = "cmp-settled-log.html";
6
	}
7
	var resourceId;
7
	var resourceId;
8
	/*资源列表查询*/
8
	/*资源列表查询*/
9
	function getRecourceMe(n,isbind,num) {
10
		var resourceNameVa=$("#resouceName").val();
11
		var $info={};
12
		$info.orgId=orgId;
13
		$info.pageSize=10;
14
		if(resourceNameVa !="") {
15
			$info.key=resourceNameVa;
9
	function getRecourceMe(n, isbind, num) {
10
		var resourceNameVa = $("#resouceName").val();
11
		var $info = {};
12
		$info.orgId = orgId;
13
		$info.pageSize = 10;
14
		if(resourceNameVa != "") {
15
			$info.key = resourceNameVa;
16
		}
16
		}
17
		$info.pageNo=n;
17
		$info.pageNo = n;
18
		$.ajax({
18
		$.ajax({
19
			"url": "/ajax/resource/pqForOrg",
19
			"url": "/ajax/resource/pqForOrg",
20
			"type": "GET",
20
			"type": "GET",
22
				console.log(data)
22
				console.log(data)
23
				if(data.success) {
23
				if(data.success) {
24
					$("#resourceList").html("");
24
					$("#resourceList").html("");
25
					if(num==1) {
26
						if(data.data.data.length==0) {
25
					if(num == 1) {
26
						if(data.data.data.length == 0) {
27
							$("#noresource").removeClass("displayNone");
27
							$("#noresource").removeClass("displayNone");
28
							$(".noContip").text("您还未发布任何资源");
28
							$(".noContip").text("您还未发布任何资源");
29
							return;
29
							return;
30
						}else{
30
						} else {
31
							$("#noresource").addClass("displayNone");
31
							$("#noresource").addClass("displayNone");
32
						}
32
						}
33
					}else{
34
						if(data.data.data.length==0) {
33
					} else {
34
						if(data.data.data.length == 0) {
35
							$("#noresource").removeClass("displayNone");
35
							$("#noresource").removeClass("displayNone");
36
							$(".noContip").text("没有符合该搜索条件的内容");
36
							$(".noContip").text("没有符合该搜索条件的内容");
37
							return;
37
							return;
38
						}else{
38
						} else {
39
							$("#noresource").addClass("displayNone");
39
							$("#noresource").addClass("displayNone");
40
						}
40
						}
41
					}
41
					}
42
					resourceHtml(data.data.data);
42
					resourceHtml(data.data.data);
43
					if(isbind == true) {
43
					if(isbind == true) {
44
								$(".tcdPageCode").createPage({
45
									pageCount: Math.ceil(data.data.total / data.data.pageSize),
46
									current: data.data.pageNo,
47
									backFn: function(p) {
48
										getRecourceMe(p,false);
49
									}
50
								});
44
						$(".tcdPageCode").createPage({
45
							pageCount: Math.ceil(data.data.total / data.data.pageSize),
46
							current: data.data.pageNo,
47
							backFn: function(p) {
48
								getRecourceMe(p, false);
51
							}
49
							}
50
						});
51
					}
52
				}
52
				}
53
			},
53
			},
54
			"data": $info,
54
			"data": $info,
58
			}
58
			}
59
		});
59
		});
60
	}
60
	}
61
	 getRecourceMe(1,true);
62
	 function resourceHtml($data) {
63
	 	for(var i=0;i<$data.length;i++) {
64
	 		var imgSrc="../images/default-resource.jpg";
65
	 		var oTime,pageview="",draftLable="",oHtml,oLi='';
66
	 		if($data[i].images.length) {
67
	 			imgSrc="/data/resource/"+$data[i].images[0].imageSrc
68
	 		}
69
	 		console.log($data[i].status)
70
	 		if($data[i].status==0) {
71
	 			oTime="修改于 "+TimeTr($data[i].modifyTime);
72
	 			draftLable='<span class="draftLable">草稿</span>';
73
	 			oHtml="resourceIssue.html";
74
	 			oLi="class='draftList'"
75
	 		}else{
76
	 			oTime="发布于 "+TimeTr($data[i].publishTime);
77
	 			pageview='<li><span>浏览量 '+$data[i].pageViews+'</span></li>';
78
	 			oHtml="../resourceShow.html"
79
	 		}
80
	 	var oStr='<li '+oLi+'>'+
81
				'<a href="'+oHtml+'?resourceId='+$data[i].resourceId+'" target="_blank">'+
82
					'<div class="madiaHead resouseHead" style="background-image: url('+imgSrc+');"></div>'	+						
83
						'<div class="madiaInfo">'+					
84
							'<p class="h1Font ellipsisSty">'+$data[i].resourceName+'</p>'+						
85
							'<ul class="h2Font clearfix">'+
86
								'<li><span>'+oTime+'</span></li>'+pageview+
87
							'</ul>'+draftLable+	
88
						'</div>'+
89
				'</a>'+
90
				'<ul class="madiaEdit">'+
91
					'<li><span class="deteleThis2" data-id="'+$data[i].resourceId+'"></span></li>'+
92
					'<li><span class="editThis" data-id="'+$data[i].resourceId+'"></span></li>'+
93
				'</ul>'+
94
			'</li>'	
95
			$("#resourceList").append(oStr);
96
	 	}
97
	 }
98
	 
61
	getRecourceMe(1, true);
62

63
	function resourceHtml($data) {
64
		for(var i = 0; i < $data.length; i++) {
65
			var imgSrc = "../images/default-resource.jpg";
66
			var oTime, pageview = "",
67
				draftLable = "",
68
				oHtml, oLi = '';
69
			if($data[i].images.length) {
70
				imgSrc = "/data/resource/" + $data[i].images[0].imageSrc
71
			}
72
			console.log($data[i].status)
73
			if($data[i].status == 0) {
74
				oTime = "修改于 " + TimeTr($data[i].modifyTime);
75
				draftLable = '<span class="draftLable">草稿</span>';
76
				oHtml = "resourceIssue.html";
77
				oLi = "class='draftList'"
78
			} else {
79
				oTime = "发布于 " + TimeTr($data[i].publishTime);
80
				pageview = '<li><span>浏览量 ' + $data[i].pageViews + '</span></li>';
81
				oHtml = "../resourceShow.html"
82
			}
83
			var oStr = '<li ' + oLi + '>' +
84
				'<a href="' + oHtml + '?resourceId=' + $data[i].resourceId + '" target="_blank">' +
85
				'<div class="madiaHead resouseHead" style="background-image: url(' + imgSrc + ');"></div>' +
86
				'<div class="madiaInfo">' +
87
				'<p class="h1Font ellipsisSty">' + $data[i].resourceName + '</p>' +
88
				'<ul class="h2Font clearfix">' +
89
				'<li><span>' + oTime + '</span></li>' + pageview + '<li><span id="oop" style="color:#e03b43;"></span></li>' +
90
				'</ul>' +
91
				'<p><span>' + draftLable + '</span><span class="crel" style="margin-left:10px"></span></p>' +
92
				'</div>' +
93
				'</a>' +
94
				'<ul class="madiaEdit">' +
95
				'<li><span class="deteleThis2" data-id="' + $data[i].resourceId + '"></span></li>' +
96
				'<li><span class="editThis" data-id="' + $data[i].resourceId + '"></span></li>' +
97
				'</ul>' +
98
				'</li>'
99
			var $os = $(oStr);
100
			$("#resourceList").append($os);
101
			if($data[i].status == 0) {
102
				resourecRel.call($os.find(".crel"), $data[i].resourceId);
103
			} else {
104
				resourecRel.call($os.find("#oop"), $data[i].resourceId);
105
			}
106
		}
107
	}
108
	/*判断资源是否设置了资源联系人*/
109
	function resourecRel(rsd) {
110
		$.ajax({
111
			"url": "/ajax/resource/qaLinkman",
112
			"type": "GET",
113
			"context": this,
114
			"success": function(data) {
115
				if(data.success) {
116
					var $data = data.data;
117
					if($data.length == 0) {
118
						this.text("未设置联系人");
119
					}
120
				}
121
			},
122
			"data": {
123
				"resourceId": rsd
124
			},
125
			dataType: "json",
126
			'error': function() {
127
				$.MsgBox.Alert('提示', '服务器连接超时!');
128
			}
129
		});
130
	}
99
	/*点击修改跳转修改页面*/
131
	/*点击修改跳转修改页面*/
100
	$("#resourceList").on("click",".editThis",function(){
101
		location.href="resourceIssue.html?resourceId="+$(this).attr("data-id")
132
	$("#resourceList").on("click", ".editThis", function() {
133
		location.href = "resourceIssue.html?resourceId=" + $(this).attr("data-id")
102
	})
134
	})
103
	/*点击删除跳转修改页面*/
135
	/*点击删除跳转修改页面*/
104
	$("#resourceList").on("click",".deteleThis2",function(){
105
		resourceId=$(this).attr("data-id");
106
		$.MsgBox.Confirm("提示", "确认删除该资源?",deleResource);
136
	$("#resourceList").on("click", ".deteleThis2", function() {
137
		resourceId = $(this).attr("data-id");
138
		$.MsgBox.Confirm("提示", "确认删除该资源?", deleResource);
107
	})
139
	})
108
	/*删除函数*/
140
	/*删除函数*/
109
	function deleResource() {
141
	function deleResource() {
110
			$.ajax({
111
					"url": "/ajax/resource/delete",
112
					"type": "POST",
113
					"success": function(data) {
114
						if(data.success) {	
115
							getRecourceMe(1,false);
116
						}
117
					},
118
					"data": {"resourceId":resourceId},
119
					"beforeSend": function() { /*console.log(this.data)*/ },
120
					"contentType": "application/x-www-form-urlencoded",
121
					dataType: "json"
122
				});
142
		$.ajax({
143
			"url": "/ajax/resource/delete",
144
			"type": "POST",
145
			"success": function(data) {
146
				if(data.success) {
147
					getRecourceMe(1, false);
148
				}
149
			},
150
			"data": {
151
				"resourceId": resourceId
152
			},
153
			"beforeSend": function() { /*console.log(this.data)*/ },
154
			"contentType": "application/x-www-form-urlencoded",
155
			dataType: "json"
156
		});
123
	}
157
	}
124
	/*输入资源名称限制字数*/
158
	/*输入资源名称限制字数*/
125
	$("#resouceName").bind({
159
	$("#resouceName").bind({
130
		}
164
		}
131
	});
165
	});
132
	/*点击搜索*/
166
	/*点击搜索*/
133
	$(".searchSpan").click(function(){
167
	$(".searchSpan").click(function() {
134
		$(".tcdPageCode").remove();
168
		$(".tcdPageCode").remove();
135
		$(".aboutRes").append('<div class="tcdPageCode"></div>');
169
		$(".aboutRes").append('<div class="tcdPageCode"></div>');
136
		getRecourceMe(1,true);
170
		getRecourceMe(1, true);
137
	})
171
	})
138
})
172
})