load_content.js 985 B

12345678910111213141516171819202122232425262728293031323334
  1. //执行JS代码
  2. var ret = {}
  3. var tmp = null
  4. if ("{{.TitleCss}}" != "") {//标题
  5. tmp = document.querySelector("{{.TitleCss}}")
  6. if (tmp) ret["title"] = tmp.getAttribute("title") || tmp.innerText
  7. }
  8. if ("{{.PublishUnitCss}}" != "") {//采购单位
  9. tmp = document.querySelector("{{.PublishUnitCss}}")
  10. if (tmp) ret["publishUnit"] = tmp.getAttribute("title") || tmp.innerText
  11. }
  12. if ("{{.PublishTimeCss}}" != "") {//发布时间
  13. tmp = document.querySelector("{{.PublishTimeCss}}")
  14. if (tmp) ret["publishTime"] = tmp.getAttribute("title") || tmp.innerText
  15. }
  16. if ("{{.ContentCss}}" != "") {//正文内容
  17. tmp = document.querySelector("{{.ContentCss}}")
  18. if (tmp) {
  19. ret["content"] = tmp.innerText
  20. ret["contentHtml"] = tmp.innerHTML
  21. }
  22. }
  23. if("{{.AttachCss}}"!=""){//附件
  24. tmp = document.querySelectorAll("{{.AttachCss}} a")
  25. let attach=[]
  26. if(tmp){
  27. tmp.forEach((v,i)=>{
  28. attach.push({title:v.getAttribute("title")||v.innerText,href:v.href})
  29. })
  30. }
  31. ret["attachLinks"]=attach
  32. }
  33. ret