Browse Source

搜索页面跳转软键盘问题

luyanan 8 years ago
parent
commit
909706f178
3 changed files with 23 additions and 31 deletions
  1. 2 2
      app/html/professorArticle.html
  2. 1 0
      app/js/searchListNew.js
  3. 20 29
      app/js/searchfirst.js

+ 2 - 2
app/html/professorArticle.html

@ -9,8 +9,8 @@
9 9
		<link href="../css/iconfont.css" rel="stylesheet" />
10 10
		<link href="../css/app.css" rel="stylesheet" />
11 11
		<style>
12
			/*html,body{height: 100%;margin:0;padding:0px;overflow: hidden;background: #FFFFFF;}*/
13
			.mui-content{height:100%;overflow: auto;background: #FFFFFF;}
12
			html,body{height: 100%;margin:0;padding:0px;overflow: hidden;background: #FFFFFF;}
13
			.mui-content{min-height:100%;overflow: auto;background: #FFFFFF;}
14 14
		</style>
15 15
	</head>
16 16

+ 1 - 0
app/js/searchListNew.js

@ -397,6 +397,7 @@ mui.plusReady(function() {
397 397
			}, "get", search.resource);
398 398
		} else if(this.innerHTML == "找专家") {
399 399
			document.getElementById("sele").style.display = "block";
400
			document.getElementById("searB").classList.add("searchboxNewT");
400 401
			qiFlag = 1;
401 402
			search.oAjaxGet(baseUrl + "/ajax/professor/pqAPP", {
402 403
				"key": document.getElementById("searchval").value,

+ 20 - 29
app/js/searchfirst.js

@ -1,30 +1,21 @@
1 1
mui.plusReady(function() {
2
	document.getElementById("searchval").focus()
3
	if(mui.os.ios) {
4
		var webView = plus.webview.currentWebview().nativeInstanceObject();
5
		webView.plusCallMethod({
6
			"setKeyboardDisplayRequiresUserAction": false
7
		});
8
	} else {
9
		var webview = plus.android.currentWebview();
10
		plus.android.importClass(webview);
11
		webview.requestFocus();
12
		var Context = plus.android.importClass("android.content.Context");
13
		var InputMethodManager = plus.android.importClass("android.view.inputmethod.InputMethodManager");
14
		var main = plus.android.runtimeMainActivity();
15
		var imm = main.getSystemService(Context.INPUT_METHOD_SERVICE);
16
		imm.toggleSoftInput(0, InputMethodManager.SHOW_FORCED);
17
	}
18
	var fff=1;
19
	document.getElementById("searchval").addEventListener("blur",aa,false);
20
	function aa() {
21
		if(fff==1) {
22
			this.focus();
23
			fff=0;
24
			this.blur()
25
		}
26
		document.getElementById("searchval").removeEventListener("blur",aa,false);
27
	}
2
//document.getElementById("searchval").focus()
3
//	if(mui.os.ios) {
4
//		var webView = plus.webview.currentWebview().nativeInstanceObject();
5
//		webView.plusCallMethod({
6
//			"setKeyboardDisplayRequiresUserAction": false
7
//		});
8
//	} else {
9
//		var webview = plus.android.currentWebview();
10
//		plus.android.importClass(webview);
11
//		webview.requestFocus();
12
//		var Context = plus.android.importClass("android.content.Context");
13
//		var InputMethodManager = plus.android.importClass("android.view.inputmethod.InputMethodManager");
14
//		var main = plus.android.runtimeMainActivity();
15
//		var imm = main.getSystemService(Context.INPUT_METHOD_SERVICE);
16
//		imm.toggleSoftInput(0, InputMethodManager.SHOW_FORCED);
17
//	}
18
	
28 19
	var search = {
29 20
		oAjaxGet: function(url, obj, oType, oFun) {
30 21
			mui.ajax(url, {
@ -59,6 +50,7 @@ mui.plusReady(function() {
59 50
			}
60 51
		},
61 52
		createWin: function(keyValue) {
53
			document.activeElement.blur();
62 54
			mui.openWindow({
63 55
				url: '../html/searchListNew.html',
64 56
				id: '../html/searchListNew.html',
@ -71,6 +63,7 @@ mui.plusReady(function() {
71 63
					qiFlag: 1
72 64
				}
73 65
			});
66
			
74 67
		}
75 68
	}
76 69

@ -81,11 +74,9 @@ mui.plusReady(function() {
81 74
	});
82 75

83 76
	/*按键字搜索*/
84
	document.getElementById("searchval").addEventListener("keyup", function() {
85
		var e = event || window.event || arguments.caller.arguments[0];
77
	document.getElementById("searchval").addEventListener("keyup", function(e) {
86 78
		if(e.keyCode == 13) {
87 79
			search.createWin(this.value);
88

89 80
		}
90 81
	})
91 82