preview.js 1.1 KB

1234567891011121314151617181920212223242526272829
  1. var isEdit;
  2. var articleId;
  3. mui.plusReady(function() {
  4. var self = plus.webview.currentWebview(),
  5. articleTitle = self.articleTitle,
  6. secondLevelCategoryName = self.secondLevelCategoryName,
  7. imgCover = self.imgCover && self.imgCover[0],//封面图
  8. content = self.content,//内容
  9. imgContent = self.imgContent ? self.imgContent : [],//用于未上传图
  10. uploadImgs = self.uploadImgs ? self.uploadImgs : [],//用于已上传图
  11. userScope = self.userScope;//使用范围
  12. for(var i = 0, len = uploadImgs.length; i < len; i++) {
  13. content += '<img style="display: block;max-width: 100%;" src="' + getImgUrl(uploadImgs[i]) + '" alt="内容图" />'
  14. }
  15. for(var i = 0, len = imgContent.length; i < len; i++) {
  16. content += '<img style="display: block;max-width: 100%;" src="' + imgContent[i] + '" alt="内容图" />'
  17. }
  18. var articlePreview = {
  19. articleTitle: articleTitle,
  20. secondLevelCategoryName: secondLevelCategoryName,
  21. imgCover: imgCover,//封面图
  22. content: content,//内容
  23. userScope: userScope//使用范围
  24. }
  25. var html = template('articlePreview_tmpl',{it:articlePreview})
  26. $('#main').html(html)
  27. })