Przeglądaj źródła

新增实名认证和专家认证功能

xuchunyang 8 lat temu
rodzic
commit
9419ab3f11

+ 49 - 0
app/html/expert-authentication.html

@ -0,0 +1,49 @@
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/app.css" rel="stylesheet" />
10
		<link href="../css/feedback-page.css" rel="stylesheet" />
11
		<link rel="stylesheet" type="text/css" href="../css/previewImage.css"/>
12
		<script src="../js/public/zepto.min.js"></script>
13
	</head>
14
 
15
	<body>
16
		<header class="mui-bar mui-bar-nav toptitbox">
17
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left topback"></a>
18
		    <h1 class="mui-title toptit">专家认证</h1>
19
		    <a class="submutbut" id="submit">提交</a>
20
		</header>
21
		
22
		<div class="mui-content feedback">
23
			<h4>科袖郑重承诺不对外提供您的个人信息</h4>
24
			<p>请上传能够证明您专家身份的相关证件,<br />如教工证、工作证、在职证明等:</p>
25
			<div class="content">  
26
				<div style="margin-top: 10px;"></div>  
27
				<input type="hidden" id="ckjl.id" name="ckjl.id" value="429">  
28
				<div class="collapse-content" >  
29
					<form>  
30
					    <label class="row-label"></label>  
31
					    <div id='F_CKJLBS' class="row image-list" style="float: left;">  
32
					        <div class="image-item " id="F_CKJLB" onclick="showActionSheet(this);" style="float: left;"></div>  
33
					    </div> 
34
					</form>  
35
				</div>  
36
			</div>
37
		</div>
38
		<script src="../js/public/mui.min.js"></script>
39
		<script src="../js/public/base.js"></script>
40
		<script src="../js/public/mui.zoom.js"></script>
41
		<script src="../js/public/mui.previewimage.js"></script>
42
		<script src="../js/public-authentication.js"></script>
43
		<script src="../js/expert-authentication.js"></script>
44
		<script>
45
			mui.previewImage();
46
	   </script>
47
</body>  
48
49
</html>

+ 78 - 3
app/html/login.html

@ -36,20 +36,95 @@
36 36
				<button id='reg' class="mui-btn mui-btn-block mui-btn-outlined frmbtn">注&nbsp;册</button>
37 37
			</div>
38 38
			
39
			<!--<div class="quickbox">
39
			<div class="quickbox">
40 40
				
41 41
				<span class="borderword">直接登录</span>
42 42
				<div class="quickway">
43
					<span class="mui-icon mui-icon-weixin quickicon weixinicon"></span>
43
					<span class="mui-icon mui-icon-weixin quickicon weixinicon" id="weixin"></span>
44 44
					<span class="mui-icon mui-icon-weibo quickicon weiboicon"></span>
45 45
					<span class="mui-icon mui-icon-qq quickicon qqicon"></span>	
46 46
				</div>
47
			</div>-->
47
			</div>
48 48
			
49 49
		</div>
50 50
		<script src="../js/public/mui.min.js"></script>
51 51
		<script src="../js/public/base.js"></script>
52 52
		<script src="../js/login.js"></script>
53
		<script type="text/javascript">
54
			var auths;
55
			mui.plusReady(function() {   
56
	            plus.oauth.getServices(function(services) { 
57
	                auths = services; 
58
	            }, function(e) { 
59
	                alert("获取登录服务列表失败:" + e.message + " - " + e.code); 
60
	            }); 
61
	        }) 
62
	        
63
	        document.getElementById('weixin').addEventListener('tap',function() { 
64
	            console.log("微信"); 
65
	            authLogin('weixin'); 
66
	        });
67
	        
68
	        function authLogin(type) { 
69
	            var s; 
70
	            for (var i = 0; i < auths.length; i++) { 
71
	                if (auths[i].id == type) { 
72
	                    s = auths[i]; 
73
	                    break; 
74
	                } 
75
	            } 
76
	            if (!s.authResult) { 
77
	                s.login(function(e) { 
78
	                    mui.toast("登录认证成功!"); 
79
	                    authUserInfo(type); 
80
	                }, function(e) { 
81
	                    mui.toast("登录认证失败!"); 
82
	                }); 
83
	            } else { 
84
	                mui.toast("已经登录认证!"); 
85
	            } 
86
	        } 
87
			
88
			// 微信登录认证信息 
89
	        function authUserInfo(type) { 
90
	            var s; 
91
	            for (var i = 0; i < auths.length; i++) { 
92
	                if (auths[i].id == type) { 
93
	                    s = auths[i]; 
94
	                    break; 
95
	                } 
96
	            } 
97
	            if (!s.authResult) { 
98
	                mui.toast("未授权登录!"); 
99
	            } else { 
100
	                s.getUserInfo(function(e) { 
101
	                    var josnStr = JSON.stringify(s.userInfo); 
102
	                    var jsonObj = s.userInfo; 
103
	                    console.log("获取用户信息成功:" + josnStr); 
104
	                    //showData(type,jsonObj); 
105
	                    authLogout(); 
106
	                }, function(e) { 
107
	                    alert("获取用户信息失败:" + e.message + " - " + e.code); 
108
	                }); 
109
	            } 
110
	        } 
111
112
113
		 //注销 
114
        function authLogout() { 
115
            for (var i in auths) { 
116
                var s = auths[i]; 
117
                if (s.authResult) { 
118
                    s.logout(function(e) { 
119
                        console.log("注销登录认证成功!"); 
120
                    }, function(e) { 
121
                        console.log("注销登录认证失败!"); 
122
                    }); 
123
                } 
124
            } 
125
        } 
126
127
		</script>
53 128
	</body>
54 129
55 130
</html>

+ 3 - 3
app/html/myaccount.html

@ -97,14 +97,14 @@
97 97
				    </li>
98 98
				    <li class="mui-table-view-cell" id="goBecomeExpert">
99 99
				        <a class="mui-navigate-right">
100
				        	<em class="mui-icon iconfont icon-friendfavor actionicon addicon mui-pull-left"></em>
100
				        	<em class="mui-icon iconfont icon-profile actionicon toProicon mui-pull-left"></em>
101 101
				        	<span class="mui-pull-left">成为专家</span>
102
				        	<span class="rightword verified">已认证</span>
102
				        	<span class="rightword verified" id="expertAuth">已认证</span>
103 103
				        </a>
104 104
				    </li>
105 105
				    <li class="mui-table-view-cell" id="goNewuser">
106 106
				        <a class="mui-navigate-right">
107
				        	<em class="mui-icon iconfont icon-friendfavor actionicon addicon mui-pull-left"></em>
107
				        	<em class="mui-icon iconfont icon-friend actionicon addicon mui-pull-left"></em>
108 108
				        	<span class="mui-pull-left">邀请好友</span>
109 109
				        	<!--<span class="mui-pull-right" style="margin-right:24px;">邀请好友得积分</span>-->
110 110
				        </a>

+ 49 - 0
app/html/realname-authentication.html

@ -0,0 +1,49 @@
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/app.css" rel="stylesheet" />
10
		<link href="../css/feedback-page.css" rel="stylesheet" />
11
		<link rel="stylesheet" type="text/css" href="../css/previewImage.css"/>
12
		<script src="../js/public/zepto.min.js"></script>
13
	</head>
14
 
15
	<body>
16
		<header class="mui-bar mui-bar-nav toptitbox">
17
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left topback"></a>
18
		    <h1 class="mui-title toptit">实名认证</h1>
19
		    <a class="submutbut" id="submit">提交</a>
20
		</header>
21
		
22
		<div class="mui-content feedback">
23
			<h4>科袖郑重承诺不对外提供您的个人信息</h4>
24
			<p>请上传您身份证的正反面照片:</p>
25
			<div class="content">  
26
				<div style="margin-top: 10px;"></div>  
27
				<input type="hidden" id="ckjl.id" name="ckjl.id" value="429">  
28
				<div class="collapse-content" >  
29
					<form>  
30
					    <label class="row-label"></label>  
31
					    <div id='F_CKJLBS' class="row image-list" style="float: left;">  
32
					        <div class="image-item " id="F_CKJLB" onclick="showActionSheet(this);" style="float: left;"></div>  
33
					    </div> 
34
					</form>  
35
				</div>  
36
			</div>
37
		</div>
38
		<script src="../js/public/mui.min.js"></script>
39
		<script src="../js/public/base.js"></script>
40
		<script src="../js/public/mui.zoom.js"></script>
41
		<script src="../js/public/mui.previewimage.js"></script>
42
		<script src="../js/public-authentication.js"></script>
43
		<script src="../js/realname-authentication.js"></script>
44
		<script>
45
			mui.previewImage();
46
	   </script>
47
</body>  
48
49
</html>

+ 49 - 0
app/html/realname-authentication2.html

@ -0,0 +1,49 @@
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/app.css" rel="stylesheet" />
10
		<link href="../css/feedback-page.css" rel="stylesheet" />
11
		<link rel="stylesheet" type="text/css" href="../css/previewImage.css"/>
12
		<script src="../js/public/zepto.min.js"></script>
13
	</head>
14
 
15
	<body>
16
		<header class="mui-bar mui-bar-nav toptitbox">
17
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left topback"></a>
18
		    <h1 class="mui-title toptit">实名认证</h1>
19
		    <a class="submutbut" id="submit">下一步</a>
20
		</header>
21
		
22
		<div class="mui-content feedback">
23
			<h4>科袖郑重承诺不对外提供您的个人信息</h4>
24
			<p>您还未进行实名认证,<br />请先上传您身份证的正反面照片:</p>
25
			<div class="content">  
26
				<div style="margin-top: 10px;"></div>  
27
				<input type="hidden" id="ckjl.id" name="ckjl.id" value="429">  
28
				<div class="collapse-content" >  
29
					<form>  
30
					    <label class="row-label"></label>  
31
					    <div id='F_CKJLBS' class="row image-list" style="float: left;">  
32
					        <div class="image-item " id="F_CKJLB" onclick="showActionSheet(this);" style="float: left;"></div>  
33
					    </div> 
34
					</form>  
35
				</div>  
36
			</div>
37
		</div>
38
		<script src="../js/public/mui.min.js"></script>
39
		<script src="../js/public/base.js"></script>
40
		<script src="../js/public/mui.zoom.js"></script>
41
		<script src="../js/public/mui.previewimage.js"></script>
42
		<script src="../js/public-authentication.js"></script>
43
		<script src="../js/realname-authentication2.js"></script>
44
		<script>
45
			mui.previewImage();
46
	   </script>
47
</body>  
48
49
</html>

+ 6 - 12
app/html/security.html

@ -16,25 +16,19 @@
16 16
		</header>
17 17
		<div class="mui-content">
18 18
			<!-- 主界面具体展示内容 -->
19
		    <div class="mui-input-group marginbox setblock">
19
		    <div class="mui-input-group marginbox setblock" style="margin-top:10px;">
20 20
				<ul class="mui-table-view">
21
				   <!-- <li class="mui-table-view-cell">
21
				  <li class="mui-table-view-cell" id="verified">
22 22
				        <a class="mui-navigate-right">
23 23
				        	<span class="mui-pull-left">实名认证</span>
24
				        	<span class="rightword verified" id="verified">已认证</span>
25
				        </a>
26
				    </li>-->
27
				    <li class="mui-table-view-cell" id="identity">
28
				        <a class="mui-navigate-right">
29
				        	<span class="mui-pull-left">身份认证 </span> 
30
				        	<span class="rightword verified" id="userType"><span id="isrenzheng"></span></span>
24
				        	<span class="rightword verified" id="isrenzheng"></span>
31 25
				        </a>
32
				    </li>
26
				   </li>
33 27
				</ul>
34 28
		    </div>
35
		    <div class="identity-wen littip">
29
		    <!--<div class="identity-wen littip">
36 30
		    	认证身份后,才能成为科袖认证专家。
37
		    </div>
31
		    </div>-->
38 32
		    <div class="mui-input-group marginbox setblock">
39 33
				<ul class="mui-table-view">
40 34
				    <li class="mui-table-view-cell">

+ 114 - 0
app/js/expert-authentication.js

@ -0,0 +1,114 @@
1
//专家认证
2
mui.plusReady(function() {
3
	var userid = plus.storage.getItem('userid');
4
	var self = plus.webview.currentWebview();
5
	var num = self.num;
6
    var imgarr = self.imgarr;
7
	$('#submit').on("click", function() {
8
		var arr = $(".image-item img");
9
		if(arr.length == 0) {
10
			plus.nativeUI.toast("请上传能够证明您专家身份的相关证件", toastStyle);
11
		} else {
12
			var temp = [];
13
			for(var i = 0;i<arr.length;i++){
14
			    temp.push(arr[i].getAttribute("data-url"));
15
			}
16
			var bts = ["是", "否"];
17
			plus.nativeUI.confirm("确认提交认证信息?一旦审核通过后,将不可更改。", function(e) {
18
				var i = e.index;
19
				if(i == 0) {
20
					plus.nativeUI.showWaiting();
21
					if(num==1){
22
						typeimg(userid,imgarr)
23
						expertimg(userid,temp);
24
					}else{
25
						expertimg(userid,temp);
26
					}
27
				}
28
			}, "提示", bts);	
29
		}
30
	})
31
})
32

33
//拼接图片样式
34
function showImgDetail(file, cacheKey) {
35
	var html = "";
36
	html += '<div  class="image-item" style="float: left;margin-right:10px">';
37
	html += '    <img id="picBig" data-preview-src="" data-preview-group="1" data-url="'+ cacheKey +'" src="' + file + '"/>';
38
	html += '    <span class="del">';
39
	html += '        <div class="fa fa-times-circle">X</div>';
40
	html += '    </span>';
41
	html += '</div>';
42
	var imglen = $(".image-item img").length;
43
	if(imglen>=5){ 
44
		plus.nativeUI.toast("最多上传5张照片", toastStyle);		
45
	}else{
46
		$("#F_CKJLBS").append(html);
47
	}
48
}
49

50
//提交专家认证图片
51
function expertimg(userid,temp) {
52
	mui.ajax(baseUrl + "/ajax/authApply/expert", {
53
		data: {
54
			"professorId": userid,
55
			"fns": temp
56
		},
57
		dataType: 'json', //数据格式类型
58
		type: 'post', //http请求类型
59
		async: false,
60
		timeout: 10000, //超时设置
61
		traditional:true,//传数组必须加这个
62
		success: function(data) {
63
			console.log(JSON.stringify(data));
64
			if(data.success) {
65
				plus.nativeUI.toast("认证信息提交成功!我们将尽快对您的信息进行认证,通过后您将成为科袖认证专家,获得特殊功能权限!", toastStyle);
66
				var myPage = plus.webview.getWebviewById('html/myaccount.html');
67
				mui.fire(myPage,'mPage', {});					
68
				var curr = plus.webview.currentWebview();
69
                var wvs = plus.webview.all();
70
                for (var i = 0, len = wvs.length; i < len; i++) {
71
                    if (wvs[i].getURL() == curr.getURL())
72
                        continue;
73
                    plus.webview.close(wvs[i]);
74
                }
75
                plus.nativeUI.closeWaiting();
76
                setTimeout(function() {
77
					 plus.webview.open('../index.html');
78
                	 curr.close();
79
				}, 500);
80
               
81
			}
82
		},
83
		error: function() {
84
			plus.nativeUI.toast("服务器链接超时", toastStyle);
85
			return;
86
		}
87
	});
88
}
89

90
//提交实名认证图片
91
function typeimg(userid,imgarr) {
92
	mui.ajax(baseUrl + "/ajax/authApply/realName", {
93
		data: {
94
			"professorId": userid,
95
			"fns": imgarr
96
		},
97
		dataType: 'json', //数据格式类型
98
		type: 'post', //http请求类型
99
		async: false,
100
		timeout: 10000, //超时设置
101
		traditional:true,//传数组必须加这个
102
		success: function(data) {
103
			//console.log(JSON.stringify(data));
104
			if(data.success) {
105
				var securityPage = plus.webview.getWebviewById('../html/security.html');
106
				mui.fire(securityPage,'sPage', {});					
107
			}
108
		},
109
		error: function() {
110
			plus.nativeUI.toast("服务器链接超时", toastStyle);
111
			return;
112
		}
113
	});
114
}

+ 73 - 18
app/js/myaccount.js

@ -23,21 +23,25 @@ mui.ready(function() {
23 23

24 24
		var userId = plus.storage.getItem('userid');
25 25
		console.log(userId);
26
		
26 27
		/*判断登录是否成功*/
27 28
		loginStatus();
28 29

29 30
		/*用户信息初始化*/
30 31
		userInformation();
31

32
		
33
		/*专家认证*/
34
		isexpert();
35
		
32 36
		/*登录按钮*/
33 37
		loginNo.addEventListener('tap', function() {
34 38
			goLoginFun();
35 39
		})
36 40

37
		/*注册按钮*/
38
		/*goReg.addEventListener('tap', function() {
39
			goRegFun();
40
		})*/
41
		/*专家认证刷新页面*/
42
		window.addEventListener('mPage', function(event) {
43
			isexpert();
44
		})
41 45

42 46
		/*退出登录刷新页面*/
43 47
		window.addEventListener('closeUser', function(event) {
@ -53,13 +57,75 @@ mui.ready(function() {
53 57
			nameli.innerHTML = ""
54 58
			userInformation();
55 59
		});
60
		
61
		/*专家认证*/
62
		function isexpert() {
63
			var userId = plus.storage.getItem('userid');
64
			var expertAuth = document.getElementById("expertAuth");
65
			mui.ajax(baseUrl + "/ajax/professor/auth", {
66
				data: {
67
					"id": userId
68
				},
69
				dataType: 'json', //数据格式类型
70
				type: 'GET', //http请求类型
71
				timeout: 10000, //超时设置
72
				async: false,
73
				success: function(data) {
74
					console.log(JSON.stringify(data));
75
					var $info = data.data || {};
76
					if(data.success && data.data) {
77
						authStatusExpert = $info.authStatusExpert;
78
						authStatus = $info.authStatus;
79
						console.log(authStatusExpert)
80
						if(authStatusExpert == -1) {
81
							expertAuth.innerHTML = "认证失败";
82
						} else if(authStatusExpert == 0) {
83
							expertAuth.innerHTML = "未认证";
84
						} else if(authStatusExpert == 1) {
85
							expertAuth.innerHTML = "待认证";
86
						} else if(authStatusExpert == 2) {
87
							expertAuth.innerHTML = "认证中";
88
						} else if(authStatusExpert == 3) {
89
							expertAuth.innerHTML = "已认证";
90
						}
91
						goBecomeExpert.addEventListener('tap', function() {
92
							if(authStatus == 3){
93
								if(authStatusExpert == -1 || authStatusExpert == 0) {
94
									mui.openWindow({
95
										url: '../html/expert-authentication.html',
96
										id: 'expert-authentication.html',
97
										show: {
98
											aniShow: "slide-in-right"
99
										}
100
									});
101
								}
102
							}else{
103
								if(authStatusExpert == -1 || authStatusExpert == 0) {
104
									mui.openWindow({
105
										url: '../html/realname-authentication2.html',
106
										id: 'realname-authentication2.html',
107
										show: {
108
											aniShow: "slide-in-right"
109
										}
110
									});
111
								}
112
							}
113
						})
114
					}
115
				},
116
				error: function() {
117
					plus.nativeUI.toast("服务器链接超时", toastStyle);
118
					return;
119
				}
120
			});
121
		}
122

56 123

57 124
		function loginStatus() {
58 125
			console.log(userId);
59 126
			if(userId && userId != "null" && userId != null) {
60 127
				loginNo.style.display = "none";
61 128
				loginYes.style.display = "block";
62
				//alert('dd')
63 129
				/*设置*/
64 130
				goSetup.addEventListener('tap', function() {
65 131
					mui.openWindow({
@ -93,18 +159,6 @@ mui.ready(function() {
93 159
					});
94 160
				})
95 161
				
96
				/*成为专家*/
97
				goBecomeExpert.addEventListener('tap', function() {
98
					mui.openWindow({
99
						url: '../html/expert-authentication.html',
100
						id: 'expert-authentication.html',
101
						show: {
102
							//autoShow: false,
103
							aniShow: "slide-in-right"
104
						}
105
					});
106
				})
107

108 162
				/*我的修改专家*/
109 163
				infobasic.addEventListener('tap', function() {
110 164
						if(oFlag1) {
@ -278,6 +332,7 @@ mui.ready(function() {
278 332
				}
279 333
			});
280 334
		}
335
		
281 336
		document.getElementById("goNewuser").addEventListener("tap", function() {
282 337
			mui.openWindow({
283 338
				url: '../html/invite_new.html',

+ 93 - 0
app/js/public-authentication.js

@ -0,0 +1,93 @@
1
//认证公用文件
2

3
//选取图片的来源,拍照和相册  
4
function showActionSheet() {
5
	var actionbuttons = [{
6
		title: "拍照"
7
	}, {
8
		title: "相册选取"
9
	}];
10
	var actionstyle = {
11
		title: "选择照片",
12
		cancel: "取消",
13
		buttons: actionbuttons
14
	};
15
	plus.nativeUI.actionSheet(actionstyle, function(e) {
16
		if(e.index == 1) {
17
			getImage();
18
		} else if(e.index == 2) {
19
			galleryImg();
20
		}
21
	});
22
}
23

24
/*摄像头拍照*/
25
function getImage() {
26
	var c = plus.camera.getCamera();
27
	c.captureImage(function(e) {
28
		plus.io.resolveLocalFileSystemURL(e, function(entry) {
29
			var imgurl = entry.toLocalURL();
30
			var task = plus.uploader.createUpload(baseUrl + "/ajax/cachedFileUpload", 
31
				{ method:"POST",blocksize:204800,priority:100 },
32
				function ( t, status ) {
33
					// 上传完成
34
					if ( status == 200 ) {
35
						var odata= JSON.parse(t.responseText);
36
						if(odata.success){
37
							cacheKey = odata.data[0].cacheKey;
38
							showImgDetail(imgurl, cacheKey);
39
						}
40
					}
41
				}
42
			);
43
			task.addFile( imgurl, {key:"testdoc"} );
44
			task.start();
45
			
46
		}, function(e) {
47
			plus.nativeUI.toast("读取拍照文件错误", toastStyle);
48
		});
49
	}, function(s) {
50
		console.log("error" + s);
51
	}, {
52
		filename: ""
53
	})
54
}
55

56
/*相册获取照片*/
57
function galleryImg() {
58
	var cacheKey;
59
	plus.gallery.pick(function(file) {
60
		var task = plus.uploader.createUpload(baseUrl + "/ajax/cachedFileUpload", 
61
			{ method:"POST",blocksize:204800,priority:100 },
62
			function ( t, status ) {
63
				// 上传完成
64
				if ( status == 200 ) {
65
					var odata= JSON.parse(t.responseText);
66
					if(odata.success){
67
						cacheKey = odata.data[0].cacheKey;
68
						showImgDetail(file, cacheKey);
69
					}
70
				}
71
			}
72
		);
73
		task.addFile( file, {key:"testdoc"} );
74
		task.start();
75
	}, function(err) {
76
		console.log(JSON.stringify(err));
77
	}, {
78
		filter: 'image',
79
		multiple: false
80
	});
81
}
82

83
//删除图片
84
mui(document).on("click", '.del', function() {
85
	var $this = $(this);
86
	var bts = ["是", "否"];
87
	plus.nativeUI.confirm("是否删除图片?", function(e) {
88
		var i = e.index;
89
		if(i == 0) {
90
			$this.parent().remove();
91
		}
92
	}, "删除图片", bts);
93
});

+ 73 - 0
app/js/realname-authentication.js

@ -0,0 +1,73 @@
1
//实名认证
2
mui.plusReady(function() {
3
	var userid = plus.storage.getItem('userid');
4
	$('#submit').on("click", function() {
5
		plus.nativeUI.showWaiting();
6
		var arr = $(".image-item img");
7
		if(arr.length == 0) {
8
			plus.nativeUI.toast("请上传您身份证的正反面照片", toastStyle);
9
		} else {
10
			var temp = [];
11
			for(var i = 0;i<arr.length;i++){
12
			    temp.push(arr[i].getAttribute("data-url"));
13
			}
14
			console.log(JSON.stringify(temp))
15
			var bts = ["是", "否"];
16
			plus.nativeUI.confirm("确认提交实名信息?一旦审核通过后,将不可更改。", function(e) {
17
				var i = e.index;
18
				if(i == 0) {
19
					typeimg(userid,temp);
20
				}
21
			}, "提示", bts);
22
			
23
		}
24
	})
25
})
26

27
//拼接图片样式
28
function showImgDetail(file, cacheKey) {
29
	var html = "";
30
	html += '<div  class="image-item" style="float: left;margin-right:10px">';
31
	html += '    <img id="picBig" data-preview-src="" data-preview-group="1" data-url="'+ cacheKey +'" src="' + file + '"/>';
32
	html += '    <span class="del">';
33
	html += '        <div class="fa fa-times-circle">X</div>';
34
	html += '    </span>';
35
	html += '</div>';
36
	var imglen = $(".image-item img").length;
37
	if(imglen>=3){ 
38
		plus.nativeUI.toast("最多上传3张照片", toastStyle);		
39
	}else{
40
		$("#F_CKJLBS").append(html);
41
	}
42
}
43

44
//提交实名认证图片
45
function typeimg(userid,temp) {
46
	mui.ajax(baseUrl + "/ajax/authApply/realName", {
47
		data: {
48
			"professorId": userid,
49
			"fns": temp
50
		},
51
		dataType: 'json', //数据格式类型
52
		type: 'post', //http请求类型
53
		async: false,
54
		timeout: 10000, //超时设置
55
		traditional:true,//传数组必须加这个
56
		success: function(data) {
57
			console.log(JSON.stringify(data));
58
			if(data.success) {
59
				plus.nativeUI.toast("认证信息提交成功!——我们将尽快对您的信息进行认证。", toastStyle);
60
				var securityPage = plus.webview.getWebviewById('../html/security.html');
61
				mui.fire(securityPage,'sPage', {});
62
				var myPage = plus.webview.getWebviewById('html/myaccount.html');
63
				mui.fire(myPage,'mPage', {});	
64
				plus.nativeUI.closeWaiting();
65
				mui.back();
66
			}
67
		},
68
		error: function() {
69
			plus.nativeUI.toast("服务器链接超时", toastStyle);
70
			return;
71
		}
72
	});
73
}

+ 43 - 0
app/js/realname-authentication2.js

@ -0,0 +1,43 @@
1
//实名认证
2
mui.plusReady(function() {
3
	var userid = plus.storage.getItem('userid');
4
	$('#submit').on("click", function() {
5
		var arr = $(".image-item img");
6
		if(arr.length == 0) {
7
			plus.nativeUI.toast("请上传您身份证的正反面照片", toastStyle);
8
		} else {
9
			var temp = [];
10
			for(var i = 0;i<arr.length;i++){
11
			    temp.push(arr[i].getAttribute("data-url"));
12
			}
13
			mui.openWindow({
14
				url: '../html/expert-authentication.html',
15
				id: 'expert-authentication.html',
16
				show: {
17
					aniShow: "slide-in-right"
18
				},
19
				extras:{
20
			        num:1,
21
			        imgarr:temp
22
			    }
23
			});
24
		}
25
	})
26
})
27

28
//拼接图片样式
29
function showImgDetail(file, cacheKey) {
30
	var html = "";
31
	html += '<div  class="image-item" style="float: left;margin-right:10px">';
32
	html += '    <img id="picBig" data-preview-src="" data-preview-group="1" data-url="'+ cacheKey +'" src="' + file + '"/>';
33
	html += '    <span class="del">';
34
	html += '        <div class="fa fa-times-circle">X</div>';
35
	html += '    </span>';
36
	html += '</div>';
37
	var imglen = $(".image-item img").length;
38
	if(imglen>=3){ 
39
		plus.nativeUI.toast("最多上传3张照片", toastStyle);		
40
	}else{
41
		$("#F_CKJLBS").append(html);
42
	}
43
}

+ 29 - 98
app/js/security.js

@ -5,30 +5,24 @@ var changePass = document.getElementById("changepass");
5 5
var phoneName = document.getElementById("phonename");
6 6
var emailName = document.getElementById("emailname");
7 7
var verified = document.getElementById("verified");
8
var userType = document.getElementById("userType");
9

10 8
var phoneCookie = "";
11 9
var emailCookie = "";
12 10
var authStatus;
13
var typenum;
11

14 12
/*退出绑定手机页面*/
15 13
window.addEventListener('xsphone', function(event) {
16 14
	phoneCookie = event.detail.phonetel;
17
	phoneName.innerText = phoneCookie; 
15
	phoneName.innerText = phoneCookie;
18 16
})
19 17

20

21

22 18
mui.plusReady(function() {
23 19
	
24 20
	window.addEventListener('sPage', function(event) {
25 21
		istyle();
26 22
	})
27 23

24
	istyle();
28 25

29
	//isAuthentication();
30
    istyle()
31
    
32 26
	lookup();
33 27

34 28
	bdEmail.addEventListener('tap', function() {
@ -60,101 +54,32 @@ mui.plusReady(function() {
60 54
			}
61 55
		});
62 56
	})
63
	
64
	/*身份认证*/
65
	
66
	identity.addEventListener('tap', function() {
67
			
68
			console.log(authStatus)
69
			//console.log(typenum)
70
			
71
			if(authStatus==0 || authStatus==4 || authStatus==5){
72
				mui.openWindow({
73
					url: '../html/identity.html',
74
					id: '../html/identity.html',
75
					show: {
76
						aniShow: "slide-in-right"
77
					},
78
					extras:{
79
						usertype:typenum,
80
					}
81
				});
82
			}else if(authStatus==1){ 
83
				var btn = ["确认", "取消"];
84
				mui.confirm("您的身份已认证,确认要重新认证?", "提示", btn, function(e) {
85
					if(e.index == 0) {
86
						mui.openWindow({
87
						url: '../html/identity.html',
88
						id: '../html/identity.html',
89
						show: {
90
							aniShow: "slide-in-right"
91
						},
92
						extras:{
93
							usertype:typenum,
94
						}
95
					});
96
					}
97
				});
98
			}else{
99
				
100
			}
101
			
102
		})	
103
	
104 57

105 58
	function ifPhoneAmdEmail() {
106

107 59
		/*判断是否绑定了手机号*/
108 60
		if(phoneCookie) {
109 61
			/*phoneName.innerText = (phoneCookie.substring(0, 3) + "****" + phoneCookie.substring(7, 11));*/
110 62
			phoneName.innerText = phoneCookie;
111

112 63
		} else {
113

114 64
			phoneName.innerText = "请绑定手机号";
115

116 65
		}
117 66

118 67
		/*判断是否绑定了邮箱*/
119 68
		if(emailCookie != "" && emailCookie != null && emailCookie != "null") {
120 69
			emailName.innerText = emailCookie;
121

122 70
		} else {
123 71
			emailName.innerText = "请绑定邮箱";
124

125 72
		}
126 73
	}
127 74

128
	/*function isAuthentication() {
129
		var userId = plus.storage.getItem('userid');
130
		mui.ajax(baseUrl + "/ajax/professor/editBaseInfo/" + userId, {
131
			dataType: 'json', //数据格式类型
132
			type: 'GET', //http请求类型
133
			timeout: 10000, //超时设置
134
			async: false,
135
			success: function(data) {
136
				var $info = data.data || {}
137
				if(data.success && data.data) {
138
					if($info.authentication) {
139
						verified.innerText = "已认证";
140
					} else {
141
						verified.innerText = "未认证";
142
					}
143
				}
144
			},
145
			error: function() {
146
				plus.nativeUI.toast("服务器链接超时", toastStyle);
147
				return;
148
			}
149
		});
150
	}*/
151
	
75
	/*实名认证*/
152 76
	function istyle() {
153 77
		var userId = plus.storage.getItem('userid');
154 78
		var isrenzheng = document.getElementById("isrenzheng");
155
		//var istypes = document.getElementById("istypes");
156 79
		mui.ajax(baseUrl + "/ajax/professor/auth", {
157
			data:{"id":userId},
80
			data: {
81
				"id": userId
82
			},
158 83
			dataType: 'json', //数据格式类型
159 84
			type: 'GET', //http请求类型
160 85
			timeout: 10000, //超时设置
@ -163,24 +88,30 @@ mui.plusReady(function() {
163 88
				console.log(JSON.stringify(data));
164 89
				var $info = data.data || {};
165 90
				if(data.success && data.data) {
166
					//istypes.setAttribute('typenum',$info.authentication)
167
					authStatus=$info.authStatus;
91
					authStatus = $info.authStatus;
168 92
					console.log(authStatus)
169
					if($info.authStatus==0){
170
						isrenzheng.innerHTML="未认证";
171
					}else if($info.authStatus==1){
172
						isrenzheng.innerHTML="已认证";
173
					}else if($info.authStatus==2){
174
						isrenzheng.innerHTML="待审核";
175
					}else if($info.authStatus==3){
176
						isrenzheng.innerHTML="审核中";
177
					}else if($info.authStatus==4){
178
						isrenzheng.innerHTML="认证通过";
179
					}else if($info.authStatus==5){
180
						isrenzheng.innerHTML="认证失败";
93
					if(authStatus == -1) {
94
						isrenzheng.innerHTML = "认证失败";
95
					} else if(authStatus == 0) {
96
						isrenzheng.innerHTML = "未认证";
97
					} else if(authStatus == 1) {
98
						isrenzheng.innerHTML = "待认证";
99
					} else if(authStatus == 2) {
100
						isrenzheng.innerHTML = "认证中";
101
					} else if(authStatus == 3) {
102
						isrenzheng.innerHTML = "已认证";
181 103
					}
182
					
183
					typenum = $info.authentication;
104
					verified.addEventListener('tap', function() {
105
						if(authStatus == -1 || authStatus == 0) {
106
							mui.openWindow({
107
								url: '../html/realname-authentication.html',
108
								id: 'realname-authentication.html',
109
								show: {
110
									aniShow: "slide-in-right"
111
								}
112
							});
113
						}
114
					})
184 115
				}
185 116
			},
186 117
			error: function() {