jack 7 years ago
parent
commit
b053e3f653
3 changed files with 183 additions and 69 deletions
  1. 1 1
      js/patentList.js
  2. 152 68
      js/patentShow.js
  3. 30 0
      patentShow.html

+ 1 - 1
js/patentList.js

@ -88,7 +88,7 @@ $(document).ready(function(){
88 88
	 }
89 89
	/*点击修改跳转修改页面*/
90 90
	$("#patentList").on("click",".editThis",function(){
91
		location.href="resourceIssue.html?resourceId="+$(this).attr("data-id")
91
		location.href="patentShow.html?patentId="+$(this).attr("data-id")+"&flag=1"
92 92
	})
93 93
	/*点击删除跳转修改页面*/
94 94
	$("#patentList").on("click",".deteleThis2",function(){

+ 152 - 68
js/patentShow.js

@ -1,6 +1,7 @@
1 1
$(document).ready(function() {
2 2
	function Patent() {
3 3
		this.init();
4
		this.flag = GetQueryString("flag");
4 5
	}
5 6
	Patent.prototype.init = function() {
6 7
		loginStatus();
@ -31,7 +32,7 @@ $(document).ready(function() {
31 32
		});
32 33
	}
33 34
	Patent.prototype.ajax = function(obj) {
34
		var $this=this;
35
		var $this = this;
35 36
		$.ajax({
36 37
			url: obj.url,
37 38
			data: obj.data,
@ -41,7 +42,7 @@ $(document).ready(function() {
41 42
			traditional: true,
42 43
			success: function(data) {
43 44
				if(data.success) {
44
					obj.Fun(data.data,$this);
45
					obj.Fun(data.data, $this);
45 46
				}
46 47
			},
47 48
			error: function() {
@ -53,12 +54,33 @@ $(document).ready(function() {
53 54
		$.MsgBox.Alert('提示', "服务器链接超时");
54 55
	}
55 56
	Patent.prototype.keyword = function($key) {
57
		console.log($key)
56 58
		for(var i in $key.split(",")) {
57
			$("#tagList").append("<li>" + $key.split(",")[i] + "<li>");
59
			if(this.flag == 1) {
60
				$("#paperSList").append("<li>" + $key.split(",")[i] + "<div class='closeThis'></div></li>");
61
			} else {
62
				$(".tagList").append("<li>" + $key.split(",")[i] + "</li>");
63
			}
64

58 65
		}
59 66
	}
60
	Patent.prototype.patentMess = function($data,$obj) {
67
	Patent.prototype.patentMess = function($data, $obj) {
61 68
		console.log($data);
69
		if($obj.flag == 1) {
70
			$(".advertItem,.tagList").hide();
71
			hotKey(".oinput", 10);
72
			if($data.keywords) {
73
				$obj.keyword($data.keywords);
74
			}
75
		} else {
76
			$(".oinput").parents(".form-item").hide();
77
			$(".conItem").hide();
78
			if($data.keywords) {
79
				$obj.keyword($data.keywords);
80
			} else {
81
				$(".tagList").hide();
82
			}
83
		}
62 84
		if($data.name) {
63 85
			$("#paperName").text($data.name);
64 86
		}
@ -79,21 +101,16 @@ $(document).ready(function() {
79 101
		if($data.summary) {
80 102
			$(".showCon").eq(5).text($data.summary);
81 103
		}
82
		if($data.keywords) {
83
			$obj.keyword($data.keywords);
84
		}else{
85
			$(".tagList").hide();
86
		}
87 104
		var weibotitle = $data.name;
88 105
		var weibourl = window.location.href;
89 106
		var weibopic = "http://" + window.location.host + "/images/default-resource.jpg";
90
		$("#weibo").attr("href","http://service.weibo.com/share/share.php?appkey=3677230589&title="+encodeURIComponent(weibotitle)+"&url="+encodeURIComponent(weibourl)+"&pic="+encodeURIComponent(weibopic)+"&content=utf-8"+"&ralateUid=6242830109&searchPic=false&style=simple");
107
		$("#weibo").attr("href", "http://service.weibo.com/share/share.php?appkey=3677230589&title=" + encodeURIComponent(weibotitle) + "&url=" + encodeURIComponent(weibourl) + "&pic=" + encodeURIComponent(weibopic) + "&content=utf-8" + "&ralateUid=6242830109&searchPic=false&style=simple");
91 108
	}
92
	Patent.prototype.patentAuth = function($data,$obj) {
109
	Patent.prototype.patentAuth = function($data, $obj) {
93 110
		console.log($data);
94
		if($data.length<4) {
111
		if($data.length < 4) {
95 112
			$(".lastBtn").hide();
96
		}else{
113
		} else {
97 114
			$(".lastBtn").find("span").text($data.length);
98 115
		}
99 116
		for(var i in $data) {
@ -115,71 +132,138 @@ $(document).ready(function() {
115 132
					Fun: $obj.profess
116 133
				});
117 134
			}
118
			$obj.bindEvent();
135
			$obj.bindEvent($obj);
119 136
		}
120 137
	}
121
	Patent.prototype.profess = function($data) {
122
			console.log($data);
123
			var img;
124
			var oClass = autho($data.authType, $data.orgAuth, $data.authStatus);
125
			var arr=[];
126
			arr[0] = $data.title||$data.office;
127
			arr[1]=$data.orgName||"";
128
			if(arr[0]) {
129
				if(arr[1]) {
130
					arr[2]=arr[0]+","+arr[1]
131
				}else{
132
					arr[2]=arr[0];
133
				}
134
			}else{
135
				arr[2]="";
136
			}
137
			if($data.hasHeadImage) {
138
				img = "/images/head/" + $data.id + "_l.jpg";
138
	Patent.prototype.profess = function($data, $obj) {
139
		console.log($data);
140
		var img;
141
		var oClass = autho($data.authType, $data.orgAuth, $data.authStatus);
142
		var csAuto, oId;
143
		var arr = [];
144
		arr[0] = $data.title || $data.office;
145
		arr[1] = $data.orgName || "";
146
		if(arr[0]) {
147
			if(arr[1]) {
148
				arr[2] = arr[0] + "," + arr[1]
139 149
			} else {
140
				img = "../images/default-photo.jpg"
150
				arr[2] = arr[0];
141 151
			}
142
			var otr = '<li class="flexCenter" style="cursor:pointer;" data-id="'+$data.id+'">' +
143
					'<div class="madiaHead useHead" id="userimg" style="background-image:url('+img+')"></div>' +
144
					'<div class="madiaInfo">' +
145
					'<p class="ellipsisSty">' +
146
					'<span class="h1Font" id="name">' + $data.name + '</span><em class="authiconNew '+oClass.sty+'" title="'+oClass.title+'"></em>' +
147
					'</p>' +
148
					'<p class="h2Font ellipsisSty">'+arr[2]+'<p>'+
149
					'</div>' +
150
					'</li>'
151
				$("#faM").prepend(otr);
152
		} else {
153
			arr[2] = "";
154
		}
155
		if($data.hasHeadImage) {
156
			img = "/images/head/" + $data.id + "_l.jpg";
157
		} else {
158
			img = "../images/default-photo.jpg"
159
		}
160
		if($obj.flag == 1) {
161
			csAuto = "auto";
162
			oId = "#"
163
		} else {
164
			csAuto = "pointer";
165
			oId = $data.id;
166
		}
167
		var otr = '<li class="flexCenter" style="cursor:' + csAuto + ';" data-id="' + oId + '">' +
168
			'<div class="madiaHead useHead" id="userimg" style="background-image:url(' + img + ')"></div>' +
169
			'<div class="madiaInfo">' +
170
			'<p class="ellipsisSty">' +
171
			'<span class="h1Font" id="name">' + $data.name + '</span><em class="authiconNew ' + oClass.sty + '" title="' + oClass.title + '"></em>' +
172
			'</p>' +
173
			'<p class="h2Font ellipsisSty">' + arr[2] + '<p>' +
174
			'</div>' +
175
			'</li>'
176
		$("#faM").prepend(otr);
152 177
	}
153
	Patent.prototype.bindEvent = function($data) {
154
		$("#faM").on("click","li",function(){
155
			var oDataId=$(this).attr("data-id");
156
			if(oDataId.substring(0,1)!="#")
157
			location.href="userInforShow.html?professorId="+oDataId
178
	Patent.prototype.bindEvent = function($obj) {
179
		$("#faM").on("click", "li", function() {
180
			var oDataId = $(this).attr("data-id");
181
			if(oDataId.substring(0, 1) != "#")
182
				location.href = "userInforShow.html?professorId=" + oDataId
158 183
		})
159 184
		$('#attention em').click(function() {
160
		if(userid && userid != "null" && userid != null) {
161
			if($(this).is('.icon-collected')) {
162
				cancelCollectionAbout(GetQueryString("patentId"), 4)
185
			if(userid && userid != "null" && userid != null) {
186
				if($(this).is('.icon-collected')) {
187
					cancelCollectionAbout(GetQueryString("patentId"), 4)
188
				} else {
189
					collectionAbout(GetQueryString("patentId"), 4);
190
				}
163 191
			} else {
164
				collectionAbout(GetQueryString("patentId"), 4);
192
				$.MsgBox.Alert('提示', "请先登录再进行收藏");
193
				$("#mb_btn_ok").val("去登录");
194
				var aele = document.createElement('a');
195
				$("#mb_btnbox").append(aele);
196
				$("#mb_btnbox a").css({
197
					'display': "block",
198
					'width': '100%',
199
					'height': '40px',
200
					'position': 'absolute',
201
					'bottom': '-6px',
202
					'left': '0'
203
				});
204
				aele.setAttribute('href', '../login.html');
165 205
			}
166
		} else {
167
			$.MsgBox.Alert('提示', "请先登录再进行收藏");
168
			$("#mb_btn_ok").val("去登录");
169
			var aele = document.createElement('a');
170
			$("#mb_btnbox").append(aele);
171
			$("#mb_btnbox a").css({
172
				'display': "block",
173
				'width': '100%',
174
				'height': '40px',
175
				'position': 'absolute',
176
				'bottom': '-6px',
177
				'left': '0'
178
			});
179
			aele.setAttribute('href', '../login.html');
180
		}
181
	})
206
		})
207
		$("body").on("click", ".closeThis", function() {
208
			if($(this).parent().length < 5) {
209
				$(this).parents(".keyResult").siblings("div").show();
210
			}
211
			$(this).parent().remove();
212

213
		});
214
		$("#release").on("click", function() {
215
			$.MsgBox.Confirm("提示", "确认发布该专利?", $obj.pubPatent);
216
		});
217
		$("#delete").on("click", function() {
218
			$.MsgBox.Confirm("提示", "确认删除该专利?", $obj.delePatent);
219
		});
182 220
	}
183 221
	Patent.prototype.pageview = function() {};
222
	Patent.prototype.captiureSubInd = function(subIndu) {
223
		var industrys = $("#" + subIndu + "").find("li");
224
		var industryAll = "";
225
		if(industrys.size() > 0) {
226
			for(var i = 0; i < industrys.size(); i++) {
227
				industryAll += industrys[i].innerText;
228

229
				industryAll += ',';
230
			};
231
			industryAll = industryAll.substring(0, industryAll.length - 1);
232
		}
233
		console.log(industryAll)
234
		return industryAll;
235
	}
236
	Patent.prototype.pubPatent = function() {
237
		var $key = oPent.captiureSubInd("paperSList");
238
		console.log($key)
239
		oPent.ajax({
240
			url: "/ajax/ppatent/kw",
241
			data: {
242
				id: GetQueryString("patentId"),
243
				keywords: $key
244
			},
245
			type: "post",
246
			Fun: oPent.pubsucess
247
		});
248
	}
249
	Patent.prototype.pubsucess = function() {
250
		$.MsgBox.Alert('提示', '资源发布成功!');
251
		$("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain');
252
		location.href = "patentList.html"
253
	}
254
	Patent.prototype.delePatent = function() {
255
		oPent.ajax({
256
			url: "/ajax/ppatent/cAss",
257
			data: {
258
				id: GetQueryString("patentId"),
259
				uid:$.cookie("userid")
260
			},
261
			type: "post",
262
			Fun: oPent.delsucess
263
		});
264
	}
265
	Patent.prototype.delsucess = function() {
266
		location.href = "patentList.html"
267
	}
184 268
	var oPent = new Patent();
185 269
})

+ 30 - 0
patentShow.html

@ -77,6 +77,24 @@
77 77
					<ul class="tagList">
78 78
						
79 79
					</ul>
80
					<!--标签模块-->
81
					<div class="form-item">
82
						<div class="aboutTit">关键词</div>
83
						<div class="col-w-12" style="position: relative;">
84
							<input type="text" class="frmcontype oinput" placeholder="请填写相关的关键词,如:腐蚀防护、石墨烯、纳米材料" data-pro="关键词不得超过10个字"  data-num="5" data-fontSizeN="10" />
85
							<button type="button" class="frmcontype btnModel frmaddG addButton">添加</button>
86
							<div class="form-drop keydrop">
87
								<ul>
88
									
89
								</ul>
90
							</div>
91
						</div>
92
						<div class="form-result keyResult">
93
							<ul class="ulspace editUlist clearfix" id="paperSList">
94
								<!--<li>XXX<div class="closeThis"></div></li>-->
95
							</ul>
96
						</div>
97
					</div>
80 98
					<!--作者-->
81 99
					<div class="form-item aboutPa">
82 100
						<div class="aboutTit">发明人</div>
@ -95,6 +113,18 @@
95 113
				<ul class="advertItem">
96 114
					<li><a href="download.html" target="_blank"><img src="images/find_img_xiazai_nor.png" /></a></li>
97 115
				</ul>
116
				<div class="conItem">
117
					<ul class="operateBlock">
118
						<li class="goFabu" id="release">
119
							<em class="operateicon icon-issue"></em>
120
							<p>发布</p>
121
						</li>
122
						<li class="disableLi" id="delete" style="cursor:pointer;opacity: 1">
123
							<em class="operateicon icon-delete"></em>
124
							<p>删除</p>
125
						</li>
126
					</ul>
127
				</div>
98 128
			</div>
99 129
		</div>
100 130
	</div>