chengjie 6 年之前
父節點
當前提交
51a6ff1a8e

+ 5 - 1
app.js

@@ -25,7 +25,7 @@ App({
25 25
     }
26 26
   },
27 27
   globalData: {
28
-    Version: "1.0.0.11",
28
+    Version: "1.0.0.18",
29 29
     IsProduction: true,
30 30
     ShareTitle: "可以用来记忆一切的工具",
31 31
     SharePath: "pages/index/index",
@@ -51,5 +51,9 @@ App({
51 51
     Key: "kylx365_chengjie",
52 52
     IV: "kylx365hongliren",
53 53
     IsEnter: true,//是否是刚进来
54
+
55
+    CardList:[],//卡列表变量
56
+    TaskToday:[],//今天任务列表
57
+    TempMiaoguoCardID:0,//临时题卡ID,用于资料选取时用
54 58
   }
55 59
 })

+ 1 - 1
app.json

@@ -1,5 +1,5 @@
1 1
 {
2
-  "pages": [    
2
+  "pages": [
3 3
     "pages/index/index",
4 4
     "pages/main/addItem",
5 5
     "pages/index/accredit",

二進制
pages/images/universalpic_editbar_cube_gray.png


+ 13 - 2
pages/index/index.js

@@ -2,6 +2,16 @@ import common from '../../utils/util';
2 2
 import main from '../../utils/main';
3 3
 
4 4
 const app = getApp();
5
+const arrSentence = [
6
+  "荀子曰:\n君子博学而日参省乎己,\n则知明而行无过矣",
7
+  "子曰:\n学而时习之,不亦悦乎。",
8
+  "子曰:\n学而不思则罔,\n思而不学则殆。",
9
+  "荀子曰:\n青,取之于蓝,而青于蓝。\n冰,水为之,而寒于水。",
10
+  "荀子曰:\n不积跬步,无以至千里;\n不积小流,无以成江海。",
11
+  "荀子曰:\n骐骥一跃,不能十步;\n驽马十驾,功在不舍。",
12
+  "荀子曰:\n锲而舍之,朽木不折;\n锲而不舍,金石可镂。",
13
+  "孟子曰:\n故天将降大任于是人也,\n必先苦其心志,劳其筋骨,\n饿其体肤……",
14
+];
5 15
 
6 16
 Page({
7 17
   data: {
@@ -56,6 +66,7 @@ Page({
56 66
     }
57 67
     this.setData({
58 68
       Containnerheight: main.getWindowHeight(),
69
+      Sentence: arrSentence[common.random(0,arrSentence.length-1)],
59 70
     });
60 71
 
61 72
     this.updateProgram();
@@ -227,8 +238,8 @@ Page({
227 238
                 IsStart: data.IsStart,
228 239
               });
229 240
 
230
-              wx.setStorageSync("TaskToday", data);
231
-
241
+              app.globalData.TaskToday=data;
242
+              app.globalData.CardList=[];
232 243
             }
233 244
           });
234 245
         });

+ 1 - 1
pages/index/index.wxml

@@ -1,4 +1,4 @@
1 1
 <view class="container FlexColumn" style='min-height:{{Containnerheight}}rpx;'>
2 2
   <image src='../images/program_start_footer.png' class="program_start_footer" />
3
-  <text class="text1">荀子曰:\n君子博学而日参省乎己,\n则知明而行无过矣</text>  
3
+  <text class="text1">{{Sentence}}</text>  
4 4
 </view>

+ 65 - 32
pages/main/add.js

@@ -7,6 +7,7 @@ var arrTag = [];
7 7
 
8 8
 Page({
9 9
   data: {
10
+    PracticeTimeStr:"智能安排"
10 11
   },
11 12
   onLoad: function (options) {
12 13
     wx.hideShareMenu();
@@ -21,9 +22,15 @@ Page({
21 22
       FieldID: fieldid,
22 23
     });
23 24
 
24
-    wx.setStorageSync("TempMiaoguoCardID", that.data.MiaoguoCardID);
25
+    var list = app.globalData.CardList;
26
+    for (var i = 0; i < list.length; i++) {
27
+      if (that.data.MiaoguoCardID == list[i].MiaoguoCardID) {
28
+        wx.setStorageSync("TempCardInfo", list[i]);
29
+        break;
30
+      }
31
+    }
32
+    app.globalData.TempMiaoguoCardID=that.data.MiaoguoCardID;
25 33
 
26
-    common.getStorageValue(that, "IsTodayStudy", true, function () {});
27 34
   },
28 35
   onShow: function () {
29 36
     var that = this;
@@ -33,12 +40,13 @@ Page({
33 40
     }
34 41
     else {
35 42
       var card = {};
36
-      var list = wx.getStorageSync("CardList");
43
+      var list = app.globalData.CardList;
37 44
       for (var i = 0; i < list.length; i++) {
38 45
         if (that.data.MiaoguoCardID == list[i].MiaoguoCardID) {
39 46
           card = main.changeStringToView(list[i].Content);
40 47
           card.MiaoguoCardID = list[i].MiaoguoCardID;
41 48
           card.LimitTime = list[i].LimitTime;
49
+          
42 50
           break;
43 51
         }
44 52
       }
@@ -66,14 +74,15 @@ Page({
66 74
     field = [[], [], [], []];
67 75
     var card = wx.getStorageSync("TempCardInfo");
68 76
     if (card) {
69
-      var list = wx.getStorageSync("CardList");
77
+      var list = app.globalData.CardList;
70 78
       for (var i = 0; i < list.length; i++) {
71 79
         if (this.data.MiaoguoCardID == list[i].MiaoguoCardID) {
72 80
           list[i] = card;
73 81
           break;
74 82
         }
75 83
       }
76
-      wx.setStorageSync("CardList", list);
84
+      app.globalData.CardList=list;
85
+      wx.removeStorageSync("TempCardInfo");
77 86
     }
78 87
   },
79 88
   onClose: function () {
@@ -109,12 +118,14 @@ Page({
109 118
   },
110 119
   switch1Change(e) {
111 120
 
121
+    var str="智能安排";
122
+    if (e.detail.value){
123
+      str="今日必练";
124
+    }
112 125
     this.setData({
113 126
       IsTodayStudy: e.detail.value,
114 127
     });
115 128
 
116
-    wx.setStorageSync("IsTodayStudy", e.detail.value);
117
-
118 129
   },
119 130
   saveCard: function () {
120 131
     var that = this;
@@ -151,11 +162,7 @@ Page({
151 162
             var item = that.data.Field[i][key];
152 163
             var str = "";
153 164
             if (item.Type == "image") {
154
-              if (item.Url) {
155
-                str = "[图 url='" + item.Url + "']" + item.Content + "[/图]";
156
-              }
157
-              else
158
-                str = "[图]" + item.Content + "[/图]";
165
+              str = "[图]" + item.Content + "[/图]";
159 166
             }
160 167
             else if (item.Type == "line") {
161 168
               for (var j = 0; j < item.Content.length; j++) {
@@ -183,17 +190,20 @@ Page({
183 190
           param1["Field" + i] = main.changeViewToString(param1["Field" + i]);
184 191
 
185 192
         }
193
+
194
+        that.saveLocalCardList(param1);
195
+
186 196
         // var param2 = {
187 197
         //   param: common.Encrypt(JSON.stringify(param1))
188 198
         // }
189 199
         main.postData('AddMiaoguoCard?Type=' + that.data.UpdateType + '&UserID=' + userid, param1, function (data) {
190 200
           if (that.data.UpdateType == "edit" || that.data.UpdateType == "edit2") {
191
-            that.saveNewData();
201
+            
192 202
             that.onClose();
193 203
           }
194 204
           else {
195 205
             wx.showToast({
196
-              title: '已保存!',
206
+              title: '已保存!',
197 207
               image: "../images/universalpic_saved_white_120x120.png",
198 208
             });
199 209
 
@@ -201,12 +211,15 @@ Page({
201 211
               that.initAddCard();
202 212
             }
203 213
 
204
-            var taskToday = wx.getStorageSync("TaskToday");
214
+            var taskToday = app.globalData.TaskToday;
205 215
             taskToday.CardNumber++;
206
-            wx.setStorageSync("TaskToday", taskToday);
216
+            app.globalData.TaskToday=taskToday;
207 217
 
208
-            that.saveNewData();
218
+            that.setData({
219
+              IsTodayStudy:false,
220
+            })
209 221
           }
222
+          wx.removeStorageSync("TempCardInfo");
210 223
         });
211 224
       });
212 225
     }
@@ -216,14 +229,19 @@ Page({
216 229
     var arrSource=[], arrResult=[];
217 230
     for(var i=0;i<arr.length;i++){
218 231
       for(var j=0;j<arr[i].length;j++){
219
-        if (arr[i][j].Type == "image" && arr[i][j].Url && !arr[i][j].Content){
220
-          //console.log("Source:" +arr[i][j].Url);
221
-          arrSource.push(arr[i][j].Url);
222
-          that.uploadImage(arr[i][j].Url, function (data) {
223
-            //console.log("Target:"+data);
224
-            data = app.globalData.uploadImageUrl+data;
225
-            arrResult.push(data);
226
-          });
232
+        if (arr[i][j].Type == "image" && arr[i][j].Content){
233
+          arrSource.push(arr[i][j].Content);
234
+          if (arr[i][j].ContentServer.indexOf(app.globalData.uploadImageUrl)>=0 
235
+          || arr[i][j].ContentServer.indexOf("baidu.com")>=0 ){
236
+            arrResult.push(arr[i][j].ContentServer);
237
+          }
238
+          else{
239
+            that.uploadImage(arr[i][j].Content, function (data) {
240
+              //console.log("Target:"+data);
241
+              data = app.globalData.uploadImageUrl + data;
242
+              arrResult.push(data);
243
+            });
244
+          }
227 245
         }
228 246
       }
229 247
     }
@@ -235,8 +253,13 @@ Page({
235 253
         var ari=0;
236 254
         for (var i = 0; i < arr.length; i++) {
237 255
           for (var j = 0; j < arr[i].length; j++) {
238
-            if (arr[i][j].Type == "image" && arr[i][j].Url && !arr[i][j].Content) {
239
-              arr[i][j].Content=arrResult[ari++];
256
+            if (arr[i][j].Type == "image" && arr[i][j].Content) {
257
+              var tempUrl = arr[i][j].Content;
258
+              var serverUrl = arrResult[ari++];
259
+              main.saveTempImage(serverUrl, tempUrl);
260
+              arr[i][j].Content = serverUrl;
261
+              arr[i][j].ContentServer = serverUrl;
262
+
240 263
             }
241 264
           }
242 265
         }
@@ -266,11 +289,20 @@ Page({
266 289
     });
267 290
 
268 291
   },
269
-  saveNewData: function () {
270
-    var list = wx.getStorageSync("CardList");
292
+  saveLocalCardList:function(param1){
293
+    var that=this;
294
+    var list = app.globalData.CardList;
271 295
     for (var i = 0; i < list.length; i++) {
272
-      if (this.data.MiaoguoCardID == list[i].MiaoguoCardID) {
273
-        wx.setStorageSync("TempCardInfo", list[i]);
296
+      if (that.data.MiaoguoCardID == list[i].MiaoguoCardID) {
297
+        for (var j = 0; j < 4; j++) {
298
+          if (j == 0){
299
+            if (param1.tags && param1.tags.length > 0)
300
+              list[i].Content[j].Content = param1.tags.join(",");
301
+          }
302
+          else
303
+            list[i].Content[j].Content = param1["Field" + j];
304
+        }
305
+        app.globalData.CardList=list;
274 306
         break;
275 307
       }
276 308
     }
@@ -285,7 +317,7 @@ Page({
285 317
       obj.Content = [];
286 318
       card.Content.push(obj);
287 319
     }
288
-    wx.setStorageSync("CardList", [card]);
320
+    app.globalData.CardList=[card];
289 321
     this.setData({
290 322
       MiaoguoCardID: 0,
291 323
       Field: [[], [], [], []],
@@ -305,6 +337,7 @@ Page({
305 337
       Field: this.data.Field,
306 338
     });
307 339
   },
340
+  
308 341
   onShareAppMessage: function () {
309 342
     return {
310 343
       title: app.globalData.ShareTitle,

+ 22 - 19
pages/main/add.wxml

@@ -28,42 +28,46 @@
28 28
         <block wx:for="{{Field[itemParent]}}" wx:key="index">
29 29
 
30 30
           <text class="textNormal" wx:if="{{item.Type=='normal'}}">{{item.Content}}</text>
31
-          
31
+
32 32
           <text class="textNormal FlexRow" wx:if="{{item.Type=='line'}}">
33 33
             <block wx:for="{{item.Content}}" wx:key="contentIndex" wx:for-item="contentItem">
34 34
               <text wx:if="{{contentItem.key=='normal'}}">{{contentItem.value}}</text>
35
-              <text class="textLine" wx:if="{{contentItem.key=='line'}}">{{contentItem.value}}</text>
36
-            </block>
37
-          </text>
35
+          <text class="textLine" wx:if="{{contentItem.key=='line'}}">{{contentItem.value}}</text>
36
+        </block>
37
+        </text>
38 38
 
39
-          <image class="universalpic_read_gray_40x40" wx:if="{{item.Type=='sound'}}" src='../images/universalpic_read_gray_40x40.png' />
40
-          <text class="textPinyin" wx:if="{{item.Type=='sound'}}">{{item.Content}}</text>
39
+        <image class="universalpic_read_gray_40x40" wx:if="{{item.Type=='sound'}}" src='../images/universalpic_read_gray_40x40.png' />
40
+        <text class="textPinyin" wx:if="{{item.Type=='sound'}}">{{item.Content}}</text>
41 41
 
42
-          <image class="imageBishun" wx:if="{{item.Type=='image' && !item.Url}}" src='{{item.Content}}' />
43
-          
44
-          <image class="imageFree" mode="widthFix" wx:if="{{item.Type=='image' && item.Url}}" src='{{item.Url}}' binderror="onBindError" />
45
-          
46
-          <text class="textReturn" wx:if="{{item.Type=='return'}}"></text>
47
-        </block>
48
-      </view>
49
-    </view>
42
+        <image class="imageBishun" wx:if="{{item.Type=='image' && !item.Url}}" src='{{item.Content}}' />
43
+
44
+        <image class="imageFree" mode="widthFix" wx:if="{{item.Type=='image' && item.Url}}" src='{{item.Url}}' binderror="onBindError" />
45
+
46
+        <text class="textReturn" wx:if="{{item.Type=='return'}}"></text>
47
+  </block>
48
+  </view>
49
+  </view>
50 50
 
51 51
   </block>
52 52
   <view class='lineFooter'></view>
53 53
 
54 54
   <view class="panelItem3 FlexRow" wx:if="{{UpdateType=='add' || UpdateType=='add2'}}">
55 55
     <view class="panelItem1">
56
-      今天练
56
+      练习时间
57
+    </view>
58
+    <view class="panelItem2 FlexRow">
59
+      <view class="panelItem31" hidden="{{IsTodayStudy}}">智能安排</view>
60
+      <view class="panelItem311 panelItem31" hidden="{{!IsTodayStudy}}">今日必练</view>
61
+      <switch class='panelItem32' checked="{{IsTodayStudy}}" bindchange="switch1Change" />
57 62
     </view>
58
-    <switch class='panelItem32' checked="{{IsTodayStudy}}" bindchange="switch1Change" />
59 63
   </view>
60 64
   <view class='lineFooter'></view>
61
-
65
+  <view class="panelItem3Remark" wx:if="{{UpdateType=='add' || UpdateType=='add2'}}">指定该题卡必定出现在今天任务中,可能增加额外的任务量</view>
62 66
   <view style='height:300rpx;'></view>
63 67
 
64 68
   <view class='panelSave FlexRow'>
65 69
     <view class="panelSave1 FlexRow" bindtap="onSearch">
66
-      <view class="add">+</view>  资料
70
+      <view class="add">+</view> 资料
67 71
     </view>
68 72
     <view class='panelSave0' bindtap="saveCard">保存</view>
69 73
     <view class="panelSave2 FlexRow" bindtap='onPreview'>
@@ -71,5 +75,4 @@
71 75
       <image class="universalpic_preview_black_30x30" src='../images/universalpic_preview_black_30x30.png' />
72 76
     </view>
73 77
   </view>
74
-
75 78
 </view>

+ 15 - 1
pages/main/add.wxss

@@ -142,7 +142,21 @@
142 142
 }
143 143
 
144 144
 .panelItem3 .panelItem32 {
145
-  margin-right: 30rpx;
145
+  margin-left: 30rpx;
146
+}
147
+
148
+.panelItem3 .panelItem31{
149
+  color:#787878;
150
+}
151
+.panelItem3 .panelItem311{
152
+  color:#0071ef;
153
+}
154
+
155
+.panelItem3Remark{
156
+  font-size:24rpx;
157
+  margin-top:30rpx;
158
+  color:#787878;
159
+  font-weight: 400;
146 160
 }
147 161
 
148 162
 .panelSave {

+ 23 - 17
pages/main/addItem.js

@@ -14,7 +14,7 @@ Page({
14 14
     Field: "",
15 15
     SoundSign: "[读]",
16 16
     LineSign: "[线]",
17
-    BtnArray: ["+", "-", "×", "÷", "="],
17
+    BtnArray: ["+", "-", "×", "÷", "=", "<", ">"],
18 18
   },
19 19
   onLoad: function (options) {
20 20
     wx.hideShareMenu();
@@ -35,15 +35,15 @@ Page({
35 35
 
36 36
   },
37 37
   onShow: function () {
38
-    console.log("onShow");
38
+    //console.log("onShow");
39 39
     var that = this;
40 40
 
41
-    console.log("onShow:" + isEdit);
41
+    //console.log("onShow:" + isEdit);
42 42
     if (app.globalData.IsAndroid && !isEdit) {
43 43
       return;
44 44
     }
45 45
 
46
-    var list = wx.getStorageSync("CardList");
46
+    var list = app.globalData.CardList;
47 47
     var card = {};
48 48
     for (var i = 0; i < list.length; i++) {
49 49
       if (that.data.MiaoguoCardID == list[i].MiaoguoCardID) {
@@ -55,7 +55,6 @@ Page({
55 55
         if (!wx.getStorageSync("TempCardInfoAddItem")) {
56 56
           wx.setStorageSync("TempCardInfoAddItem", content);
57 57
         }
58
-
59 58
         break;
60 59
       }
61 60
     }
@@ -73,6 +72,8 @@ Page({
73 72
     isEdit = true;
74 73
   },
75 74
   bindinputField: function (e) {
75
+    console.log("bindinputField:" + e.detail.value + " isEdit:" + isEdit);
76
+
76 77
     var that = this;
77 78
     if (app.globalData.IsAndroid && !isEdit) {
78 79
       return;
@@ -81,12 +82,11 @@ Page({
81 82
     this.setData({
82 83
       Field: e.detail.value,
83 84
     });
84
-    console.log("bindinputField:" + e.detail.value);
85 85
     //this.updateField();
86 86
 
87 87
   },
88 88
   addSymbol: function (e) {
89
-    console.log("addSymbol");
89
+    //console.log("addSymbol");
90 90
     isEdit = true;
91 91
     var that = this;
92 92
 
@@ -130,15 +130,22 @@ Page({
130 130
   },
131 131
   onBindblur: function (e) {
132 132
     var that = this;
133
-    console.log("onBindblur:" + isEdit + " Filed:" + this.data.Field);
133
+    //console.log("onBindblur:" + isEdit + " Filed:" + this.data.Field);
134 134
     if (app.globalData.IsAndroid && !isEdit) {
135 135
       setTimeout(function () {
136 136
         isEdit = true;
137
+        console.log("onBindblur2:" + isEdit);
137 138
       }, 500);
138 139
       return;
139 140
     }
140 141
     isEdit = false;
141
-    console.log("onBindblur:"+isEdit);
142
+    if (app.globalData.IsAndroid && !isEdit) {
143
+      setTimeout(function () {
144
+        isEdit = true;
145
+        console.log("onBindblur2:" + isEdit);
146
+      }, 500);
147
+    }
148
+    //console.log("onBindblur:"+isEdit);
142 149
 
143 150
     this.updateField();
144 151
     tempCursor = e.detail.cursor;
@@ -184,12 +191,12 @@ Page({
184 191
     
185 192
     setTimeout(function () {
186 193
       isEdit = true;
187
-      console.log("onSearchEnd");
194
+      //console.log("onSearchEnd");
188 195
     }, 1000);
189 196
   },
190 197
   clear: function () {
191 198
     var that = this;
192
-    console.log("clear");
199
+    //console.log("clear");
193 200
     this.setData({
194 201
       Field: "",
195 202
       Focus: true,
@@ -213,7 +220,7 @@ Page({
213 220
   },
214 221
 
215 222
   uploadImage: function () {
216
-    console.log("uploadImageStart");
223
+    //console.log("uploadImageStart");
217 224
     var that = this;
218 225
 
219 226
     wx.chooseImage({
@@ -226,7 +233,6 @@ Page({
226 233
         //console.log(tempFilePaths[0]);
227 234
         //that.data.Field = that.data.Field + "[图 url='" + tempFilePaths[0] + "']" + tempFilePaths[0] + "[/图]";
228 235
 
229
-
230 236
         if (tempCursor == undefined)
231 237
           tempCursor = that.data.Field.length;
232 238
         var str1 = "",
@@ -236,11 +242,11 @@ Page({
236 242
           str2 = that.data.Field.substring(tempCursor, that.data.Field.length);
237 243
         }
238 244
 
239
-        var str0 = "[图 url='" + tempFilePaths[0] + "'][/图]";
245
+        var str0 = "[图]" + tempFilePaths[0] + "[/图]";
240 246
 
241 247
         that.data.Field = str1 + str0 + str2;
242 248
 
243
-        console.log("uploadImageEnd:" + that.data.Field);
249
+        //console.log("uploadImageEnd:" + that.data.Field);
244 250
 
245 251
         that.setData({
246 252
           Field: that.data.Field,
@@ -264,7 +270,7 @@ Page({
264 270
     str = str.replace(/\[\/图\]/g, "[\/图]\n");
265 271
     str = str.replace(/\n\n/g, "\n");
266 272
 
267
-    var list = wx.getStorageSync("CardList");
273
+    var list = app.globalData.CardList;
268 274
     for (var i = 0; i < list.length; i++) {
269 275
       if (this.data.MiaoguoCardID == list[i].MiaoguoCardID) {
270 276
         if (history != undefined)
@@ -274,7 +280,7 @@ Page({
274 280
         break;
275 281
       }
276 282
     }
277
-    wx.setStorageSync("CardList", list);
283
+    app.globalData.CardList=list;
278 284
   },
279 285
   onShareAppMessage: function () {
280 286
     return {

+ 22 - 18
pages/main/addItem.wxml

@@ -30,25 +30,29 @@
30 30
     <textarea class="input" maxlength='-1' show-confirm-bar="true" value="{{Field}}" focus="{{Focus}}" cursor="{{Cursor}}" bindinput="bindinputField" bindblur="onBindblur" bindfocus="onBindFocus" data-id='{{FieldNumber}}' />
31 31
   </view>
32 32
   <cover-view class='lineFooter'></cover-view>
33
-  <cover-view class="panelTag0 panelTag FlexRow">
34
-    <cover-view class="btn0"></cover-view>
35
-    <cover-view class="btn1 FlexRow" bindtap="addSymbol" data-id="(     )">
36
-      <cover-image class="universalpic_editbar_brackets_gray" src='../images/universalpic_editbar_brackets_gray.png' />
33
+  <cover-view class='panel2 FlexColumn'>
34
+    <cover-view class="panelBtnSmall FlexRow">
35
+      <cover-view class="btn0"></cover-view>
36
+      <cover-view class="btn1 FlexRow" bindtap="addSymbol" data-id="(     )">
37
+        <cover-image class="universalpic_editbar_brackets_gray" src='../images/universalpic_editbar_brackets_gray.png' />
38
+      </cover-view>
39
+      <cover-view class="btn1 FlexRow" bindtap="addSymbol" data-id="_____">
40
+        <cover-image class="universalpic_editbar_underline_gray" src='../images/universalpic_editbar_underline_gray.png' />
41
+      </cover-view>
42
+      <cover-view class="btn" bindtap="addSymbol" wx:for="{{BtnArray}}" wx:key="index" data-id="{{item}}">{{item}}</cover-view>
43
+      <cover-view class="btn1 FlexRow" bindtap="addSymbol" data-id="²">
44
+        <cover-image class="universalpic_editbar_sqr_gray" src='../images/universalpic_editbar_sqr_gray.png' />
45
+      </cover-view>
46
+      <cover-view class="btn1 FlexRow" bindtap="addSymbol" data-id="³">
47
+        <cover-image class="universalpic_editbar_sqr_gray" src='../images/universalpic_editbar_cube_gray.png' />
48
+      </cover-view>
37 49
     </cover-view>
38
-    <cover-view class="btn1 FlexRow" bindtap="addSymbol" data-id="_____">
39
-      <cover-image class="universalpic_editbar_underline_gray" src='../images/universalpic_editbar_underline_gray.png' />
50
+    <cover-view class='lineFooter'></cover-view>
51
+    <cover-view class='panelBtn FlexRow'>
52
+      <cover-view class='text1' bindtap="closeAddItem" data-idsave="false">取消</cover-view>
53
+      <cover-view class='line1'></cover-view>
54
+      <cover-view class='text2 text1' bindtap="closeAddItem" data-idsave="true">确定</cover-view>
40 55
     </cover-view>
41
-    <cover-view class="btn" bindtap="addSymbol" wx:for="{{BtnArray}}" wx:key="index" data-id="{{item}}">{{item}}</cover-view>
42
-    <cover-view class="btn1 FlexRow" bindtap="addSymbol" data-id="²">
43
-      <cover-image class="universalpic_editbar_sqr_gray" src='../images/universalpic_editbar_sqr_gray.png' />
44
-    </cover-view>
45
-  </cover-view>
46
-  <cover-view class='lineFooter'></cover-view>
47
-  <cover-view class='panelBtn FlexRow'>
48
-    <cover-view class='text1' bindtap="closeAddItem" data-idsave="false">取消</cover-view>
49
-    <cover-view class='line1'></cover-view>
50
-    <cover-view class='text2 text1' bindtap="closeAddItem" data-idsave="true">确定</cover-view>
56
+    <cover-view class='lineFooter'></cover-view>
51 57
   </cover-view>
52
-  <cover-view class='lineFooter'></cover-view>
53
-
54 58
 </view>

+ 49 - 37
pages/main/addItem.wxss

@@ -3,6 +3,8 @@
3 3
   font-weight: 500;
4 4
   color: #1e1e1e;
5 5
   background-color: #f0f0f0;
6
+  position: fixed;
7
+  top: 0;
6 8
 }
7 9
 
8 10
 .left {
@@ -23,8 +25,8 @@
23 25
 .panelSave1 {
24 26
   width: 148rpx;
25 27
   background-color: #fff;
26
-  border:1rpx solid #9B9B9B;
27
-  color:#787878;
28
+  border: 1rpx solid #9b9b9b;
29
+  color: #787878;
28 30
   text-align: center;
29 31
   height: 80rpx;
30 32
   line-height: 80rpx;
@@ -36,7 +38,7 @@
36 38
   width: 80rpx;
37 39
   height: 80rpx;
38 40
   background-color: #fff;
39
-  border:1rpx solid #9B9B9B;
41
+  border: 1rpx solid #9b9b9b;
40 42
   margin-left: 10rpx;
41 43
 }
42 44
 
@@ -44,8 +46,8 @@
44 46
   width: 80rpx;
45 47
   height: 80rpx;
46 48
   margin-left: 10rpx;
47
-  background-color: #0071EF;
48
-  border:1rpx solid #0071EF;
49
+  background-color: #0071ef;
50
+  border: 1rpx solid #0071ef;
49 51
 }
50 52
 
51 53
 .universalpic_read_begin_gray_20x20 {
@@ -53,22 +55,22 @@
53 55
   height: 20rpx;
54 56
 }
55 57
 
56
-.universalpic_read_end_white_38x22{
58
+.universalpic_read_end_white_38x22 {
57 59
   width: 38rpx;
58 60
   height: 22rpx;
59 61
 }
60 62
 
61
-.universalpic_editbar_underline_gray_14x20{
63
+.universalpic_editbar_underline_gray_14x20 {
62 64
   width: 14rpx;
63 65
   height: 20rpx;
64 66
 }
65 67
 
66
-.universalpic_underline_end_white_30x22{
68
+.universalpic_underline_end_white_30x22 {
67 69
   width: 31rpx;
68 70
   height: 22rpx;
69 71
 }
70 72
 
71
-.universalpic_picture_gray_26x26{
73
+.universalpic_picture_gray_26x26 {
72 74
   width: 26rpx;
73 75
   height: 26rpx;
74 76
 }
@@ -84,7 +86,7 @@
84 86
   height: 80rpx;
85 87
   color: #0071ef;
86 88
   background-color: #fff;
87
-  border:1rpx solid #9B9B9B;
89
+  border: 1rpx solid #9b9b9b;
88 90
   text-align: center;
89 91
   border-radius: 10rpx;
90 92
   line-height: 80rpx;
@@ -104,21 +106,46 @@
104 106
   margin: 0 0 0 40rpx;
105 107
 }
106 108
 
107
-.panelTag0 {
108
-  justify-content: flex-start;
109
+.panelInput {
110
+  width: 100%;
111
+  height: 250rpx;
112
+  margin-top: 10rpx;
113
+  background-color: #fff;
114
+  font-size: 36rpx;
115
+  font-weight: 400;
116
+}
117
+
118
+.input {
119
+  margin: 30rpx 30rpx 0 30rpx;
120
+  width: 690rpx;
121
+  height: 220rpx;
122
+}
123
+
124
+.panel2 {
125
+  position: fixed;
126
+  top: 382rpx;
127
+  width: 100%;
128
+  background-color: #fff;
129
+}
130
+
131
+.panelBtnSmall {
109 132
   z-index: 10;
133
+  width:100%;
134
+  height: 120rpx;
135
+  background-color: #fff;
136
+  justify-content: flex-start;
110 137
 }
111 138
 
112
-.panelTag .btn0 {
113
-  width: 20rpx;
139
+.panelBtnSmall .btn0 {
140
+  width: 10rpx;
114 141
 }
115 142
 
116
-.panelTag .btn {
143
+.panelBtnSmall .btn {
117 144
   font-family: 'Roboto-Black';
118 145
   width: 80rpx;
119 146
   background-color: #fff;
120
-  border:1rpx solid #9B9B9B;
121
-  color:#787878;
147
+  border: 1rpx solid #9b9b9b;
148
+  color: #787878;
122 149
   border-radius: 10rpx;
123 150
   text-align: center;
124 151
   line-height: 80rpx;
@@ -127,11 +154,11 @@
127 154
   font-size: 36rpx;
128 155
 }
129 156
 
130
-.panelTag .btn1 {
157
+.panelBtnSmall .btn1 {
131 158
   width: 80rpx;
132 159
   height: 80rpx;
133 160
   background-color: #fff;
134
-  border:1rpx solid #9B9B9B;
161
+  border: 1rpx solid #9b9b9b;
135 162
   border-radius: 10rpx;
136 163
   margin-right: 10rpx;
137 164
 }
@@ -141,7 +168,7 @@
141 168
   height: 26rpx;
142 169
 }
143 170
 
144
-.universalpic_editbar_underline_gray{
171
+.universalpic_editbar_underline_gray {
145 172
   width: 18rpx;
146 173
   height: 28rpx;
147 174
 }
@@ -151,21 +178,6 @@
151 178
   height: 22rpx;
152 179
 }
153 180
 
154
-.panelInput {
155
-  width: 100%;
156
-  height: 250rpx;
157
-  margin-top: 10rpx;
158
-  background-color: #fff;
159
-  font-size: 36rpx;
160
-  font-weight: 400;
161
-}
162
-
163
-.input {
164
-  margin: 30rpx 30rpx 0 30rpx;
165
-  width: 690rpx;
166
-  height:220rpx;
167
-}
168
-
169 181
 .panelBtn {
170 182
   width: 100%;
171 183
   background-color: #f8f8f8;
@@ -190,6 +202,6 @@
190 202
   color: #0071ef;
191 203
 }
192 204
 
193
-.lineFooter{
205
+.lineFooter {
194 206
   z-index: 10;
195
-}
207
+}

+ 1 - 1
pages/main/cardInfo.js

@@ -18,7 +18,7 @@ Page({
18 18
   init: function (id) {
19 19
     var that = this;
20 20
     var card={};
21
-    var list = wx.getStorageSync("CardList");
21
+    var list = app.globalData.CardList;
22 22
     for (var i = 0; i < list.length; i++) {
23 23
       if (id == list[i].MiaoguoCardID) {
24 24
         card.CreateTimeStr = common.formatDateCHS(list[i].CreateTime);

+ 8 - 31
pages/main/default.js

@@ -59,39 +59,16 @@ Page({
59 59
   },
60 60
   //得到当天任务
61 61
   getTaskTodayList: function () {
62
-    wx.showLoading({
63
-      title: '请稍候',
64
-      mask:true,
65
-    })
66
-    var that = this;
67
-    common.getStorageValue(that, "CardMaxNumberNew", 10, function () {
68
-      common.getStorageValue(that, "CardMaxNumberHistory", 30, function () {
69
-        common.getStorageValue(that, "SortTypeIndex", 0, function () {
70
-          var url = 'GetMiaoguoCardToday?UserID=' + app.globalData.userInfo.UserID;
71
-          url += "&New=" + that.data.CardMaxNumberNew;
72
-          url += "&History=" + that.data.CardMaxNumberHistory;
73
-          url += "&SortTypeIndex=" + that.data.SortTypeIndex;
74
-
75
-          main.getData(url, function (data) {
76
-            wx.hideLoading();
77
-
78
-            if (data) {
79
-              var TodayTaskNumber = data.ListNew.length + data.ListReview.length + data.ListHistory.length;
80
-              that.setData({
81
-                List: data,
82
-                DayNumber: data.DayNumber,
83
-                TodayTaskNumber: TodayTaskNumber,
84
-                IsStart: data.IsStart,
85
-              });
86
-
87
-              wx.setStorageSync("TaskToday", data);
88
-
89
-            }
90
-          });
91
-        });
62
+    var that=this;
63
+    main.getTaskTodayList(function(data){
64
+      var TodayTaskNumber = data.ListNew.length + data.ListReview.length + data.ListHistory.length;
65
+      that.setData({
66
+        List: data,
67
+        DayNumber: data.DayNumber,
68
+        TodayTaskNumber: TodayTaskNumber,
69
+        IsStart: data.IsStart,
92 70
       });
93 71
     });
94
-    
95 72
   },
96 73
   gotoCard: function () {
97 74
     wx.redirectTo({

+ 49 - 17
pages/main/detail.js

@@ -12,7 +12,7 @@ var timeStart; //计算时长
12 12
 var TaskList = [];
13 13
 var iTimeout = 0;
14 14
 var arrImage = [], arrImage2 = [];
15
-var intervalSound;
15
+var intervalSound = 0, intervalRefresh=0;
16 16
 
17 17
 Page({
18 18
   data: {
@@ -72,17 +72,16 @@ Page({
72 72
       that.setSoundFile(-1);
73 73
 
74 74
 
75
-      var list = wx.getStorageSync("CardList");
75
+      var list = app.globalData.CardList;
76 76
       if (list && list.length > 0) {
77 77
         for (var i = 0; i < list.length; i++) {
78 78
           if (TaskList[0].MiaoguoCardID == list[i].MiaoguoCardID) {
79
-            var card = {};
80 79
             TaskList[0].Content = list[i].Content;
81 80
             TaskList[0].ContentNew = main.changeStringToView(list[i].Content);
82 81
             that.setData({
83 82
               TaskInfo: TaskList[0],
84 83
             });
85
-            wx.removeStorageSync("CardList");
84
+            app.globalData.CardList=[];
86 85
             break;
87 86
           }
88 87
         }
@@ -140,7 +139,7 @@ Page({
140 139
     });
141 140
   },
142 141
   getList: function () {
143
-    var task = wx.getStorageSync("TaskToday");
142
+    var task = app.globalData.TaskToday;
144 143
     var that = this;
145 144
     var arrNew = task.ListNew;
146 145
     var arrHistory = task.ListHistory;
@@ -291,9 +290,8 @@ Page({
291 290
     var that = this;
292 291
     //console.log(res.tapIndex);
293 292
     var list = [];
294
-    TaskList[0].MiaoguoCardID = TaskList[0].ID;
295 293
     list.push(TaskList[0]);
296
-    wx.setStorageSync("CardList", list);
294
+    app.globalData.CardList=list;
297 295
     wx.navigateTo({
298 296
       url: './add?type=edit&id=' + TaskList[0].MiaoguoCardID,
299 297
     });
@@ -325,7 +323,7 @@ Page({
325 323
 
326 324
       var that = this;
327 325
       var url = "UndoMiaoguoCard?";
328
-      url += "ID=" + card.Card.ID;
326
+      url += "ID=" + card.Card.MiaoguoCardID;
329 327
       url += "&UserID=" + app.globalData.userInfo.UserID;
330 328
       url += "&IntervalTime=" + card.IntervalTime;
331 329
       url += "&IntervalDay=" + card.Card.IntervalDay;
@@ -353,7 +351,7 @@ Page({
353 351
 
354 352
         //去除重复
355 353
         for (var i = 0; i < TaskList.length; i++) {
356
-          if (TaskList[i].ID == card.Card.ID) {
354
+          if (TaskList[i].MiaoguoCardID == card.Card.MiaoguoCardID) {
357 355
             TaskList.splice(i, 1);
358 356
           }
359 357
         }
@@ -491,7 +489,7 @@ Page({
491 489
 
492 490
     //保存上传
493 491
     var obj = {
494
-      ID: TaskList[0].ID,
492
+      MiaoguoCardID: TaskList[0].MiaoguoCardID,
495 493
       IntervalTime: time,
496 494
       BtnNumber: btnnumber,
497 495
       LearningType: learningType,
@@ -569,7 +567,7 @@ Page({
569 567
   },
570 568
   saveCard: function (obj, callback) {
571 569
     var url = "UpdateMiaoguoCardToday?";
572
-    url += "ID=" + obj.ID;
570
+    url += "ID=" + obj.MiaoguoCardID;
573 571
     url += "&UserID=" + app.globalData.userInfo.UserID;
574 572
     url += "&IntervalTime=" + obj.IntervalTime;
575 573
     url += "&BtnNumber=" + obj.BtnNumber;
@@ -577,6 +575,8 @@ Page({
577 575
     url += "&FontSize=" + TaskList[0].FontSize;
578 576
 
579 577
     var duration = common.diffDate("s", timeStart, new Date());
578
+    if (obj.btnnumber==1)
579
+      duration=0;
580 580
     url += "&Duration=" + duration;
581 581
 
582 582
     url += "&IsUndo=" + obj.IsUndo;
@@ -598,7 +598,15 @@ Page({
598 598
       url = e.currentTarget.dataset.soundmark;
599 599
     }
600 600
     else if (e.currentTarget.dataset.soundmark && e.currentTarget.dataset.soundmark != "undefined") {
601
-      url = e.currentTarget.dataset.soundmark;
601
+      var soundmark = e.currentTarget.dataset.soundmark;
602
+      if (soundmark && soundmark.indexOf("http") < 0) {
603
+        url = app.globalData.audioUrlBaidu;
604
+        url = url.replace("[token]", app.globalData.BaiduToken);
605
+        url = url.replace("[word]", soundmark);
606
+      }
607
+      else {
608
+        url = soundmark;
609
+      }
602 610
     }
603 611
     else {
604 612
       url = app.globalData.audioUrlBaidu;
@@ -681,6 +689,35 @@ Page({
681 689
     });
682 690
   },
683 691
   onBindError: function (e) {
692
+    var that = this;
693
+    var serverUrl = e.currentTarget.dataset.serverurl;
694
+    var oldTempUrl = e.currentTarget.dataset.name;
695
+    //console.log("serverUrl1:" + serverUrl);
696
+    wx.downloadFile({
697
+      url: serverUrl, // 仅为示例,并非真实的资源
698
+      success(res) {
699
+        // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
700
+        if (res.statusCode === 200) {
701
+          //console.log("serverUrl2:" + serverUrl);
702
+          //console.log(res.tempFilePath);
703
+          main.saveTempImage(serverUrl, res.tempFilePath);
704
+          for(var i=0;i<arrImage.length;i++){
705
+            if (arrImage[i] == oldTempUrl){
706
+              arrImage[i] = res.tempFilePath;
707
+            }
708
+          }
709
+        }
710
+      }
711
+    });
712
+
713
+    clearTimeout(intervalRefresh);
714
+    intervalRefresh = setTimeout(function () {
715
+      TaskList[0].ContentNew = main.changeStringToView(TaskList[0].Content);
716
+      that.setData({
717
+        TaskInfo: TaskList[0],
718
+      });
719
+    }, 1000);
720
+
684 721
     for (var i = 1; i < this.data.TaskInfo.ContentNew.Field.length; i++) {
685 722
       for (var j = 0; j < this.data.TaskInfo.ContentNew.Field[i].length; j++) {
686 723
         if (this.data.TaskInfo.ContentNew.Field[i][j].Type == "image") {
@@ -688,14 +725,9 @@ Page({
688 725
         }
689 726
       }
690 727
     }
691
-    arrImage = arrImage2;
692 728
     this.setData({
693 729
       TaskInfo: this.data.TaskInfo,
694 730
     });
695
-
696
-    main.getData('UpdateCardImageUrl?MiaoguoCardID=' + this.data.TaskInfo[0].ID, function (data) {
697
-
698
-    });
699 731
   },
700 732
   onClose:function(){
701 733
     wx.navigateBack({

+ 7 - 7
pages/main/detail.wxml

@@ -57,10 +57,10 @@
57 57
 
58 58
         <text class="textPinyin" wx:if="{{item.Type=='sound'}}" catchtap="playSound" data-content="{{item.Content}}" data-soundmark="{{item.SoundMark}}" data-fieldid="1">{{item.Content}}</text>
59 59
 
60
-        <image class="imageBishun" wx:if="{{item.Type=='image'  && !item.Url}}" src='{{item.Content}}' catchtap='showImage' data-name="{{item.Content}}" />
61
-
62
-        <image class="imageFree" mode='widthFix' wx:if="{{item.Type=='image' && item.Url}}" src='{{item.Url}}' catchtap='showImage' data-name="{{item.Url}}" binderror="onBindError" />
60
+        <!-- <image class="imageBishun" wx:if="{{item.Type=='image'  && !item.Url}}" src='{{item.Content}}' catchtap='showImage' data-name="{{item.Content}}" /> -->
63 61
 
62
+        <image class="imageFree" mode="widthFix" wx:if="{{item.Type=='image'}}" src='{{item.Content}}' bindtap='showImage' data-name="{{item.Content}}" data-serverurl="{{item.ContentServer}}" binderror="onBindError" />
63
+      
64 64
   </block>
65 65
   </view>
66 66
 
@@ -103,10 +103,10 @@
103 103
 
104 104
         <text class="textPinyin" wx:if="{{item.Type=='sound'}}" catchtap="playSound" data-content="{{item.Content}}" data-soundmark="{{item.SoundMark}}" data-fieldid="{{itemParent}}">{{item.Content}}</text>
105 105
 
106
-        <image class="imageBishun" wx:if="{{item.Type=='image' && !item.Url}}" src='{{item.Content}}' catchtap='showImage' data-name="{{item.Content}}" />
107
-
108
-        <image class="imageFree" mode="widthFix" wx:if="{{item.Type=='image' && item.Url}}" src='{{item.Url}}' catchtap='showImage' data-name="{{item.Url}}" binderror="onBindError" />
106
+        <!-- <image class="imageBishun" wx:if="{{item.Type=='image' && !item.Url}}" src='{{item.Content}}' catchtap='showImage' data-name="{{item.Content}}" /> -->
109 107
 
108
+        <image class="imageFree" mode="widthFix" wx:if="{{item.Type=='image'}}" src='{{item.Content}}' bindtap='showImage' data-name="{{item.Content}}" data-serverurl="{{item.ContentServer}}" binderror="onBindError" />
109
+      
110 110
         </block>
111 111
       </view>
112 112
     </view>
@@ -188,7 +188,7 @@
188 188
       <view class="lineWidth700"></view>
189 189
     </view>
190 190
     <view class="numberContainer12 FlexRow">
191
-      <view class='left'>重点回顾</view>
191
+      <view class='left'>及时强化</view>
192 192
       <view class='right3'>{{NumberReview}}张</view>
193 193
     </view>
194 194
     <view class='lineFooter'></view>

+ 130 - 37
pages/main/preview.js

@@ -2,8 +2,8 @@ import common from '../../utils/util';
2 2
 import main from '../../utils/main';
3 3
 
4 4
 const app = getApp();
5
-var iTimeout = 0, intervalSound=0;
6
-var arrImage = [], arrImage2 = [];
5
+var iTimeout = 0, intervalSound = 0, intervalRefresh = 0;
6
+var arrImage = [];
7 7
 
8 8
 Page({
9 9
   data: {
@@ -22,9 +22,9 @@ Page({
22 22
       MiaoguoCardID: id,
23 23
     });
24 24
     //console.log("MiaoguoCardID:" + id);
25
-    
25
+
26 26
     this.audioCtx = [];
27
-    
27
+
28 28
 
29 29
     if (options.type == "share") {
30 30
       wx.setNavigationBarTitle({
@@ -34,30 +34,31 @@ Page({
34 34
   },
35 35
   onShow: function () {
36 36
     var that = this;
37
-    if (that.data.ShowType == "share") {
38
-      var url = "GetMiaoguoCardInfo?UserID=" + app.globalData.introducer + "&MiaoguoCardID=" + that.data.MiaoguoCardID;
39
-      main.getData(url, function (data) {
40
-        if (data) {
41
-          wx.setStorageSync("CardList", [data]);
42
-          that.init();
43
-        }
44
-      });
45
-    }
46
-    else
47
-      that.init();
37
+    if (that.data.ShowType)
38
+      if (that.data.ShowType == "share") {
39
+        var url = "GetMiaoguoCardInfo?UserID=" + app.globalData.introducer + "&MiaoguoCardID=" + that.data.MiaoguoCardID;
40
+        main.getData(url, function (data) {
41
+          if (data) {
42
+            app.globalData.CardList=[data];
43
+            that.init();
44
+          }
45
+        });
46
+      }
47
+      else
48
+        that.init();
48 49
   },
49 50
   onUnload: function () {
50 51
     clearTimeout(iTimeout);
51 52
     clearInterval(intervalSound);
52 53
   },
53 54
   init: function () {
54
-    var list = wx.getStorageSync("CardList");
55
+    var that=this;
56
+    var list = app.globalData.CardList;
55 57
     var card = {};
56 58
     var prevId = 0;
57 59
     var nextId = 0;
58 60
     for (var i = 0; i < list.length; i++) {
59 61
       if (this.data.MiaoguoCardID == list[i].MiaoguoCardID) {
60
-        wx.setStorageSync("TempCardInfo", list[i]);
61 62
         if (i > 0)
62 63
           prevId = list[i - 1].MiaoguoCardID;
63 64
         else
@@ -78,10 +79,34 @@ Page({
78 79
       card.FontSize = 46;
79 80
 
80 81
     arrImage = card.Images;
81
-    arrImage2 = card.Images2;
82 82
 
83
-    console.log("arrImage:" + arrImage);
84
-    console.log("arrImage2" + arrImage2);
83
+    //console.log("arrImage:" + arrImage);
84
+
85
+    var limitTimeStr = common.formatDateCHS(card.LimitTime);
86
+
87
+    var isTodayPractice = true;
88
+    var task = app.globalData.TaskToday;
89
+
90
+    for (var i = 0; i < task.ListNew.length; i++) {
91
+      if (task.ListNew[i].MiaoguoCardID == that.data.MiaoguoCardID) {
92
+        isTodayPractice = false;
93
+        break;
94
+      }
95
+    }
96
+    for (var i = 0; i < task.ListHistory.length; i++) {
97
+      if (task.ListHistory[i].MiaoguoCardID == that.data.MiaoguoCardID) {
98
+        isTodayPractice = false;
99
+        break;
100
+      }
101
+    }
102
+    for (var i = 0; i < task.ListReview.length; i++) {
103
+      if (task.ListReview[i].MiaoguoCardID == that.data.MiaoguoCardID) {
104
+        isTodayPractice = false;
105
+        break;
106
+      }
107
+    }
108
+
109
+
85 110
 
86 111
     this.setData({
87 112
       ID: card.MiaoguoCardID,
@@ -90,7 +115,8 @@ Page({
90 115
       PrevID: prevId,
91 116
       NextID: nextId,
92 117
       FontSize: card.FontSize,
93
-      LimitTimeStr: common.formatDateCHS(card.LimitTime),
118
+      LimitTimeStr: limitTimeStr,
119
+      IsTodayPractice: isTodayPractice,
94 120
     });
95 121
   },
96 122
   practiceToday: function () {
@@ -109,8 +135,9 @@ Page({
109 135
             var time = common.formatTime(new Date());
110 136
             that.setData({
111 137
               LimitTimeStr: common.formatDateCHS(time),
138
+              IsTodayPractice: false,
112 139
             });
113
-            var list = wx.getStorageSync("CardList");
140
+            var list = app.globalData.CardList;
114 141
             for (var i = 0; i < list.length; i++) {
115 142
               if (that.data.ID == list[i].MiaoguoCardID) {
116 143
                 list[i].LimitTime = time;
@@ -118,7 +145,7 @@ Page({
118 145
                 break;
119 146
               }
120 147
             }
121
-            wx.setStorageSync("CardList", list);
148
+            app.globalData.CardList=list;
122 149
             wx.showToast({
123 150
               title: '改为今天练',
124 151
               icon: 'none',
@@ -131,6 +158,49 @@ Page({
131 158
       }
132 159
     })
133 160
   },
161
+  shelveTask: function () {
162
+    //搁置题卡,今天不练
163
+    var that = this;
164
+    wx.showModal({
165
+      title: '今天不练吗?',
166
+      content: '这张题卡今天不练习',
167
+      success(res) {
168
+        if (res.confirm) {
169
+          var url = "UpdateMiaoguoCardToday?";
170
+          url += "ID=" + that.data.MiaoguoCardID;
171
+          url += "&UserID=" + app.globalData.userInfo.UserID;
172
+          url += "&IntervalTime=1d";
173
+          url += "&BtnNumber=1";
174
+          url += "&LearningType=3";
175
+          url += "&Duration=0";
176
+          url += "&IsUndo=0";
177
+          main.getData(url, function (data) {
178
+            var time = common.formatTime(common.addDate("d", 1, new Date()));
179
+            that.setData({
180
+              LimitTimeStr: common.formatDateCHS(time),
181
+              IsTodayPractice: true,
182
+            });
183
+            var list = app.globalData.CardList;
184
+            for (var i = 0; i < list.length; i++) {
185
+              if (that.data.ID == list[i].MiaoguoCardID) {
186
+                list[i].LimitTime = time;
187
+                list[i].LimitTimeStr = "明天";
188
+                break;
189
+              }
190
+            }
191
+            app.globalData.CardList=list;
192
+            wx.showToast({
193
+              title: '改为明天练',
194
+              icon: 'none',
195
+            });
196
+          });
197
+        }
198
+        else if (res.cancel) {
199
+
200
+        }
201
+      }
202
+    })
203
+  },
134 204
   saveCard: function (obj, callback) {
135 205
     var url = "UpdateMiaoguoCardToday?";
136 206
     url += "ID=" + obj.ID;
@@ -184,10 +254,18 @@ Page({
184 254
       url = e.currentTarget.dataset.soundmark;
185 255
     }
186 256
     else if (e.currentTarget.dataset.soundmark && e.currentTarget.dataset.soundmark != "undefined") {
187
-      url = e.currentTarget.dataset.soundmark;
257
+      var soundmark = e.currentTarget.dataset.soundmark;
258
+      if (soundmark && soundmark.indexOf("http") < 0) {
259
+        url = app.globalData.audioUrlBaidu;
260
+        url = url.replace("[token]", app.globalData.BaiduToken);
261
+        url = url.replace("[word]", soundmark);
262
+      }
263
+      else {
264
+        url = soundmark;
265
+      }
188 266
     }
189 267
     else {
190
-      var url = app.globalData.audioUrlBaidu;
268
+      url = app.globalData.audioUrlBaidu;
191 269
       url = url.replace("[token]", app.globalData.BaiduToken);
192 270
       url = url.replace("[word]", str);
193 271
     }
@@ -252,6 +330,7 @@ Page({
252 330
       },
253 331
     })
254 332
   },
333
+
255 334
   deleteCard: function () {
256 335
     var that = this;
257 336
     wx.showModal({
@@ -262,18 +341,18 @@ Page({
262 341
           var url = 'DeleteMiaoguoCard?UserID=' + app.globalData.userInfo.UserID;
263 342
           url += "&ID=" + that.data.MiaoguoCardID;
264 343
           main.getData(url, function (data) {
265
-            var list = wx.getStorageSync("CardList");
344
+            var list = app.globalData.CardList;
266 345
             for (var i = 0; i < list.length; i++) {
267 346
               if (that.data.MiaoguoCardID == list[i].MiaoguoCardID) {
268 347
                 list.splice(i, 1);
269 348
                 break;
270 349
               }
271 350
             }
272
-            wx.setStorageSync("CardList", list);
351
+            app.globalData.CardList=list;
273 352
 
274
-            var taskToday = wx.getStorageSync("TaskToday");
353
+            var taskToday = app.globalData.TaskToday;
275 354
             taskToday.CardNumber--;
276
-            wx.setStorageSync("TaskToday", taskToday);
355
+            app.globalData.TaskToday=taskToday;
277 356
 
278 357
             wx.navigateBack({
279 358
               delta: 1,
@@ -312,17 +391,31 @@ Page({
312 391
     });
313 392
   },
314 393
   onBindError: function (e) {
315
-    for (var i = 1; i < this.data.Field.length; i++) {
316
-      for (var j = 0; j < this.data.Field[i].length; j++) {
317
-        if (this.data.Field[i][j].Type == "image") {
318
-          this.data.Field[i][j].Url = this.data.Field[i][j].Content;
394
+    var that = this;
395
+    var serverUrl = e.currentTarget.dataset.serverurl;
396
+    var oldTempUrl = e.currentTarget.dataset.name;
397
+    //console.log("serverUrl1:" + serverUrl);
398
+    wx.downloadFile({
399
+      url: serverUrl, // 仅为示例,并非真实的资源
400
+      success(res) {
401
+        // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
402
+        if (res.statusCode === 200) {
403
+          //console.log("serverUrl2:" + serverUrl);
404
+          //console.log(res.tempFilePath);
405
+          main.saveTempImage(serverUrl, res.tempFilePath);
406
+          for (var i = 0; i < arrImage.length; i++) {
407
+            if (arrImage[i] == oldTempUrl) {
408
+              arrImage[i] = res.tempFilePath;
409
+            }
410
+          }
319 411
         }
320 412
       }
321
-    }
322
-    arrImage = arrImage2;
323
-    this.setData({
324
-      Field: this.data.Field,
325 413
     });
414
+
415
+    clearTimeout(intervalRefresh);
416
+    intervalRefresh = setTimeout(function () {
417
+      that.init();
418
+    }, 1000);
326 419
   },
327 420
   onShareAppMessage: function () {
328 421
     var that = this;

+ 7 - 14
pages/main/preview.wxml

@@ -6,7 +6,8 @@
6 6
         <view class="text2">{{LimitTimeStr}}</view>
7 7
       </view>
8 8
       <view class='right FlexRow'>
9
-        <view class="text3" bindtap='practiceToday'>今天练</view>
9
+        <view class="text3" bindtap='practiceToday' hidden="{{!IsTodayPractice}}">今天必练</view>
10
+        <view class="text4 text3" bindtap='shelveTask' hidden="{{IsTodayPractice}}">今天不练</view>
10 11
       </view>
11 12
     </view>
12 13
     <view class="panelTop1"></view>
@@ -15,29 +16,20 @@
15 16
     <view class="panelField11 panelItem FlexRow" style="font-size:{{FontSize}}rpx;">
16 17
       <block wx:for="{{Field[1]}}" wx:key="index">
17 18
         <text class="textReturn" wx:if="{{index>0 && item.Type=='return'}}"></text>
18
-
19 19
         <text class="textNormal" wx:if="{{item.Type=='normal'}}">{{item.Content}}</text>
20
-
21 20
         <text class="textNormal FlexRow" wx:if="{{item.Type=='line'}}">
22 21
           <block wx:for="{{item.Content}}" wx:key="contentIndex" wx:for-item="contentItem">
23 22
               <text wx:if="{{contentItem.key=='normal'}}">{{contentItem.value}}</text>
24 23
           <text class="textLine" wx:if="{{contentItem.key=='line'}}">{{contentItem.value}}</text>
25 24
         </block>
26 25
         </text>
27
-
28 26
         <view class="panelSound FlexRow" wx:if="{{item.Type=='sound'}}" bindtap="playSound" data-content="{{item.Content}}" data-soundmark="{{item.SoundMark}}" data-fieldid="1">
29 27
           <image class="universalpic_read_mark_black_20x20" src='../images/universalpic_read_mark_black_20x20.{{item.SoundImageName}}' />
30 28
         </view>
31
-
32 29
         <text class="textPinyin" wx:if="{{item.Type=='sound'}}" catchtap="playSound" data-content="{{item.Content}}" data-soundmark="{{item.SoundMark}}" data-fieldid="1">{{item.Content}}</text>
33
-
34
-        <image class="imageBishun" wx:if="{{item.Type=='image' && !item.Url}}" src='{{item.Content}}' bindtap='showImage' data-name="{{item.Content}}" />
35
-        
36
-        <image class="imageFree" mode="widthFix" wx:if="{{item.Type=='image' && item.Url}}" src='{{item.Url}}' bindtap='showImage' data-name="{{item.Url}}" binderror="onBindError" />
37
-      
30
+        <image class="imageFree" mode="widthFix" wx:if="{{item.Type=='image'}}" src='{{item.Content}}' bindtap='showImage' data-name="{{item.Content}}" data-serverurl="{{item.ContentServer}}" binderror="onBindError" />
38 31
       </block>
39 32
     </view>
40
-
41 33
   </view>
42 34
 
43 35
   <view class="panelTag FlexRow" wx:if="{{Tags && Tags.length>0}}">
@@ -47,6 +39,7 @@
47 39
     </view>
48 40
     <view wx:if="{{true}}"></view>
49 41
   </view>
42
+  
50 43
   <view class="panelField2 FlexColumn" wx:for="{{[2,3]}}" wx:key="indexParent" wx:for-index="indexParent" wx:for-item="itemParent" wx:if="{{Field[itemParent].length>0}}" bindlongpress='editField' data-id="{{itemParent}}">
51 44
     <view wx:if="{{itemParent==3}}" class="lineField"></view>
52 45
 
@@ -69,9 +62,9 @@
69 62
 
70 63
         <text class="textPinyin" wx:if="{{item.Type=='sound'}}" catchtap="playSound" data-content="{{item.Content}}" data-soundmark="{{item.SoundMark}}" data-fieldid="{{itemParent}}">{{item.Content}}</text>
71 64
 
72
-        <image class="imageBishun" wx:if="{{item.Type=='image' && !item.Url}}" src='{{item.Content}}' bindtap='showImage' data-name="{{item.Content}}" />
73
-        
74
-        <image class="imageFree" mode="widthFix" wx:if="{{item.Type=='image' && item.Url}}" src='{{item.Url}}' bindtap='showImage' data-name="{{item.Url}}" binderror="onBindError" />
65
+        <!-- <image class="imageBishun" wx:if="{{item.Type=='image' && !item.Url}}" src='{{item.Content}}' bindtap='showImage' data-name="{{item.Content}}" />
66
+         -->
67
+        <image class="imageFree" mode="widthFix" wx:if="{{item.Type=='image'}}" src='{{item.Content}}' bindtap='showImage' data-name="{{item.Content}}" data-serverurl="{{item.ContentServer}}" binderror="onBindError" />
75 68
       
76 69
       </block>
77 70
     </view>

+ 3 - 1
pages/main/preview.wxss

@@ -49,7 +49,9 @@
49 49
   font-size: 24rpx;
50 50
 }
51 51
 
52
-
52
+.text4 {
53
+  color: #1e1e1e;
54
+}
53 55
 
54 56
 .panelItem {
55 57
   width: 650rpx;

+ 30 - 12
pages/main/searchCard.js

@@ -14,7 +14,7 @@ Page({
14 14
     });
15 15
   },
16 16
   onShow:function(){
17
-    var taskToday=wx.getStorageSync("TaskToday");
17
+    var taskToday = app.globalData.TaskToday;
18 18
     this.setData({
19 19
       CardNumber: taskToday.CardNumber,
20 20
     })
@@ -41,19 +41,37 @@ Page({
41 41
     });
42 42
     var IsToday=e.currentTarget.dataset.id;
43 43
     var that = this;
44
-    var url = 'GetMiaoguoCardList?UserID=' + app.globalData.userInfo.UserID;
45
-    if (IsToday)
46
-      url += "&IsToday=" + IsToday;
47 44
 
48
-    main.getData(url, function (data) {
49
-      wx.hideLoading();
50
-      if (data) {
51
-        wx.setStorageSync("CardList", data.List);
45
+    if (IsToday==1){
46
+      main.getTaskTodayList(function(task){
47
+        var list = [];
48
+        for (var i = 0; i < task.ListNew.length; i++) {
49
+          list.push(task.ListNew[i]);
50
+        }
51
+        for (var i = 0; i < task.ListHistory.length; i++) {
52
+          list.push(task.ListHistory[i]);
53
+        }
54
+        for (var i = 0; i < task.ListReview.length; i++) {
55
+          list.push(task.ListReview[i]);
56
+        }
57
+        app.globalData.CardList=list;
52 58
         wx.navigateTo({
53
-          url: './searchCardList?type='+IsToday+"&Count="+data.Count,
54
-        })
55
-      }
56
-    });
59
+          url: './searchCardList?type=1&Count=' + list.length,
60
+        });
61
+      });
62
+    }
63
+    else{
64
+      var url = 'GetMiaoguoCardList?UserID=' + app.globalData.userInfo.UserID;
65
+      main.getData(url, function (data) {
66
+        wx.hideLoading();
67
+        if (data) {
68
+          app.globalData.CardList= data.List;
69
+          wx.navigateTo({
70
+            url: './searchCardList?type=0&Count=' + data.Count,
71
+          })
72
+        }
73
+      });
74
+    }
57 75
   },
58 76
   onShareAppMessage: function () {
59 77
     return {

+ 1 - 1
pages/main/searchCard.wxml

@@ -12,7 +12,7 @@
12 12
         <view class="text2">{{CardNumber}}</view>
13 13
       </view>
14 14
       <view class='line1'></view>
15
-      <view class='text1' bindtap="getList" data-id="1">今日的任务</view>
15
+      <view class='text1' bindtap="getList" data-id="1">剩余任务</view>
16 16
     </view>
17 17
     <view class='lineFooter'></view>
18 18
   </view>

+ 1 - 1
pages/main/searchCard1.js

@@ -32,7 +32,7 @@ Page({
32 32
 
33 33
       main.getData(url, function (data) {
34 34
         if (data) {
35
-          wx.setStorageSync("CardList", data.List);
35
+          app.globalData.CardList= data.List;
36 36
           wx.navigateTo({
37 37
             url: './searchCardList?search=' + search+'&Count='+data.Count,
38 38
           })

+ 47 - 29
pages/main/searchCardList.js

@@ -2,9 +2,11 @@ import common from '../../utils/util';
2 2
 import main from '../../utils/main';
3 3
 
4 4
 const app = getApp();
5
+var intervalRefresh = 0;
5 6
 
6 7
 Page({
7 8
   data: {
9
+    HasPage:false,
8 10
   },
9 11
   onLoad: function (options) {
10 12
     wx.hideShareMenu();
@@ -21,7 +23,7 @@ Page({
21 23
     else if (options.type == 1) {
22 24
       IsToday = 1;
23 25
       wx.setNavigationBarTitle({
24
-        title: "今日的任务"
26
+        title: "剩余任务"
25 27
       });
26 28
     }
27 29
 
@@ -37,7 +39,8 @@ Page({
37 39
     that.getList();
38 40
   },
39 41
   getList: function () {
40
-    var list = wx.getStorageSync("CardList");
42
+    var that=this;
43
+    var list = app.globalData.CardList;
41 44
     var len = 20;
42 45
     for (var i = 0; i < list.length; i++) {
43 46
       var item = list[i];
@@ -55,27 +58,41 @@ Page({
55 58
       if (imageUrl.length == 0 && item.Content[3].Content)
56 59
         imageUrl = getImage(item.Content[3].Content);
57 60
 
58
-      if (imageUrl.length > 0)
59
-        item.ImageUrl = imageUrl;
61
+      if (imageUrl.length > 0) {
62
+        item.ImageUrlTemp = main.getTempImage(imageUrl);
63
+        item.ImageUrlServer = imageUrl;
64
+      }
60 65
     }
66
+
67
+    if (that.data.IsToday==1){
68
+      var tempList=[];
69
+      for (var i = 0; i < list.length; i++) {
70
+        var item = list[i];
71
+        var limitTimeStr = common.formatDateCHS(item.LimitTime);
72
+        var today = common.formatDateCHS(common.formatTime(new Date()));
73
+        if (limitTimeStr <= today) {
74
+          tempList.push(list[i]);
75
+        }
76
+      }
77
+      list=tempList;
78
+      app.globalData.CardList=list;
79
+    }
80
+
81
+    var hasPage=false;
82
+    if (list.length % 20 == 0 && that.data.IsToday==0)
83
+      hasPage=true;
84
+    
61 85
     this.setData({
62 86
       List: list,
87
+      HasPage:hasPage,
63 88
     });
64 89
     wx.hideLoading();
65 90
 
66 91
     function getImage(str) {
67
-      var result = [];
68
-      if (str.indexOf("[图") >= 0) {
69
-        if (str.indexOf("[图]") >= 0)
70
-          result.push(str.substring(str.indexOf("[图]") + 3, str.indexOf("[/图]")));
71
-        else {
72
-          str = str.substr(str.indexOf("[图") + 2);
73
-          result.push(str.substring(str.indexOf(" url='") + 6, str.indexOf("]")-1));
74
-          str = str.substring(str.indexOf("]") + 1, str.indexOf("[/图]"));
75
-          result.push(str);
76
-        }
92
+      var result = "";
93
+      if (str.indexOf("[图]") >= 0) {
94
+        result = str.substring(str.indexOf("[图]") + 3, str.indexOf("[/图]"));
77 95
       }
78
-      //console.log("images:"+result);
79 96
       return result;
80 97
     }
81 98
 
@@ -118,23 +135,24 @@ Page({
118 135
     })
119 136
   },
120 137
   onBindError: function (e) {
138
+    var that = this;
121 139
     var id = e.currentTarget.dataset.id;
122
-    for (var i = 0; i < this.data.List.length; i++) {
123
-      if (this.data.List[i].ImageUrl && this.data.List[i].ImageUrl.length>1) {
124
-        if (id == this.data.List[i].MiaoguoCardID){
125
-          this.data.List[i].ImageUrl[0] = this.data.List[i].ImageUrl[1];
126
-          //console.log("Image1:" + this.data.List[i].ImageUrl[0]);
127
-          //console.log("Image2:" + this.data.List[i].ImageUrl[1]);
140
+
141
+    var serverUrl = e.currentTarget.dataset.serverurl;
142
+    wx.downloadFile({
143
+      url: serverUrl, // 仅为示例,并非真实的资源
144
+      success(res) {
145
+        // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
146
+        if (res.statusCode === 200) {
147
+          main.saveTempImage(serverUrl, res.tempFilePath);
128 148
         }
129 149
       }
130
-    }
131
-    this.setData({
132
-      List: this.data.List,
133 150
     });
134 151
 
135
-    main.getData('UpdateCardImageUrl?MiaoguoCardID='+id, function (data) {
136
-      
137
-    });
152
+    clearTimeout(intervalRefresh);
153
+    intervalRefresh = setTimeout(function () {
154
+      that.getList();
155
+    }, 1000);
138 156
   },
139 157
   gotoNextPage: function (e) {
140 158
     wx.showLoading({
@@ -149,11 +167,11 @@ Page({
149 167
     main.getData(url, function (data) {
150 168
       if (data) {
151 169
 
152
-        var list = wx.getStorageSync("CardList");
170
+        var list = app.globalData.CardList;
153 171
         for (var i = 0; i < data.List.length; i++) {
154 172
           list.push(data.List[i]);
155 173
         }
156
-        wx.setStorageSync("CardList", list);
174
+        app.globalData.CardList=list;
157 175
         that.getList();
158 176
       }
159 177
     });

+ 3 - 3
pages/main/searchCardList.wxml

@@ -13,7 +13,7 @@
13 13
       </view>
14 14
       <view class="panelItem FlexRow" bindtap='onPreview' data-id="{{item.MiaoguoCardID}}">
15 15
         <view class="panelItem1 FlexRow">
16
-          <image class="ImageCSS" mode="aspectFill" src='{{item.ImageUrl[0]}}' wx:if="{{item.ImageUrl[0]}}" binderror="onBindError" data-id="{{item.MiaoguoCardID}}" />
16
+          <image class="ImageCSS" mode="aspectFill" src='{{item.ImageUrlTemp}}' wx:if="{{item.ImageUrlServer}}" binderror="onBindError" data-id="{{item.MiaoguoCardID}}" data-serverurl="{{item.ImageUrlServer}}" />
17 17
           <view class="panelItem11 FlexColumn">
18 18
             <view class='Text1'>{{item.Content[1].ContentStr}}</view>
19 19
             <view class='Text2'>{{item.Content[2].ContentStr}}</view>
@@ -24,10 +24,10 @@
24 24
         </view>
25 25
       </view>
26 26
     </block>
27
-    <view class="lineWidthAll FlexRow" wx:if="{{List.length % 20 ==0}}">
27
+    <view class="lineWidthAll FlexRow" wx:if="{{HasPage}}">
28 28
       <view class="lineWidth750"></view>
29 29
     </view>
30
-    <view class='panelItem3 panelItem FlexRow' wx:if="{{List.length % 20 ==0}}" bindtap='gotoNextPage' data-id="{{List[List.length-1].MiaoguoCardID}}">
30
+    <view class='panelItem3 panelItem FlexRow' wx:if="{{HasPage}}" bindtap='gotoNextPage' data-id="{{List[List.length-1].MiaoguoCardID}}">
31 31
       <view class="more">更多</view>
32 32
     </view>
33 33
     <view class='lineFooter'></view>

+ 5 - 9
pages/main/searchWeb2.js

@@ -135,13 +135,9 @@ Page({
135 135
       this.data.CSS[css].Tag = tag;
136 136
       if (tag == "发音")
137 137
         this.data.CSS[css].SoundMark = soundmark;
138
-      if (tag == "拼音") {
139
-        var pinyin = main.getPinyin(content);
140
-        if (pinyin)
141
-          this.data.CSS[css].SoundMark = pinyin;
142
-      } 
138
+      
143 139
       if (tag == "读写") {
144
-        var pinyin = main.getPinyin(e.currentTarget.dataset.pinyin);
140
+        var pinyin = e.currentTarget.dataset.pinyin;
145 141
         if (pinyin)
146 142
           this.data.CSS[css].SoundMark = pinyin;
147 143
       }
@@ -179,8 +175,8 @@ Page({
179 175
         wx.removeStorageSync("TempFieldNumber");
180 176
       }
181 177
 
182
-      var id = wx.getStorageSync("TempMiaoguoCardID");
183
-      var list = wx.getStorageSync("CardList");
178
+      var id = app.globalData.TempMiaoguoCardID;
179
+      var list = app.globalData.CardList;
184 180
       for (var i = 0; i < list.length; i++) {
185 181
         if (id == list[i].MiaoguoCardID) {
186 182
           for (var key in this.data.CSS) {
@@ -225,7 +221,7 @@ Page({
225 221
           break;
226 222
         }
227 223
       }
228
-      wx.setStorageSync("CardList", list);
224
+      app.globalData.CardList=list;
229 225
 
230 226
       wx.navigateBack({
231 227
         delta: back,

+ 1 - 1
pages/main/searchWeb2.wxml

@@ -195,7 +195,7 @@
195 195
     <view class="numberContainer12 FlexRow">
196 196
       <text class='numberContainer121'>
197 197
       点一下,添加到段落1;\n
198
-      第下,添加到段落2;\n
198
+      第下,添加到段落2;\n
199 199
       第三下,添加到段落3;\n
200 200
       第四下,不添加;\n
201 201
       1、2、3是段落号码,和点选的先后顺序无关。

+ 7 - 2
pages/main/setting.js

@@ -4,8 +4,8 @@ import main from '../../utils/main';
4 4
 const app = getApp();
5 5
 const arrSortType = ["时间较早的题卡", "时间较近的题卡"];
6 6
 const arrSortType2 = ["较早的", "较近的"];
7
-var arrUserName = ["程杰", "程晟涵", "唱意班主任", "teresa", "古利古拉"];
8
-var arrUserID = [1, 2, 4, 8, 9];
7
+var arrUserName = ["程杰", "程晟涵", "大耳兔", "teresa", "古利古拉", "Lucy-chan"];
8
+var arrUserID = [1, 2, 11, 8, 9, 10];
9 9
 
10 10
 Page({
11 11
   data: {
@@ -131,6 +131,11 @@ Page({
131 131
       url: './colorplan',
132 132
     })
133 133
   },
134
+  updateMember:function(){
135
+    wx.reLaunch({
136
+      url: '../index/index',
137
+    })
138
+  },
134 139
   onShareAppMessage: function () {
135 140
     return {
136 141
       title: app.globalData.ShareTitle,

+ 74 - 12
utils/main.js

@@ -187,7 +187,7 @@ function getWindowHeight() {
187 187
   else {
188 188
     height = height + 50;
189 189
   }
190
-  console.log("height:" + height);
190
+  //console.log("height:" + height);
191 191
 
192 192
   //var height = app.globalData.systemInfo.screenHeight * 2;
193 193
   return height;
@@ -310,7 +310,6 @@ function changeStringToView(field) {
310 310
   var result = {};
311 311
   result.Field = [[]];
312 312
   result.Images = [];
313
-  result.Images2 = [];
314 313
 
315 314
   for (var j = 0; j < field.length; j++) {
316 315
     if (j == 0) {
@@ -341,17 +340,9 @@ function changeStringToView(field) {
341 340
             var obj = {};
342 341
             obj.Type = "image";
343 342
             if (arr[k].indexOf("[图]") >= 0) {
344
-              obj.Content = arr[k].substring(arr[k].indexOf("[图]") + 3, arr[k].indexOf("[/图]"));
343
+              obj.ContentServer = arr[k].substring(arr[k].indexOf("[图]") + 3, arr[k].indexOf("[/图]"));
344
+              obj.Content = getTempImage(obj.ContentServer);
345 345
               result.Images.push(obj.Content);
346
-              result.Images2.push(obj.Content);
347
-            }
348
-            else {
349
-              var temp = arr[k].substring(arr[k].indexOf("[图"), arr[k].indexOf("[/图]"));
350
-              obj.Url = temp.substring(temp.indexOf("url=") + 5, temp.indexOf("]") - 1);
351
-              temp = temp.substr(temp.indexOf("]") + 1);
352
-              obj.Content = temp;
353
-              result.Images.push(obj.Url);
354
-              result.Images2.push(obj.Content);
355 346
             }
356 347
             arrResult.push(obj);
357 348
 
@@ -446,6 +437,41 @@ function changeStringToView(field) {
446 437
   return result;
447 438
 }
448 439
 
440
+//得到当天任务
441
+function getTaskTodayList(callback) {
442
+  wx.showLoading({
443
+    title: '请稍候',
444
+    mask: true,
445
+  })
446
+  var that = this;
447
+  var CardMaxNumberNew = wx.getStorageSync("CardMaxNumberNew");
448
+  if (!CardMaxNumberNew)
449
+    CardMaxNumberNew = 10;
450
+
451
+  var CardMaxNumberHistory = wx.getStorageSync("CardMaxNumberHistory");
452
+  if (!CardMaxNumberHistory)
453
+    CardMaxNumberHistory = 30;
454
+
455
+  var SortTypeIndex = wx.getStorageSync("SortTypeIndex");
456
+  if (!SortTypeIndex)
457
+    SortTypeIndex = 0;
458
+
459
+  var url = 'GetMiaoguoCardToday?UserID=' + app.globalData.userInfo.UserID;
460
+  url += "&New=" + CardMaxNumberNew;
461
+  url += "&History=" + CardMaxNumberHistory;
462
+  url += "&SortTypeIndex=" + SortTypeIndex;
463
+
464
+  getData(url, function (data) {
465
+    wx.hideLoading();
466
+
467
+    if (data) {
468
+      app.globalData.TaskToday= data;
469
+      callback(data);
470
+
471
+    }
472
+  });
473
+}
474
+
449 475
 function getDetailColor(index) {
450 476
   var arr = [
451 477
     {//随机
@@ -588,6 +614,39 @@ function getDetailColor(index) {
588 614
     return arr;
589 615
 }
590 616
 
617
+function getTempImage(serverUrl) {
618
+  if (serverUrl.indexOf("miaguo-1253256735") >= 0) {
619
+    var list = wx.getStorageSync("TempImageList");
620
+    if (!list)
621
+      list = [];
622
+    for (var i = 0; i < list.length; i++) {
623
+      if (list[i].ServerUrl == serverUrl) {
624
+        return list[i].TempUrl;
625
+        break;
626
+      }
627
+    }
628
+  }
629
+  return serverUrl;
630
+}
631
+
632
+function saveTempImage(serverUrl, tempUrl) {
633
+  var list = wx.getStorageSync("TempImageList");
634
+  if (!list)
635
+    list = [];
636
+  var b = false;
637
+  for (var i = 0; i < list.length; i++) {
638
+    if (list[i].ServerUrl == serverUrl) {
639
+      list[i].TempUrl = tempUrl;
640
+      b = true;
641
+      break;
642
+    }
643
+  }
644
+  if (!b) {
645
+    list.push({ "ServerUrl": serverUrl, "TempUrl": tempUrl });
646
+  }
647
+  wx.setStorageSync("TempImageList", list);
648
+}
649
+
591 650
 function getPinyin(pinyin) {
592 651
   var result = [];
593 652
   var arr = getPinyinArray();
@@ -2106,4 +2165,7 @@ module.exports = {
2106 2165
   encryptUrl: EncryptUrl,
2107 2166
   decryptUrl: DecryptUrl,
2108 2167
   getPinyin: getPinyin,
2168
+  saveTempImage: saveTempImage,
2169
+  getTempImage: getTempImage,
2170
+  getTaskTodayList: getTaskTodayList,
2109 2171
 }