Przeglądaj źródła

我发布的需求列表

luyanan 7 lat temu
rodzic
commit
5aee3ca121

+ 47 - 1
app/html/needList.html

@ -15,7 +15,7 @@
15 15
		<header class="mui-bar mui-bar-nav toptitbox">
16 16
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left topback"></a>
17 17
		    <h1 class="mui-title toptit">我发布的需求</h1>
18
		    <span class="mui-pull-right topsave">发需求</span>
18
		    <span class="mui-pull-right topsave" id="needIssue">发需求</span>
19 19
		</header>
20 20
		<div class="mui-content"></div>
21 21
		
@ -33,6 +33,52 @@
33 33
					}
34 34
				}]
35 35
			});
36
			/*点击按钮*/
37
			mui.plusReady(function(){
38
				document.getElementById("needIssue").addEventListener('tap', function() {
39
					var $status=["0","1"];
40
					mui.ajax(baseUrl+"/ajax/demand/qc",{//查询是否有发布中和已过期的需求
41
						type:"get",
42
						data:{
43
							state:$status,
44
							uid:plus.storage.getItem('userid')
45
						},
46
						async:true,
47
						datatype:"json",
48
						traditional: true,
49
						success:function(data){
50
							var statusN=data.data;
51
							if(statusN!=0){
52
								mui.openWindow({
53
									url: '../html/needIssue.html',
54
									id: '../html/needIssue.html',
55
									show: {
56
										aniShow: "slide-in-right"
57
									},
58
									extras: {
59
										ourl: plus.webview.currentWebview().id
60
									}
61
								});
62
							}else{
63
								mui.openWindow({
64
									url: '../html/updateBasic-org.html',
65
									id: '../html/updateBasic-org.html',
66
									show: {
67
										aniShow: "slide-in-right"
68
									},
69
									extras: {
70
										ourl: plus.storage.getItem('userid')
71
									}
72
								});
73
							}
74
						},
75
						error: function() {
76
							plus.nativeUI.toast("服务器链接超时", toastStyle);
77
							return;
78
						}
79
					})
80
				});
81
			})
36 82
		</script>
37 83
	</body>
38 84

+ 0 - 36
app/html/needSearch.html

@ -1,36 +0,0 @@
1
<!doctype html>
2
<html>
3
	<head>
4
		<meta charset="UTF-8">
5
		<title>需求搜索</title>
6
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
7
		<link href="../css/mui.min.css" rel="stylesheet" />
8
		<link href="../css/iconfont.css" rel="stylesheet" />
9
		<link href="../css/app.css" rel="stylesheet" />
10
	</head>
11
12
	<body>
13
		<header class="mui-bar mui-bar-nav toptitbox">
14
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left topback"></a>
15
		    <h1 class="mui-title toptit">需求搜索</h1>
16
		</header>
17
		<div class="mui-content"></div>
18
		
19
		<script src="../js/public/mui.min.js"></script>
20
		<script src="../js/public/base.js"></script>
21
		<script type="text/javascript">
22
			//启用双击监听
23
			mui.init({
24
				subpages:[{
25
					url:'needSearch_sub.html',
26
					id:'needSearch_sub.html',
27
					styles:{
28
						top: '44px',
29
						bottom: '0px',
30
					}
31
				}]
32
			});
33
		</script>
34
	</body>
35
36
</html>

+ 0 - 41
app/html/needSearch_sub.html

@ -1,41 +0,0 @@
1
<!doctype html>
2
<html>
3
	<head>
4
		<meta charset="UTF-8">
5
		<title>需求搜索</title>
6
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
7
		<link href="../css/mui.min.css" rel="stylesheet" />
8
		<link href="../css/iconfont.css" rel="stylesheet" />
9
		<link href="../css/app.css" rel="stylesheet" />
10
	</head>
11
12
	<body>
13
		<div class="mui-content mui-scroll-wrapper" id="pullrefresh">
14
		 	<div class="mui-scroll">
15
				<div class="infocon madiaBlock needList">
16
					<ul class="mui-table-view" id="demandList">
17
						<!--<li class="mui-table-view-cell">
18
							<div class="madiaInfo">
19
								<p class="h1Font mui-ellipsis-2">需求主题寻求一名斯特林热机技术顾问需求主题寻求一名斯特林热机技术顾问需求主题寻求一名斯特林热机技术顾问</p>
20
								<p class="h2Font mui-ellipsis-5">需求内容:我们是一家医疗器械公司,主要生产健康理疗类的电子产品,目前希望对护膝、护腰类的产品进行改进,
21
									想先找一位有资深设计经验的三维工业设计专家,通过三维建模的方式先设计出产品的三维模型,用于展示以及为后续生产做准备我们是一家医疗器械公司,主要生产健康理疗类的电子产品,目前希望对护膝、护腰类的产品进行改进,
22
									想先找一位有资深设计经验的三维工业设计专家,通过三维建模的方式先设计出</p>
23
								<div class="showli mui-ellipsis">
24
									<span>北京市</span>
25
									<span>预期 1个月内</span>
26
									<span>预算 1万元以内</span>
27
									<span>有效期至 8月17日</span>
28
								</div>
29
							</div>
30
						</li>-->
31
					</ul>
32
				</div>
33
			</div>
34
		</div>
35
		
36
		<script src="../js/public/mui.min.js"></script>
37
		<script src="../js/public/base.js"></script>
38
		<script src="../js/needSearch.js"></script>
39
	</body>
40
41
</html>

+ 50 - 10
app/js/needList.js

@ -13,20 +13,20 @@
13 13
		}
14 14
	});
15 15
	var Num=1;
16
	function pulldownRefresh() {
17
		setTimeout(function() {
18
			demandOnePase();
19
			mui('#pullrefresh').pullRefresh().endPulldownToRefresh();
20
		}, 1500);
21
	}
16 22
	function pullupRefresh() {
17 23
		setTimeout(function() {
18 24
			Num = ++Num;
19 25
			myDemandList(10,Num);
20
			mui('#pullrefresh').pullRefresh().endPullupToRefresh((Num>2));
26
			mui('#pullrefresh').pullRefresh().endPullupToRefresh();
21 27
		}, 1500);
22 28
	
23 29
	}
24
	function pulldownRefresh() {
25
		setTimeout(function() {
26
			myDemandList(10,1);
27
			mui('#pullrefresh').pullRefresh().endPulldownToRefresh();
28
		}, 1500);
29
	}
30 30
	
31 31
	mui.plusReady(function() {
32 32
		mui("#myneedList").on("tap", "li>.madiaInfo", function() {
@ -53,9 +53,6 @@
53 53
						var ws=plus.webview.getWebviewById("../html/needList.html");
54 54
						plus.nativeUI.closeWaiting();
55 55
						ws.show("slide-in-right", 150);
56
						if(pageNo == 1){
57
							document.getElementById("myneedList").innerHTML="";
58
						}
59 56
						if(pageNo!=data.data.pageNo) {
60 57
							data.data.data=[];
61 58
						}
@ -84,6 +81,49 @@
84 81
			});
85 82
		})
86 83
	}
84
	function demandOnePase() {
85
		mui.plusReady(function() {
86
			Num=1;
87
			mui.ajax(baseUrl + '/ajax/demand/pq', {
88
				dataType: 'json', //数据格式类型
89
				type: 'GET', //http请求类型
90
				timeout: 10000, //超时设置
91
				data: {
92
					"uid": plus.storage.getItem('userid'),
93
					"pageNo": 1,
94
					"pageSize": 10
95
				},
96
				success: function(data) {
97
					if(data.success) {
98
						mui('#pullrefresh').pullRefresh().refresh(true);
99
						var ws=plus.webview.getWebviewById("../html/needList.html");
100
						plus.nativeUI.closeWaiting();
101
						ws.show("slide-in-right", 150);
102
						document.getElementById("myneedList").innerHTML="";
103
						var $info = data.data.data;
104
						console.log(JSON.stringify(data))
105
						if($info.length > 0){
106
							for(var i = 0; i < $info.length; i++) {
107
								var liStr=document.createElement("li");
108
								liStr.className="mui-table-view-cell flexCenter";
109
								document.getElementById("myneedList").appendChild(liStr);
110
								demandHtml($info[i],liStr);
111
							}
112
						}
113
						if(1 < Math.ceil(data.data.total / data.data.pageSize)) {
114
							mui('#pullrefresh').pullRefresh().endPullupToRefresh(false); /*能上拉*/
115
						} else {
116
							mui('#pullrefresh').pullRefresh().endPullupToRefresh(true); /*不能上拉*/
117
						}
118
					}
119
				},
120
				error: function() {
121
					plus.nativeUI.toast("服务器链接超时", toastStyle);
122
					return;
123
				}
124
			});
125
		})
126
	}
87 127
	function demandHtml($data,liStr) {
88 128
		var statusU="";
89 129
		var dateGap = delayDay($data.invalidDay);

+ 0 - 197
app/js/needSearch.js

@ -1,197 +0,0 @@
1
mui.init({
2
	pullRefresh: {
3
		container: '#pullrefresh',
4
		up: {
5
			height: 50,
6
			contentrefresh: '正在加载...',
7
			callback: pullupRefresh
8
		},
9
		down: {
10
			auto:true,
11
			callback: pulldownRefresh
12
		}
13
	}
14
});
15
var Num=1;
16
function pullupRefresh() {
17
	setTimeout(function() {
18
		Num = ++Num;
19
		demandList(5,Num);
20
		mui('#pullrefresh').pullRefresh().endPullupToRefresh((Num>2));
21
	}, 1000);
22

23
}
24
function pulldownRefresh() {
25
	setTimeout(function() {
26
		demandList(5,1);
27
		mui('#pullrefresh').pullRefresh().endPulldownToRefresh();
28
	}, 1500);
29
}
30
mui.plusReady(function() {
31
	mui("#demandList").on("tap", "li>.madiaInfo", function() {
32
		var oDemandId = this.getAttribute("data-id");
33
		plus.nativeUI.showWaiting();
34
		plus.webview.create("../html/needShow.html", 'needShow.html', {}, {
35
			demanid: oDemandId
36
		});
37
	})
38
})
39

40

41
/*需求列表*/
42
function demandList(pageSize, pageNo) {
43
	mui.plusReady(function() {
44
		mui.ajax(baseUrl+"/ajax/demand/search",{
45
			type: "GET",
46
			timeout: 10000,
47
			dataType: "json",
48
			traditional:true,
49
			data: {
50
				"state":"1",
51
				"pageNo": pageNo,
52
				"pageSize":pageSize
53
			},
54
			success: function(data) {
55
				if(data.success) {
56
					var ws=plus.webview.getWebviewById("../html/needSearch.html");
57
					plus.nativeUI.closeWaiting();
58
					ws.show("slide-in-right", 150);
59
					if(pageNo==1){
60
						document.getElementById("demandList").innerHTML="";
61
					}
62
					if(pageNo!=data.data.pageNo) {
63
						data.data.data=[];
64
					}
65
					var $info = data.data.data;
66
					console.log(JSON.stringify(data))
67
					if($info.length > 0){
68
						for(var i = 0; i < $info.length; i++) {
69
							var liStr=document.createElement("li");
70
							liStr.className="mui-table-view-cell";
71
							document.getElementById("demandList").appendChild(liStr);
72
							demandHtml($info[i],liStr);
73
						}
74
					}
75
					if(pageNo < Math.ceil(data.data.total / data.data.pageSize)) {
76
						mui('#pullrefresh').pullRefresh().endPullupToRefresh(false); /*能上拉*/
77
					} else {
78
						mui('#pullrefresh').pullRefresh().endPullupToRefresh(true); /*不能上拉*/
79
					}
80
				}
81
			},
82
			error: function() {
83
				plus.nativeUI.toast("服务器链接超时", toastStyle);
84
				mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
85
				return;
86
			}
87
		})
88
	})
89
}
90
function demandHtml($data,liStr) {
91
	var strCon='';
92
		strCon+='<div class="madiaInfo" data-id="'+$data.id+'">'
93
		strCon+='<p class="h1Font mui-ellipsis-2">'+ $data.title +'</p>'
94
		strCon+='<p class="h2Font mui-ellipsis-5">'+ $data.descp +'</p>'
95
		strCon+='<div class="showli mui-ellipsis">'
96
		
97
		if($data.city){ strCon+='<span>'+$data.city+'</span>' }
98
		if($data.duration!=0){ strCon+='<span>预期:'+demandDuration[$data.duration]+'</span>' }
99
		if($data.cost!=0){ strCon+='<span>预算:'+demandCost[$data.cost]+'</span>' }
100
		if($data.invalidDay){ strCon+='<span>有效期至:'+TimeTr($data.invalidDay)+'</span>' }
101
		
102
		strCon+='</div></div>'
103
	liStr.innerHTML=strCon;
104
}
105

106
//
107
//function datalistEach(datalist) {
108
//	mui.each(datalist, function(index, ite) {
109
//		item = ite.professor;
110
//		/*获取头像*/
111
//		if(item.hasHeadImage == 1) {
112
//			var img = baseUrl + "/images/head/" + item.id + "_l.jpg";
113
//		} else {
114
//			var img = "../images/default-photo.jpg";
115
//		}
116
//
117
//		var title = "";
118
//		var office = "";
119
//		var orgName = "";
120
//		var address = "";
121
//		if(item.title && item.office && item.orgName && item.address) {
122
//			title = item.title + ",";
123
//			office = item.office + ",";
124
//			orgName = item.orgName + " | ";
125
//			address = item.address;
126
//		} else if(!item.title && item.office && item.orgName && item.address) {
127
//			office = item.office + ",";
128
//			orgName = item.orgName + " | ";
129
//			address = item.address;
130
//		} else if(item.title && !item.office && item.orgName && item.address) {
131
//			title = item.title + ",";
132
//			orgName = item.orgName + " | ";
133
//			address = item.address;
134
//		} else if(item.title && item.office && !item.orgName && item.address) {
135
//			title = item.title + ",";
136
//			office = item.office + " | ";
137
//			address = item.address;
138
//		} else if(item.title && item.office && item.orgName && !item.address) {
139
//			title = item.title + ",";
140
//			office = item.office + ",";
141
//			orgName = item.orgName;
142
//		} else if(!item.title && !item.office && item.orgName && item.address) {
143
//			orgName = item.orgName + " | ";
144
//			address = item.address;
145
//		} else if(!item.title && item.office && !item.orgName && item.address) {
146
//			office = item.office + " | ";
147
//			address = item.address;
148
//		} else if(!item.title && item.office && item.orgName && !item.address) {
149
//			office = item.office + ",";
150
//			orgName = item.orgName;
151
//		} else if(item.title && !item.office && !item.orgName && item.address) {
152
//			title = item.title + " | ";
153
//			address = item.address;
154
//		} else if(item.title && !item.office && item.orgName && !item.address) {
155
//			office = item.title + ",";
156
//			address = item.orgName;
157
//		} else if(item.title && item.office && !item.orgName && !item.address) {
158
//			title = item.title + ",";
159
//			office = item.office;
160
//		} else if(!item.title && !item.office && !item.orgName && item.address) {
161
//			address = item.address;
162
//		} else if(!item.title && !item.office && item.orgName && !item.address) {
163
//			orgName = item.orgName;
164
//		} else if(!item.title && item.office && !item.orgName && !item.address) {
165
//			office = item.office;
166
//		} else if(item.title && !item.office && !item.orgName && !item.address) {
167
//			title = item.title;
168
//		}
169
//		var typeTname = '';
170
//		var oSty = autho(item.authType, item.orgAuth, item.authStatus);
171
//		typeTname='<em class="authicon ' + oSty.sty + '"></em>'
172
//		
173
//		var li = document.createElement('li');
174
//		li.className = 'mui-table-view-cell mui-media';
175
//		li.setAttribute("demandId", ite.demandId);
176
//		var oCreateTime = ite.createTime.substr(0, 4) + "-" + ite.createTime.substr(4, 2) + "-" + ite.createTime.substr(6, 2) + " " + ite.createTime.substr(8, 2) + ":" + ite.createTime.substr(10, 2);
177
//		var odemand, odemandAim;
178
//		(ite.demandType == 1) ? odemand = "个人": odemand = "企业";
179
//		(ite.demandAim == 1) ? odemandAim = "技术": (ite.demandAim == 2) ? odemandAim = "资源" : odemandAim = "其他";
180
//		var oString = '<div class="coutopicbox"><span class="coutheme mui-ellipsis mui-pull-left">' + ite.demandTitle + '</span>'
181
//		oString += '<div class="coustatus mui-pull-right">'
182
//		oString += '<span class="aimlabel">' + odemand + '</span>'
183
//		oString += '<span class="aimlabel">' + odemandAim + '</span></div></div>'
184
//		oString += '<a class="proinfor itemBtn">' <!-- displayNone-->
185
//		oString += '<img class="mui-media-object mui-pull-left headimg headRadius" src="' + img + '">'
186
//		oString += '<div class="mui-media-body">'
187
//		oString += '<p class="listtit">' + item.name + ' ' + typeTname + ''
188
//		oString += '<span class="thistime">' + oCreateTime + '</span></p>'
189
//		oString += '<p class="listtit2">'
190
//		oString += '<span>' + title + '</span><span>' + office + '</span><span>' + orgName + '</span><span>' + address + '</span></p>'
191
//		oString += '<p class="listtit3 mui-ellipsis">' + ite.demandContent + '</p></div></a>'
192
//		li.innerHTML = oString;
193
//		document.getElementsByClassName("tableList")[0].appendChild(li);
194
//
195
//	});
196
//}
197