guidance-detail.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. new Vue({
  2. el: '#app',
  3. data:{
  4. guidanceData:""
  5. },
  6. methods:{
  7. },
  8. mounted: function(){
  9. var vm = this
  10. var Request = GetRequest();
  11. var id = Request["id"];
  12. recordAPI.guidanceDetail({id:id}).then(function(res){
  13. if(res.status == 200){
  14. var data = res.data;
  15. var regN = /\n/g;
  16. var regRN = /\r\n/g;
  17. var content = data.content.replace(/ /g, " ");
  18. content = content.replace(regN,"<br/>");
  19. var p = "<p class='c-f14 c-333'>"+content+"</p>",
  20. images = "",
  21. imagesList = [];
  22. if(data.images && data.images.length > 0){
  23. imagesList = data.images.split(",");
  24. }
  25. for(i=0; i<imagesList.length; i++){
  26. var src = httpRequest.getImgUrl(imagesList[i]);
  27. images += "<div class='img-contain'><img class='set-img' src='"+src+"'></div>";
  28. }
  29. vm.guidanceData = p+images
  30. }else{
  31. top.toastr.error(res.msg)
  32. }
  33. })
  34. var divH = $(".layui-layer-content",parent.document).height();
  35. $(".pc-container").slimScroll({ height: divH,color: '#666'});
  36. $(".mobile-text").slimScroll({ height: '421px',color: '#666'});
  37. },
  38. })