async noteContent, images, attachs

This commit is contained in:
life
2015-02-10 01:03:10 +08:00
parent 5d9fb0c1eb
commit 40879a3e38

40
node_modules/note.js generated vendored
View File

@@ -1100,26 +1100,28 @@ var Note = {
// 异步操作 // 异步操作
syncContentAndImagesAndAttachs: function(note) { syncContentAndImagesAndAttachs: function(note) {
var me = this; var me = this;
// 内容 setTimeout(function() {
console.log("syncContentAndImagesAndAttachs..................." + note.NoteId); // 内容
me.getNoteContent(note.NoteId, function(noteAndContent) { console.log("syncContentAndImagesAndAttachs..................." + note.NoteId);
if(noteAndContent) { me.getNoteContent(note.NoteId, function(noteAndContent) {
console.log('sync content ' + note.NoteId + ' ok'); if(noteAndContent) {
var content = noteAndContent.Content; console.log('sync content ' + note.NoteId + ' ok');
Web.contentSynced(note.NoteId, note.Content); var content = noteAndContent.Content;
// 图片 Web.contentSynced(note.NoteId, note.Content);
if(content) { // 图片
me.syncImages(content); if(content) {
me.syncImages(content);
}
} }
} });
});
// 附件 // 附件
var attachs = note.Attachs || []; var attachs = note.Attachs || [];
for(var i in attachs) { for(var i in attachs) {
var attach = attachs[i]; var attach = attachs[i];
me.downloadAttachFromServer(note.NoteId, attach.ServerFileId, attach.FileId); me.downloadAttachFromServer(note.NoteId, attach.ServerFileId, attach.FileId);
} }
}, 500);
}, },
// 同步图片 // 同步图片
@@ -1130,7 +1132,7 @@ var Note = {
return; return;
} }
console.log('syncImages..................'); console.log('syncImages..................');
console.log(content); // console.log(content);
// 得到图片id // 得到图片id
var reg = new RegExp(Evt.localUrl + "/api/file/getImage\\?fileId=(.{24})\"", 'g'); var reg = new RegExp(Evt.localUrl + "/api/file/getImage\\?fileId=(.{24})\"", 'g');
// var a = 'abdfileId="xxx" alksdjfasdffileId="life"'; // var a = 'abdfileId="xxx" alksdjfasdffileId="life"';