Browse Source

身份认证添加

xuchunyang 8 years ago
parent
commit
8f2376bd51
2 changed files with 102 additions and 6 deletions
  1. 11 2
      app/html/security.html
  2. 91 4
      app/js/security.js

+ 11 - 2
app/html/security.html

@ -18,14 +18,23 @@
18 18
			<!-- 主界面具体展示内容 -->
19 19
		    <div class="mui-input-group marginbox setblock">
20 20
				<ul class="mui-table-view">
21
				    <li class="mui-table-view-cell">
21
				   <!-- <li class="mui-table-view-cell">
22 22
				        <a class="mui-navigate-right">
23 23
				        	<span class="mui-pull-left">实名认证</span>
24
				        	<span class="rightword verified" id="verified">已认证</span><!--未认证灰色字#C0C0C0,点击提示“暂时未开通实名认证,敬请期待”-->
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 typenum="" id="istypes"></span>,<span id="isrenzheng"></span></span>
25 31
				        </a>
26 32
				    </li>
27 33
				</ul>
28 34
		    </div>
35
		    <div class="identity-wen">
36
		    	认证身份后,才能成为科袖认证专家。
37
		    </div>
29 38
		    <div class="mui-input-group marginbox setblock">
30 39
				<ul class="mui-table-view">
31 40
				    <li class="mui-table-view-cell">

+ 91 - 4
app/js/security.js

@ -5,19 +5,27 @@ 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 identity = document.getElementById("identity");
9
var userType = document.getElementById("userType");
10

8 11
var phoneCookie = "";
9 12
var emailCookie = "";
10

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

17
mui.plusReady(function() {
20
window.addEventListener('sPage', function(event) {
21
	istyle();
22
})
18 23

19
	isAuthentication();
24
mui.plusReady(function() {
20 25

26
	//isAuthentication();
27
    istyle()
28
    
21 29
	lookup();
22 30

23 31
	bdEmail.addEventListener('tap', function() {
@ -49,6 +57,45 @@ mui.plusReady(function() {
49 57
			}
50 58
		});
51 59
	})
60
	
61
	/*身份认证*/
62
	
63
	identity.addEventListener('tap', function() {
64
			var typenum = document.querySelector("#userType span").getAttribute("typenum");
65
			console.log(authStatus)
66
			if(authStatus==0){
67
				mui.openWindow({
68
					url: '../html/identity.html',
69
					id: '../html/identity.html',
70
					show: {
71
						aniShow: "slide-in-right"
72
					},
73
					extras:{
74
						usertype:typenum,
75
					}
76
				});
77
			}else if(authStatus==1){ 
78
				
79
			}else{
80
				var btn = ["确认", "取消"];
81
				mui.confirm("您的身份已认证,确认要重新认证?", "提示", btn, function(e) {
82
					if(e.index == 0) {
83
						mui.openWindow({
84
						url: '../html/identity.html',
85
						id: '../html/identity.html',
86
						show: {
87
							aniShow: "slide-in-right"
88
						},
89
						extras:{
90
							usertype:typenum,
91
						}
92
					});
93
					}
94
				});
95
			}
96
			
97
		})	
98
	
52 99

53 100
	function ifPhoneAmdEmail() {
54 101

@ -73,7 +120,7 @@ mui.plusReady(function() {
73 120
		}
74 121
	}
75 122

76
	function isAuthentication() {
123
	/*function isAuthentication() {
77 124
		var userId = plus.storage.getItem('userid');
78 125
		mui.ajax(baseUrl + "/ajax/professor/editBaseInfo/" + userId, {
79 126
			dataType: 'json', //数据格式类型
@ -95,6 +142,46 @@ mui.plusReady(function() {
95 142
				return;
96 143
			}
97 144
		});
145
	}*/
146
	
147
	function istyle() {
148
		var userId = plus.storage.getItem('userid');
149
		var isrenzheng = document.getElementById("isrenzheng");
150
		var istypes = document.getElementById("istypes");
151
		mui.ajax(baseUrl + "/ajax/professor/auth", {
152
			data:{"id":userId},
153
			dataType: 'json', //数据格式类型
154
			type: 'GET', //http请求类型
155
			timeout: 10000, //超时设置
156
			async: false,
157
			success: function(data) {
158
				console.log(JSON.stringify(data));
159
				var $info = data.data || {};
160
				if(data.success && data.data) {
161
					istypes.setAttribute('typenum',$info.authentication)
162
					authStatus=$info.authStatus;
163
					if($info.authStatus==0){
164
						isrenzheng.innerHTML="未认证";
165
					}else if($info.authStatus==1){
166
						isrenzheng.innerHTML="已认证";
167
					}else if($info.authStatus==2){
168
						isrenzheng.innerHTML="认证中";
169
					}
170
					
171
					if($info.authentication==1){
172
						istypes.innerHTML="科研工作者";
173
					}else if($info.authentication==2){
174
						istypes.innerHTML="在企人员";
175
					}else if($info.authentication==3){ 
176
						istypes.innerHTML="在校生";
177
					}
178
				}
179
			},
180
			error: function() {
181
				plus.nativeUI.toast("服务器链接超时", toastStyle);
182
				return;
183
			}
184
		});
98 185
	}
99 186

100 187
	function lookup() {