Browse Source

发布需求规则

luyanan 7 years ago
parent
commit
11b8d116a4
4 changed files with 246 additions and 75 deletions
  1. 66 0
      app/html/sureOrg.html
  2. 68 68
      app/js/index.js
  3. 104 0
      app/js/sureOrg.js
  4. 8 7
      app/js/updateBasic.js

+ 66 - 0
app/html/sureOrg.html

@ -0,0 +1,66 @@
1
<!doctype html>
2
<html>
3

4
	<head>
5
		<meta charset="UTF-8">
6
		<title>编辑个人资料-所在机构</title>
7
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
8
		<link href="../css/mui.min.css" rel="stylesheet" />
9
		<link href="../css/mui.picker.min.css" rel="stylesheet" />
10
		<link href="../css/app.css" rel="stylesheet" />
11
		<style>
12
			html,body{height: 100%;margin:0;padding:0px;overflow: hidden;}
13
			.mui-content{height:100%;overflow: auto;}
14
			.simulation{
15
				padding:2px;
16
				height:24px;
17
				overflow:hidden;
18
				width:100%;
19
			}
20
		</style>
21
		<script>
22
			function autoGrow(oField) {
23
				document.getElementById("tt").style.width=oField.scrollWidth+"px";
24
				document.getElementById("tt").value=oField.value;
25
				oField.style.height=document.getElementById("tt").scrollHeight+"px";
26
			}
27
		</script>
28
	</head>
29

30
	<body>
31
		<header class="mui-bar mui-bar-nav toptitbox">
32
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left topback"></a>
33
		    <h1 class="mui-title toptit">请先确认您的所在机构</h1>
34
		</header>
35
		<div class="mui-content" style="padding-top:34px;">
36
			<div class="mui-input-group mainbox">
37
				<div class="infocontit infocontitM OnetitM  mui-clearfix" style="line-height:18px;background-color: rgba(0,0,0,.6);">
38
    				<p style="color:#fff;font-size:12px;padding-top:16px;">只能发布你所在机构的需求</p>
39
    				<p style="color:#fff;font-size:12px;">当您在资料中变更了所在机构后,该需求将会自动关闭</p>
40
    			</div>
41
			<div class="mui-input-group mainbox">
42
				<div class="infocon">
43
					<textarea class="textareabox simulation" id="title" oninput="autoGrow(this)" maxlength="50" placeholder="请填写当前就职的机构"></textarea>
44
					<textarea class="textareabox simulation" id="tt" style="position:absolute;top:0;left:-999px;"></textarea>
45
				</div>
46
		    </div>
47
			<div class="limitBox">
48
				<p class="limitNum"><span id="fontAdd">0</span>/50</p>
49
			</div>
50
			<div class="mui-content-padded frmboxNew">
51
				<button id="login" class="mui-btn mui-btn-block frmbtn frmactive">确定</button>
52
			</div>
53
		</div>
54
		<script src="../js/public/mui.min.js"></script>
55
		<script src="../js/public/zepto.min.js"></script>
56
		<script src="../js/public/mui.picker.min.js"></script>
57
		<script src="../js/public/city.data.js"></script>
58
		<script src="../js/public/base.js"></script>
59
		<script type="text/javascript" src="../js/sureOrg.js"></script>		
60
		<script type="text/javascript"> 
61
			//处理iOS下弹出软键盘后头部会随页面的滚动条消失问题
62
		    iosheader();
63
		</script>
64
	</body>
65

66
</html>

+ 68 - 68
app/js/index.js

@ -8,70 +8,60 @@ mui.plusReady(function() {
8 8
	plus.nativeUI.showWaiting();
9 9
	checkVersion();
10 10
})
11
document.addEventListener("resume", function(){
11
document.addEventListener("resume", function() {
12 12
	checkVersion();
13 13
}, false)
14
document.getElementById("demandP").addEventListener("tap", function() {
15
	var userid = plus.storage.getItem('userid');
16
	if(userid == null) {
17
		mui.openWindow({
18
			url: '../html/login.html',
19
			id: 'login.html'
20
		})
21
		return;
22
	}
23
	mui.ajax(baseUrl + "/ajax/professor/auth", {
14

15
function orName() {
16
	mui.ajax(baseUrl + "/ajax/professor/baseInfo/" + plus.storage.getItem('userid'), {
17
		dataType: 'json', //数据格式类型
18
		type: 'GET', //http请求类型
19
		timeout: 10000, //超时设置
20
		success: function(data) {
21
			if(data.success && data.data) {
22
				var $info = data.data || {};
23
				dem($info.id, $info.orgId)
24
			}
25
		},
26
		error: function() {
27
			plus.nativeUI.toast("服务器链接超时", toastStyle);
28
			return;
29
		}
30
	});
31
}
32

33
function dem(uid, oid) {
34
	mui.ajax(baseUrl + "/ajax/demand/qc", {
24 35
		dataType: 'json', //数据格式类型
25 36
		type: 'GET', //http请求类型
26 37
		timeout: 10000, //超时设置
27 38
		data: {
28
			"id": userid
39
			"state": [0, 1],
40
			"uid": uid,
41
			"oid": oid
29 42
		},
43
		traditional: true,
30 44
		success: function(data) {
31 45
			if(data.success) {
32 46
				var $data = data.data;
33
				if($data.authStatus == 3) {
34
					var oDa = {};
35
					oDa.flag = ($data.orgAuth == 0) ? 1 : 0;
47
				if($data) {
36 48
					mui.openWindow({
37
						url: '../html/needIssue.html',
38
						id: '../html/needIssue.html',
49
						url: '../html/demandPublish.html',
50
						id: 'demandPublish.html',
39 51
						show: {
40
							autoShow: false,
41
							aniShow: "slide-in-right",
42
						},
43
						extras: oDa
52
							autoShow: ture,
53
							aniShow: "slide-in-left"
54
						}
44 55
					});
45 56
				} else {
46
					if($data.orgAuth == 1) {
47
						mui.openWindow({
48
							url: '../html/needIssue.html',
49
							id: '../html/needIssue.html',
50
							show: {
51
								autoShow: false,
52
								aniShow: "slide-in-right",
53
							}
54
						});
55
					} else {
56
						if($data.authStatus == 2) {
57
							plus.nativeUI.toast("我们正在对您的信息进行认证,请稍等片刻", {
58
								'verticalAlign': 'center'
59
							});
60
						} else if($data.authStatus == 1) {
61
							plus.nativeUI.toast("我们将尽快对您的信息进行认证", {
62
								'verticalAlign': 'center'
63
							});
64
						} else if($data.authStatus <= 0) {
65
							mui.openWindow({
66
								url: '../html/realname-authentication.html',
67
								id: 'realname-authentication.html',
68
								show: {
69
									autoShow: false,
70
									aniShow: "slide-in-right",
71
								}
72
							});
57
					mui.openWindow({
58
						url: '../html/sureOrg.html',
59
						id: 'sureOrg.html',
60
						show: {
61
							autoShow: true,
62
							aniShow: "slide-in-right",
73 63
						}
74
					}
64
					});
75 65
				}
76 66
			}
77 67
		},
@ -80,6 +70,17 @@ document.getElementById("demandP").addEventListener("tap", function() {
80 70
			return;
81 71
		}
82 72
	});
73
}
74
document.getElementById("demandP").addEventListener("tap", function() {
75
	var userid = plus.storage.getItem('userid');
76
	if(userid == null) {
77
		mui.openWindow({
78
			url: '../html/login.html',
79
			id: 'login.html'
80
		})
81
		return;
82
	}
83
	orName()
83 84

84 85
})
85 86
document.getElementById("improfessor").addEventListener("tap", function() {
@ -159,15 +160,15 @@ document.getElementById("improfessor").addEventListener("tap", function() {
159 160
	});
160 161
})
161 162
mui('.list').on('tap', 'li', function() {
162
		var id = this.getAttribute("data-id");
163
		var userid = plus.storage.getItem('userid');
164
		console.log(id);
165
		plus.nativeUI.showWaiting(); //显示原生等待框
166
		webviewShow = plus.webview.create("../html/userInforShow.html", 'userInforShow.html', {}, {
167
			proid: id
168
		}); //后台创建webview并打开show.html
169
	})
170
	/*点击轮播图*/
163
	var id = this.getAttribute("data-id");
164
	var userid = plus.storage.getItem('userid');
165
	console.log(id);
166
	plus.nativeUI.showWaiting(); //显示原生等待框
167
	webviewShow = plus.webview.create("../html/userInforShow.html", 'userInforShow.html', {}, {
168
		proid: id
169
	}); //后台创建webview并打开show.html
170
})
171
/*点击轮播图*/
171 172
mui('.artical-scroll').on('tap', 'a', function() {
172 173
	var articalNum = this.getAttribute("data-title");
173 174
	mui.openWindow({
@ -368,22 +369,21 @@ function datalistEach(datalist) {
368 369

369 370
		var typeTname = '';
370 371
		var oSty = autho(item.authType, item.orgAuth, item.authStatus);
371
		typeTname='<em class="authicon ' + oSty.sty + '"></em>'
372

372
		typeTname = '<em class="authicon ' + oSty.sty + '"></em>'
373 373

374 374
		var li = document.createElement('li');
375 375
		li.className = 'mui-table-view-cell flexCenter OflexCenter';
376 376
		li.setAttribute("data-id", item.id);
377 377
		li.innerHTML =
378
					'<div class="madiaHead useHead" style="background-image:url(' + img + ')"></div>'+
379
					'<div class="madiaInfo">'+
380
						'<p><span class="h1Font">' + item.name + typeTname + '</p>'+
381
						'<p class="mui-ellipsis h2Font">'+ otherIn +'</p>'+
382
						'<p class="mui-ellipsis h2Font">' + rlist + '</p>' +
383
//						'<p class="mui-ellipsis h3Font">' + zlist + '</p>' +
384
					'</div>';
378
			'<div class="madiaHead useHead" style="background-image:url(' + img + ')"></div>' +
379
			'<div class="madiaInfo">' +
380
			'<p><span class="h1Font">' + item.name + typeTname + '</p>' +
381
			'<p class="mui-ellipsis h2Font">' + otherIn + '</p>' +
382
			'<p class="mui-ellipsis h2Font">' + rlist + '</p>' +
383
			//						'<p class="mui-ellipsis h3Font">' + zlist + '</p>' +
384
			'</div>';
385 385

386 386
		table.appendChild(li, table.firstChild);
387 387

388 388
	});
389
}
389
}

+ 104 - 0
app/js/sureOrg.js

@ -0,0 +1,104 @@
1
mui.ready(function() {
2
	mui.plusReady(function() {
3
		var web = plus.webview.currentWebview()
4
		web.show("slide-in-right", 150);
5
		var userid = plus.storage.getItem('userid');
6
		var organName=""
7
		function person(orgName) {
8
			plus.nativeUI.closeWaiting();
9
			var title = document.getElementById("title");
10
			title.value = orgName;
11
			document.getElementById("tt").value = orgName;
12
			title.style.height = document.getElementById("tt").scrollHeight + "px";
13
			if(orgName.length) {
14
				document.getElementById("fontAdd").innerHTML = orgName.length;
15
				document.getElementById("login").removeAttribute("disabled");
16
			}
17
			document.getElementById("title").addEventListener("input", function() {
18
				if(this.value == "") {
19
					document.getElementById("login").disabled = "disabled";
20
				} else {
21
					document.getElementById("login").removeAttribute("disabled");
22
				}
23
				document.getElementById("fontAdd").innerHTML = this.value.length;
24
			})
25
		}
26
27
		document.getElementById("login").addEventListener("tap", function() {
28
			if(document.getElementById("title").value.length) {
29
				if(document.getElementById("title").value.length>50) {
30
					plus.nativeUI.toast("机构名称不可超过50个字", toastStyle);
31
					return;
32
				}
33
			}
34
			if(organName==document.querySelector("#title").value) {
35
				mui.openWindow({
36
							url: '../html/demandPublish.html',
37
							id: 'demandPublish.html',
38
							show: {
39
								autoShow: true,
40
								aniShow: "slide-in-right"
41
							}
42
						});
43
			}else{
44
				
45
						savePro();
46
			}
47
			
48
		})
49
		orName()
50
		// 获取企业名字
51
		function orName() {
52
			mui.ajax(baseUrl + "/ajax/professor/baseInfo/" + plus.storage.getItem('userid'), {
53
				dataType: 'json', //数据格式类型
54
				type: 'GET', //http请求类型
55
				timeout: 10000, //超时设置
56
				//async: false,
57
				success: function(data) {
58
					if(data.success && data.data) {
59
						var $info = data.data || {};
60
						person($info.orgName);
61
						organName=$info.orgName;
62
					}
63
				},
64
				error: function() {
65
					plus.nativeUI.toast("服务器链接超时", toastStyle);
66
					return;
67
				}
68
			});
69
		}
70
71
		function savePro() {
72
			console.log(plus.storage.getItem('userid'))
73
			var ccc={
74
					"id": plus.storage.getItem('userid'),
75
					"name": document.getElementById("title").value
76
				}
77
			$.ajax({
78
				"url": baseUrl + '/ajax/professor/org',
79
				"type": "POST",
80
				"async": true,
81
				"data": ccc,
82
				"beforeSend":function(){
83
					console.log(JSON.stringify(ccc));
84
				},
85
				"success": function(data) {
86
					console.log(JSON.stringify(data));
87
					if(data.success) {
88
						plus.nativeUI.showWaiting();
89
						mui.openWindow({
90
							url: '../html/demandPublish.html',
91
							id: 'demandPublish.html',
92
							show: {
93
								autoShow: true,
94
								aniShow: "slide-in-right"
95
							}
96
						});
97
					} else {
98
						plus.nativeUI.toast("服务器链接超时", toastStyle);
99
					}
100
				}
101
			});
102
		}
103
	})
104
})

+ 8 - 7
app/js/updateBasic.js

@ -30,17 +30,18 @@ mui.ready(function() {
30 30
							var mun = Math.round(Math.random() * 99 + 1);
31 31
							document.getElementById("userimg").style.backgroundImage = "url(" + baseUrl + "/images/head/" + $data.id + "_l.jpg?" + mun + ")";
32 32
						}
33
						var on1=document.querySelectorAll("exName")
33
						var onp=document.querySelectorAll(".exName");
34 34
						if($data.orgAuth==0) {
35
							on1[0].style.display="none";
36
							on1[1].style.display="none";
37
							on1[4].innerHTML=$data.name;
35
							onp[0].style.display="none";
36
							onp[1].style.display="none";
37
							onp[2].style.display="block";
38
							onp[3].innerHTML=$data.name;
38 39
							if(!f1) {
39
						}else {
40
							bindEvent({selector:"name",txt:"请填写您的姓名",web:{html:'updateName.html',id:"updateName.html"}});
40
						
41
							bindEvent({selector:"name",txt:"请填写您的姓名",web:{html:'updataName.html',id:"updataName.html"}});
41 42
						}
42 43
						}else {
43
							on1[3].innerHTML=$data.name;
44
							onp[1].innerHTML=$data.name;
44 45
						}
45 46
						person.name=$data.name;
46 47
						if($data.orgName) {