temp-preview-panel.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. var TempPreviewPanel = {
  2. template: '<div>\
  3. <div></div>\
  4. <a class="back-btn c-t-center mr15" @click="goBack">\
  5. 返回\
  6. </a>\
  7. </div>',
  8. props: [],
  9. data: function() {
  10. return {
  11. }
  12. },
  13. methods: {
  14. listDetail: function() {
  15. var vm = this
  16. guidanceAPI.listDetail({
  17. modelCode: vm.modelCode
  18. }).then(function(res) {
  19. var data = res.data
  20. if(data) {
  21. vm.content = data.content
  22. vm.modelName = data.modelName
  23. vm.imgs = _.map(data.imagesUrls, function(s) {
  24. return httpRequest.getImgUrl(s)
  25. })
  26. }
  27. })
  28. },
  29. getDetail: function (){
  30. var regN = /\n/g;
  31. var regRN = /\r\n/g;
  32. var content = detail.content.replace(/ /g, "&nbsp;");
  33. content = content.replace(regN,"<br/>");
  34. var p = "<p class='c-f14 c-333'>"+content+"</p>",
  35. images = "";
  36. for(i=0; i<detail.images.length; i++){
  37. var src = detail.images[i];
  38. if(!(src.indexOf("file://") > -1)){
  39. src = getImgUrl(detail.images[i]);
  40. }
  41. images += "<div class='mtb10'><img src='"+src+"' width='100%'></div>";
  42. }
  43. $(".content").append(p+images);
  44. },
  45. goBack: function() {
  46. this.$router.back()
  47. }
  48. }
  49. }