chengjie hace 7 años
padre
commit
a9b9758e1e
Se han modificado 7 ficheros con 131 adiciones y 41 borrados
  1. 1 1
      app.js
  2. 3 8
      pages/main/detail.js
  3. 12 15
      pages/main/index.js
  4. 71 11
      pages/main/test.js
  5. 10 2
      pages/main/test.wxml
  6. 31 1
      pages/main/test.wxss
  7. 3 3
      utils/pinyin.js

+ 1 - 1
app.js

@@ -11,7 +11,7 @@ App({
11 11
     this.globalData.systemInfo = wx.getSystemInfoSync();
12 12
   },
13 13
   globalData: {
14
-    Version: "1.1.9",
14
+    Version: "1.1.10",
15 15
     IsProduction: true,
16 16
     ProgramID: 106,
17 17
     AppID: "wx313a8f2c0741efe1",

+ 3 - 8
pages/main/detail.js

@@ -130,14 +130,9 @@ Page({
130 130
       wx.setStorageSync('IsHelpPosition1', 2);
131 131
     }
132 132
 
133
-    wx.getSetting({
134
-      success(res) {
135
-        if (!res.authSetting['scope.userInfo']) {
136
-          wx.setStorageSync('IsRemindAccredit', 1);
137
-        }
138
-      }
139
-    })
140
-
133
+    var IsRemindTest = wx.getStorageSync("IsRemindTest");
134
+    if (!IsRemindTest)
135
+      wx.setStorageSync('IsRemindTest', 1);
141 136
   },
142 137
   submitData: function (content) {
143 138
     if (app.globalData.userInfo && app.globalData.userInfo.UserID) {

+ 12 - 15
pages/main/index.js

@@ -42,12 +42,9 @@ Page({
42 42
           });
43 43
         }
44 44
         else {
45
-          //付费用户请去授权
46
-          if (app.globalData.userInfo.IsMember == 1) {
47
-            wx.navigateTo({
48
-              url: '../about/payfinished?type=accredit',
49
-            });
50
-          }
45
+          wx.navigateTo({
46
+            url: '../about/payfinished?type=accredit',
47
+          });
51 48
         }
52 49
       }
53 50
     })
@@ -60,15 +57,6 @@ Page({
60 57
   onShow: function () {
61 58
     this.getData();
62 59
 
63
-    //进入详情出来后,让用户授权
64
-    if (!this.data.IsAccredit) {
65
-      var IsRemindAccredit = wx.getStorageSync("IsRemindAccredit");
66
-      if (IsRemindAccredit == 1) {
67
-        this.getAccredit();
68
-        wx.removeStorageSync('IsRemindAccredit');
69
-      }
70
-    }
71
-
72 60
     if (wx.getStorageSync("indexNav")) {
73 61
       var obj = {
74 62
         currentTarget: {
@@ -87,6 +75,15 @@ Page({
87 75
         url: '../about/paylist',
88 76
       });
89 77
     }
78
+    else{
79
+      var IsRemindTest = wx.getStorageSync("IsRemindTest");
80
+      if (IsRemindTest == 1) {
81
+        wx.setStorageSync('IsRemindTest', 2);
82
+        wx.navigateTo({
83
+          url: '../main/test',
84
+        });
85
+      }
86
+    }
90 87
   },
91 88
   getAccredit: function () {
92 89
     if (!this.data.IsAccredit) {

+ 71 - 11
pages/main/test.js

@@ -5,9 +5,14 @@ import pinyin from '../../utils/pinyin';
5 5
 const app = getApp();
6 6
 var currentIndex = 0;
7 7
 var isRight = false;
8
+var arrTrue = [];
8 9
 
9 10
 Page({
10 11
   data: {
12
+    CurrentIndex: 1,
13
+    AnswerTrue: 0,
14
+    AnswerError: 0,
15
+    AnswerErrorMax: 3,
11 16
   },
12 17
   onLoad: function (options) {
13 18
     this.setData({
@@ -30,13 +35,13 @@ Page({
30 35
             for (var j = 0; j < pinyinList.length; j++) {
31 36
               if (list[i].PinyinTest[k].options == pinyinList[j][1]) {
32 37
                 list[i].PinyinTest[k].name = pinyinList[j][2][0];
33
-                
38
+
34 39
                 break;
35 40
               }
36 41
             }
37 42
           }
38 43
         }
39
-
44
+        arrTrue = [];
40 45
         that.setData({
41 46
           List: data,
42 47
           CurrentItem: item,
@@ -61,10 +66,10 @@ Page({
61 66
     });
62 67
   },
63 68
   playAudio: function (pinyin, name) {
64
-    if (name != undefined){
65
-      if (pinyin==undefined)
66
-        pinyin="";
67
-      
69
+    if (name != undefined) {
70
+      if (pinyin == undefined)
71
+        pinyin = "";
72
+
68 73
       var url = app.globalData.audioUrlBaidu;
69 74
       url = url.replace("[token]", app.globalData.BaiduToken);
70 75
       url = url.replace("[word]", name + "(" + pinyin + ")");
@@ -82,6 +87,17 @@ Page({
82 87
     if (isRight) {
83 88
       title = "正确";
84 89
       icon = "success";
90
+      that.data.AnswerTrue++;
91
+      for (var i = 0; i < arrTrue.length; i++) {
92
+        if (arrTrue[i] == that.data.CurrentItem.HanziUnitID) {
93
+          arrTrue.splice(i, 1);
94
+          break;
95
+        }
96
+      }
97
+      arrTrue.push(that.data.CurrentItem.HanziUnitID);
98
+    }
99
+    else {
100
+      that.data.AnswerError++;
85 101
     }
86 102
 
87 103
     wx.showToast({
@@ -89,17 +105,61 @@ Page({
89 105
       icon: icon,
90 106
       duration: 1000,
91 107
       complete: function () {
92
-        isRight=false;
108
+        isRight = false;
93 109
         currentIndex++;
94
-        if (currentIndex >= that.data.List.length)
110
+        if (currentIndex >= that.data.List.length) {
95 111
           currentIndex = 0;
96
-        that.setData({
97
-          CurrentItem: that.data.List[currentIndex],
98
-        });
112
+          that.getResult(1);
113
+        } 
114
+        else if (that.data.AnswerError > 3) {
115
+          currentIndex = 0;
116
+          that.getResult(0);
117
+        }
118
+        else {
119
+          that.setData({
120
+            CurrentItem: that.data.List[currentIndex],
121
+            CurrentIndex: currentIndex + 1,
122
+            AnswerTrue: that.data.AnswerTrue,
123
+            AnswerError: that.data.AnswerError,
124
+          });
125
+        }
99 126
       }
100 127
     })
101 128
 
102 129
   },
130
+  getResult: function (isFinished) {
131
+    var content = "";
132
+    var arr = JSON.parse(wx.getStorageSync("HanziAll"));
133
+    var count = 0;
134
+    var book = arr[0].Name;
135
+    for (var i = 0; i < arr.length; i++) {
136
+      for (var j = 0; j < arr[i].Units.length; j++) {
137
+        for (var k = 0; k < arrTrue.length; k++) {
138
+          if (arrTrue[k] == arr[i].Units[j].ID) {
139
+            count += arr[i].Units[j].Words.length;
140
+            book=arr[i].Name;
141
+          }
142
+        }
143
+      }
144
+    }
145
+    content = '您孩子的识字数大约是' + count + '个,建议从《' + book+'》学习起。';
146
+    if (count == 0) {
147
+      content = '您孩子的识字数未知,建议从《' + book +'》学习起。';
148
+    }
149
+    if (isFinished == 1) {
150
+      content = '您孩子的识字数大约是' + count + '个,实在太优秀了!建议自行搜索文字学习。';
151
+    }
152
+    wx.showModal({
153
+      title: '测试结果',
154
+      content: content,
155
+      showCancel: false,
156
+      success: function () {
157
+        wx.navigateBack({
158
+          delta: 1
159
+        })
160
+      },
161
+    });
162
+  },
103 163
   onShareAppMessage: function () {
104 164
     return {
105 165
       title: app.globalData.ShareTitle,

+ 10 - 2
pages/main/test.wxml

@@ -1,6 +1,11 @@
1 1
 <view class="container FlexColumn" style='min-height:{{Height}}rpx;'>
2 2
   <image src='https://hanzi-1253256735.file.myqcloud.com/images/hanzi{{CurrentItem.Name}}.jpg' class="wordImage" />
3 3
 
4
+  <view class="panelTop0 FlexRow">
5
+    <view class='left'>得分:{{AnswerTrue}} / {{List.length}}</view>
6
+    <view class='right'>错误:{{AnswerError}} / {{AnswerErrorMax}}</view>
7
+  </view>
8
+
4 9
   <view class="panelTop FlexRow">
5 10
     <view class="title">选择正确的汉字发音</view>
6 11
   </view>
@@ -8,10 +13,13 @@
8 13
     <view wx:if="{{!item.IsSelected}}" class="universalpic_select_on_black"></view>
9 14
     <image src='../../images/SelectYes.png' wx:if="{{item.IsSelected}}" class="universalpic_select_on_black" />
10 15
     <view class="Number">{{index+1}}.</view>
11
-    
16
+
12 17
     <view class="Name">{{item.options}}</view>
13 18
   </view>
14
-  <view class="bottom" bindtap='gotoOK' data-id="0">确认</view>
19
+  <view class="bottom FlexRow" >
20
+    <text class="bottom1" bindtap='getResult'>退出\n测试</text>
21
+    <view class="bottom2" bindtap='gotoOK' data-id="0">确认</view>
22
+  </view>
15 23
 
16 24
 </view>
17 25
 <audio hidden='true' id="myAudio"></audio>

+ 31 - 1
pages/main/test.wxss

@@ -11,12 +11,30 @@
11 11
 }
12 12
 
13 13
 
14
+.panelTop0{
15
+  width:100%;
16
+  justify-content:space-between;
17
+  height:100rpx;
18
+  position: absolute;
19
+  top:-10rpx;
20
+  font-size: 24rpx;
21
+}
22
+
23
+.panelTop0 .left{
24
+  margin-left: 30rpx;
25
+}
26
+
27
+.panelTop0 .right{
28
+  margin-right: 30rpx;
29
+}
30
+
14 31
 .panelTop{
15 32
   width:100%;
16 33
   justify-content: flex-start;
17 34
   height:100rpx;
18 35
 }
19 36
 
37
+
20 38
 .title{
21 39
   margin: 50rpx 0 30rpx 30rpx;
22 40
   font-size:24rpx;
@@ -51,10 +69,22 @@
51 69
 .bottom{
52 70
   position: fixed;
53 71
   bottom:0;
72
+  width: 100%;
73
+  background-color: #4A4A4A;
74
+}
75
+
76
+.bottom1{
77
+  font-size:28rpx;
78
+  color:#fff;
79
+  text-align: center;
80
+  width: 20%;
81
+}
82
+
83
+.bottom2{
54 84
   font-size:48rpx;
55 85
   color:#fff;
56 86
   background-color: #FF7245;
57 87
   text-align: center;
58 88
   line-height: 120rpx;
59
-  width: 100%;
89
+  width: 80%;
60 90
 }

+ 3 - 3
utils/pinyin.js

@@ -24,7 +24,7 @@ const getPinyinArray = function () {
24 24
     ['ba2', 'bá', ['拔']],
25 25
     ['ba3', 'bǎ', ['把']],
26 26
     ['ba4', 'bà', ['爸']],
27
-    ['ba5', 'ba', ['']],
27
+    ['ba5', 'ba', ['']],
28 28
     ['bai1', 'bāi', ['掰']],
29 29
     ['bai2', 'bái', ['白']],
30 30
     ['bai3', 'bǎi', ['百']],
@@ -718,7 +718,7 @@ const getPinyinArray = function () {
718 718
     ['men2', 'mén', ['门', '们']],
719 719
     ['men3', 'měn', ['']],
720 720
     ['men4', 'mèn', ['闷']],
721
-    ['men5', 'men', ['']],
721
+    ['men5', 'men', ['']],
722 722
     ['meng1', 'mēng', ['蒙']],
723 723
     ['meng2', 'méng', ['蒙', '盟', '萌']],
724 724
     ['meng3', 'měng', ['猛', '']],
@@ -1404,7 +1404,7 @@ const getPinyinArray = function () {
1404 1404
     ['zhe2', 'zhé', ['折']],
1405 1405
     ['zhe3', 'zhě', ['者']],
1406 1406
     ['zhe4', 'zhè', ['这']],
1407
-    ['zhe5', 'zhe', ['']],
1407
+    ['zhe5', 'zhe', ['']],
1408 1408
     ['zhei4', 'zhèi', ['这']],
1409 1409
     ['zhen1', 'zhēn', ['真', '针', '珍']],
1410 1410
     ['zhen3', 'zhěn', ['枕', '诊', '疹']],