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