chengjie před 4 roky
rodič
revize
48652cd1fd
3 změnil soubory, kde provedl 97 přidání a 79 odebrání
  1. 14 2
      pages/main/search.js
  2. 6 4
      pages/main/search.wxml
  3. 77 73
      project.config.json

+ 14 - 2
pages/main/search.js

@@ -4,7 +4,10 @@ import server from '../../utils/main';
4 4
 const app = getApp();
5 5
 
6 6
 Page({
7
-  data: {},
7
+  data: {
8
+    focus: false,
9
+    inputValue: ''
10
+  },
8 11
   onLoad: function (options) {
9 12
     this.setData({
10 13
       Height: common.getSystemHeight(),
@@ -12,6 +15,11 @@ Page({
12 15
       IsSearchResult: false,
13 16
     });
14 17
   },
18
+  onShow:function(){
19
+    this.setData({
20
+      focus:true,
21
+    });
22
+  },
15 23
   getExampleArray: function () {
16 24
     var result = [];
17 25
     var arr = JSON.parse(wx.getStorageSync("HanziAll"));
@@ -39,11 +47,15 @@ Page({
39 47
   },
40 48
   researchWord: function (e) {
41 49
     var that = this;
50
+    var word = e.detail.value;
51
+    if (word.length>1)
52
+      word=word.substr(0,1);
42 53
     that.setData({
43 54
       IsSearchResult: false,
55
+      inputValue:word,
44 56
     });
45 57
     var result = false;
46
-    var word = e.detail.value;
58
+    
47 59
     if (common.IsChinese(word)) {
48 60
       server.getData('SearchHanzi?Word=' + word, function (data) {
49 61
         if (data) {

+ 6 - 4
pages/main/search.wxml

@@ -1,7 +1,9 @@
1
-<view class="container FlexColumn" style='min-height:{{Height}}rpx;'>
2
-  <view class="search1 FlexColumn">
3
-    <input class="input" placeholder="" maxlength="1" focus="true" confirm-type="search" bindconfirm="researchWord" />
4
-  </view>
1
+<view class="container FlexColumn" style='min-height:{{Height}}rpx;' bindtap="onFocus">
2
+
3
+  <form class="search1 FlexColumn">
4
+    <input class="input" always-embed="true" type="text" value="{{inputValue}}" focus="{{focus}}" confirm-type="search" confirm-hold="true" bindconfirm="researchWord" />
5
+  </form>
6
+  
5 7
   <block wx:if="{{IsSearchResult}}">
6 8
     <image class="image04009" src="../images/04009.png" />
7 9
     <view class="search2">暂未收录</view>

+ 77 - 73
project.config.json

@@ -1,75 +1,79 @@
1 1
 {
2
-	"description": "项目配置文件。",
3
-	"setting": {
4
-		"urlCheck": false,
5
-		"es6": true,
6
-		"postcss": true,
7
-		"minified": true,
8
-		"newFeature": true,
9
-		"checkInvalidKey": true,
10
-		"checkSiteMap": true,
11
-		"uploadWithSourceMap": true,
12
-		"babelSetting": {
13
-			"ignore": [],
14
-			"disablePlugins": [],
15
-			"outputPath": ""
16
-		},
17
-		"useIsolateContext": true,
18
-		"useCompilerModule": true,
19
-		"userConfirmedUseCompilerModuleSwitch": false
20
-	},
21
-	"compileType": "miniprogram",
22
-	"libVersion": "2.3.0",
23
-	"appid": "wx313a8f2c0741efe1",
24
-	"projectname": "%E8%AF%86%E5%AD%97",
25
-	"isGameTourist": false,
26
-	"simulatorType": "wechat",
27
-	"simulatorPluginLibVersion": {},
28
-	"condition": {
29
-		"search": {
30
-			"current": -1,
31
-			"list": []
32
-		},
33
-		"conversation": {
34
-			"current": -1,
35
-			"list": []
36
-		},
37
-		"plugin": {
38
-			"current": -1,
39
-			"list": []
40
-		},
41
-		"game": {
42
-			"currentL": -1,
43
-			"list": []
44
-		},
45
-		"miniprogram": {
46
-			"current": -1,
47
-			"list": [
48
-				{
49
-					"id": -1,
50
-					"name": "首页",
51
-					"pathName": "pages/main/index",
52
-					"query": ""
53
-				},
54
-				{
55
-					"id": -1,
56
-					"name": "列表",
57
-					"pathName": "pages/main/list",
58
-					"query": ""
59
-				},
60
-				{
61
-					"id": 2,
62
-					"name": "详情页",
63
-					"pathName": "pages/main/detail",
64
-					"query": "bookid=1&unitid=1&wordid=0"
65
-				},
66
-				{
67
-					"id": -1,
68
-					"name": "\b搜索",
69
-					"pathName": "pages/main/search",
70
-					"query": ""
71
-				}
72
-			]
73
-		}
74
-	}
2
+  "description": "项目配置文件。",
3
+  "setting": {
4
+    "urlCheck": false,
5
+    "es6": true,
6
+    "postcss": true,
7
+    "minified": true,
8
+    "newFeature": true,
9
+    "checkInvalidKey": true,
10
+    "checkSiteMap": true,
11
+    "uploadWithSourceMap": true,
12
+    "useMultiFrameRuntime": true,
13
+    "useApiHook": true,
14
+    "babelSetting": {
15
+      "ignore": [],
16
+      "disablePlugins": [],
17
+      "outputPath": ""
18
+    },
19
+    "bundle": false,
20
+    "useIsolateContext": true,
21
+    "useCompilerModule": true,
22
+    "userConfirmedUseCompilerModuleSwitch": false,
23
+    "userConfirmedBundleSwitch": false,
24
+    "packNpmManually": false,
25
+    "packNpmRelationList": [],
26
+    "minifyWXSS": true,
27
+    "useApiHostProcess": false
28
+  },
29
+  "compileType": "miniprogram",
30
+  "libVersion": "2.3.0",
31
+  "appid": "wx313a8f2c0741efe1",
32
+  "projectname": "%E8%AF%86%E5%AD%97",
33
+  "isGameTourist": false,
34
+  "simulatorType": "wechat",
35
+  "simulatorPluginLibVersion": {},
36
+  "condition": {
37
+    "search": {
38
+      "list": []
39
+    },
40
+    "conversation": {
41
+      "list": []
42
+    },
43
+    "plugin": {
44
+      "list": []
45
+    },
46
+    "game": {
47
+      "currentL": -1,
48
+      "list": []
49
+    },
50
+    "miniprogram": {
51
+      "list": [
52
+        {
53
+          "id": -1,
54
+          "name": "首页",
55
+          "pathName": "pages/main/index",
56
+          "query": ""
57
+        },
58
+        {
59
+          "id": -1,
60
+          "name": "列表",
61
+          "pathName": "pages/main/list",
62
+          "query": ""
63
+        },
64
+        {
65
+          "id": 2,
66
+          "name": "详情页",
67
+          "pathName": "pages/main/detail",
68
+          "query": "bookid=1&unitid=1&wordid=0"
69
+        },
70
+        {
71
+          "id": -1,
72
+          "name": "\b搜索",
73
+          "pathName": "pages/main/search",
74
+          "query": ""
75
+        }
76
+      ]
77
+    }
78
+  }
75 79
 }