Browse Source

增加时间戳到请求头

sophieChenyx 6 years ago
parent
commit
4c8b02d07b

+ 1 - 3
src/stage/index/scene/IndexScene.js

@@ -104,9 +104,7 @@ class IndexScene extends scene {
 	}
 
   loadDownloadList() {
-    APIClient.getDownloadList( ( isTrue,res) => {
-      console.log('fail result',res)
-    })
+    APIClient.getDownloadList( ( isTrue,res) => {})
 	}
 
 	onCreate() {

+ 6 - 0
src/stage/index/scene/LoginScene.js

@@ -33,7 +33,13 @@ class LoginScene extends scene {
       				this.showScene(require('./IndexScene.js'), {});
 				}
 			} else if (Consts.API_CODE_ISBOUND == res.code) {
+				//账号被登陆
 				this.showScene(require('./RepeatLoginScene.js'), {});
+        this.sidInput.value = '|';
+        this.passwordInput.value = '';
+        this.moye.root.getWidgetById('sid-input').focus();
+        this.onKeydown();
+
 			} else {
 				TVUtil.Toast.show('帐号或密码错误!', 3000);
 				this.sidInput.value = '|';

+ 0 - 2
src/stage/index/scene/RepeatLoginScene.js

@@ -5,7 +5,6 @@ class RepeatLoginScene extends scene {
 
 	onCreate() {
 		this.setContentView(require('../../../res/tpl/RepeatLoginScene.tpl'), {}, 'RepeatLoginScene', {'isParentShow': true}, () => {
-			// 默认光标指向"知道了"按钮
 			this.moye.root.getWidgetById('iknow-btn').focus();
 		});
 	}
@@ -40,7 +39,6 @@ class RepeatLoginScene extends scene {
 			this.hideScene({});
 		}
 	}
-
 	onBack() {
 
 	}

+ 3 - 1
src/util/API/AJAXHelper.js

@@ -54,10 +54,12 @@ class AJAXHelper {
 			platform = 'web';
 		}
 		let url = AJAXHelper.genAPIUrl(path, method, { eid, uid, terminal: platform, ...data });
-
+		//添加时间戳
+		let timestamp = new Date().getTime();
 		let xmlHttpReq = new XMLHttpRequest();
 		xmlHttpReq.open(method, url, true);
 		//构造请求头(每个请求都带的公共参数)
+		xmlHttpReq.setRequestHeader('t', timestamp);
 		xmlHttpReq.setRequestHeader('eid', eid);
 		xmlHttpReq.setRequestHeader('uid', uid);
 		xmlHttpReq.setRequestHeader('sign', sign);