chengjie 7 yıl önce
ebeveyn
işleme
2729a3de96

+ 3 - 1
app.js

@@ -12,7 +12,7 @@ App({
12 12
   },
13 13
   globalData: {
14 14
     Version: "1.0.0",
15
-    IsProduction: true,
15
+    IsProduction: false,
16 16
     userInfo: null,
17 17
     fileUrl: "https://www.kylx365.com/",
18 18
     serverUrl: "https://www.kylx365.com/apiData/",
@@ -20,6 +20,7 @@ App({
20 20
     serverUrlLocalhost: "http://localhost:3020/apiData/",
21 21
     imageUrl: "https://hanzi-1253256735.file.myqcloud.com",
22 22
     audioUrl: "https://pinyin.kylx365.com",
23
+    audioUrlBaidu: "https://tsn.baidu.com/text2audio?lan=zh&ctp=1&cuid=abcdxxx&tok=[token]&tex=[word]&vol=9&per=0&spd=3&pit=5",
23 24
     Key: "kylx365_chengjie",
24 25
     IV: "kylx365hongliren",
25 26
     systemInfo: null,
@@ -29,6 +30,7 @@ App({
29 30
     DayNumber: 0,//使用天数
30 31
     PayMoney: 9.8,//产品销售价
31 32
     TestScoreMax: 0,//测试最高分
33
+    BaiduToken:"",//百度开发平台token
32 34
     IsShow: 0,
33 35
   }
34 36
 })

+ 2 - 0
app.json

@@ -3,6 +3,8 @@
3 3
     "pages/index/index",
4 4
     "pages/main/list",
5 5
     "pages/main/detail",
6
+    "pages/main/search",
7
+    "pages/main/about",
6 8
     "pages/main/index"
7 9
   ],
8 10
   "window": {

BIN
images/012.png


BIN
images/04001.png


BIN
images/04002.png


BIN
images/04003.png


BIN
images/04004.png


BIN
images/130.png


BIN
images/303.png


BIN
images/Arrow.png


images/02014.png → images/FACE.png


+ 142 - 14
pages/index/index.js

@@ -2,37 +2,165 @@ import common from '../../utils/util';
2 2
 import server from '../../utils/main';
3 3
 
4 4
 const app = getApp()
5
+var timeout2, timeout3;
5 6
 
6 7
 Page({
7 8
   data: {
8 9
     FileUrl: "../../",
9 10
     ImageAll: ["../../images/01003.png", "../../images/01004.png", "../../images/01005.png"],
10
-    indexImage:0,
11
+    indexImage: 0,
11 12
   },
12 13
   onReady: function (e) {
13 14
   },
14
-  onLoad: function () {
15
+  onLoad: function (options) {
16
+    if (options) {
17
+      if (options.UserID) {
18
+        console.log("UserID:" + options.UserID);
19
+        app.globalData.introducer = options.UserID;
20
+      }
21
+      if (options.SourceID) {
22
+        console.log("SourceID:" + options.SourceID);
23
+        app.globalData.SourceID = options.SourceID;
24
+      }
25
+      // 扫码介绍人
26
+      if (options.scene) {
27
+        var scene = decodeURIComponent(options.scene);
28
+        console.log("scene:" + scene);
29
+        var introducer = 0;
30
+        if (scene.indexOf("UserID") >= 0)
31
+          introducer = scene.substr(scene.indexOf("UserID") + 7);
32
+        console.log("introducer:" + introducer);
33
+        app.globalData.introducer = scene;
34
+      }
35
+    }
15 36
     this.setData({
16 37
       Height: common.getSystemHeight(),
17
-      indexImage:common.random(0,2),
38
+      indexImage: common.random(0, 2),
18 39
     });
19 40
 
20
-    setTimeout(function(){
21
-      wx.redirectTo({
22
-        url: '../main/index'
23
-      })
24
-    },2000);
41
+    this.getUserInfo();
42
+    
43
+  },
44
+  //得到用户信息
45
+  getUserInfo: function (cb) {
46
+    var that = this
47
+    //调用登录接口
48
+    wx.login({
49
+      success: function (res0) {
50
+        app.globalData.userInfo = {};
51
+        app.globalData.userInfo.Code = res0.code;
52
+        //console.log("Code:" + res0.code);
53
+
54
+        wx.getSetting({
55
+          scope: "scope.userInfo",
56
+          success(res) {
57
+            if (!res.authSetting['scope.userInfo']) {
58
+              app.globalData.userInfo.nickName = "陌生用户";
59
+              app.globalData.userInfo.language = "";
60
+              app.globalData.userInfo.gender = "0";
61
+              app.globalData.userInfo.city = "";
62
+              app.globalData.userInfo.province = "";
63
+              app.globalData.userInfo.country = "";
64
+              app.globalData.userInfo.avatarUrl = "../../images/FACE.png";
65
+              that.login(app.globalData.userInfo);
66
+            }
67
+            else {
68
+              wx.getUserInfo({
69
+                withCredentials: false,
70
+                success: function (res) {
71
+                  app.globalData.userInfo = res.userInfo;
72
+
73
+                  app.globalData.userInfo.NickName = app.globalData.userInfo.nickName;
74
+                  app.globalData.userInfo.AvatarUrl = app.globalData.userInfo.avatarUrl;
75
+
76
+                  app.globalData.userInfo.Code = res0.code;
77
+                  that.login(app.globalData.userInfo);
25 78
 
26
-    this.getHanzi();
79
+                },
80
+                fail: function (res) {
81
+                  that.login(app.globalData.userInfo);
82
+                }
83
+              });
84
+
85
+            }
86
+          }
87
+        });
88
+      },
89
+      fail: function () {
90
+        timeout2 = setTimeout(function () {
91
+          that.getUserInfo();
92
+          console.log("reboot:" + new Date().getTime());
93
+        }, 2000);
94
+      }
95
+    });
27 96
   },
28
-  getHanzi: function () {
97
+
98
+  login: function (param) {
99
+    var that = this;
100
+
101
+    server.getLocalHost(function () {
102
+      server.postData('HanziLogin', {
103
+        Code: param.Code,
104
+        NickName: param.nickName,
105
+        Language: param.language,
106
+        Gender: param.gender,
107
+        City: param.city,
108
+        Province: param.province,
109
+        Country: param.country,
110
+        AvatarUrl: param.avatarUrl,
111
+        Introducer: app.globalData.introducer,
112
+        UserSource: app.globalData.userSource,
113
+        SourceID: app.globalData.SourceID,
114
+        LastUserSource: app.globalData.userSource,
115
+        Brand: app.globalData.systemInfo.brand,
116
+        Model: app.globalData.systemInfo.model,
117
+        PixelRatio: app.globalData.systemInfo.pixelRatio,
118
+        ScreenWidth: app.globalData.systemInfo.screenWidth,
119
+        ScreenHeight: app.globalData.systemInfo.screenHeight,
120
+        WindowWidth: app.globalData.systemInfo.windowWidth,
121
+        WindowHeight: app.globalData.systemInfo.windowHeight,
122
+        WXLanguage: app.globalData.systemInfo.language,
123
+        WXVersion: app.globalData.systemInfo.version,
124
+        System: app.globalData.systemInfo.system,
125
+        Platform: app.globalData.systemInfo.platform,
126
+        SDKVersion: app.globalData.systemInfo.SDKVersion,
127
+        ProgramVersion: app.globalData.Version,
128
+      }, function (data) {
129
+        //console.log("UserInfo:" + data);
130
+        if (!data) {
131
+          timeout3 = setTimeout(function () {
132
+            that.getUserInfo();
133
+            console.log("reboot:" + new Date().getTime());
134
+          }, 2000);
135
+        }
136
+        else {
137
+          app.globalData.userInfo = data;
138
+          //app.globalData.userInfo.AvatarUrl = param.avatarUrl;
139
+          
140
+          that.getHanzi(function(){
141
+            setTimeout(function () {
142
+              wx.redirectTo({
143
+                url: '../main/index'
144
+              })
145
+            }, 2000);
146
+          });
147
+        }
148
+      });
149
+
150
+    });
151
+  },
152
+  getHanzi: function (callback) {
29 153
     var that = this;
30 154
     var time = wx.getStorageSync("HanziUpdateTime");
31 155
     server.getData('GetHanziAll?UpdateTime=' + time, function (data) {
32 156
       if (data) {
33
-        var arr = common.Decrypt(data.List);
34
-        wx.setStorageSync("HanziAll", arr);
35
-        wx.setStorageSync("HanziUpdateTime", data.UpdateTime);
157
+        if (data.List) {
158
+          var arr = common.Decrypt(data.List);
159
+          wx.setStorageSync("HanziAll", arr);
160
+          wx.setStorageSync("HanziUpdateTime", data.UpdateTime);
161
+        }
162
+        app.globalData.BaiduToken = data.String;
163
+        callback();
36 164
       }
37 165
     });
38 166
   },
@@ -42,7 +170,7 @@ Page({
42 170
       path: 'pages/index/index',
43 171
       imageUrl: '../../images/07001.png',
44 172
       success: function (res) {
45
-        
173
+
46 174
       },
47 175
       fail: function (err) {
48 176
         console.log(err);

+ 42 - 0
pages/main/about.js

@@ -0,0 +1,42 @@
1
+import common from '../../utils/util';
2
+import server from '../../utils/main';
3
+
4
+const app = getApp();
5
+
6
+Page({
7
+  data: {
8
+    ListProgram: [],
9
+  },
10
+  onLoad: function (options) {
11
+    this.setData({
12
+      ListProgram: server.getProgramList(),
13
+    })
14
+  },
15
+  switchProgram: function (e) {
16
+    wx.navigateToMiniProgram({
17
+      appId: e.currentTarget.dataset.appid,
18
+      path: e.currentTarget.dataset.path,
19
+      extraData: {
20
+      },
21
+      success(res) {
22
+        // 打开成功
23
+      }
24
+    });
25
+  },
26
+  onShareAppMessage: function () {
27
+    return {
28
+      title: '识字练习——让阅读赢在起点',
29
+      path: 'pages/index/index',
30
+      imageUrl: '../../images/07001.png',
31
+      success: function (res) {
32
+
33
+      },
34
+      fail: function (err) {
35
+        console.log(err);
36
+      },
37
+      complete: function (res) {
38
+        console.log(res);
39
+      },
40
+    }
41
+  },
42
+})

+ 6 - 0
pages/main/about.json

@@ -0,0 +1,6 @@
1
+{
2
+  "navigationBarBackgroundColor": "#F5E2BE",
3
+  "navigationBarTitleText": "关于",
4
+  "backgroundColor": "#F5E2BE",
5
+  "enablePullDownRefresh": false
6
+}

+ 5 - 0
pages/main/about.wxml

@@ -0,0 +1,5 @@
1
+<view class="container FlexColumn">
2
+  <image src="../../images/06001.png" class="bg" />
3
+
4
+  <view class="btn" wx:for="{{ListProgram}}" wx:key="index" style='left:{{item.left}}rpx;top:{{item.top}}rpx;' bindtap='switchProgram' data-appid="{{item.appId}}" data-path="{{item.path}}"></view>
5
+</view>

+ 17 - 0
pages/main/about.wxss

@@ -0,0 +1,17 @@
1
+.container {
2
+  background-color: #F5E2BE;
3
+  justify-content: flex-start;
4
+  color: #872439;
5
+}
6
+
7
+.bg{
8
+  width:100%;
9
+  height:3081rpx;
10
+  margin-top: 40rpx;
11
+}
12
+
13
+.btn{
14
+  width:216rpx;
15
+  height:284rpx;
16
+  position: absolute;
17
+}

+ 525 - 35
pages/main/detail.js

@@ -3,8 +3,11 @@ import server from '../../utils/main';
3 3
 import pinyin from '../../utils/pinyin';
4 4
 
5 5
 const app = getApp();
6
-var wordNumber = 0;
7
-
6
+var isEditSetting = [];//是否修改设置
7
+var intervalAutoPage = 0;
8
+var insertID = 0, hanziNumber = 0;
9
+var isClickFinished = true;//可以点击学会了
10
+var isClickReview = true;//可以点击要复习
8 11
 Page({
9 12
   data: {
10 13
     IsAutoPlay: true,//是否自动播放
@@ -13,75 +16,257 @@ Page({
13 16
     PlayChecked: "checked",
14 17
     PageChecked: "",
15 18
     IsFinished: false,//是否练会了
16
-    arrIntervalSecond: [3, 4, 5, 6, 7, 8, 9, 10],//播放间隔秒数组
19
+    arrIntervalSecond: [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],//播放间隔秒数组
20
+    audioPer: [0, 1, 3, 4],//音色
17 21
     IntervalSecondIndex: 2,//播放间隔秒数索引
18 22
     IsImageError: false,
23
+    SpeakerArray: [{ name: "温柔姐姐", value: "woman", isShow: true }, { name: "爽朗哥哥", value: "man", isShow: false }, { name: "激情叔叔", value: "oldman", isShow: false }, { name: "搞怪妹妹", value: "sister", isShow: false }],
24
+
19 25
   },
20 26
   onLoad: function (options) {
21
-    var bookID = options.bookid;
22
-    var unitID = options.id;
27
+    var bookID = options.bookid || 0;
28
+    var unitID = options.unitid || 0;
29
+    var wordID = options.wordid || 0;
23 30
     this.audioCtx = wx.createAudioContext('myAudio');
31
+    hanziNumber = 0;
32
+    isClickFinished = true;
33
+    isClickReview = true;
34
+    var isfinished = options.isfinished;
35
+    if (!isfinished || isfinished == "false")
36
+      isfinished = false;
37
+    else if (isfinished == "true")
38
+      isfinished = true;
39
+
40
+    if (!options.Type) {
41
+      options.Type = "normal";
42
+    }
24 43
 
25 44
     this.setData({
26 45
       Height: common.getSystemHeight(),
27 46
       IsShowPrev: false,
28 47
       IsShowNext: true,
29
-      CurrentIndex: 0,
30
-      IsFinished: false,
48
+      CurrentIndex: wordID,
49
+      IsFinished: isfinished,
31 50
       IsHelpPosition1: 0,
32 51
       IsHelpPosition2: 0,
33 52
       IsReview: false,
53
+      IsShowWordDetail: false,
54
+      ShowMenu: "sort",
34 55
       UnitID: unitID,
35 56
       BookID: bookID,
57
+      selectedRandom: false,
58
+      SpeakerTitle: this.data.SpeakerArray[0].name,
59
+      SpeakerMan: 0,
60
+      ShowPinyin: true,
61
+      IsAudioLengthChecked: true,//显示组词播放音
62
+      WordType: options.Type,
36 63
     });
37 64
 
38
-    this.init();
65
+    var that = this;
66
+    common.getStorageValue(that, "IsAutoPlay", true, function () {
67
+      common.getStorageValue(that, "IsAutoPage", false, function () {
68
+        common.getStorageValue(that, "selectedRandom", false, function () {
69
+          common.getStorageValue(that, "ShowPinyin", true, function () {
70
+            common.getStorageValue(that, "IntervalSecondIndex", 2, function () {
71
+              common.getStorageValue(that, "IsAudioLengthChecked", true, function () {
72
+                common.getStorageValue(that, "SpeakerMan", 0, function () {
73
+                  that.settingPlay(null, that.data.IsAutoPlay);
74
+                  that.settingPage(null, that.data.IsAutoPage);
75
+                  that.settingSort(null, that.data.selectedRandom.toString());
76
+                  that.settingShowPinyin(null, that.data.ShowPinyin);
77
+                  that.settingAudioLength(null, that.data.IsAudioLengthChecked);
78
+                  that.settingSpeaker(null, that.data.SpeakerMan);
79
+                  if (that.data.WordType == "normal")
80
+                    that.init();
81
+                  else if (that.data.WordType == "review")
82
+                    that.initReview();
83
+                });
84
+              });
85
+            });
86
+          });
87
+        });
88
+      });
89
+    });
90
+
91
+    if (this.data.WordType == "normal")
92
+      this.submitData();
93
+
94
+  },
95
+  onUnload: function () {
96
+    clearInterval(intervalAutoPage);
97
+
98
+    server.postData('UpdateHanziRecord', {
99
+      RecordID: insertID,
100
+      HanziNumber: hanziNumber,
101
+    }, function (data) { });
102
+  },
103
+  submitData: function (content) {
104
+    if (app.globalData.userInfo && app.globalData.userInfo.UserID) {
105
+      server.postData('AddHanziRecord', {
106
+        UserID: app.globalData.userInfo.UserID,
107
+        Category: this.data.BookID,
108
+        Content: this.data.UnitID,
109
+      }, function (data) {
110
+        //console.log(data.insertId);
111
+        insertID = data.insertId;
112
+      });
113
+    }
39 114
   },
40 115
   init: function () {
41 116
     var arr = JSON.parse(wx.getStorageSync("HanziAll"));
42
-
117
+    var arrReview = wx.getStorageSync("ReviewList");
118
+    var title = "";
43 119
     var result;
44 120
     for (var i = 0; i < arr.length; i++) {
45 121
       if (arr[i].ID == this.data.BookID) {
46
-        result = arr[i];
47
-        for (var j = 0; j < result.Units.length; j++) {
48
-          var item = result.Units[j];
49
-          if (item.ID == this.data.UnitID){
50
-            for(var k=0;k<item.Words.length;k++){
122
+        for (var j = 0; j < arr[i].Units.length; j++) {
123
+          var item = arr[i].Units[j];
124
+          if (item.ID == this.data.UnitID) {
125
+            for (var k = 0; k < item.Words.length; k++) {
51 126
               if (item.Words[k].Pinyin.indexOf(",") > 0)
52 127
                 item.Words[k].Pinyin = item.Words[k].Pinyin.substr(0, item.Words[k].Pinyin.indexOf(","));
53 128
 
54
-              item.Words[k].WordUrl = app.globalData.imageUrl+"/images/hanzi"+item.Words[k].Name+".jpg";
129
+              item.Words[k].WordUrl = app.globalData.imageUrl + "/images/hanzi" + item.Words[k].Name + ".jpg";
130
+
131
+              item.Words[k].IsReview = false;
132
+
133
+              title = arr[i].Name.replace("识字能力", "");
134
+              title += " " + item.Name;
135
+              for (var l = 0; l < arrReview.length; l++) {
136
+                if (arrReview[l].Word == item.Words[k].Name) {
137
+                  item.Words[k].IsReview = true;
138
+                  break;
139
+                }
140
+              }
55 141
             }
56
-            result=item;
142
+            result = item;
57 143
             break;
58 144
           }
59 145
         }
60 146
         break;
61 147
       }
62 148
     }
149
+
150
+    if (this.data.selectedRandom) {
151
+      result.Words = common.randomArray(result.Words);
152
+    }
153
+
154
+    var obj = {
155
+      Title: result.Name,
156
+      Title2: "到底了",
157
+      IsEnd: true,
158
+    }
159
+    result.Words.push(obj);
160
+
63 161
     this.setData({
64 162
       List: result.Words,
65 163
     });
66 164
 
67
-    this.restart();
165
+    this.restart(this.data.CurrentIndex);
166
+
167
+    wx.setNavigationBarTitle({
168
+      title: title
169
+    });
170
+  },
171
+  initReview: function () {
172
+    var arr = JSON.parse(wx.getStorageSync("HanziAll"));
173
+    var arrReview = wx.getStorageSync("ReviewList");
174
+    var title = "";
175
+    var result = [];
176
+    for (var l = 0; l < arrReview.length; l++) {
177
+      for (var i = 0; i < arr.length; i++) {
178
+        for (var j = 0; j < arr[i].Units.length; j++) {
179
+          var item = arr[i].Units[j];
180
+          for (var k = 0; k < item.Words.length; k++) {
181
+            if (arrReview[l].Word == item.Words[k].Name && arrReview[l].WordID == item.Words[k].ID) {
182
+              if (item.Words[k].Pinyin.indexOf(",") > 0)
183
+                item.Words[k].Pinyin = item.Words[k].Pinyin.substr(0, item.Words[k].Pinyin.indexOf(","));
184
+
185
+              item.Words[k].WordUrl = app.globalData.imageUrl + "/images/hanzi" + item.Words[k].Name + ".jpg";
186
+              item.Words[k].IsReview = false;
187
+              item.Words[k].IsReview = true;
188
+              result.push(item.Words[k]);
189
+              break;
190
+            }
191
+          }
192
+        }
193
+      }
194
+    }
195
+
196
+    if (this.data.selectedRandom) {
197
+      result = common.randomArray(result);
198
+    }
199
+
200
+    var obj = {
201
+      Title: "复习",
202
+      Title2: "到底了",
203
+      IsEnd: true,
204
+    }
205
+    result.push(obj);
206
+
207
+    this.setData({
208
+      List: result,
209
+    });
210
+
211
+    this.restart(this.data.CurrentIndex);
212
+
213
+    wx.setNavigationBarTitle({
214
+      title: "复习"
215
+    });
68 216
   },
69 217
   playAudio: function (e) {
70 218
     //console.log("playAudio");
71 219
     var click = false;
72
-    if (e)
220
+    if (e && e.currentTarget.dataset.click)
73 221
       click = e.currentTarget.dataset.click;
74 222
 
223
+    var url = app.globalData.audioUrlBaidu;
224
+    url = url.replace("[token]", app.globalData.BaiduToken);
225
+    url = url.replace("per=0", "per=" + this.data.audioPer[this.data.SpeakerMan]);
75 226
 
76 227
     if ((click || this.data.IsAutoPlay) && !(click && this.data.IsAutoPage)) {
77
-      var pinyinItem = this.data.List[this.data.CurrentIndex].Pinyin;
78
-      if (pinyinItem) {
79
-        pinyinItem = pinyin.getPinyinName(pinyinItem);
80
-        this.audioCtx.setSrc(app.globalData.audioUrl + "/sounds/" + pinyinItem + ".m4a");
81
-        this.audioCtx.play();
228
+      if (this.data.CurrentIndex == this.data.List.length - 1) {
229
+        if (this.data.WordType == "review")
230
+          url = url.replace("[word]", "本次复习" + this.data.List[this.data.CurrentIndex].Title2);
231
+        else
232
+          url = url.replace("[word]", "本章节" + this.data.List[this.data.CurrentIndex].Title2);
233
+        url = url.replace("spd=3", "spd=6");
82 234
       }
235
+      else {
236
+
237
+        var pinyinItem = this.data.List[this.data.CurrentIndex].Pinyin;
238
+        if (e && e.currentTarget.dataset.pinyin)
239
+          pinyinItem = e.currentTarget.dataset.pinyin;
240
+        if (pinyinItem) {
241
+          pinyinItem = pinyin.getPinyinName(pinyinItem);
242
+
243
+          var Name = this.data.List[this.data.CurrentIndex].Name;
244
+          var CombineWords = this.data.List[this.data.CurrentIndex].CombineWords;
245
+
246
+
247
+          if ((e && e.currentTarget.dataset.pinyin) || !this.data.IsAudioLengthChecked) {
248
+            url = url.replace("[word]", Name + "(" + pinyinItem + ")");
249
+            url = url.replace("spd=3", "spd=1");
250
+          }
251
+          else {
252
+            url = url.replace("[word]", Name + "(" + pinyinItem + ")," + CombineWords + "的" + Name + "(" + pinyinItem + ")");
253
+          }
254
+
255
+        }
256
+      }
257
+      this.audioCtx.setSrc(url);
258
+      this.audioCtx.play();
83 259
     }
84 260
   },
261
+  startAutoPage: function () {
262
+    var that = this;
263
+    clearInterval(intervalAutoPage);
264
+    var second = this.data.arrIntervalSecond[this.data.IntervalSecondIndex] * 1000;
265
+    //console.log("second:" + second);
266
+    intervalAutoPage = setInterval(function () {
267
+      that.nextHandler();
268
+    }, second);
269
+  },
85 270
   prevHandler: function () {
86 271
     if (this.data.IsShowPrev && !this.data.IsAutoPage) {
87 272
       var index = this.data.CurrentIndex;
@@ -98,7 +283,7 @@ Page({
98 283
 
99 284
       this.playAudio();
100 285
 
101
-      wordNumber++;
286
+      hanziNumber++;
102 287
     }
103 288
   },
104 289
   nextHandler: function (e) {
@@ -117,15 +302,20 @@ Page({
117 302
       }
118 303
       this.setCurrentWord(index, isShowPrev, isShowNext);
119 304
 
120
-      if (isShowNext)
121
-        this.playAudio();
305
+      this.playAudio();
122 306
 
123
-      wordNumber++;
307
+      hanziNumber++;
124 308
     }
125 309
   },
126
-  restart: function () {
310
+  restart: function (index) {
127 311
     var that = this;
128
-    var index = 0;
312
+    if (!index)
313
+      index = 0;
314
+
315
+    var isShowPrev = true;
316
+    if (index == 0)
317
+      isShowPrev = false;
318
+
129 319
 
130 320
     if (that.data.wordType == "review") {
131 321
       for (var i = 0; i < that.data.List.length - 1; i++) {
@@ -137,10 +327,10 @@ Page({
137 327
       });
138 328
     }
139 329
 
140
-    this.setCurrentWord(index, false, true);
330
+    this.setCurrentWord(index, isShowPrev, true);
141 331
 
142 332
     this.playAudio();
143
-    wordNumber++;
333
+    hanziNumber++;
144 334
 
145 335
     if (this.data.IsAutoPage) {
146 336
       this.startAutoPage();
@@ -156,16 +346,16 @@ Page({
156 346
     }, second);
157 347
   },
158 348
   setCurrentWord: function (index, isShowPrev, isShowNext) {
159
-    
160 349
     this.setData({
161 350
       CurrentIndex: index,
162 351
       IsShowPrev: isShowPrev,
163 352
       IsShowNext: isShowNext,
353
+      IsShowWordDetail: false,
164 354
     });
165 355
   },
166
-  getImageError:function(){
356
+  getImageError: function () {
167 357
     this.setData({
168
-      IsImageError:true,
358
+      IsImageError: true,
169 359
     });
170 360
   },
171 361
   getImageDownload: function () {
@@ -173,4 +363,304 @@ Page({
173 363
       IsImageError: false,
174 364
     });
175 365
   },
176
-})
366
+  showWordDetailHandler: function (e) {
367
+    var that = this;
368
+    if (this.data.IsShowNext && !this.data.IsAutoPage) {
369
+      this.data.IsShowWordDetail = !this.data.IsShowWordDetail;
370
+      this.setData({
371
+        IsShowWordDetail: this.data.IsShowWordDetail,
372
+      });
373
+
374
+      if (this.data.IsShowWordDetail) {
375
+        var id = e.currentTarget.dataset.id;
376
+        server.getData('GetHanziDetail?ID=' + id, function (data) {
377
+          if (data) {
378
+            //var data = common.Decrypt(data);
379
+            //data=JSON.parse(data);
380
+            data.Antonym = data.Antonym.join(" ");
381
+            data.Synonym = data.Synonym.join(" ");
382
+            that.setData({
383
+              Detail: data,
384
+            });
385
+          }
386
+        });
387
+      }
388
+    }
389
+  },
390
+  //显示设置菜单
391
+  showSettingMenu: function (e) {
392
+    var status = e.currentTarget.dataset.status;
393
+    this.setData({
394
+      isShowSettingMenu: true,
395
+      ShowMenu: status,
396
+    });
397
+  },
398
+  //打开设置界面
399
+  openSetting: function () {
400
+    this.setData({
401
+      IsShowSetting: true,
402
+    });
403
+    isEditSetting = [];
404
+
405
+    clearInterval(intervalAutoPage);
406
+  },
407
+  closeSetting: function () {
408
+    var that = this;
409
+    this.setData({
410
+      IsShowSetting: false,
411
+    });
412
+
413
+    if (isEditSetting.length > 0) {
414
+      for (var i = 0; i < isEditSetting.length; i++) {
415
+        if (isEditSetting[i] == "page" || isEditSetting[i] == "sort") {
416
+          that.data.CurrentIndex = 0;
417
+          if (that.data.WordType == "normal")
418
+            that.init();
419
+          else if (that.data.WordType == "review")
420
+            that.initReview();
421
+
422
+          break;
423
+        }
424
+        else if (isEditSetting[i] == "speaker") {
425
+          that.playAudio();
426
+          break;
427
+        }
428
+      }
429
+    }
430
+    else {
431
+      if (this.data.IsAutoPage) {
432
+        this.startAutoPage();
433
+      }
434
+    }
435
+  },
436
+  closeSettingMenu: function () {
437
+    this.setData({
438
+      isShowSettingMenu: false,
439
+    });
440
+  },
441
+
442
+  settingSort: function (e, b) {
443
+    isEditSetting.push("sort");
444
+    var result = b;
445
+    if (e)
446
+      result = e.currentTarget.dataset.id;
447
+
448
+    var title = "";
449
+    var selectedRandom = true;
450
+    if (result == "false") {
451
+      title = "课文排序";
452
+      selectedRandom = false;
453
+    }
454
+    else {
455
+      title = "随机排序";
456
+    }
457
+    this.setData({
458
+      isShowSettingMenu: false,
459
+      SortTitle: title,
460
+      selectedRandom: selectedRandom,
461
+    });
462
+    wx.setStorageSync('selectedRandom', selectedRandom);
463
+  },
464
+  settingSpeaker: function (e, b) {
465
+    isEditSetting.push("speaker");
466
+    var result = b;
467
+    if (e)
468
+      result = e.currentTarget.dataset.id;
469
+    for (var i = 0; i < this.data.SpeakerArray.length; i++) {
470
+      this.data.SpeakerArray[i].isShow = false;
471
+      if (i == result)
472
+        this.data.SpeakerArray[i].isShow = true;
473
+    }
474
+
475
+    this.setData({
476
+      SpeakerMan: result,
477
+      isShowSettingMenu: false,
478
+      SpeakerTitle: this.data.SpeakerArray[result].name,
479
+      SpeakerArray: this.data.SpeakerArray,
480
+    });
481
+    wx.setStorageSync('SpeakerMan', result);
482
+  },
483
+  settingShowPinyin: function (e, b) {
484
+    var result = !this.data.ShowPinyin;
485
+    if (b != undefined)
486
+      result = b;
487
+    this.setData({
488
+      ShowPinyin: result,
489
+    });
490
+    wx.setStorageSync('ShowPinyin', result);
491
+  },
492
+  settingPlay: function (e, b) {
493
+    isEditSetting.push("play");
494
+    var result = !this.data.IsAutoPlay;
495
+    if (b != undefined)
496
+      result = b;
497
+
498
+    var PlayChecked = "";
499
+    if (result)
500
+      PlayChecked = "checked";
501
+    this.setData({
502
+      IsAutoPlay: result,
503
+      isShowSettingMenu: false,
504
+      PlayChecked: PlayChecked,
505
+    });
506
+    wx.setStorageSync('IsAutoPlay', result);
507
+  },
508
+  settingAudioLength: function (e, b) {
509
+    var result = !this.data.IsAudioLengthChecked;
510
+    if (b != undefined)
511
+      result = b;
512
+    this.setData({
513
+      IsAudioLengthChecked: result,
514
+    });
515
+    wx.setStorageSync('IsAudioLengthChecked', result);
516
+  },
517
+  settingPage: function (e, b) {
518
+    isEditSetting.push("page");
519
+    var result = !this.data.IsAutoPage;
520
+    if (b != undefined)
521
+      result = b;
522
+
523
+    if (result) {
524
+      this.data.PageChecked = "checked";
525
+      this.data.IsAutoPlay = true;
526
+      this.data.PlayChecked = "checked";
527
+    }
528
+    else {
529
+      clearInterval(intervalAutoPage);
530
+      this.data.PageChecked = "";
531
+    }
532
+
533
+    this.setData({
534
+      IsAutoPlay: this.data.IsAutoPlay,
535
+      IsAutoPage: result,
536
+      isShowSettingMenu: false,
537
+      PageChecked: this.data.PageChecked,
538
+      IsAutoPlay: this.data.IsAutoPlay,
539
+      PlayChecked: this.data.PlayChecked,
540
+    });
541
+    wx.setStorageSync('IsAutoPage', result);
542
+  },
543
+  bindPickerChange: function (e) {
544
+    this.setData({
545
+      IntervalSecondIndex: e.detail.value
546
+    });
547
+    wx.setStorageSync('IntervalSecondIndex', Number(e.detail.value));
548
+    isEditSetting.push("page");
549
+  },
550
+  updateFinish: function () {
551
+    var that = this;
552
+    if (isClickFinished) {
553
+      this.setData({
554
+        IsFinished: !this.data.IsFinished,
555
+      });
556
+      isClickFinished = false;
557
+
558
+      app.globalData.IsRefreshFinished = true;
559
+
560
+      if (!this.data.IsFinished) {
561
+        that.setRemind("取消", "");
562
+      }
563
+      else {
564
+        that.setRemind("学过了", "Remind3");
565
+      }
566
+
567
+      server.postData('UpdateHanziFinished', {
568
+        IsFinished: this.data.IsFinished,
569
+        UserID: app.globalData.userInfo.UserID,
570
+        Category: this.data.BookID,
571
+        Title: this.data.UnitID,
572
+      }, function (data) {
573
+        server.getData('GetHanziFinishedData?UserID=' + app.globalData.userInfo.UserID, function (data) {
574
+          if (data) {
575
+            wx.setStorageSync("FinishedList", data);
576
+          }
577
+        });
578
+      });
579
+    }
580
+  },
581
+  setRemind: function (str, css) {
582
+    var that = this;
583
+    that.setData({
584
+      RemindStr: str,
585
+      RemindCss: css,
586
+    })
587
+    that.animateOpacity(1, "animationData", 500);
588
+    setTimeout(function () {
589
+      isClickReview = true;
590
+      isClickFinished = true;
591
+      that.animateOpacity(0, "animationData", 500);
592
+    }, 1000);
593
+  },
594
+  //动画淡入淡出
595
+  animateOpacity: function (opacity, obj, duration) {
596
+    var animation = wx.createAnimation({
597
+      duration: duration,
598
+      timingFunction: 'ease',
599
+    });
600
+
601
+    //this.animation = animation;
602
+    animation.opacity(opacity).step();
603
+    this.setData({
604
+      animationData: animation.export(),
605
+    });
606
+  },
607
+
608
+  reviewHandler: function () {
609
+    var that = this;
610
+    if (this.data.IsShowNext && !this.data.IsAutoPage) {
611
+      if (isClickReview) {
612
+        this.data.List[this.data.CurrentIndex].IsReview = !this.data.List[this.data.CurrentIndex].IsReview;
613
+
614
+        this.setData({
615
+          List: this.data.List,
616
+        });
617
+
618
+        isClickReview = false;
619
+
620
+        var status = "add";
621
+        if (!this.data.List[this.data.CurrentIndex].IsReview) {
622
+          status = "delete";
623
+          that.setRemind("取消", "");
624
+        }
625
+        else {
626
+          that.setRemind("添加到复习", "Remind2");
627
+        }
628
+
629
+        server.postData('UpdateHanziReview', {
630
+          UserID: app.globalData.userInfo.UserID,
631
+          Word: this.data.List[this.data.CurrentIndex].Name,
632
+          WordID: this.data.List[this.data.CurrentIndex].ID,
633
+          Status: status,
634
+        }, function (data) {
635
+
636
+          server.getData('GetHanziReviewList?UserID=' + app.globalData.userInfo.UserID, function (data) {
637
+            if (data) {
638
+              wx.setStorageSync("ReviewList", data);
639
+            }
640
+          });
641
+
642
+        });
643
+      }
644
+    }
645
+    else {
646
+      if (that.data.CurrentIndex == that.data.List.length - 1)
647
+        that.restart();
648
+    }
649
+  },
650
+  onShareAppMessage: function () {
651
+    return {
652
+      title: '识字练习——让阅读赢在起点',
653
+      path: 'pages/index/index',
654
+      imageUrl: '../../images/07001.png',
655
+      success: function (res) {
656
+
657
+      },
658
+      fail: function (err) {
659
+        console.log(err);
660
+      },
661
+      complete: function (res) {
662
+        console.log(res);
663
+      },
664
+    }
665
+  },
666
+});

+ 236 - 7
pages/main/detail.wxml

@@ -1,9 +1,103 @@
1 1
 <view class="container FlexColumn" style='height:{{Height}}rpx;'>
2
-  <view class="main FlexColumn" bindtap='playAudio' data-click="true" >
3
-    <view class="pinyin">{{List[CurrentIndex].Pinyin}}</view>
4
-    <image binderror='getImageError' wx:if="{{!IsImageError}}" src='{{List[CurrentIndex].WordUrl}}' class="wordImage" />
5
-    <image catchtap='getImageDownload' wx:if="{{IsImageError}}" src='../../images/05014.png' class="wordImage" />
2
+  <view class="main FlexColumn" bindtap='playAudio' data-click="true">
3
+    <block wx:if="{{CurrentIndex<List.length-1}}">
4
+      <view class="pinyin">
5
+        <block wx:if="{{ShowPinyin}}">
6
+          {{List[CurrentIndex].Pinyin}}
7
+        </block>
8
+      </view>
9
+      <image binderror='getImageError' wx:if="{{!IsImageError}}" src='{{List[CurrentIndex].WordUrl}}' class="wordImage" />
10
+      <image catchtap='getImageDownload' wx:if="{{IsImageError}}" src='../../images/05014.png' class="wordImage" />
11
+    </block>
12
+    <block wx:if="{{CurrentIndex==List.length-1}}">
13
+      <view class="hanziEnd FlexColumn" wx:if="{{hanziType!='review'}}">
14
+        <view wx:if="{{WordType!='review'}}">章节</view>
15
+        <view class="hanziEnd2">{{List[CurrentIndex].Title}}</view>
16
+        <view class="hanziEnd3">{{List[CurrentIndex].Title2}}</view>
17
+      </view>
18
+
19
+      <view class="finished FlexColumn" catchtap='updateFinish' wx:if="{{WordType!='review' && IsFinished}}">
20
+        <view class="finished1 FlexColumn" >
21
+          <image src='../../images/05010.png' class="btnImage04006" />
22
+        </view>
23
+      </view>
24
+      <view class="finished2 finished FlexColumn" catchtap='updateFinish' wx:if="{{WordType!='review' && !IsFinished}}">
25
+        <view class="finished3 finished1 FlexColumn" >
26
+          <image src='../../images/05011.png' class="btnImage04006" />
27
+        </view>
28
+      </view>
29
+    </block>
30
+
31
+    <view class="{{RemindCss}} Remind" animation="{{animationData}}">{{RemindStr}}</view>
32
+
33
+  </view>
34
+  <view class="detail" wx:if="{{IsShowWordDetail}}">
35
+    <image src='{{Detail.BiShunUrl}}' class="bishun" />
36
+    <view class="line"></view>
37
+    <view class="title2 title FlexRow">
38
+      <view class="title1">汉语拼音</view>
39
+    </view>
40
+    <view class="content FlexRow">
41
+      <view class="pinyin FlexRow" wx:for="{{Detail.PinYin}}" wx:key="index" catchtap='playAudio' data-click="true" data-pinyin="{{item.pinyin}}">
42
+        <view>{{item.pinyin}}</view>
43
+        <image src='../../images/05008.png' class="btnImage05008" />
44
+      </view>
45
+    </view>
46
+    <view class="title FlexRow">
47
+      <view class="title1">汉字结构</view>
48
+    </view>
49
+    <view class="content FlexColumn">
50
+      <view class="content1 FlexRow">
51
+        <view class="left">部首</view>
52
+        <view class="right">{{Detail.BuShou}}</view>
53
+      </view>
54
+      <view class="line2 FlexRow">
55
+        <view class="line3"></view>
56
+      </view>
57
+      <view class="content1 FlexRow">
58
+        <view class="left">笔画</view>
59
+        <view class="right">{{Detail.BiHua}}</view>
60
+      </view>
61
+    </view>
62
+    <view class="title FlexRow">
63
+      <view class="title1">基本释义</view>
64
+    </view>
65
+    <view class="content FlexColumn">
66
+      <view class="content2 FlexColumn" wx:for="{{Detail.PinYin}}" wx:key="index" wx:for-item="item">
67
+        <view class="pinyin2 FlexRow" wx:if="{{Detail.PinYin.length>1}}">[
68
+          <view class="pinyin3">{{item.pinyin}}</view>]</view>
69
+        <text class="explain FlexColumn" wx:for="{{item.explain}}" wx:key="i" wx:for-item="itemChild">{{itemChild}}</text>
70
+      </view>
71
+    </view>
72
+    <view class="title FlexRow">
73
+      <view class="title1">相关组词</view>
74
+    </view>
75
+    <view class="content FlexColumn">
76
+      <view class="content2 FlexRow">
77
+        <text class="combineWords" wx:for="{{Detail.CombineWords}}" wx:key="i">{{item}}</text>
78
+      </view>
79
+    </view>
80
+    <view class="title FlexRow" wx:if="{{Detail.Antonym || Detail.Synonym}}">
81
+      <view class="title1">近反义词</view>
82
+    </view>
83
+    <view class="content FlexColumn">
84
+      <view class="content1 FlexRow" wx:if="{{Detail.Antonym}}">
85
+        <view class="left">反义词</view>
86
+        <view class="right">{{Detail.Antonym}}</view>
87
+      </view>
88
+      <view class="line2 FlexRow" wx:if="{{Detail.Synonym}}">
89
+        <view class="line3"></view>
90
+      </view>
91
+      <view class="content1 FlexRow" wx:if="{{Detail.Synonym}}">
92
+        <view class="left">近义词</view>
93
+        <view class="right">{{Detail.Synonym}}</view>
94
+      </view>
95
+    </view>
96
+    <view class="bottom1">
97
+
98
+    </view>
6 99
   </view>
100
+
7 101
   <view class="bottom FlexColumn">
8 102
     <view class="bottom1 FlexRow">
9 103
       <view class="btn FlexColumn" bindtap='prevHandler'>
@@ -17,9 +111,9 @@
17 111
       <view class="btn FlexColumn" bindtap='openSetting'>
18 112
         <image src='../../images/05004.png' class="btnImage05004" />
19 113
       </view>
20
-      <view class="btn FlexColumn" bindtap='showWordHandler'>
21
-        <image src='../../images/05005.png' wx:if="{{IsShowWordCurrent && IsShowNext && !IsAutoPage}}" class="btnImage05005" />
22
-        <image src='../../images/05006.png' wx:if="{{!IsShowWordCurrent && IsShowNext && !IsAutoPage}}" class="btnImage05006" />
114
+      <view class="btn FlexColumn" bindtap='showWordDetailHandler' data-id='{{List[CurrentIndex].ID}}'>
115
+        <image src='../../images/05005.png' wx:if="{{!IsShowWordDetail && IsShowNext && !IsAutoPage}}" class="btnImage05005" />
116
+        <image src='../../images/05006.png' wx:if="{{IsShowWordDetail && IsShowNext && !IsAutoPage}}" class="btnImage05006" />
23 117
       </view>
24 118
       <view class="btn FlexColumn" bindtap='nextHandler' data-status="click">
25 119
         <image src='../../images/05007.png' class="btnImage05001" wx:if="{{IsShowNext && !IsAutoPage}}" />
@@ -28,4 +122,139 @@
28 122
   </view>
29 123
 </view>
30 124
 
125
+<!-- 设置 -->
126
+<view class="settingContainer container FlexColumn" style='height:{{Height}}rpx;' wx:if="{{IsShowSetting}}">
127
+
128
+  <view class="title1">
129
+    <view class="title1_1">汉字显示</view>
130
+  </view>
131
+  <view class="line FlexColumn">
132
+    <view class="line1"></view>
133
+  </view>
134
+  <view class="title2 FlexRow" bindtap='showSettingMenu' data-status="sort">
135
+    <view class="title2_1">顺序</view>
136
+    <view class="title2_2 FlexRow">
137
+      <view>{{SortTitle}}</view>
138
+      <image src='../../images/Arrow.png' class="Arrow" />
139
+    </view>
140
+  </view>
141
+
142
+  <view class="title1">
143
+    <view class="title1_1">汉字朗读</view>
144
+  </view>
145
+  <view class="title2 FlexRow" bindtap='showSettingMenu' data-status="speaker">
146
+    <view class="title2_1">发音人</view>
147
+    <view class="title2_2 FlexRow">
148
+      <view>{{SpeakerTitle}}</view>
149
+      <image src='../../images/Arrow.png' class="Arrow" />
150
+    </view>
151
+  </view>
152
+  <view class="line FlexColumn">
153
+    <view class="line1"></view>
154
+  </view>
155
+  <view class="title3 FlexRow">
156
+    <view class="title2_1 FlexColumn">
157
+      <view>连贯演示</view>
158
+      <view class="title3_2">间隔 {{arrIntervalSecond[IntervalSecondIndex]}} 秒连续翻页并播放读音,不能点读</view>
159
+    </view>
160
+    <switch class='title2_2' checked="{{PageChecked}}" bindchange="settingPage" />
161
+  </view>
162
+  <view class="line FlexColumn">
163
+    <view class="line1"></view>
164
+  </view>
165
+
166
+  <view class="title3 FlexRow" wx:if="{{IsAutoPage}}">
167
+    <view class="title2_1 FlexColumn">
168
+      <view>播放间隔秒数</view>
169
+    </view>
170
+
171
+    <view class="title2_2 FlexRow">
172
+      <picker bindchange="bindPickerChange" value="{{IntervalSecondIndex}}" range="{{arrIntervalSecond}}">
173
+        <view>
174
+          {{arrIntervalSecond[IntervalSecondIndex]}} 秒
175
+        </view>
176
+      </picker>
177
+      <image src='../../images/Arrow.png' class="Arrow" />
178
+    </view>
179
+
180
+  </view>
181
+
182
+
183
+  <view class="title3 FlexRow" wx:if="{{!IsAutoPage}}">
184
+    <view class="title2_1 FlexColumn">
185
+      <view>默认播放读音</view>
186
+    </view>
187
+    <switch class='title2_2' checked="{{PlayChecked}}" bindchange="settingPlay" />
188
+  </view>
189
+
190
+  <view class="line FlexColumn" wx:if="{{!IsAutoPage}}">
191
+    <view class="line1"></view>
192
+  </view>
193
+
194
+  <view class="title3 FlexRow">
195
+    <view class="title2_1 FlexColumn">
196
+      <view>默认显示拼音</view>
197
+    </view>
198
+    <switch class='title2_2' checked="{{ShowPinyin}}" bindchange="settingShowPinyin" />
199
+  </view>
200
+
201
+  <view class="line FlexColumn" wx:if="{{!IsAutoPage}}">
202
+    <view class="line1"></view>
203
+  </view>
204
+
205
+  <view class="title3 FlexRow">
206
+    <view class="title2_1 FlexColumn">
207
+      <view>组词播报</view>
208
+      <view class="title3_2">“中国的国”,以组词形式播报</view>
209
+
210
+    </view>
211
+    <switch class='title2_2' checked="{{IsAudioLengthChecked}}" bindchange="settingAudioLength" />
212
+  </view>
213
+
214
+
215
+  <view class="bottom FlexColumn" bindtap='closeSetting'>
216
+    <view class="bottom1 FlexRow">
217
+      返回
218
+    </view>
219
+  </view>
220
+
221
+</view>
222
+
223
+<!-- 设置菜单 -->
224
+<view class="settingMenu container FlexColumn" style="height:{{Height}}rpx;" wx:if="{{isShowSettingMenu}}">
225
+  <view class="settingMenu1 FlexColumn">
226
+    <block wx:if="{{ShowMenu=='sort'}}">
227
+      <view class="settingMenuBasic2 FlexColumn">
228
+        <image class="settingMenuIcon" src="../../images/303.png" />
229
+        <view class="word2">选择汉字显示顺序</view>
230
+      </view>
231
+      <view class="settingMenuBasic FlexColumn" bindtap='settingSort' data-id="false">
232
+        <view class="word">按课文顺序排序</view>
233
+        <image class="SelectLogo" src="../../images/012.png" hidden="{{selectedRandom}}" />
234
+      </view>
235
+      <view style='height:2rpx'></view>
236
+      <view class="settingMenuBasic FlexColumn" bindtap='settingSort' data-id="true">
237
+        <view class="word">随机排序</view>
238
+        <image class="SelectLogo" src="../../images/012.png" hidden="{{!selectedRandom}}" />
239
+      </view>
240
+    </block>
241
+
242
+    <block wx:if="{{ShowMenu=='speaker'}}">
243
+      <view class="settingMenuBasic2 FlexColumn">
244
+        <image class="settingMenuIcon" src="../../images/130.png" />
245
+        <view class="word2">选择发音人</view>
246
+      </view>
247
+      <block wx:for="{{SpeakerArray}}" wx:key="index">
248
+        <view style='height:2rpx'></view>
249
+        <view class="settingMenuBasic FlexColumn" bindtap='settingSpeaker' data-id="{{index}}">
250
+          <view class="word">{{item.name}}</view>
251
+          <image class="SelectLogo" src="../../images/012.png" hidden="{{!item.isShow}}" />
252
+        </view>
253
+      </block>
254
+    </block>
255
+    <view style='height:20rpx'></view>
256
+    <view class="settingMenuBasic" bindtap='closeSettingMenu'>取消</view>
257
+  </view>
258
+</view>
259
+
31 260
 <audio hidden='true' src="{{AudioSrc}}" id="myAudio"></audio>

+ 360 - 10
pages/main/detail.wxss

@@ -4,15 +4,16 @@
4 4
   font-weight: 500;
5 5
 }
6 6
 
7
-.bottom{
7
+.container .bottom{
8 8
   width:100%;
9 9
   height:160rpx;
10 10
   position: fixed;
11 11
   bottom:0;
12 12
   background-color: #CDB797;
13 13
   justify-content: flex-end;
14
+  z-index: 100;
14 15
 }
15
-.bottom1{
16
+.container .bottom1{
16 17
   width:100%;
17 18
   height:140rpx;
18 19
   background-color: #1B1B1B;
@@ -22,37 +23,37 @@
22 23
   color: #f0f0f0;
23 24
 }
24 25
 
25
-.bottom1 .btn{
26
+.container .bottom1 .btn{
26 27
   width:20%;
27 28
   height:120rpx;
28 29
 }
29 30
 
30
-.bottom1 .btnImage05004{
31
+.container .bottom1 .btnImage05004{
31 32
   width:36rpx;
32 33
   height:36rpx;
33 34
 }
34 35
 
35
-.bottom1 .btnImage05005{
36
+.container .bottom1 .btnImage05005{
36 37
   width:45rpx;
37 38
   height:44rpx;
38 39
 }
39 40
 
40
-.bottom1 .btnImage05002{
41
+.container .bottom1 .btnImage05002{
41 42
   width:32rpx;
42 43
   height:34rpx;
43 44
 }
44 45
 
45
-.bottom1 .btnImage05006{
46
+.container .bottom1 .btnImage05006{
46 47
   width:42rpx;
47 48
   height:44rpx;
48 49
 }
49 50
 
50
-.bottom1 .btnImage022{
51
+.container .bottom1 .btnImage022{
51 52
   width:40rpx;
52 53
   height:40rpx;
53 54
 }
54 55
 
55
-.bottom1 .btnImage05001{
56
+.container .bottom1 .btnImage05001{
56 57
   width:33rpx;
57 58
   height:40rpx;
58 59
 }
@@ -63,6 +64,7 @@
63 64
   position: fixed;
64 65
   top:0;
65 66
   left:0;
67
+  min-height:1050rpx;
66 68
 }
67 69
 
68 70
 .main .pinyin{
@@ -72,8 +74,356 @@
72 74
   font-weight: normal;
73 75
   font-style: normal;
74 76
 }
77
+
75 78
 .main .wordImage{
76 79
   margin-top: 40rpx;
80
+  margin-right: 10rpx;
77 81
   width:366rpx;
78 82
   height:370rpx;
79
-}
83
+}
84
+
85
+.detail{
86
+  width:100%;
87
+  justify-content: flex-start;
88
+  position: absolute;
89
+  top:0;
90
+  left:0;
91
+  z-index: 10;
92
+  overflow-x: hidden;
93
+}
94
+.detail .bishun{
95
+  width:758rpx;
96
+  height:758rpx;
97
+  position: absolute;
98
+  top:-4rpx;
99
+  left:-4rpx;
100
+  z-index: 10;
101
+}
102
+.detail .line{
103
+  width:100%;
104
+  height:10rpx;
105
+  position: absolute;
106
+  top:748rpx;
107
+  background-color: #F0F0F0;
108
+  z-index: 20;
109
+}
110
+.detail .title{
111
+  width:100%;
112
+  height:125rpx;
113
+  justify-content: flex-start;
114
+  align-items: flex-start;
115
+  background-color: #F0F0F0;
116
+}
117
+.detail .title1{
118
+  margin: 50rpx 0 0 30rpx;
119
+  font-size:32rpx;
120
+}
121
+.detail .title2{
122
+  margin-top: 751rpx;
123
+}
124
+
125
+.detail .content{
126
+  width:100%;
127
+  background-color: #fff;
128
+  justify-content: flex-start;
129
+  align-items: flex-start;
130
+  font-size:28rpx;
131
+  font-weight: 400;
132
+}
133
+
134
+
135
+.detail .pinyin{
136
+  min-width:201rpx;
137
+  height:74rpx;
138
+  border-radius: 10rpx;
139
+  border:1rpx solid #979797;
140
+  margin: 50rpx 0 50rpx 40rpx;
141
+
142
+}
143
+.detail .btnImage05008{
144
+  width:41rpx;
145
+  height:34rpx;
146
+  margin-left: 20rpx;
147
+}
148
+
149
+
150
+.detail .content1{
151
+  width:100%;
152
+  justify-content: space-between;
153
+}
154
+
155
+.detail .left{
156
+  margin: 30rpx;
157
+}
158
+
159
+.detail .right{
160
+  margin: 30rpx;
161
+}
162
+
163
+.detail .line2{
164
+  width:100%;
165
+  height:1rpx;
166
+  background-color: #fff;
167
+  justify-content: flex-end;
168
+}
169
+
170
+.detail .line3{
171
+  width:720rpx;
172
+  height:1rpx;
173
+  background-color: #D2D2D2;
174
+}
175
+
176
+
177
+.detail .content2{
178
+  margin: 30rpx 20rpx 30rpx 40rpx;
179
+  background-color: #fff;
180
+  align-items: flex-start;
181
+  flex-wrap: wrap;
182
+  justify-content: flex-start;
183
+}
184
+
185
+
186
+.detail .pinyin2{
187
+  font-weight: 600;
188
+  font-size:30rpx;
189
+  justify-content: flex-start;
190
+}
191
+.detail .pinyin3{
192
+  font-family: 'GB Pinyinok-C';
193
+  font-weight: normal;
194
+  font-style: normal;
195
+  margin: 0 10rpx;
196
+}
197
+
198
+.detail .explain{
199
+  align-items: flex-start;
200
+  margin-bottom: 5rpx;
201
+}
202
+
203
+.detail .bottom1{
204
+  width: 100%;
205
+  background-color: #fff;
206
+  height:160rpx;
207
+}
208
+
209
+.detail .combineWords{
210
+  margin-right: 30rpx;
211
+}
212
+
213
+.settingContainer {
214
+  position: fixed;
215
+  top: 0;
216
+  background-color: #E3E3E3;
217
+  color: #1e1e1e;
218
+  z-index: 200;
219
+}
220
+
221
+.settingContainer .title1 {
222
+  width: 100%;
223
+  height: 125rpx;
224
+  background-color: #E3E3E3;
225
+}
226
+
227
+.settingContainer .title1_1 {
228
+  margin: 50rpx 0 0 30rpx;
229
+  font-size: 32rpx;
230
+}
231
+
232
+.settingContainer .title2 {
233
+  width: 100%;
234
+  background-color: #F8F8F8;
235
+  font-size: 28rpx;
236
+  height: 100rpx;
237
+  justify-content: space-between;
238
+  font-weight: 400;
239
+}
240
+
241
+.settingContainer .title2_1 {
242
+  margin-left: 30rpx;
243
+  align-items: flex-start;
244
+}
245
+
246
+.settingContainer .title2_2 {
247
+  margin-right: 30rpx;
248
+}
249
+
250
+.Arrow {
251
+  width: 16rpx;
252
+  height: 26rpx;
253
+  margin: 0 0 0 30rpx;
254
+}
255
+
256
+.settingContainer .title3 {
257
+  width: 100%;
258
+  background-color: #F8F8F8;
259
+  font-size: 28rpx;
260
+  height: 139rpx;
261
+  justify-content: space-between;
262
+  font-weight: 400;
263
+}
264
+
265
+.settingContainer .title3_2 {
266
+  font-size: 24rpx;
267
+}
268
+
269
+.settingContainer .line {
270
+  width: 100%;
271
+  height: 2rpx;
272
+  background-color: #F8F8F8;
273
+  align-items: flex-end;
274
+}
275
+
276
+.settingContainer .line1 {
277
+  width: 720rpx;
278
+  height: 1rpx;
279
+  background-color: #E3E3E3;
280
+}
281
+
282
+.settingContainer .bottom {
283
+  width:100%;
284
+  height:160rpx;
285
+  position: fixed;
286
+  bottom:0;
287
+  background-color: #CDB797;
288
+  justify-content: flex-end;
289
+}
290
+.settingContainer .bottom1{
291
+  width:100%;
292
+  height:140rpx;
293
+  background-color: #1B1B1B;
294
+  text-align: center;
295
+  line-height: 140rpx;
296
+  font-size: 48rpx;
297
+  color: #f0f0f0;
298
+}
299
+
300
+.settingMenu {
301
+  position: fixed;
302
+  top: 0;
303
+  background-color: rgba(46, 49, 55, 0.9);
304
+  z-index: 300;
305
+}
306
+
307
+.settingMenu1 {
308
+  width: 100%;
309
+  justify-content: flex-end;
310
+  position: fixed;
311
+  bottom: 0;
312
+  background-color: #d2d2d2;
313
+}
314
+
315
+.settingMenuBasic {
316
+  width: 100%;
317
+  height: 110rpx;
318
+  line-height: 110rpx;
319
+  text-align: center;
320
+  background-color: #fff;
321
+  color: #1e1e1e;
322
+  font-size: 36rpx;
323
+  font-weight: 400;
324
+  position: relative;
325
+}
326
+
327
+.settingMenuBasic2 {
328
+  width: 100%;
329
+  color: #1e1e1e;
330
+  font-weight: 600;
331
+  height: 173rpx;
332
+  background-color: #d2d2d2;
333
+  font-size: 24rpx;
334
+  justify-content: center;
335
+  align-items: center;
336
+}
337
+
338
+.settingMenuIcon {
339
+  width: 80rpx;
340
+  height: 60rpx;
341
+  margin-bottom: 23rpx;
342
+}
343
+
344
+.SelectLogo {
345
+  width: 40rpx;
346
+  height: 40rpx;
347
+  position: absolute;
348
+  left: 40rpx;
349
+  top: 35rpx;
350
+}
351
+
352
+.main .hanziEnd {
353
+  font-family: 'Century Gothic';
354
+  font-weight: bold;
355
+  font-style: normal;
356
+  color: #1e1e1e;
357
+  font-size:36rpx;
358
+  margin-top:102rpx;
359
+}
360
+
361
+.main .hanziEnd2 {
362
+  border-bottom:6rpx solid #1e1e1e;
363
+  min-width: 144rpx;
364
+  margin-top:20rpx;
365
+  padding-bottom: 20rpx;
366
+  text-align: center;
367
+  font-size:48rpx;
368
+}
369
+
370
+.main .hanziEnd3 {
371
+  margin-top:20rpx;
372
+  font-size:48rpx;
373
+}
374
+
375
+.main .btnImage04006{
376
+  width:60rpx;
377
+  height:95rpx;
378
+}
379
+
380
+.main .finished{
381
+  margin-top: 170rpx;
382
+  width:200rpx;
383
+  height:200rpx;
384
+  background-color: #CDB797;
385
+  border-radius: 50%;
386
+}
387
+
388
+.main .finished1{
389
+  width:176rpx;
390
+  height:176rpx;
391
+  background-color: #F5E2BE;
392
+  border-radius: 50%;
393
+}
394
+.main .finished2{
395
+  background-color: #D2D2D2;
396
+}
397
+
398
+.main .finished3{
399
+  background-color: #F0F0F0;
400
+}
401
+
402
+
403
+.main .Remind{
404
+  min-width: 108rpx;
405
+  height:60rpx;
406
+  background-color: #262626;
407
+  color:#D2D2D2;
408
+  text-align: center;
409
+  line-height: 60rpx;
410
+  font-size:24rpx;
411
+  position: fixed;
412
+  top:946rpx;
413
+  left:323rpx;
414
+  z-index: 20;
415
+  opacity: 0;
416
+  border-radius: 30rpx;
417
+}
418
+
419
+.main .Remind2{
420
+  width:180rpx;
421
+  left:287rpx;
422
+}
423
+.main .Remind3{
424
+  width:132rpx;
425
+  left:310rpx;
426
+}
427
+
428
+
429
+

+ 229 - 28
pages/main/index.js

@@ -2,36 +2,14 @@ import common from '../../utils/util';
2 2
 import server from '../../utils/main';
3 3
 
4 4
 const app = getApp();
5
+var interval = 0;
6
+var isPaying = false;
7
+var hanziNumber = 0;
5 8
 
6 9
 Page({
7 10
   data: {
8 11
     Version: app.globalData.Version,
9
-    ListProgram: [
10
-      {
11
-        ImageUrl: "03001.png",
12
-        ImageUrl2: "02018.png",
13
-        appId: 'wx46a7b4c420e6d38f',
14
-        path: 'pages/index/start?SourceID=106',
15
-      },
16
-      {
17
-        ImageUrl: "03002.png",
18
-        ImageUrl2: "02020.png",
19
-        appId: 'wxb54a6d5aff836ee3',
20
-        path: 'pages/index/index?SourceID=106',
21
-      },
22
-      {
23
-        ImageUrl: "03003.png",
24
-        ImageUrl2: "02019.png",
25
-        appId: 'wx331e8dd070f01d0e',
26
-        path: 'pages/index/index?SourceID=106',
27
-      },
28
-      {
29
-        ImageUrl: "03004.png",
30
-        ImageUrl2: "02021.png",
31
-        appId: 'wxa5e33c61fe37dd01',
32
-        path: 'pages/index/index?SourceID=106',
33
-      },
34
-    ],
12
+    ListProgram: server.getProgramList(),
35 13
     NickName: "陌生用户",
36 14
     IsMember: false,
37 15
     AvatarUrl: "",
@@ -48,7 +26,187 @@ Page({
48 26
   onLoad: function () {
49 27
     this.setData({
50 28
       Height: common.getSystemHeight(),
51
-      indexImage: common.random(0, 2),
29
+      NickName: app.globalData.userInfo.NickName,
30
+      AvatarUrl: app.globalData.userInfo.AvatarUrl,
31
+    });
32
+
33
+    if (app.globalData.userInfo && app.globalData.userInfo.NickName != "陌生用户") {
34
+      this.setData({
35
+        IsAccredit: true,
36
+      });
37
+    }
38
+  },
39
+  onShow: function () {
40
+    this.getData();
41
+    if (app.globalData.userInfo.IsMember == 1) {
42
+      this.setData({
43
+        IsMember: true,
44
+      });
45
+    }
46
+    if (!this.data.IsAccredit) {
47
+      var IsRemindAccredit = wx.getStorageSync("IsRemindAccredit");
48
+      if (IsRemindAccredit == 1) {
49
+        this.getAccredit();
50
+        wx.removeStorageSync('IsRemindAccredit');
51
+      }
52
+    }
53
+  },
54
+  getAccredit: function () {
55
+    if (!this.data.IsAccredit) {
56
+
57
+      var that = this;
58
+      wx.getSetting({
59
+        success(res) {
60
+          if (!res.authSetting['scope.userInfo']) {
61
+            wx.authorize({
62
+              scope: 'scope.userInfo',
63
+              success() {
64
+                that.getUserInfo();
65
+              },
66
+              fail() {
67
+                wx.openSetting({
68
+                  success(res) {
69
+                    that.getUserInfo();
70
+                  }
71
+                });
72
+              }
73
+            })
74
+          }
75
+        }
76
+      })
77
+    }
78
+  },
79
+  //得到用户信息
80
+  getUserInfo: function () {
81
+    var that = this
82
+    //调用登录接口
83
+    wx.login({
84
+      success: function (res0) {
85
+        wx.getUserInfo({
86
+          withCredentials: false,
87
+          success: function (res) {
88
+            app.globalData.userInfo = res.userInfo;
89
+
90
+            app.globalData.userInfo.NickName = app.globalData.userInfo.nickName;
91
+            app.globalData.userInfo.AvatarUrl = app.globalData.userInfo.avatarUrl;
92
+            // that.hasGetShareInfo(app.globalData.userInfo);
93
+            that.setData({
94
+              IsAccredit: true,
95
+              NickName: app.globalData.userInfo.NickName,
96
+              AvatarUrl: app.globalData.userInfo.AvatarUrl
97
+            });
98
+
99
+            app.globalData.userInfo.Code = res0.code;
100
+            that.login(app.globalData.userInfo);
101
+
102
+          },
103
+          fail: function (res) {
104
+            //console.log("getUserInfo:fail");
105
+            app.globalData.userInfo.NickName = "陌生用户";
106
+            app.globalData.userInfo.AvatarUrl = "../../images/FACE.png";
107
+            app.globalData.userInfo.language = "";
108
+            app.globalData.userInfo.gender = "0";
109
+            app.globalData.userInfo.city = "";
110
+            app.globalData.userInfo.province = "";
111
+            app.globalData.userInfo.country = "";
112
+            // that.hasGetShareInfo(app.globalData.userInfo);
113
+            that.setData({
114
+              IsAccredit: false,
115
+            });
116
+          }
117
+        });
118
+      },
119
+      fail: function () {
120
+        that.setData({
121
+          IsAccredit: false,
122
+        });
123
+      }
124
+    });
125
+  },
126
+  login: function (param) {
127
+    var that = this;
128
+    server.getLocalHost(function () {
129
+      server.postData('HanziLogin', {
130
+        Code: param.Code,
131
+        NickName: param.nickName,
132
+        Language: param.language,
133
+        Gender: param.gender,
134
+        City: param.city,
135
+        Province: param.province,
136
+        Country: param.country,
137
+        AvatarUrl: param.avatarUrl,
138
+        ProgramVersion: app.globalData.Version,
139
+        Introducer: app.globalData.introducer,
140
+        UserSource: app.globalData.userSource,
141
+        SourceID: app.globalData.SourceID,
142
+        LastUserSource: app.globalData.userSource,
143
+      }, function (data) {
144
+
145
+      });
146
+    });
147
+  },
148
+  getData: function () {
149
+    var that = this;
150
+    server.getData('GetHanziRecordData?UserID=' + app.globalData.userInfo.UserID + "&Version=" + app.globalData.Version, function (data) {
151
+      if (data) {
152
+
153
+        if (!data.DayNumber)
154
+          data.DayNumber = 0;
155
+        var finishedCount = 0;
156
+        if (data.FinishedList)
157
+          finishedCount = data.FinishedList.length;
158
+        var reviewCount = 0;
159
+        if (data.ReviewList)
160
+          reviewCount = data.ReviewList.length;
161
+
162
+        hanziNumber = 0;
163
+        var arr = JSON.parse(wx.getStorageSync("HanziAll"));
164
+        for (var k = 0; k < data.FinishedList.length; k++) {
165
+          for (var i = 0; i < arr.length; i++) {
166
+            var b1 = false;
167
+            for (var j = 0; j < arr[i].Units.length; j++) {
168
+              var item = arr[i].Units[j];
169
+              if (item.ID == data.FinishedList[k].UnitID) {
170
+                hanziNumber += item.Words.length;
171
+
172
+                for (var n = 0; n < item.Words.length; n++) {
173
+                  for (var l = 0; l < data.ReviewList.length; l++) {
174
+                    if (data.ReviewList[l].WordID == item.Words[n].ID) {
175
+                      hanziNumber--;
176
+                    }
177
+                  }
178
+                }
179
+
180
+                b1 = true;
181
+                break;
182
+              }
183
+
184
+            }
185
+            if (b1)
186
+              break;
187
+          }
188
+        }
189
+
190
+        that.setData({
191
+          DayNumber: data.DayNumber,
192
+          HanziNumber: hanziNumber,
193
+          FinishedCount: finishedCount,
194
+          ReviewCount: reviewCount,
195
+          IsShow: data.IsShow,
196
+        });
197
+
198
+        wx.setStorageSync("FinishedList", data.FinishedList);
199
+        wx.setStorageSync("ReviewList", data.ReviewList);
200
+
201
+        if (data.DayNumber2)
202
+          app.globalData.DayNumber = data.DayNumber2;
203
+        else
204
+          app.globalData.DayNumber = data.DayNumber;
205
+
206
+        if (data.IsShow)
207
+          app.globalData.IsShow = data.IsShow;
208
+
209
+      }
52 210
     });
53 211
   },
54 212
   selectNav: function (e) {
@@ -73,7 +231,50 @@ Page({
73 231
   goto: function (e) {
74 232
     var id = e.currentTarget.dataset.id;
75 233
     wx.navigateTo({
76
-      url: "./list?id="+id,
234
+      url: "./list?id=" + id,
77 235
     });
78 236
   },
237
+  gotoSearch: function (e) {
238
+    wx.navigateTo({
239
+      url: "./search",
240
+    });
241
+  },
242
+  gotoAbout: function () {
243
+    wx.navigateTo({
244
+      url: "./about"
245
+    });
246
+  },
247
+  gotoReview: function () {
248
+    var id = "review";
249
+    wx.navigateTo({
250
+      url: './detail?Type=' + id,
251
+    });
252
+  },
253
+  switchProgram: function (e) {
254
+    wx.navigateToMiniProgram({
255
+      appId: e.currentTarget.dataset.appid,
256
+      path: e.currentTarget.dataset.path,
257
+      extraData: {
258
+      },
259
+      success(res) {
260
+        // 打开成功
261
+      }
262
+    });
263
+  },
264
+  onShareAppMessage: function () {
265
+    return {
266
+      title: '识字练习——让阅读赢在起点',
267
+      path: 'pages/index/index',
268
+      imageUrl: '../../images/07001.png',
269
+      success: function (res) {
270
+
271
+      },
272
+      fail: function (err) {
273
+        console.log(err);
274
+      },
275
+      complete: function (res) {
276
+        console.log(res);
277
+      },
278
+    }
279
+  },
79 280
 })

+ 2 - 2
pages/main/index.wxml

@@ -59,7 +59,7 @@
59 59
     </view>
60 60
     <view class="index8 FlexColumn">
61 61
       <image src='../../images/02013.png' class="img" />
62
-      <view class="index8_1">
62
+      <view class="index8_1" bindtap='gotoSearch'>
63 63
         搜一搜,输入一个字
64 64
       </view>
65 65
     </view>
@@ -90,7 +90,7 @@
90 90
         <view class="index3_1 FlexColumn">
91 91
           <view class="index3_1_1 FlexRow">
92 92
             <view class="number" wx:if="{{!IsAccredit}}">-</view>
93
-            <view class="number" wx:if="{{IsAccredit}}">{{PhonicsNumber}}</view>
93
+            <view class="number" wx:if="{{IsAccredit}}">{{HanziNumber}}</view>
94 94
           </view>
95 95
           <view class="index3_1_2 FlexRow">总共识字
96 96
           </view>

+ 1 - 0
pages/main/index.wxss

@@ -3,6 +3,7 @@
3 3
   justify-content: flex-start;
4 4
   font-weight: 500;
5 5
   color:#1e1e1e;
6
+  overflow-x:hidden;
6 7
 }
7 8
 
8 9
 .index1{

+ 82 - 2
pages/main/list.js

@@ -16,10 +16,15 @@ Page({
16 16
       IsShowNav1:true,
17 17
       BookID:bookID,
18 18
     });
19
+    
20
+  },
21
+  onShow:function(){
19 22
     this.init();
20 23
   },
21 24
   init:function(){
22 25
     var arr=JSON.parse(wx.getStorageSync("HanziAll"));
26
+    var arrReview = wx.getStorageSync("ReviewList");
27
+    var arrFinished = wx.getStorageSync("FinishedList");
23 28
 
24 29
     var result;
25 30
     for (var i = 0; i < arr.length; i++) {
@@ -31,6 +36,24 @@ Page({
31 36
           item.Example ="";
32 37
           for(var k=0;k<rnd;k++)
33 38
             item.Example += item.Words[k].Name;
39
+          
40
+          item.IsFinished = false;
41
+          for (var k = 0; k < arrFinished.length; k++) {
42
+            if (item.ID == arrFinished[k].UnitID) {
43
+              item.IsFinished = true;
44
+              break;
45
+            }
46
+          }
47
+
48
+          for (var k = 0; k < item.Words.length; k++) {
49
+            item.Words[k].ReviewCss = "";
50
+            for (var l = 0; l < arrReview.length; l++) {
51
+              if (arrReview[l].WordID == item.Words[k].ID) {
52
+                item.Words[k].ReviewCss = "boxSelect";
53
+                break;
54
+              }
55
+            }
56
+          }
34 57
         }
35 58
         break;
36 59
       }
@@ -42,6 +65,7 @@ Page({
42 65
     wx.setNavigationBarTitle({
43 66
       title: result.Name,
44 67
     });
68
+    
45 69
   },
46 70
   selectNav: function (e) {
47 71
     var id = e.currentTarget.dataset.id;
@@ -63,9 +87,65 @@ Page({
63 87
   },
64 88
   goto: function (e) {
65 89
     var bookid = e.currentTarget.dataset.bookid;
66
-    var id = e.currentTarget.dataset.id;
90
+    var unitid = e.currentTarget.dataset.unitid;
91
+    var wordid = e.currentTarget.dataset.wordid;
92
+    var isfinished = e.currentTarget.dataset.isfinished;
93
+    if (!wordid)
94
+      wordid=0
95
+    else{
96
+      wx.setStorageSync('selectedRandom', false);
97
+    }
67 98
     wx.navigateTo({
68
-      url: "./detail?bookid="+bookid+"&id=" + id,
99
+      url: "./detail?bookid=" + bookid + "&unitid=" + unitid + "&wordid=" + wordid + "&isfinished=" + isfinished,
69 100
     });
70 101
   },
102
+  getFinished: function () {
103
+    var that = this;
104
+    server.getData('GetHanziFinishedData?Category=' + this.data.BookID + '&UserID=' + app.globalData.userInfo.UserID, function (data) {
105
+      if (data) {
106
+        var list = that.data.List;
107
+        var arrReview = wx.getStorageSync("ReviewList");
108
+
109
+        for (var i = 0; i < list.length; i++) {
110
+          list[i].IsFinished = false;
111
+          for (var j = 0; j < data.length; j++) {
112
+            if (list[i].ID == data[j].Title) {
113
+              list[i].IsFinished = true;
114
+              break;
115
+            }
116
+          }
117
+
118
+          var item=list[i];
119
+          for (var k = 0; k < item.Words.length; k++) {
120
+            item.Words[k].ReviewCss = "";
121
+            for (var l = 0; l < arrReview.length; l++) {
122
+              if (arrReview[l].WordID == item.Words[k].ID) {
123
+                item.Words[k].ReviewCss = "boxSelect";
124
+                break;
125
+              }
126
+            }
127
+          }
128
+        }
129
+        that.setData({
130
+          List: list,
131
+        })
132
+      }
133
+    });
134
+  },
135
+  onShareAppMessage: function () {
136
+    return {
137
+      title: '识字练习——让阅读赢在起点',
138
+      path: 'pages/index/index',
139
+      imageUrl: '../../images/07001.png',
140
+      success: function (res) {
141
+
142
+      },
143
+      fail: function (err) {
144
+        console.log(err);
145
+      },
146
+      complete: function (res) {
147
+        console.log(res);
148
+      },
149
+    }
150
+  },
71 151
 })

+ 1 - 0
pages/main/list.json

@@ -1,5 +1,6 @@
1 1
 {
2 2
   "navigationBarBackgroundColor": "#f0f0f0",
3 3
   "navigationBarTitleText": "",
4
+  "backgroundColor": "#dfc7a4",
4 5
   "enablePullDownRefresh": false
5 6
 }

+ 4 - 3
pages/main/list.wxml

@@ -18,10 +18,11 @@
18 18
     <view class="line2 line">
19 19
     </view>
20 20
     <view class="list2 FlexColumn">
21
-      <view class="btn" bindtap="goto" data-bookid='{{BookID}}' data-id='{{item.ID}}' wx:for="{{List}}" wx:key="index">
21
+      <view class="btn" bindtap="goto" data-bookid='{{BookID}}' data-unitid='{{item.ID}}' data-isfinished='{{item.IsFinished}}' wx:for="{{List}}" wx:key="index">
22 22
         <view class="btn1 FlexRow">
23 23
           <view class="left FlexRow">
24
-            <image src='../../images/04007.png' class="img04007" />
24
+            <image wx:if="{{!item.IsFinished}}" src='../../images/04007.png' class="img04007" />
25
+            <image wx:if="{{item.IsFinished}}" src='../../images/04006.png' class="img04007" />
25 26
             <view class="title">{{item.Example}}</view>
26 27
           </view>
27 28
           <view class="right FlexColumn">
@@ -48,7 +49,7 @@
48 49
         <view class="title1">{{item.Name}}</view>
49 50
       </view>
50 51
       <view class="table FlexRow">
51
-      <view class="box" wx:for="{{item.Words}}" wx:for-item="itemChild">{{itemChild.Name}}</view>
52
+      <view class="{{itemChild.ReviewCss}} box" wx:for="{{item.Words}}" wx:key="i" wx:for-item="itemChild" wx:for-index="i" bindtap="goto" data-bookid='{{BookID}}' data-unitid='{{item.ID}}' data-wordid='{{i}}' data-isfinished='{{item.IsFinished}}'>{{itemChild.Name}}</view>
52 53
       </view>
53 54
     </view>
54 55
     

+ 7 - 5
pages/main/list.wxss

@@ -142,20 +142,22 @@
142 142
   font-size:28rpx;
143 143
 }
144 144
 .group .table{
145
-  margin: 30rpx 24rpx 60rpx 30rpx;
145
+  margin: 40rpx 20rpx 60rpx 30rpx;
146 146
   font-size:48rpx;
147 147
   justify-content: flex-start;
148 148
   align-items: flex-start;
149 149
   flex-wrap: wrap;
150
+  /* background-color: #000; */
150 151
 }
151 152
 .group .box{
152
-  margin: 0 6rpx 6rpx 0;
153
+  margin: 0 7rpx 7rpx 0;
153 154
   background-color: #fff;
154
-  width:110rpx;
155
-  height:110rpx;
155
+  width:106rpx;
156
+  height:106rpx;
157
+  line-height: 106rpx;
156 158
   text-align: center;
157
-  line-height: 110rpx;
158 159
   font-weight: 400;
160
+  border:1rpx solid #CDB797;
159 161
 }
160 162
 .group .boxSelect{
161 163
   color:#fff;

+ 94 - 0
pages/main/search.js

@@ -0,0 +1,94 @@
1
+import common from '../../utils/util';
2
+import server from '../../utils/main';
3
+
4
+const app = getApp();
5
+
6
+Page({
7
+  data: {
8
+  },
9
+  onLoad: function (options) {
10
+    this.setData({
11
+      Height: common.getSystemHeight(),
12
+      ExampleArray: this.getExampleArray(),
13
+      IsSearchResult: false,
14
+    });
15
+  },
16
+  getExampleArray:function(){
17
+    var result=[];
18
+    var arr = JSON.parse(wx.getStorageSync("HanziAll"));
19
+    for (var i = 0; i < arr.length; i++) {
20
+      var rnd1 = common.random(0, arr[i].Units.length-1);
21
+      var rnd2 = common.random(0, arr[i].Units[rnd1].Words.length - 1);
22
+      
23
+      var isfinished = false;
24
+      var arrReview = wx.getStorageSync("ReviewList");
25
+      for (var l = 0; l < arrReview.length; l++) {
26
+        if (arrReview[l].Word == arr[i].Units[rnd1].Words[rnd2].Name) {
27
+          isfinished = true;
28
+          break;
29
+        }
30
+      }
31
+      arr[i].Units[rnd1].Words[rnd2].BookID = arr[i].ID;
32
+      arr[i].Units[rnd1].Words[rnd2].UnitID = arr[i].Units[rnd1].ID;
33
+      arr[i].Units[rnd1].Words[rnd2].WordID = rnd2;
34
+      arr[i].Units[rnd1].Words[rnd2].IsFinished=isfinished;
35
+      result.push(arr[i].Units[rnd1].Words[rnd2]);
36
+    }
37
+    return result;
38
+  },
39
+  researchWord: function (e) {
40
+    var result=false;
41
+    var word = e.detail.value;
42
+    if (word) {
43
+      console.log(word);
44
+      var arr = JSON.parse(wx.getStorageSync("HanziAll"));
45
+      for (var i = 0; i < arr.length; i++) {
46
+        for (var j = 0; j < arr[i].Units.length; j++) {
47
+          var item = arr[i].Units[j];
48
+          for (var n = 0; n < item.Words.length; n++) {
49
+            if (word == item.Words[n].Name) {
50
+              var bookid = arr[i].ID;
51
+              var unitid = item.ID;
52
+              var wordid = n;
53
+
54
+              var isfinished = false;
55
+              var arrReview = wx.getStorageSync("ReviewList");
56
+              for (var l = 0; l < arrReview.length; l++) {
57
+                if (arrReview[l].Word == word) {
58
+                  isfinished=true;
59
+                  break;
60
+                }
61
+              }
62
+              wx.navigateTo({
63
+                url: "./detail?bookid=" + bookid + "&unitid=" + unitid + "&wordid=" + wordid + "&isfinished=" + isfinished,
64
+              });
65
+              result=true;
66
+              break;
67
+            }
68
+          }
69
+        }
70
+      }
71
+    }
72
+
73
+    if (!result){
74
+      this.setData({
75
+        IsSearchResult: true,
76
+      });
77
+    }
78
+  },
79
+  goto: function (e) {
80
+    var bookid = e.currentTarget.dataset.bookid;
81
+    var unitid = e.currentTarget.dataset.unitid;
82
+    var wordid = e.currentTarget.dataset.wordid;
83
+    var isfinished = e.currentTarget.dataset.isfinished;
84
+    if (!wordid)
85
+      wordid = 0
86
+    else {
87
+      wx.setStorageSync('selectedRandom', false);
88
+      wx.setStorageSync('IsAutoPage', false);
89
+    }
90
+    wx.navigateTo({
91
+      url: "./detail?bookid=" + bookid + "&unitid=" + unitid + "&wordid=" + wordid + "&isfinished=" + isfinished,
92
+    });
93
+  },
94
+})

+ 6 - 0
pages/main/search.json

@@ -0,0 +1,6 @@
1
+{
2
+  "navigationBarBackgroundColor": "#F5E2BE",
3
+  "navigationBarTitleText": "搜索",
4
+  "backgroundColor": "#F5E2BE",
5
+  "enablePullDownRefresh": false
6
+}

+ 15 - 0
pages/main/search.wxml

@@ -0,0 +1,15 @@
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>
5
+  <block wx:if="{{IsSearchResult}}">
6
+    <image class="image04009" src="../../images/04009.png" />
7
+    <view class="search2">暂未收录</view>
8
+    <text class="search3">换个常用字试试吧\n更多字逐步更新中</text>
9
+    <view class="line"></view>
10
+    <view class="search4">推荐几个常用字</view>
11
+    <view class="search5 FlexRow">
12
+      <view class="box" wx:for="{{ExampleArray}}" wx:key="index" bindtap="goto" data-bookid='{{item.BookID}}' data-unitid='{{item.UnitID}}' data-wordid='{{item.WordID}}' data-isfinished='{{item.IsFinished}}'>{{item.Name}}</view>
13
+    </view>
14
+  </block>
15
+</view>

+ 73 - 0
pages/main/search.wxss

@@ -0,0 +1,73 @@
1
+.container {
2
+  background-color: #f0f0f0;
3
+  justify-content: flex-start;
4
+  font-weight: 500;
5
+  color:#1e1e1e;
6
+}
7
+
8
+.search1{
9
+  width:100%;
10
+  height:116rpx;
11
+  background-color: #F5E2BE;
12
+  
13
+}
14
+.search1 .input{
15
+  width:690rpx;
16
+  height:70rpx;
17
+  line-height: 70rpx;
18
+  background-color: #ffffff;
19
+  border-radius: 10rpx;
20
+  text-align: center;
21
+  font-size:36rpx;
22
+  color:#1e1e1e;
23
+  /* padding-left: 20rpx; */
24
+}
25
+
26
+
27
+.image04009{
28
+  width:130rpx;
29
+  height:130rpx;
30
+  margin-top: 170rpx;
31
+}
32
+
33
+.search2{
34
+  margin-top: 30rpx;
35
+  font-size:48rpx;
36
+  color:#9B9B9B;
37
+}
38
+
39
+.search3{
40
+  font-size:24rpx;
41
+  color:#9B9B9B;
42
+  width:264rpx;
43
+  text-align: center;
44
+}
45
+
46
+.line{
47
+  margin-top: 60rpx;
48
+  background-color: #9B9B9B;
49
+  width:458rpx;
50
+  height:6rpx;
51
+}
52
+
53
+.search4{
54
+  margin-top: 66rpx;
55
+  font-size:36rpx;
56
+  color:#9B9B9B;
57
+}
58
+
59
+.search5{
60
+  margin-top: 30rpx;
61
+}
62
+
63
+.search5 .box{
64
+  width:110rpx;
65
+  height:110rpx;
66
+  background-color: #fff;
67
+  border:1rpx solid #CDB797;
68
+  font-size:48rpx;
69
+  text-align: center;
70
+  line-height: 110rpx;
71
+  font-weight: 400;
72
+  margin: 0 3rpx;
73
+}

+ 13 - 1
project.config.json

@@ -48,7 +48,19 @@
48 48
 					"id": 2,
49 49
 					"name": "详情页",
50 50
 					"pathName": "pages/main/detail",
51
-					"query": "bookid=1&id=1"
51
+					"query": "bookid=1&unitid=1&wordid=0"
52
+				},
53
+				{
54
+					"id": -1,
55
+					"name": "\b搜索",
56
+					"pathName": "pages/main/search",
57
+					"query": ""
58
+				},
59
+				{
60
+					"id": -1,
61
+					"name": "\b关于",
62
+					"pathName": "pages/main/about",
63
+					"query": ""
52 64
 				}
53 65
 			]
54 66
 		}

+ 37 - 0
utils/main.js

@@ -118,10 +118,47 @@ function payMoney(payType, money, callback) {
118 118
   });
119 119
 }
120 120
 
121
+function getProgramList(){
122
+  return [
123
+    {
124
+      ImageUrl: "03001.png",
125
+      ImageUrl2: "02018.png",
126
+      appId: 'wx46a7b4c420e6d38f',
127
+      path: 'pages/index/start?SourceID=106',
128
+      left: 117,
129
+      top: 837,
130
+    },
131
+    {
132
+      ImageUrl: "03002.png",
133
+      ImageUrl2: "02020.png",
134
+      appId: 'wxb54a6d5aff836ee3',
135
+      path: 'pages/index/index?SourceID=106',
136
+      left: 117,
137
+      top: 1181,
138
+    },
139
+    {
140
+      ImageUrl: "03003.png",
141
+      ImageUrl2: "02019.png",
142
+      appId: 'wx331e8dd070f01d0e',
143
+      path: 'pages/index/index?SourceID=106',
144
+      left: 425,
145
+      top: 837,
146
+    },
147
+    {
148
+      ImageUrl: "03004.png",
149
+      ImageUrl2: "02021.png",
150
+      appId: 'wxa5e33c61fe37dd01',
151
+      path: 'pages/index/index?SourceID=106',
152
+      left: 117,
153
+      top: 1525,
154
+    },
155
+  ];
156
+}
121 157
 
122 158
 module.exports = {
123 159
   getData: getData,
124 160
   postData: postData,
125 161
   payMoney: payMoney,
126 162
   getLocalHost: getLocalHost,
163
+  getProgramList: getProgramList,
127 164
 }

+ 4 - 4
utils/pinyin.js

@@ -227,7 +227,6 @@ const getPinyinArray = function () {
227 227
     ['dao3', 'dǎo', ['岛']],
228 228
     ['dao4', 'dào', ['到']],
229 229
     ['dao5', 'dao', ['']],
230
-    ['de', 'de', ['嘚']],
231 230
     ['de2', 'dé', ['得']],
232 231
     ['de5', 'de', ['的']],
233 232
     ['dei3', 'děi', ['得']],
@@ -609,10 +608,9 @@ const getPinyinArray = function () {
609 608
     ['lao3', 'lǎo', ['老']],
610 609
     ['lao4', 'lào', ['涝']],
611 610
     ['lao5', 'lao', ['']],
612
-    ['le', 'le', ['了']],
613 611
     ['le1', 'lē', ['肋']],
614 612
     ['le4', 'lè', ['乐']],
615
-    ['le5', 'le', ['']],
613
+    ['le5', 'le', ['']],
616 614
     ['lei1', 'lēi', ['勒']],
617 615
     ['lei2', 'léi', ['雷']],
618 616
     ['lei3', 'lěi', ['磊']],
@@ -1484,8 +1482,10 @@ const getPinyinArray = function () {
1484 1482
 function getPinyinName(pinyin){
1485 1483
   var arr=getPinyinArray();
1486 1484
   for(var i=0;i<arr.length;i++){
1487
-    if (arr[i][1]==pinyin)
1485
+    if (arr[i][1]==pinyin){
1486
+      
1488 1487
       return arr[i][0];
1488
+    }
1489 1489
   }
1490 1490
   return "";
1491 1491
 }