12345678910111213141516171819202122232425262728293031323334 |
- //执行JS代码
- var ret = {}
- var tmp = null
- if ("{{.TitleCss}}" != "") {//标题
- tmp = document.querySelector("{{.TitleCss}}")
- if (tmp) ret["title"] = tmp.getAttribute("title") || tmp.innerText
- }
- if ("{{.PublishUnitCss}}" != "") {//采购单位
- tmp = document.querySelector("{{.PublishUnitCss}}")
- if (tmp) ret["publishUnit"] = tmp.getAttribute("title") || tmp.innerText
- }
- if ("{{.PublishTimeCss}}" != "") {//发布时间
- tmp = document.querySelector("{{.PublishTimeCss}}")
- if (tmp) ret["publishTime"] = tmp.getAttribute("title") || tmp.innerText
- }
- if ("{{.ContentCss}}" != "") {//正文内容
- tmp = document.querySelector("{{.ContentCss}}")
- if (tmp) {
- ret["content"] = tmp.innerText
- ret["contentHtml"] = tmp.innerHTML
- }
- }
- if("{{.AttachCss}}"!=""){//附件
- tmp = document.querySelectorAll("{{.AttachCss}} a")
- let attach=[]
- if(tmp){
- tmp.forEach((v,i)=>{
- attach.push({title:v.getAttribute("title")||v.innerText,href:v.href})
- })
- }
- ret["attachLinks"]=attach
- }
- ret
|