Commit 0e4673ac authored by danfuman's avatar danfuman

修改

parent 2dae0abe
...@@ -54,8 +54,48 @@ function saveFixed(field, num=2){ ...@@ -54,8 +54,48 @@ function saveFixed(field, num=2){
return parseFloat(field.toFixed(num)) return parseFloat(field.toFixed(num))
} }
//移除字符串中指定标签
let removeTag = function(str, external, implant, row) { //str字符串, external外部引用方式的标签组[一个标签], implant嵌入引用的标签组[包含首尾标签], row行内标签组
let newHtml = str
if(external){
let externalArr = external.split(",")
for (let item of externalArr){
newHtml = newHtml.replace(new RegExp("<"+item+"([^>]+)>", "img"),"")
}
}
if(implant){
let implantArr = implant.split(",")
for (let item of implantArr){
newHtml = newHtml.replace(new RegExp("<"+item+"[^>]*>([\\S\\s]*?)<\/"+item+">", "img"),"")
}
}
if(row){
let rowArr = row.split(",")
for (let item of rowArr){
newHtml = newHtml.replace(new RegExp(""+item+"\\s*?=\\s*?(['`\"])[\\s\\S]*?\\1", "img"),"")
}
}
return newHtml
}
//替换字符串中指定标签
let checkTag = function(str, oldTag, newTag) { //str字符串, oldTag当前标签数组, newTag替换后的新标签数组
let newHtml = str
if(oldTag && newTag){
let oldArr = oldTag.split(",")
let newArr = newTag.split(",")
if(oldArr.length==newArr.length){
for (let i=0; i<oldArr.length; i++){
newHtml = newHtml.replace(new RegExp("<"+oldArr[i]+"\\b[^>]*>([\\S\\s]*?)<\\/"+oldArr[i]+">", "img"), "<"+newArr[i]+">$1</"+newArr[i]+">")
}
}
}
return newHtml
}
export { export {
encodeStr, encodeStr,
changePath, changePath,
saveFixed saveFixed,
removeTag,
checkTag
} }
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<span class="list-label list-label-zb" v-if="textList.tenderStage"> <span class="list-label list-label-zb" v-if="textList.tenderStage">
{{textList.tenderStage}} {{textList.tenderStage}}
</span> </span>
<span class="list-label" v-if="textList.province||textList.city||textList.area">{{textList.province}}<template v-if="textList.city">-{{textList.city}}</template><template v-if="textList.area">-{{textList.area}}</template></span> <span class="list-label" v-if="textList.province||textList.city||textList.area">{{textList.province}}<template v-if="textList.city">-{{textList.city}}</template><template v-if="textList.area">-{{textList.area}}</template></span>
<span class="list-label list-label-zb" v-if="textList.businessType"> <span class="list-label list-label-zb" v-if="textList.businessType">
{{textList.businessType}} {{textList.businessType}}
...@@ -19,22 +19,22 @@ ...@@ -19,22 +19,22 @@
{{textList.industry}} {{textList.industry}}
</span> </span>
</div> </div>
<div class="list-content"> <div class="list-content">
<p class="list-content-text" v-if="textList.tenderee"> <p class="list-content-text" v-if="textList.tenderee">
<span>招采单位:</span> <span>招采单位:</span>
<router-link v-if="textList.tenderee" :to="textList.tendereeUipId?'/enterprise/' + encodeStr(textList.tendereeId) :'/company/' + encodeStr(textList.tendereeId) " tag="a" class="list-titel-a blue" v-html="textList.tenderee"></router-link> <router-link v-if="textList.tenderee" :to="textList.tendereeUipId?'/enterprise/' + encodeStr(textList.tendereeId) :'/company/' + encodeStr(textList.tendereeId) " tag="a" class="list-titel-a blue" v-html="textList.tenderee"></router-link>
<span v-else>--</span> <span v-else>--</span>
</p> </p>
<p class="list-content-text" v-if="textList.agency"> <p class="list-content-text" v-if="textList.agency">
<span>代理单位:</span> <span>代理单位:</span>
<router-link v-if="textList.agency" :to="textList.agencyUipId?'/enterprise/' + encodeStr(textList.agencyId) :'/company/' + encodeStr(textList.agencyId) " tag="a" class="list-titel-a blue" v-html="textList.agency"></router-link> <router-link v-if="textList.agency" :to="textList.agencyUipId?'/enterprise/' + encodeStr(textList.agencyId) :'/company/' + encodeStr(textList.agencyId) " tag="a" class="list-titel-a blue" v-html="textList.agency"></router-link>
<span v-else>--</span> <span v-else>--</span>
</p> </p>
</div> </div>
<div class="list-content" v-if="textList.projectAmount||textList.contact"> <div class="list-content" v-if="textList.projectAmount||textList.contact">
<p class="list-content-text" v-if="textList.projectAmount"> <p class="list-content-text" v-if="textList.projectAmount">
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
<span >招采单位 {{textList.contact}}{{textList.contactTel}}</span> <span >招采单位 {{textList.contact}}{{textList.contactTel}}</span>
</p> </p>
</div> </div>
<div class="list-content" v-if="textList.issueTime||textList.overTime||textList.dataSource"> <div class="list-content" v-if="textList.issueTime||textList.overTime||textList.dataSource">
<p class="list-content-text" v-if="textList.issueTime"> <p class="list-content-text" v-if="textList.issueTime">
<span>发布时间:</span> <span>发布时间:</span>
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
<span >{{textList.dataSource||'--'}}</span> <span >{{textList.dataSource||'--'}}</span>
</p> </p>
</div> </div>
</li> </li>
</ul> </ul>
...@@ -82,20 +82,20 @@ ...@@ -82,20 +82,20 @@
</span> </span>
</div> </div>
<div class="main3-box" v-html="textList.content"> <div class="main3-box" v-html="textList.content">
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import "@/assets/styles/public.scss"; import "@/assets/styles/public.scss";
import api from '@/api/radar/radar.js'; import api from '@/api/radar/radar.js';
import {encodeStr} from "@/assets/js/common.js" import {encodeStr,removeTag,checkTag} from "@/assets/js/common.js"
export default { export default {
name: 'TenderDetails', name: 'TenderDetails',
...@@ -118,11 +118,13 @@ ...@@ -118,11 +118,13 @@
}).then(res => { }).then(res => {
// console.log(res); // console.log(res);
this.textList = res.data; this.textList = res.data;
this.textList.content = removeTag(res.data.content, 'link,meta', 'script,style', 'href,target,style') //采集详情针对性处理
this.textList.content = checkTag(res.data.content, 'h1,a', 'b,span') //采集详情针对性处理
}).catch(error => { }).catch(error => {
}); });
}, },
} }
} }
...@@ -325,7 +327,7 @@ ...@@ -325,7 +327,7 @@
min-height: 400px; min-height: 400px;
border: 1px solid #D8D8D8; border: 1px solid #D8D8D8;
padding: 16px; padding: 16px;
overflow: hidden;
} }
.list-content-img{ .list-content-img{
position: absolute; position: absolute;
...@@ -349,4 +351,4 @@ ...@@ -349,4 +351,4 @@
} }
</style> </style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment