chengjie 7 年之前
父节点
当前提交
4bbb9ebe29
共有 5 个文件被更改,包括 52 次插入45 次删除
  1. 36 36
      pages/main/detail.js
  2. 3 3
      pages/main/detail.wxml
  3. 1 1
      pages/main/index.wxml
  4. 1 1
      pages/main/list.js
  5. 11 4
      pages/main/search.js

+ 36 - 36
pages/main/detail.js

@@ -27,6 +27,7 @@ Page({
27
     var bookID = options.bookid || 0;
27
     var bookID = options.bookid || 0;
28
     var unitID = options.unitid || 0;
28
     var unitID = options.unitid || 0;
29
     var wordID = options.wordid || 0;
29
     var wordID = options.wordid || 0;
30
+
30
     this.audioCtx = wx.createAudioContext('myAudio');
31
     this.audioCtx = wx.createAudioContext('myAudio');
31
     hanziNumber = 0;
32
     hanziNumber = 0;
32
     isClickFinished = true;
33
     isClickFinished = true;
@@ -54,7 +55,7 @@ Page({
54
       ShowMenu: "sort",
55
       ShowMenu: "sort",
55
       UnitID: unitID,
56
       UnitID: unitID,
56
       BookID: bookID,
57
       BookID: bookID,
57
-      selectedRandom: false,
58
+      SelectedRandom: false,
58
       SpeakerTitle: this.data.SpeakerArray[0].name,
59
       SpeakerTitle: this.data.SpeakerArray[0].name,
59
       SpeakerMan: 0,
60
       SpeakerMan: 0,
60
       ShowPinyin: true,
61
       ShowPinyin: true,
@@ -65,14 +66,14 @@ Page({
65
     var that = this;
66
     var that = this;
66
     common.getStorageValue(that, "IsAutoPlay", true, function () {
67
     common.getStorageValue(that, "IsAutoPlay", true, function () {
67
       common.getStorageValue(that, "IsAutoPage", false, function () {
68
       common.getStorageValue(that, "IsAutoPage", false, function () {
68
-        common.getStorageValue(that, "selectedRandom", false, function () {
69
+        common.getStorageValue(that, "SelectedRandom", false, function () {
69
           common.getStorageValue(that, "ShowPinyin", true, function () {
70
           common.getStorageValue(that, "ShowPinyin", true, function () {
70
             common.getStorageValue(that, "IntervalSecondIndex", 2, function () {
71
             common.getStorageValue(that, "IntervalSecondIndex", 2, function () {
71
               common.getStorageValue(that, "IsAudioLengthChecked", true, function () {
72
               common.getStorageValue(that, "IsAudioLengthChecked", true, function () {
72
                 common.getStorageValue(that, "SpeakerMan", 0, function () {
73
                 common.getStorageValue(that, "SpeakerMan", 0, function () {
73
                   that.settingPlay(null, that.data.IsAutoPlay);
74
                   that.settingPlay(null, that.data.IsAutoPlay);
74
                   that.settingPage(null, that.data.IsAutoPage);
75
                   that.settingPage(null, that.data.IsAutoPage);
75
-                  that.settingSort(null, that.data.selectedRandom.toString());
76
+                  that.settingSort(null, that.data.SelectedRandom.toString());
76
                   that.settingShowPinyin(null, that.data.ShowPinyin);
77
                   that.settingShowPinyin(null, that.data.ShowPinyin);
77
                   that.settingAudioLength(null, that.data.IsAudioLengthChecked);
78
                   that.settingAudioLength(null, that.data.IsAudioLengthChecked);
78
                   that.settingSpeaker(null, that.data.SpeakerMan);
79
                   that.settingSpeaker(null, that.data.SpeakerMan);
@@ -127,7 +128,7 @@ Page({
127
               item.Words[k].PinyinAll = item.Words[k].Pinyin;
128
               item.Words[k].PinyinAll = item.Words[k].Pinyin;
128
               if (item.Words[k].Pinyin.indexOf(",") > 0)
129
               if (item.Words[k].Pinyin.indexOf(",") > 0)
129
                 item.Words[k].Pinyin = item.Words[k].Pinyin.substr(0, item.Words[k].Pinyin.indexOf(","));
130
                 item.Words[k].Pinyin = item.Words[k].Pinyin.substr(0, item.Words[k].Pinyin.indexOf(","));
130
-              
131
+
131
               item.Words[k].WordUrl = app.globalData.imageUrl + "/images/hanzi" + item.Words[k].Name + ".jpg";
132
               item.Words[k].WordUrl = app.globalData.imageUrl + "/images/hanzi" + item.Words[k].Name + ".jpg";
132
 
133
 
133
               item.Words[k].IsReview = false;
134
               item.Words[k].IsReview = false;
@@ -146,7 +147,7 @@ Page({
146
       }
147
       }
147
     }
148
     }
148
 
149
 
149
-    if (this.data.selectedRandom) {
150
+    if (this.data.SelectedRandom) {
150
       result.Words = common.randomArray(result.Words);
151
       result.Words = common.randomArray(result.Words);
151
     }
152
     }
152
 
153
 
@@ -171,7 +172,7 @@ Page({
171
     for (var l = 0; l < arrReview.length; l++) {
172
     for (var l = 0; l < arrReview.length; l++) {
172
       var item = arrReview[l];
173
       var item = arrReview[l];
173
       item.PinyinAll = item.Pinyin;
174
       item.PinyinAll = item.Pinyin;
174
-      if (item.Pinyin.indexOf(",")>0)
175
+      if (item.Pinyin.indexOf(",") > 0)
175
         item.Pinyin = item.Pinyin.substr(0, item.Pinyin.indexOf(","));
176
         item.Pinyin = item.Pinyin.substr(0, item.Pinyin.indexOf(","));
176
 
177
 
177
       item.WordUrl = app.globalData.imageUrl + "/images/hanzi" + item.Name + ".jpg";
178
       item.WordUrl = app.globalData.imageUrl + "/images/hanzi" + item.Name + ".jpg";
@@ -179,7 +180,7 @@ Page({
179
     }
180
     }
180
     var result = arrReview;
181
     var result = arrReview;
181
 
182
 
182
-    if (this.data.selectedRandom) {
183
+    if (this.data.SelectedRandom) {
183
       result = common.randomArray(result);
184
       result = common.randomArray(result);
184
     }
185
     }
185
 
186
 
@@ -206,7 +207,7 @@ Page({
206
     var result = wx.getStorageSync("CurrentSearchWord");
207
     var result = wx.getStorageSync("CurrentSearchWord");
207
     result.WordUrl += "?" + new Date().getTime();
208
     result.WordUrl += "?" + new Date().getTime();
208
     result.PinyinAll = result.Pinyin;
209
     result.PinyinAll = result.Pinyin;
209
-    if (result.Pinyin && result.Pinyin.indexOf(",")>0)
210
+    if (result.Pinyin && result.Pinyin.indexOf(",") > 0)
210
       result.Pinyin = result.Pinyin.substr(0, result.Pinyin.indexOf(","));
211
       result.Pinyin = result.Pinyin.substr(0, result.Pinyin.indexOf(","));
211
 
212
 
212
 
213
 
@@ -244,7 +245,7 @@ Page({
244
     wx.setNavigationBarTitle({
245
     wx.setNavigationBarTitle({
245
       title: title
246
       title: title
246
     });
247
     });
247
-    
248
+
248
     if (result.IsNew) {
249
     if (result.IsNew) {
249
       wx.showLoading({
250
       wx.showLoading({
250
         title: '加载中',
251
         title: '加载中',
@@ -255,9 +256,9 @@ Page({
255
           List: resultArr,
256
           List: resultArr,
256
         });
257
         });
257
         that.restart(that.data.CurrentIndex);
258
         that.restart(that.data.CurrentIndex);
258
-      }, 5000)
259
+      }, 1000);
259
     }
260
     }
260
-    else{
261
+    else {
261
       that.setData({
262
       that.setData({
262
         List: resultArr,
263
         List: resultArr,
263
       });
264
       });
@@ -286,15 +287,15 @@ Page({
286
       else {
287
       else {
287
 
288
 
288
         var pinyinItem = this.data.List[this.data.CurrentIndex].PinyinAll;
289
         var pinyinItem = this.data.List[this.data.CurrentIndex].PinyinAll;
289
-        
290
+
290
         if (pinyinItem) {
291
         if (pinyinItem) {
291
           var pinyinStr = "";
292
           var pinyinStr = "";
292
-          if (pinyinItem.indexOf(",")>0){
293
-            pinyinItem=pinyinItem.substr(0,pinyinItem.indexOf(","));
293
+          if (pinyinItem.indexOf(",") > 0) {
294
+            pinyinItem = pinyinItem.substr(0, pinyinItem.indexOf(","));
294
             if (e && e.currentTarget.dataset.pinyin)
295
             if (e && e.currentTarget.dataset.pinyin)
295
               pinyinItem = e.currentTarget.dataset.pinyin;
296
               pinyinItem = e.currentTarget.dataset.pinyin;
296
-              
297
-            pinyinStr = "(" + pinyin.getPinyinName(pinyinItem)+")";
297
+
298
+            pinyinStr = "(" + pinyin.getPinyinName(pinyinItem) + ")";
298
           }
299
           }
299
 
300
 
300
           var Name = this.data.List[this.data.CurrentIndex].Name;
301
           var Name = this.data.List[this.data.CurrentIndex].Name;
@@ -305,13 +306,13 @@ Page({
305
           else {
306
           else {
306
             var CombineWords = this.data.List[this.data.CurrentIndex].CombineWords;
307
             var CombineWords = this.data.List[this.data.CurrentIndex].CombineWords;
307
             if (CombineWords)
308
             if (CombineWords)
308
-              CombineWords = ","+CombineWords.replace(Name, Name + pinyinStr)+"的"+Name;
309
+              CombineWords = "," + CombineWords.replace(Name, Name + pinyinStr) + "的" + Name;
309
 
310
 
310
             url = url.replace("[word]", Name + pinyinStr + CombineWords + pinyinStr);
311
             url = url.replace("[word]", Name + pinyinStr + CombineWords + pinyinStr);
311
           }
312
           }
312
         }
313
         }
313
       }
314
       }
314
-      url=encodeURI(url);
315
+      url = encodeURI(url);
315
       this.audioCtx.setSrc(url);
316
       this.audioCtx.setSrc(url);
316
       this.audioCtx.play();
317
       this.audioCtx.play();
317
     }
318
     }
@@ -393,32 +394,31 @@ Page({
393
     }, second);
394
     }, second);
394
   },
395
   },
395
   setCurrentWord: function (index, isShowPrev, isShowNext) {
396
   setCurrentWord: function (index, isShowPrev, isShowNext) {
396
-    var that=this;
397
+    var that = this;
397
     that.setData({
398
     that.setData({
398
       CurrentIndex: index,
399
       CurrentIndex: index,
399
       IsShowPrev: isShowPrev,
400
       IsShowPrev: isShowPrev,
400
       IsShowNext: isShowNext,
401
       IsShowNext: isShowNext,
401
       IsShowWordDetail: false,
402
       IsShowWordDetail: false,
402
     });
403
     });
403
-    
404
+
404
   },
405
   },
405
   getImageError: function () {
406
   getImageError: function () {
406
     var that = this;
407
     var that = this;
408
+    that.data.List[that.data.CurrentIndex].WordUrl = "";
409
+
407
     that.setData({
410
     that.setData({
411
+      List: that.data.List,
408
       IsImageError: true,
412
       IsImageError: true,
409
     });
413
     });
410
-    if (that.data.WordType == "normal")
411
-      that.init();
412
-    else if (that.data.WordType == "review")
413
-      that.initReview();
414
-    else if (that.data.WordType == "search")
415
-      that.initSearch();
414
+
416
   },
415
   },
417
   getImageDownload: function () {
416
   getImageDownload: function () {
418
-    this.data.List[this.data.CurrentIndex].WordUrl += "?"+common.random(0, 9);
419
-    this.setData({
420
-      List: this.data.List,
421
-      IsImageError: false,
417
+    var that = this;
418
+    server.getData('SearchHanzi?Word=' + that.data.List[that.data.CurrentIndex].Name, function (data) {
419
+      wx.redirectTo({
420
+        url: "./detail?Type=" + that.data.WordType + "&bookid=" + that.data.BookID + "&unitid=" + that.data.UnitID + "&wordid=" + that.data.CurrentIndex + "&isfinished=" + that.data.IsFinished,
421
+      });
422
     });
422
     });
423
   },
423
   },
424
   showWordDetailHandler: function (e) {
424
   showWordDetailHandler: function (e) {
@@ -428,7 +428,7 @@ Page({
428
       this.setData({
428
       this.setData({
429
         IsShowWordDetail: this.data.IsShowWordDetail,
429
         IsShowWordDetail: this.data.IsShowWordDetail,
430
       });
430
       });
431
-      if (!this.data.IsShowWordDetail){
431
+      if (!this.data.IsShowWordDetail) {
432
         this.setData({
432
         this.setData({
433
           Detail: null,
433
           Detail: null,
434
         });
434
         });
@@ -531,10 +531,10 @@ Page({
531
       result = e.currentTarget.dataset.id;
531
       result = e.currentTarget.dataset.id;
532
 
532
 
533
     var title = "";
533
     var title = "";
534
-    var selectedRandom = true;
534
+    var SelectedRandom = true;
535
     if (result == "false") {
535
     if (result == "false") {
536
       title = "课本一致";
536
       title = "课本一致";
537
-      selectedRandom = false;
537
+      SelectedRandom = false;
538
     }
538
     }
539
     else {
539
     else {
540
       title = "随机";
540
       title = "随机";
@@ -542,9 +542,9 @@ Page({
542
     this.setData({
542
     this.setData({
543
       isShowSettingMenu: false,
543
       isShowSettingMenu: false,
544
       SortTitle: title,
544
       SortTitle: title,
545
-      selectedRandom: selectedRandom,
545
+      SelectedRandom: SelectedRandom,
546
     });
546
     });
547
-    wx.setStorageSync('selectedRandom', selectedRandom);
547
+    wx.setStorageSync('SelectedRandom', SelectedRandom);
548
   },
548
   },
549
   settingSpeaker: function (e, b) {
549
   settingSpeaker: function (e, b) {
550
     isEditSetting.push("speaker");
550
     isEditSetting.push("speaker");
@@ -685,7 +685,7 @@ Page({
685
 
685
 
686
     //this.animation = animation;
686
     //this.animation = animation;
687
     animation.opacity(opacity).step();
687
     animation.opacity(opacity).step();
688
-    if (obj =="animationData"){
688
+    if (obj == "animationData") {
689
       this.setData({
689
       this.setData({
690
         animationData: animation.export(),
690
         animationData: animation.export(),
691
       });
691
       });

+ 3 - 3
pages/main/detail.wxml

@@ -6,7 +6,7 @@
6
           {{List[CurrentIndex].Pinyin}}
6
           {{List[CurrentIndex].Pinyin}}
7
         </block>
7
         </block>
8
       </view>
8
       </view>
9
-      <image binderror='getImageError' wx:if="{{!IsImageError}}" src='{{List[CurrentIndex].WordUrl}}' class="wordImage" animation="{{animationDataWord}}"/>
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" />
10
       <image catchtap='getImageDownload' wx:if="{{IsImageError}}" src='../../images/05014.png' class="wordImage" />
11
     </block>
11
     </block>
12
     <block wx:if="{{CurrentIndex==List.length-1}}">
12
     <block wx:if="{{CurrentIndex==List.length-1}}">
@@ -249,12 +249,12 @@
249
       </view>
249
       </view>
250
       <view class="settingMenuBasic FlexColumn" bindtap='settingSort' data-id="false">
250
       <view class="settingMenuBasic FlexColumn" bindtap='settingSort' data-id="false">
251
         <view class="word">课本一致</view>
251
         <view class="word">课本一致</view>
252
-        <image class="SelectLogo" src="../../images/012.png" hidden="{{selectedRandom}}" />
252
+        <image class="SelectLogo" src="../../images/012.png" hidden="{{SelectedRandom}}" />
253
       </view>
253
       </view>
254
       <view style='height:2rpx'></view>
254
       <view style='height:2rpx'></view>
255
       <view class="settingMenuBasic FlexColumn" bindtap='settingSort' data-id="true">
255
       <view class="settingMenuBasic FlexColumn" bindtap='settingSort' data-id="true">
256
         <view class="word">随机</view>
256
         <view class="word">随机</view>
257
-        <image class="SelectLogo" src="../../images/012.png" hidden="{{!selectedRandom}}" />
257
+        <image class="SelectLogo" src="../../images/012.png" hidden="{{!SelectedRandom}}" />
258
       </view>
258
       </view>
259
     </block>
259
     </block>
260
 
260
 

+ 1 - 1
pages/main/index.wxml

@@ -141,7 +141,7 @@
141
       </view>
141
       </view>
142
     </view>
142
     </view>
143
 
143
 
144
-    <view class="index9 FlexRow" wx:if="{{IsMember==1 && NewUserNumber>=NewUserNumberMax}}">
144
+    <view class="index9 FlexRow" wx:if="{{IsMember==0 || (IsMember==1 && NewUserNumber>=NewUserNumberMax)}}">
145
       <image src='../../images/02016.png' class="imgWave" />
145
       <image src='../../images/02016.png' class="imgWave" />
146
     </view>
146
     </view>
147
   </block>
147
   </block>

+ 1 - 1
pages/main/list.js

@@ -103,7 +103,7 @@ Page({
103
       if (!wordid)
103
       if (!wordid)
104
         wordid = 0
104
         wordid = 0
105
       else {
105
       else {
106
-        wx.setStorageSync('selectedRandom', false);
106
+        wx.setStorageSync('SelectedRandom', false);
107
       }
107
       }
108
       wx.navigateTo({
108
       wx.navigateTo({
109
         url: "./detail?bookid=" + bookid + "&unitid=" + unitid + "&wordid=" + wordid + "&isfinished=" + isfinished,
109
         url: "./detail?bookid=" + bookid + "&unitid=" + unitid + "&wordid=" + wordid + "&isfinished=" + isfinished,

+ 11 - 4
pages/main/search.js

@@ -38,12 +38,19 @@ Page({
38
   },
38
   },
39
   researchWord: function (e) {
39
   researchWord: function (e) {
40
     var that = this;
40
     var that = this;
41
+    that.setData({
42
+      IsSearchResult: false,
43
+    });
41
     var result = false;
44
     var result = false;
42
     var word = e.detail.value;
45
     var word = e.detail.value;
43
     if (common.IsChinese(word)) {
46
     if (common.IsChinese(word)) {
44
       server.getData('SearchHanzi?Word=' + word, function (data) {
47
       server.getData('SearchHanzi?Word=' + word, function (data) {
45
         if (data) {
48
         if (data) {
46
           wx.setStorageSync("CurrentSearchWord", data);
49
           wx.setStorageSync("CurrentSearchWord", data);
50
+
51
+          wx.setStorageSync('SelectedRandom', false);
52
+          wx.setStorageSync('IsAutoPage', false);
53
+
47
           wx.navigateTo({
54
           wx.navigateTo({
48
             url: "./detail?Type=search",
55
             url: "./detail?Type=search",
49
           });
56
           });
@@ -68,10 +75,10 @@ Page({
68
     var isfinished = e.currentTarget.dataset.isfinished;
75
     var isfinished = e.currentTarget.dataset.isfinished;
69
     if (!wordid)
76
     if (!wordid)
70
       wordid = 0
77
       wordid = 0
71
-    else {
72
-      wx.setStorageSync('selectedRandom', false);
73
-      wx.setStorageSync('IsAutoPage', false);
74
-    }
78
+   
79
+    wx.setStorageSync('SelectedRandom', false);
80
+    wx.setStorageSync('IsAutoPage', false);
81
+    
75
     wx.navigateTo({
82
     wx.navigateTo({
76
       url: "./detail?Type=search&bookid=" + bookid + "&unitid=" + unitid + "&wordid=" + wordid + "&isfinished=" + isfinished,
83
       url: "./detail?Type=search&bookid=" + bookid + "&unitid=" + unitid + "&wordid=" + wordid + "&isfinished=" + isfinished,
77
     });
84
     });