Browse Source

专家需求搜索

jack 8 years ago
parent
commit
3875ba2c0c
2 changed files with 191 additions and 110 deletions
  1. 181 0
      js/needList.js
  2. 10 110
      needList.html

+ 181 - 0
js/needList.js

1
$(document).ready(function() {
2
	var oDemandAim = "",
3
		oSortType = "";
4
	/*需求列表*/
5
	function demandList(isbind, pageSize, pageNo,oDemand,oSort) {
6
		$.ajax({
7
			url: "/ajax/demand/pq",
8
			type: "GET",
9
			timeout: 10000,
10
			dataType: "json",
11
			data: {
12
				"pageNo": pageNo,
13
				"demandAim": oDemand,
14
				"sortType": oSort
15
			},
16
			beforeSend: function() {
17
			},
18
			success: function(data, textState) {
19
				if(data.success) {
20
					$("#demandList").html(" ");
21
					var $info = data.data.data;
22
					demandHtml($info);
23
					if(isbind == true) {
24
						$(".tcdPageCode").createPage({
25
							pageCount: Math.ceil(data.data.total / pageSize),
26
							current: data.data.data.pageNo,
27
							backFn: function(p) {
28
								demandList(false, 5, p,oDemandAim,oSortType);
29
							}
30
						});
31
					}
32
				}
33

34
			},
35
			error: function(XMLHttpRequest, textStats, errorThrown) {
36

37
			}
38
		})
39
	}
40

41
	function demandHtml($data) {
42
		for(var i = 0; i < $data.length; i++) {
43
			var $obje = $data[i].professor;
44
			var personStr = personalInformation($obje);
45
			var demandAim = "技术咨询",
46
				demandType = "企业需求";
47
			var oImg = "",
48
				oTime = "";
49
			if($data[i].demandAim == 2) {
50
				demandAim = "寻找资源"
51
			} else if($data[i].demandAim == 3) {
52
				demandAim = "其他需求"
53
			}
54
			if($data[i].demandType == 1) {
55
				demandType = "个人需求"
56
			}
57
			if($obje.hasHeadImage) {
58
				oImg = "/images/head/" + $obje.id + "_l.jpg";
59
			} else {
60
				oImg = "images/default-photo.jpg"
61
			}
62
			if($obje.authType) {
63
				var typeTname = " authicon authicon-cu"
64
			} else {
65
				if($obje.authStatus == 3) {
66
					if($obje.authentication == 1) {
67
						var typeTname = " authicon2 authicon-mana";
68
					} else if($obje.authentication == 2) {
69
						var typeTname = " authicon2 authicon-staff";
70
					} else {
71
						var typeTname = " authicon2 authicon-stu"
72
					}
73
				}
74
			}
75
			oTime = $data[i]["createTime"].substr(0, 4) + "年" + $data[i].createTime.substr(4, 2) + "月" + $data[i].createTime.substr(6, 2) + "日" +
76
				$data[i].createTime.substr(8, 2) + ":" + $data[i].createTime.substr(10, 2);
77
			var dataString = "<table width='100%'>"
78
			dataString += "<tbody><tr><td width='14%' class='messagebox'>"
79
			dataString += "<a class='workhead workitimg headRadius'>"
80
			dataString += "<img class='headPhoto' src='" + oImg + "'  width='100%' height='100%'></a></td>"
81
			dataString += "<td style='position:relative;top:20px;' width='86%'>"
82
			dataString += "<div class='workinfor worksitcon'><h4><a class='named'>" + $obje.name + "</a>"
83
			dataString += "<a class='modifyicon" + typeTname + "'></a><input type='text' class='assessStar' style='display: none;'></h4><h6 class='h3Font'>"
84
			dataString += "<span>" + personStr + "</span>"
85
			dataString += "<h6 style='position:relative;'>"
86
			dataString += "<div class='titList'>需求主题:<em class='h4Font'>" + $data[i].demandTitle + "</em></div>"
87
			dataString += "<span class='lasttime rightTime'>" + oTime + "</span>"
88
			dataString += "<p class='rebackcon' >" + $data[i].demandContent + "</p></div>"
89
			dataString += "<div class='workhandle'><div class='rightopert floatR'>"
90
			dataString += "<span class='replybtn'>查看</span></div>"
91
			dataString += "<div class='leftstate floatR'>"
92
			dataString += "<span class='coultstate status-4'><i>" + demandAim + "</i></span></div>"
93
			dataString += "<div class='leftstate floatR'>"
94
			dataString += "<span class='coultstate coulstAim status-4'><i>" + demandType + "</i></span>"
95
			dataString += "</div></div></td></tr></tbody></table>"
96
			$("#demandList").append(dataString);
97
		}
98
	}
99
	/*职位职称所在机构,部门,地址等等*/
100
	function personalInformation($person) {
101
		var arr1 = [$person.title, $person.office, $person.department, $person.orgName, $person.address];
102
		var arr = new Array();
103
		var arr2 = new Array();
104
		var n = 0;
105
		for(var i = 0; i < arr1.length; i++) {
106
			if(arr1[i]) {
107
				arr.push(arr1[i]);
108
				if(arr1[i] == arr1[arr1.length - 1]) {
109
					n = 1;
110
				}
111
			}
112
		}
113
		if(n == 1) {
114
			for(var i = 0; i < arr.length - 1; i++) {
115
				arr2.push(arr1[i]);
116
			}
117
			return arr2.join() + "|" + arr[arr.length - 1];
118
		} else {
119
			return arr.join();
120
		}
121

122
	}
123
	demandList(true, 5, 1,oDemandAim,oSortType);
124

125
	/*检索排序*/
126
	function selcet(i) {
127
		$(".selcet" + i).on('click', function(e) {
128
			var option = $(this).find(".option" + i);
129
			option.css("display", "block")
130
			var o_this = $(this);
131
			o_this.find("li").click(function() {
132
				o_this.find("li").removeClass("workcurrent");
133
				$(this).addClass("workcurrent");
134
				o_this.find("span").text($(this).text());
135
				option.css("display", "none");
136
				if($(this).text() == "技术咨询") {
137
					oDemandAim = 1;
138
					$(".tcdPageCode").remove();
139
					$("#shoudao").append('<div class="tcdPageCode"></div>');
140
					demandList(true, 5, 1,oDemandAim,oSortType);
141
				} else if($(this).text() == "资源合作") {
142
					oDemandAim = 2;
143
					$(".tcdPageCode").remove();
144
					$("#shoudao").append('<div class="tcdPageCode"></div>');
145
					demandList(true, 5, 1,oDemandAim,oSortType);
146
				} else if($(this).text() == "其他需求") {
147
					oDemandAim = 3;
148
					$(".tcdPageCode").remove();
149
					$("#shoudao").append('<div class="tcdPageCode"></div>');
150
					demandList(true, 5, 1,oDemandAim,oSortType);
151
				}else if($(this).text() == "不限") {
152
					oDemandAim = "";
153
					$(".tcdPageCode").remove();
154
					$("#shoudao").append('<div class="tcdPageCode"></div>');
155
					demandList(true, 5, 1,oDemandAim,oSortType);
156
				}
157
				else if($(this).text() == "按最早发布时间排序") {
158
					oSortType = 1;
159
					$(".tcdPageCode").remove();
160
					$("#shoudao").append('<div class="tcdPageCode"></div>');
161
					demandList(true, 5, 1,oDemandAim,oSortType);
162
				} else if($(this).text() == "按最新发布时间排序") {
163
					oSortType = 0;
164
					$(".tcdPageCode").remove();
165
					$("#shoudao").append('<div class="tcdPageCode"></div>');
166
					demandList(true, 5, 1,oDemandAim,oSortType);
167
				}
168
				return false;
169
			});
170
			$("body").click(function(e) {
171
				if($(".option4")[0].style.display == "block" || $(".option3")[0].style.display == "block") {
172
					$(".option4")[0].style.display = "none";
173
					$(".option3")[0].style.display = "none";
174
				}
175
			});
176
			return false;
177
		})
178
	}
179
	selcet(3);
180
	selcet(4);
181
})

+ 10 - 110
needList.html

49
<!--中间-->
49
<!--中间-->
50
<div id="container">
50
<div id="container">
51
	<div class="con-center">
51
	<div class="con-center">
52
        <div class="workmenu" style="height: 600px;">
52
        <div class="workmenu">
53
            <a href="workspaces.html" class="workmenutit">我的工作台</a>
53
            <a href="workspaces.html" class="workmenutit">我的工作台</a>
54
            <a href="consult.html"  class="worksubmenu">咨询</a>
55
            <a href="newsciresource.html"  class="worksubmenu" >资源</a>
56
            <a href="news-list.html"  class="worksubmenu" >文章</a>
57
            <a href="needList.html"  class="worksubmenu subcolor" >需求</a>
54
            <a class="worksubmenu" id="gozixu">咨询</a>
55
            <a href="newsciresource.html"  class="worksubmenu nohide" style="display:none;">资源</a>
56
            <a href="news-list.html"  class="worksubmenu nohide" style="display:none;">文章</a>
57
            <a href="needList.html"  class="worksubmenu subcolor">需求</a>
58
        </div>
58
        </div>
59
        <div class="workcon">
59
        <div class="workcon">
60
			<div class="workconitem consublock">
60
			<div class="workconitem consublock">
97
            <div class="workselectcon" id="shoudao">
97
            <div class="workselectcon" id="shoudao">
98
                <div id="workContainer">
98
                <div id="workContainer">
99
                	<div id="workContainer2">
99
                	<div id="workContainer2">
100
	                	<div class='workselectitem'>
101
						  <table width='100%'><tbody><tr><td width='14%' class='messagebox'>
102
									<a class='workhead workitimg headRadius'>
103
										<img class='headPhoto' src='images/default-photo.jpg'  width='100%' height='100%'>
104
									</a>
105
								</td>
106
								<td style='position:relative;top:20px;' width='86%'>
107
								<div class='workinfor worksitcon'><h4><a class='named' id='nameS'>["name"] </a>
108
								 <a class='modifyicon authicon authicon-cu'></a><input type='text' class='assessStar' style='display: none;'></h4><h6 class='h3Font'>
109
									<span>["title"]</span>, <span>["office"]</span>,<span>["orgName"]</span>,<span>["department"]</span> | <span>["address"]</span>
110
									</h6><h6 style='position:relative;'>
111
										<div class='titList'>需求主题:<em class='h4Font'> data[i]["consultTitle"] </em></div>
112
											<span class='lasttime rightTime'>2017年3月9日 14:20</span>
113
											
114
											<p class='rebackcon lastReplyCon' >lastReplyFn(userid,data[i]["consultId"])["lastReplyCon"]</p>
115
											</div>
116
											<div class='workhandle'>
117
												<div class='rightopert floatR'>
118
													<span class='replybtn'>查看
119
													</span>
120
												</div>
121
												<div class='leftstate floatR'>
122
													<span class='coultstate status-4'><i>寻找资源</i></span>
123
												</div>
124
												<div class='leftstate floatR'>
125
													<span class='coultstate coulstAim status-4'><i>个人需求</i></span>
126
												</div>
127
											</div>
128
										</td>
129
									</tr></tbody></table>
130
								</div>
100
	                	<div class='workselectitem' id="demandList">
101
						
102
	                	</div>
131
                	</div>
103
                	</div>
132
                
104
                
133
                </div>
105
                </div>
231
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
203
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
232
<script type="text/javascript"src="js/jquery.cookie.js"></script>
204
<script type="text/javascript"src="js/jquery.cookie.js"></script>
233
<script type="text/javascript"src="js/jquery.similar.msgbox.js"></script>
205
<script type="text/javascript"src="js/jquery.similar.msgbox.js"></script>
206
<script type="text/javascript" src="js/jquery.page.js"></script>
234
<script type="text/javascript" src="js/common.js"></script>
207
<script type="text/javascript" src="js/common.js"></script>
235
<script type="text/javascript" src="js/index.js"></script>
208
<script type="text/javascript" src="js/index.js"></script>
236
<script type="text/javascript" src="js/popup.js"></script>
209
<script type="text/javascript" src="js/popup.js"></script>
237
<script type="text/javascript">
238
	//下拉菜单,点击选项和body,下拉onsole.log($(".selcet"+i)); */
239
	function selcet(i){
240
		$(".selcet"+i).on('click',function(e){
241
			
242
			var attrPa;
243
			var option = $(this).find(".option"+i);
244
			/* console.log(option); */
245
			option
246
			.css("display","block")
247
			.slideDown();
248
			
249
			if($(this).find(".workselectmenu").attr('tip')){
250
				attrPa = 'tip';
251
			}
252
			if($(this).find(".workselectmenu").attr('tim')){
253
				attrPa = 'tim';
254
			};
255
			var o_this = $(this);
256
			o_this.find("li").click(function(){
257
		    	option.slideUp();
258
		    		/* console.log($(this)); */
259
		    		o_this.find("li").removeClass("workcurrent");
260
		    		$(this).addClass("workcurrent");
261
			      o_this.find("span").text($(this).text());
262
			      o_this.find("span").attr(attrPa,$(this).attr(attrPa));
263
			     /*  $(this).find("span").attr(attrPa,$(this).attr(attrPa));
264
			      $(this).find("input").val($(this).attr(attrPa)); */
265
			      
266
			      	consultStatus = $("#consultSelectId").val();//需求状态值
267
					timeType = $("#timeTypeId").val();//时间类型值
268
					sortType = $("#timeSortId").val();//排序值;
269
					
270
					replyStatus = $("#replySelectId").val();//回复状态值
271
					timeType2 = $("#timeTypeId2").val();//回复时间类型值
272
					sortType2 = $("#timeSortId2").val();//回复中 排序值;
273
		    });
274
			
275
			$("body").click(function(e){
276
				if($(e.target)["0"] == $("#showStatus2")["0"]){
277
					 $(".select1").slideDown();
278
				}else if($(e.target)["0"] == $("#showTimeSort2")["0"]){
279
					$(".select2").slideDown();
280
				}else if($(e.target)["0"] == $("#showStatus")["0"]){
281
					$(".select3").slideDown();
282
				}else if($(e.target)["0"] == $("#showTimeSort")["0"]){
283
					$(".select4").slideDown();
284
				}
285
				else {
286
					option.slideUp();
287
				}
288
				
289
			});
290
			 
291
		})
292
	}
293
	selcet(1);
294
	selcet(2);
295
	selcet(3);
296
	selcet(4);
297
	
298
	/*...点击之后的下拉*/
299
	$(".moreopert").click(function(){
300
		$(".moreopertbtn").eq($(".moreopert").index(this)).toggle();	
301
	
302
	})
303
304
305
$("#needIssueBtn").click(function(){
306
		$("body").css("position","fixed");
307
		$("#needIssue").fadeIn();
308
	})
309
</script>
310
210
<script type="text/javascript" src="js/needList.js"></script>
311
</body>
211
</body>
312
</html>
212
</html>
313
213