From 40879a3e38c803b1b7cf011c0f75b59775aad8ab Mon Sep 17 00:00:00 2001 From: life Date: Tue, 10 Feb 2015 01:03:10 +0800 Subject: [PATCH] async noteContent, images, attachs --- node_modules/note.js | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/node_modules/note.js b/node_modules/note.js index e42a9a1b..5311e69a 100644 --- a/node_modules/note.js +++ b/node_modules/note.js @@ -1100,26 +1100,28 @@ var Note = { // 异步操作 syncContentAndImagesAndAttachs: function(note) { var me = this; - // 内容 - console.log("syncContentAndImagesAndAttachs..................." + note.NoteId); - me.getNoteContent(note.NoteId, function(noteAndContent) { - if(noteAndContent) { - console.log('sync content ' + note.NoteId + ' ok'); - var content = noteAndContent.Content; - Web.contentSynced(note.NoteId, note.Content); - // 图片 - if(content) { - me.syncImages(content); + setTimeout(function() { + // 内容 + console.log("syncContentAndImagesAndAttachs..................." + note.NoteId); + me.getNoteContent(note.NoteId, function(noteAndContent) { + if(noteAndContent) { + console.log('sync content ' + note.NoteId + ' ok'); + var content = noteAndContent.Content; + Web.contentSynced(note.NoteId, note.Content); + // 图片 + if(content) { + me.syncImages(content); + } } - } - }); + }); - // 附件 - var attachs = note.Attachs || []; - for(var i in attachs) { - var attach = attachs[i]; - me.downloadAttachFromServer(note.NoteId, attach.ServerFileId, attach.FileId); - } + // 附件 + var attachs = note.Attachs || []; + for(var i in attachs) { + var attach = attachs[i]; + me.downloadAttachFromServer(note.NoteId, attach.ServerFileId, attach.FileId); + } + }, 500); }, // 同步图片 @@ -1130,7 +1132,7 @@ var Note = { return; } console.log('syncImages..................'); - console.log(content); + // console.log(content); // 得到图片id var reg = new RegExp(Evt.localUrl + "/api/file/getImage\\?fileId=(.{24})\"", 'g'); // var a = 'abdfileId="xxx" alksdjfasdffileId="life"';