|
|
@@ -210,61 +210,70 @@ Page({
|
|
210
|
210
|
isSave = true;
|
|
211
|
211
|
}, 5000);
|
|
212
|
212
|
|
|
213
|
|
- that.uploadImageAll(that.data.Field, function (field) {
|
|
214
|
|
- that.data.Field = field;
|
|
215
|
|
- var userid = app.globalData.userInfo.UserID;
|
|
216
|
|
- var isTodayStudy = 0;
|
|
217
|
|
- if (that.data.IsTodayStudy && that.data.UpdateType == "add2")
|
|
218
|
|
- isTodayStudy = 1;
|
|
219
|
|
-
|
|
220
|
|
- var tags = [];
|
|
221
|
|
- for (var i = 0; i < that.data.Tags.length; i++) {
|
|
222
|
|
- if (that.data.Tags[i])
|
|
223
|
|
- tags.push(that.data.Tags[i]);
|
|
224
|
|
- }
|
|
225
|
|
- var param1 = {};
|
|
226
|
|
- param1 = that.formatField(that.data.Field);
|
|
227
|
|
- param1.Tags = tags;
|
|
228
|
|
- param1.IsTodayStudy = isTodayStudy;
|
|
229
|
|
- param1.ID = that.data.MiaoguoCardID;
|
|
230
|
|
- that.saveLocalCardList(param1);
|
|
231
|
|
-
|
|
232
|
|
- // var param2 = {
|
|
233
|
|
- // param: common.Encrypt(JSON.stringify(param1))
|
|
234
|
|
- // }
|
|
235
|
|
- wx.hideLoading();
|
|
236
|
|
- wx.showLoading({
|
|
237
|
|
- title: '保存数据请稍候',
|
|
238
|
|
- mask: true,
|
|
239
|
|
- });
|
|
240
|
|
- timeoutUploadImage = setTimeout(function () {
|
|
|
213
|
+ that.uploadImageAll(that.data.Field, function (success,field) {
|
|
|
214
|
+ if (success){
|
|
|
215
|
+ that.data.Field = field;
|
|
|
216
|
+ var userid = app.globalData.userInfo.UserID;
|
|
|
217
|
+ var isTodayStudy = 0;
|
|
|
218
|
+ if (that.data.IsTodayStudy && that.data.UpdateType == "add2")
|
|
|
219
|
+ isTodayStudy = 1;
|
|
|
220
|
+
|
|
|
221
|
+ var tags = [];
|
|
|
222
|
+ for (var i = 0; i < that.data.Tags.length; i++) {
|
|
|
223
|
+ if (that.data.Tags[i])
|
|
|
224
|
+ tags.push(that.data.Tags[i]);
|
|
|
225
|
+ }
|
|
|
226
|
+ var param1 = {};
|
|
|
227
|
+ param1 = that.formatField(that.data.Field);
|
|
|
228
|
+ param1.Tags = tags;
|
|
|
229
|
+ param1.IsTodayStudy = isTodayStudy;
|
|
|
230
|
+ param1.ID = that.data.MiaoguoCardID;
|
|
|
231
|
+ that.saveLocalCardList(param1);
|
|
|
232
|
+
|
|
|
233
|
+
|
|
241
|
234
|
wx.hideLoading();
|
|
242
|
|
- }, 15000);
|
|
243
|
235
|
|
|
244
|
|
- main.postData('AddMiaoguoCard?Type=' + that.data.UpdateType + '&UserID=' + userid, param1, function (data) {
|
|
245
|
|
- wx.removeStorageSync("TempCardNoSaved");
|
|
246
|
236
|
|
|
247
|
|
- if (that.data.UpdateType == "edit" || that.data.UpdateType == "edit2" || that.data.UpdateType == "edit3") {
|
|
248
|
|
- that.onClose();
|
|
249
|
|
- }
|
|
250
|
|
- else {
|
|
|
237
|
+
|
|
|
238
|
+ wx.showLoading({
|
|
|
239
|
+ title: '保存数据请稍候',
|
|
|
240
|
+ mask: true,
|
|
|
241
|
+ });
|
|
|
242
|
+ timeoutUploadImage = setTimeout(function () {
|
|
251
|
243
|
wx.hideLoading();
|
|
252
|
|
- wx.showToast({
|
|
253
|
|
- title: '已保存!',
|
|
254
|
|
- image: "../images/universalpic_saved_white_120x120.png",
|
|
255
|
|
- });
|
|
|
244
|
+ }, 15000);
|
|
256
|
245
|
|
|
257
|
|
- if (that.data.UpdateType == "add2") {
|
|
258
|
|
- that.initAddCard();
|
|
|
246
|
+ main.postData('AddMiaoguoCard?Type=' + that.data.UpdateType + '&UserID=' + userid, param1, function (data) {
|
|
|
247
|
+ wx.removeStorageSync("TempCardNoSaved");
|
|
|
248
|
+
|
|
|
249
|
+ if (that.data.UpdateType == "edit" || that.data.UpdateType == "edit2" || that.data.UpdateType == "edit3") {
|
|
|
250
|
+ that.onClose();
|
|
259
|
251
|
}
|
|
|
252
|
+ else {
|
|
|
253
|
+ wx.hideLoading();
|
|
|
254
|
+ wx.showToast({
|
|
|
255
|
+ title: '已保存!',
|
|
|
256
|
+ image: "../images/universalpic_saved_white_120x120.png",
|
|
|
257
|
+ });
|
|
|
258
|
+
|
|
|
259
|
+ if (that.data.UpdateType == "add2") {
|
|
|
260
|
+ that.initAddCard();
|
|
|
261
|
+ }
|
|
260
|
262
|
|
|
261
|
|
- var taskToday = app.globalData.TaskToday;
|
|
262
|
|
- taskToday.CardNumber++;
|
|
263
|
|
- app.globalData.TaskToday = taskToday;
|
|
|
263
|
+ var taskToday = app.globalData.TaskToday;
|
|
|
264
|
+ taskToday.CardNumber++;
|
|
|
265
|
+ app.globalData.TaskToday = taskToday;
|
|
264
|
266
|
|
|
265
|
|
- }
|
|
266
|
|
- wx.removeStorageSync("TempCardInfo");
|
|
267
|
|
- });
|
|
|
267
|
+ }
|
|
|
268
|
+ wx.removeStorageSync("TempCardInfo");
|
|
|
269
|
+ });
|
|
|
270
|
+ }
|
|
|
271
|
+ else{
|
|
|
272
|
+ wx.showToast({
|
|
|
273
|
+ title: '图片上传失败',
|
|
|
274
|
+ mask: true,
|
|
|
275
|
+ });
|
|
|
276
|
+ }
|
|
268
|
277
|
});
|
|
269
|
278
|
}
|
|
270
|
279
|
else {
|
|
|
@@ -363,6 +372,8 @@ Page({
|
|
363
|
372
|
console.log("arrResult:" + JSON.stringify(arrResult));
|
|
364
|
373
|
|
|
365
|
374
|
clearInterval(interval);
|
|
|
375
|
+ var success=true;
|
|
|
376
|
+
|
|
366
|
377
|
var ari = 0;
|
|
367
|
378
|
for (var i = 0; i < arr.length; i++) {
|
|
368
|
379
|
for (var j = 0; j < arr[i].length; j++) {
|
|
|
@@ -375,24 +386,26 @@ Page({
|
|
375
|
386
|
break;
|
|
376
|
387
|
}
|
|
377
|
388
|
}
|
|
378
|
|
- console.log("serverUrl:" + serverUrl);
|
|
379
|
|
- console.log("tempUrl:" + tempUrl);
|
|
|
389
|
+ //console.log("serverUrl:" + serverUrl);
|
|
|
390
|
+ //console.log("tempUrl:" + tempUrl);
|
|
380
|
391
|
|
|
381
|
392
|
main.saveTempImage(serverUrl, tempUrl);
|
|
382
|
393
|
arr[i][j].Content = serverUrl;
|
|
383
|
394
|
arr[i][j].ContentServer = serverUrl;
|
|
384
|
395
|
|
|
|
396
|
+ if (serverUrl==""){
|
|
|
397
|
+ success=false;
|
|
|
398
|
+ break;
|
|
|
399
|
+ }
|
|
385
|
400
|
}
|
|
386
|
401
|
}
|
|
387
|
402
|
}
|
|
388
|
403
|
//console.log(JSON.stringify(arr));
|
|
389
|
|
- callback(arr);
|
|
|
404
|
+ callback(success,arr);
|
|
390
|
405
|
}
|
|
391
|
406
|
}, 500);
|
|
392
|
407
|
},
|
|
393
|
408
|
uploadImage: function (file, callback) {
|
|
394
|
|
-
|
|
395
|
|
-
|
|
396
|
409
|
var url = common.Encrypt("MiaoguoUploadFile2");
|
|
397
|
410
|
wx.uploadFile({
|
|
398
|
411
|
url: app.globalData.serverUrl + url,
|
|
|
@@ -783,7 +796,13 @@ Page({
|
|
783
|
796
|
str2 = that.data.FieldContent.substring(tempCursor, that.data.FieldContent.length);
|
|
784
|
797
|
}
|
|
785
|
798
|
|
|
786
|
|
- var str0 = "[图 w='" + res.width + "' h='" + res.height + "']" + tempFilePaths[0] + "[/图]";
|
|
|
799
|
+ var width = res.width;
|
|
|
800
|
+ if (isNaN(width))
|
|
|
801
|
+ width = 650;
|
|
|
802
|
+ var height = res.height;
|
|
|
803
|
+ if (isNaN(height))
|
|
|
804
|
+ height = 650;
|
|
|
805
|
+ var str0 = "[图 w='" + width + "' h='" + height + "']" + tempFilePaths[0] + "[/图]";
|
|
787
|
806
|
|
|
788
|
807
|
that.data.FieldContent = str1 + str0 + str2;
|
|
789
|
808
|
|