chengjie 7 vuotta sitten
vanhempi
commit
c01d7feb70

+ 3 - 2
app.js

@@ -11,8 +11,8 @@ App({
11 11
     this.globalData.systemInfo = wx.getSystemInfoSync();
12 12
   },
13 13
   globalData: {
14
-    Version: "1.0.0",
15
-    IsProduction: false,
14
+    Version: "1.0.1",
15
+    IsProduction: true,
16 16
     ProgramID: 106,
17 17
     AppID: "wx313a8f2c0741efe1",
18 18
     ShareTitle:"赢在阅读起跑线",
@@ -34,5 +34,6 @@ App({
34 34
     BaiduToken:"",//百度开发平台token
35 35
     IsShow: 0,
36 36
     NewUserNumberMax:6,//邀请新用户最大值
37
+    IsSaveCustom:false,//是否保存了定制
37 38
   }
38 39
 })

+ 1 - 0
app.json

@@ -4,6 +4,7 @@
4 4
     "pages/main/list",
5 5
     "pages/main/detail",
6 6
     "pages/main/search",
7
+    "pages/main/setcombine",
7 8
     "pages/about/about",
8 9
     "pages/about/cooperation",
9 10
     "pages/about/payfinished",

+ 40 - 3
pages/main/detail.js

@@ -99,6 +99,12 @@ Page({
99 99
       this.submitData();
100 100
 
101 101
   },
102
+  onShow: function (e) {
103
+    if (app.globalData.IsSaveCustom) {
104
+      isEditSetting.push("saveCustom");
105
+      app.globalData.IsSaveCustom=false;
106
+    }
107
+  },
102 108
   onUnload: function () {
103 109
     clearInterval(intervalAutoPage);
104 110
 
@@ -135,6 +141,15 @@ Page({
135 141
         for (var j = 0; j < arr[i].Units.length; j++) {
136 142
           var item = arr[i].Units[j];
137 143
           if (item.ID == this.data.UnitID) {
144
+            //查看用户有没有自定义
145
+            var wordArr = wx.getStorageSync("UnitCustom");
146
+            if (wordArr) {
147
+              for (var k = 0; k < wordArr.length; k++) {
148
+                if (wordArr[k].ID == this.data.UnitID) {
149
+                  item.Words = wordArr[k].List;
150
+                }
151
+              }
152
+            }
138 153
             for (var k = 0; k < item.Words.length; k++) {
139 154
               item.Words[k].PinyinAll = item.Words[k].Pinyin;
140 155
               if (item.Words[k].Pinyin.indexOf(",") > 0)
@@ -144,7 +159,7 @@ Page({
144 159
 
145 160
               item.Words[k].IsReview = false;
146 161
               for (var l = 0; l < arrReview.length; l++) {
147
-                if (arrReview[l].Word == item.Words[k].Name) {
162
+                if (arrReview[l].Name == item.Words[k].Name) {
148 163
                   item.Words[k].IsReview = true;
149 164
                   break;
150 165
                 }
@@ -195,6 +210,20 @@ Page({
195 210
       result = common.randomArray(result);
196 211
     }
197 212
 
213
+    var wordArr = wx.getStorageSync("UnitCustom");
214
+    if (wordArr) {
215
+      for (var k = 0; k < wordArr.length; k++) {
216
+        for (var n = 0; n < wordArr[k].List.length; n++) {
217
+          for (var i = 0; i < result.length;i++){
218
+            if (wordArr[k].List[n].ID == result[i].ID) {
219
+              result[i].CombineWords=wordArr[k].List[n].CombineWords;
220
+              break;
221
+            }
222
+          }
223
+        }
224
+      }
225
+    }
226
+
198 227
     var obj = {
199 228
       Title: "复习",
200 229
       Title2: "到底了",
@@ -517,8 +546,10 @@ Page({
517 546
 
518 547
     if (isEditSetting.length > 0) {
519 548
       for (var i = 0; i < isEditSetting.length; i++) {
520
-        if (isEditSetting[i] == "page" || isEditSetting[i] == "sort") {
521
-          that.data.CurrentIndex = 0;
549
+        if (isEditSetting[i] == "page" || isEditSetting[i] == "saveCustom" || isEditSetting[i] == "sort") {
550
+          if (isEditSetting[i] != "saveCustom")
551
+            that.data.CurrentIndex = 0;
552
+
522 553
           if (that.data.WordType == "normal")
523 554
             that.init();
524 555
           else if (that.data.WordType == "review")
@@ -697,6 +728,12 @@ Page({
697 728
       });
698 729
     }
699 730
   },
731
+  setCombine: function (e) {
732
+    var id = e.currentTarget.dataset.id;
733
+    wx.navigateTo({
734
+      url: '../main/setcombine?id=' + id,
735
+    });
736
+  },
700 737
   setRemind: function (str, css) {
701 738
     var that = this;
702 739
     that.setData({

+ 2 - 2
pages/main/detail.wxml

@@ -225,10 +225,10 @@
225 225
     </view>
226 226
     <switch class='title2_2' checked="{{IsAudioLengthChecked}}" bindchange="settingAudioLength" />
227 227
   </view>
228
-  <view class="line FlexColumn" wx:if="{{!IsAutoPage}}">
228
+  <view class="line FlexColumn" wx:if="{{!IsAutoPage && WordType == 'normal'}}">
229 229
     <view class="line1"></view>
230 230
   </view>
231
-  <view class="title2 FlexRow" bindtap='showSettingMenu' data-status="speaker" wx:if="{{!IsAutoPage}}">
231
+  <view class="title2 FlexRow" bindtap='setCombine' data-id="{{UnitID}}" wx:if="{{!IsAutoPage && WordType == 'normal'}}">
232 232
     <view class="title2_1">首选词语</view>
233 233
     <view class="title2_2 FlexRow">
234 234
       <image src='../../images/Arrow.png' class="Arrow" />

+ 15 - 0
pages/main/index.js

@@ -223,11 +223,26 @@ Page({
223 223
 
224 224
         if (data.IsShow)
225 225
           app.globalData.IsShow = data.IsShow;
226
+        else
227
+          app.globalData.IsShow = 0;
226 228
 
227 229
         app.globalData.userInfo.IsMember = data.IsMember;
228 230
 
229 231
       }
230 232
     });
233
+
234
+    var UnitCustom = wx.getStorageSync("UnitCustom");
235
+    if (!UnitCustom) {
236
+      var that = this;
237
+      server.getData('GetHanziCustomList?UserID=' + app.globalData.userInfo.UserID, function (data) {
238
+        if (data && data.length>0) {
239
+          for (var n = 0; n < data.length; n++) {
240
+            data[n].List = JSON.parse(data[n].List);
241
+          }
242
+          wx.setStorageSync("UnitCustom", data);
243
+        }
244
+      });
245
+    }
231 246
   },
232 247
   selectNav: function (e) {
233 248
     var id = e.currentTarget.dataset.id;

+ 1 - 1
pages/main/list.js

@@ -63,7 +63,7 @@ Page({
63 63
 
64 64
           if (item.WordLength % 6 > 0) {
65 65
             var count = 6 - (item.WordLength % 6);
66
-            console.log(count);
66
+            //console.log(count);
67 67
             for (var n = 0; n < count; n++) {
68 68
               var obj = {
69 69
                 Name: "",

+ 5 - 1
pages/main/list.wxml

@@ -18,7 +18,10 @@
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-islocked='{{item.IsLocked}}' data-unitid='{{item.ID}}' data-isfinished='{{item.IsFinished}}' wx:for="{{List}}" wx:key="index">
21
+      <view class="btn" bindtap="goto" 
22
+      data-bookid='{{BookID}}' data-islocked='{{item.IsLocked}}' data-word='true'
23
+      data-unitid='{{item.ID}}' data-isfinished='{{item.IsFinished}}' 
24
+      wx:for="{{List}}" wx:key="index">
22 25
         <view class="btn1 FlexRow">
23 26
           <view class="left FlexRow">
24 27
             <image wx:if="{{IsShow==1 && item.IsLocked==0 && !item.IsFinished}}" src='../../images/04007.png' class="img04007" />
@@ -26,6 +29,7 @@
26 29
             <image wx:if="{{IsShow==1 && item.IsLocked==1}}" src='../../images/04005.png' class="img04005" />
27 30
             <image wx:if="{{IsShow==0 && item.IsLocked==0 && !item.IsFinished}}" src='../../images/04007.png' class="img04007" />
28 31
             <image wx:if="{{IsShow==0 && item.IsLocked==0 && item.IsFinished}}" src='../../images/04006.png' class="img04007" />
32
+            <image wx:if="{{IsShow==0 && item.IsLocked==1}}" src='../../images/04007.png' class="img04007" />
29 33
             <view class="title">{{item.Example}}</view>
30 34
           </view>
31 35
           <view class="right FlexColumn">

+ 103 - 0
pages/main/setcombine.js

@@ -0,0 +1,103 @@
1
+import common from '../../utils/util';
2
+import server from '../../utils/main';
3
+
4
+const app = getApp();
5
+Page({
6
+  data: {
7
+
8
+  },
9
+  onLoad: function (options) {
10
+    var unitid = options.id;
11
+    this.setData({
12
+      Height: common.getSystemHeight(),
13
+      UnitID: unitid,
14
+    });
15
+    this.init();
16
+  },
17
+  init: function () {
18
+    var that = this;
19
+    server.getData('GetHanziWordListByUnitID?UnitID=' + this.data.UnitID + "&UserID=" + app.globalData.userInfo.UserID, function (data) {
20
+      if (data) {
21
+        that.setData({
22
+          List: data,
23
+        })
24
+      }
25
+    });
26
+  },
27
+  changeSelected: function (e) {
28
+    var id = e.currentTarget.dataset.id;
29
+    var name = e.currentTarget.dataset.name;
30
+    for (var i = 0; i < this.data.List.length; i++) {
31
+      if (this.data.List[i].ID == id) {
32
+        for (var j = 0; j < this.data.List[i].CombineWords.length; j++) {
33
+          var item = this.data.List[i].CombineWords[j];
34
+          if (item.name == name) {
35
+            if (item.css == "")
36
+              item.css = "selected";
37
+            else
38
+              item.css = "";
39
+            break;
40
+          }
41
+        }
42
+      }
43
+    }
44
+    this.setData({
45
+      List: this.data.List,
46
+    })
47
+  },
48
+  save: function () {
49
+    var result=[];
50
+    for (var i = 0; i < this.data.List.length; i++) {
51
+      var word=[];
52
+      for (var j = 0; j < this.data.List[i].CombineWords.length; j++) {
53
+        var item = this.data.List[i].CombineWords[j];
54
+        if (item.css == "selected"){
55
+          word.push(item.name);
56
+        }
57
+      }
58
+      this.data.List[i].CombineWords=word.join(",");
59
+      result.push(this.data.List[i]);
60
+    }
61
+
62
+    var UnitCustom = wx.getStorageSync("UnitCustom");
63
+    if (UnitCustom){
64
+      var b=false;
65
+      for(var i=0;i<UnitCustom.length;i++){
66
+        if (UnitCustom[i].ID==this.data.UnitID){
67
+          UnitCustom[i].List=result;
68
+          b=true;
69
+          break;
70
+        }
71
+      }
72
+
73
+      if (!b){
74
+        UnitCustom.push({
75
+          ID:this.data.UnitID,
76
+          List:result,
77
+        })
78
+      }
79
+    }
80
+    else{
81
+      UnitCustom=[];
82
+      UnitCustom.push({
83
+        ID: this.data.UnitID,
84
+        List: result,
85
+      })
86
+    }
87
+
88
+    wx.setStorageSync("UnitCustom", UnitCustom);
89
+    
90
+    
91
+    server.postData('AddHanziCustom',{
92
+      UserID: app.globalData.userInfo.UserID,
93
+      UnitID: this.data.UnitID,
94
+      UnitCustom: JSON.stringify(result),
95
+    }, function (data) {});
96
+
97
+    app.globalData.IsSaveCustom=true;
98
+    
99
+    wx.navigateBack({
100
+      delta: 1
101
+    });
102
+  },
103
+})

+ 7 - 0
pages/main/setcombine.json

@@ -0,0 +1,7 @@
1
+{
2
+  "navigationBarBackgroundColor": "#F0F0F0",
3
+  "navigationBarTitleText": "首选词语",
4
+  "enablePullDownRefresh": false,
5
+  "backgroundColor": "#F0F0F0",
6
+  "disableScroll": false
7
+}

+ 21 - 0
pages/main/setcombine.wxml

@@ -0,0 +1,21 @@
1
+<view class="container FlexColumn" style='min-height:{{Height}}rpx;'>
2
+  <view class="panel1">
3
+    <view class="text">调整本章节范围内“组词播报”的首选词语。每组中,第一或第二个词语来自课文,之后是扩展阅读中常见词汇。确认修改按“完成”。</view>
4
+  </view>
5
+  <view class="panel1 FlexColumn" wx:for="{{List}}" wx:key="index">
6
+    <view class="word FlexRow">
7
+      <view class="word1 FlexRow"><view>{{item.Name}}</view><view class="pinyin">{{item.Pinyin}}</view></view>
8
+    </view>
9
+    <view class="combine FlexRow">
10
+      <view class="combine1 FlexRow">
11
+        <view bindtap='changeSelected' data-id="{{item.ID}}" data-name="{{itemChild.name}}" class="{{itemChild.css}} word2" wx:for="{{item.CombineWords}}" wx:for-item="itemChild" wx:key="i">{{itemChild.name}}</view>
12
+      </view>
13
+    </view>
14
+  </view>
15
+  <view style='height:200rpx;'></view>
16
+  <view class="bottom FlexColumn" bindtap='save'>
17
+    <view class="bottom1 FlexRow">
18
+      完成
19
+    </view>
20
+  </view>
21
+</view>

+ 85 - 0
pages/main/setcombine.wxss

@@ -0,0 +1,85 @@
1
+.container {
2
+  background-color: #F0F0F0;
3
+  justify-content: flex-start;
4
+  font-weight: 500;
5
+}
6
+
7
+.panel1{
8
+  width: 100%;
9
+  background-color: #fff;
10
+}
11
+.panel1 .text{
12
+  width: 690rpx;
13
+  margin: 40rpx 30rpx;
14
+  font-size:24rpx;
15
+  color:#1e1e1e;
16
+  font-weight: 400;
17
+  line-height: 35rpx;
18
+}
19
+
20
+.panel1 .word{
21
+  width: 100%;
22
+  height:125rpx;
23
+  background-color: #F0F0F0;
24
+  justify-content: flex-start;
25
+}
26
+
27
+.panel1 .word1{
28
+  font-size:32rpx;
29
+  margin: 50rpx 0 30rpx 30rpx;
30
+}
31
+
32
+.panel1 .pinyin{
33
+  margin-left: 30rpx;
34
+  font-family: 'GB Pinyinok-C';
35
+  font-weight: normal;
36
+  font-style: normal;
37
+}
38
+
39
+.panel1 .combine{
40
+  width: 100%;
41
+}
42
+
43
+.panel1 .combine1{
44
+  margin: 30rpx 20rpx 10rpx 20rpx;
45
+  width: 710rpx;
46
+  justify-content: flex-start;
47
+  align-items: flex-start;
48
+  flex-wrap: wrap;
49
+}
50
+.panel1 .word2{
51
+  font-size:28rpx;
52
+  margin: 0 10rpx 20rpx 10rpx;
53
+  padding: 6rpx 10rpx;
54
+}
55
+.panel1 .selected{
56
+  background-color: #F5E2BE;
57
+  border-radius: 6rpx;
58
+  padding: 6rpx 10rpx;
59
+}
60
+
61
+.container .bottom{
62
+  width:100%;
63
+  height:160rpx;
64
+  position: fixed;
65
+  bottom:0;
66
+  background-color: #CDB797;
67
+  justify-content: flex-end;
68
+  z-index: 100;
69
+}
70
+.container .bottom1{
71
+  width:100%;
72
+  height:140rpx;
73
+  background-color: #1B1B1B;
74
+  text-align: center;
75
+  line-height: 140rpx;
76
+  font-size: 48rpx;
77
+  color: #f0f0f0;
78
+}
79
+
80
+.container .bottom1 .btn{
81
+  width:20%;
82
+  height:120rpx;
83
+}
84
+
85
+

+ 4 - 4
project.config.json

@@ -1,7 +1,7 @@
1 1
 {
2 2
 	"description": "项目配置文件。",
3 3
 	"setting": {
4
-		"urlCheck": false,
4
+		"urlCheck": true,
5 5
 		"es6": true,
6 6
 		"postcss": true,
7 7
 		"minified": true,
@@ -64,9 +64,9 @@
64 64
 				},
65 65
 				{
66 66
 					"id": 5,
67
-					"name": "\b活动",
68
-					"pathName": "pages/about/paylist",
69
-					"query": ""
67
+					"name": "\b首选词语",
68
+					"pathName": "pages/main/setcombine",
69
+					"query": "id=1"
70 70
 				}
71 71
 			]
72 72
 		}