jack 7 年 前
コミット
deab156b8c
共有1 個のファイルを変更した69 個の追加66 個の削除を含む
  1. 69 66
      app/js/myaccount.js

+ 69 - 66
app/js/myaccount.js

@ -10,7 +10,7 @@
10 10
function pulldownRefresh() {
11 11
	setTimeout(function() {
12 12
		userInformation();
13
		signyesFun();
13
		isexpert();
14 14
		signFun();
15 15
		/*专家认证*/
16 16
		//isexpert();
@ -108,71 +108,7 @@ mui.ready(function() {
108 108
			});
109 109
		})
110 110

111
		/*专家认证*/
112
		function isexpert() {
113
			var userId = plus.storage.getItem('userid');
114
			var expertAuth = document.getElementById("expertAuth");
115
			mui.ajax(baseUrl + "/ajax/professor/auth", {
116
				data: {
117
					"id": userId
118
				},
119
				dataType: 'json', //数据格式类型
120
				type: 'GET', //http请求类型
121
				timeout: 10000, //超时设置
122
				async: false,
123
				success: function(data) {
124
					console.log(JSON.stringify(data));
125
					var $info = data.data || {};
126
					if(data.success && data.data) {
127
						authStatusExpert = $info.authStatusExpert;
128
						authStatus = $info.authStatus;
129
						console.log(authStatusExpert)
130
						if(authStatusExpert == -1) {
131
							expertAuth.innerHTML = "认证失败";
132
						} else if(authStatusExpert == 0) {
133
							expertAuth.innerHTML = "未认证";
134
						} else if(authStatusExpert == 1) {
135
							expertAuth.innerHTML = "待认证";
136
						} else if(authStatusExpert == 2) {
137
							expertAuth.innerHTML = "认证中";
138
						} else if(authStatusExpert == 3) {
139
							expertAuth.innerHTML = "已认证";
140
						}
141
						goBecomeExpert.addEventListener('tap', function() {
142
							if(authStatus == 3){
143
								if(authStatusExpert == -1 || authStatusExpert == 0) {
144
									mui.openWindow({
145
										url: '../html/expert-authentication.html',
146
										id: 'expert-authentication.html',
147
										show: {
148
											autoShow: false,
149
											aniShow: "slide-in-right"
150
										}
151
									});
152
								}
153
							}else if(authStatus == -1 || authStatus == 0){
154
								if(authStatusExpert == -1 || authStatusExpert == 0) {
155
									mui.openWindow({
156
										url: '../html/realname-authentication2.html',
157
										id: 'realname-authentication2.html',
158
										show: {
159
											autoShow: false,
160
											aniShow: "slide-in-right"
161
										}
162
									});
163
								}
164
							}else if(authStatus == 1 || authStatus == 2){
165
								plus.nativeUI.toast("正在进行实名认证,请稍等片刻。", toastStyle);
166
							}
167
						})
168
					}
169
				},
170
				error: function() {
171
					plus.nativeUI.toast("服务器链接超时", toastStyle);
172
					return;
173
				}
174
			});
175
		}
111
	
176 112

177 113
		function loginStatus() {
178 114
			//alert(userId);
@ -378,4 +314,71 @@ function signFun(){
378 314
				}
379 315
			});
380 316
			})
317
		}
318
			/*专家认证*/
319
		function isexpert() {
320
			mui.plusReady(function(){
321
			var userId = plus.storage.getItem('userid');
322
			var expertAuth = document.getElementById("expertAuth");
323
			mui.ajax(baseUrl + "/ajax/professor/auth", {
324
				data: {
325
					"id": userId
326
				},
327
				dataType: 'json', //数据格式类型
328
				type: 'GET', //http请求类型
329
				timeout: 10000, //超时设置
330
				async: false,
331
				success: function(data) {
332
					console.log(JSON.stringify(data));
333
					var $info = data.data || {};
334
					if(data.success && data.data) {
335
						authStatusExpert = $info.authStatusExpert;
336
						authStatus = $info.authStatus;
337
						console.log(authStatusExpert)
338
						if(authStatusExpert == -1) {
339
							expertAuth.innerHTML = "认证失败";
340
						} else if(authStatusExpert == 0) {
341
							expertAuth.innerHTML = "未认证";
342
						} else if(authStatusExpert == 1) {
343
							expertAuth.innerHTML = "待认证";
344
						} else if(authStatusExpert == 2) {
345
							expertAuth.innerHTML = "认证中";
346
						} else if(authStatusExpert == 3) {
347
							expertAuth.innerHTML = "已认证";
348
						}
349
						goBecomeExpert.addEventListener('tap', function() {
350
							if(authStatus == 3){
351
								if(authStatusExpert == -1 || authStatusExpert == 0) {
352
									mui.openWindow({
353
										url: '../html/expert-authentication.html',
354
										id: 'expert-authentication.html',
355
										show: {
356
											autoShow: false,
357
											aniShow: "slide-in-right"
358
										}
359
									});
360
								}
361
							}else if(authStatus == -1 || authStatus == 0){
362
								if(authStatusExpert == -1 || authStatusExpert == 0) {
363
									mui.openWindow({
364
										url: '../html/realname-authentication2.html',
365
										id: 'realname-authentication2.html',
366
										show: {
367
											autoShow: false,
368
											aniShow: "slide-in-right"
369
										}
370
									});
371
								}
372
							}else if(authStatus == 1 || authStatus == 2){
373
								plus.nativeUI.toast("正在进行实名认证,请稍等片刻。", toastStyle);
374
							}
375
						})
376
					}
377
				},
378
				error: function() {
379
					plus.nativeUI.toast("服务器链接超时", toastStyle);
380
					return;
381
				}
382
			});
383
			})
381 384
		}