政策详情图片的处理,修改推送字段类型为int
This commit is contained in:
@ -1,5 +1,30 @@
|
||||
import { handlePic } from '@/api/policy/library';
|
||||
export function formatRichText(url, id) {
|
||||
export let urlList =[
|
||||
'http://ahchjkq.hefei.gov.cn/',
|
||||
'http://bhkxc.hefei.gov.cn/',
|
||||
'http://cxjsj.hefei.gov.cn/index.html',
|
||||
'http://drc.hefei.gov.cn/',
|
||||
'http://gxq.hefei.gov.cn/',
|
||||
'http://hetda.hefei.gov.cn/',
|
||||
'http://hfxz.hefei.gov.cn/index.html',
|
||||
'http://jxj.hefei.gov.cn/index.html',
|
||||
'http://kjj.hefei.gov.cn/',
|
||||
'http://rsj.hefei.gov.cn/',
|
||||
'http://swj.hefei.gov.cn/',
|
||||
'http://sjzyj.hefei.gov.cn/',
|
||||
'http://www.ahfeixi.gov.cn/',
|
||||
'http://www.ahhfly.gov.cn/index.html',
|
||||
'http://www.baohe.gov.cn/index.html',
|
||||
'http://www.changfeng.gov.cn/',
|
||||
'http://www.chaohu.gov.cn/',
|
||||
'http://www.feidong.gov.cn/index.html',
|
||||
'http://www.hefei.gov.cn/',
|
||||
'http://wlj.hefei.gov.cn/index.html',
|
||||
'http://www.hfyaohai.gov.cn/',
|
||||
'http://www.hfss.gov.cn/index.html',
|
||||
'http://www.lj.gov.cn/',
|
||||
]
|
||||
export function formatRichText(dowUrl, id, url) {
|
||||
// let src = document.querySelectorAll('#text .ql-editor img');
|
||||
|
||||
/**
|
||||
@ -15,23 +40,33 @@ export function formatRichText(url, id) {
|
||||
}
|
||||
if (endUrl.length) {
|
||||
const data = {
|
||||
startUrl: url,
|
||||
startUrl: dowUrl,
|
||||
policyId: id,
|
||||
endUrl
|
||||
};
|
||||
handlePic(data).then(({ data: res }) => {
|
||||
console.log(res);
|
||||
for (let i = 0; i < src.length; i++) {
|
||||
src[i].setAttribute('src', res[i].name);
|
||||
let flag = true;
|
||||
urlList.map(item=>{
|
||||
if(url.includes(item)){
|
||||
flag = false;
|
||||
handlePic(data).then(({ data: res }) => {
|
||||
for (let i = 0; i < src.length; i++) {
|
||||
src[i].setAttribute('src', res[i].name);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
if(flag){
|
||||
for (let i = 0; i < src.length; i++) {
|
||||
src[i].setAttribute('src', dowUrl+endUrl[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// let src2 = document.querySelectorAll('#text .ql-editor a');
|
||||
let src2 = document.querySelectorAll('#text a');
|
||||
for (let i = 0; i < src2.length; i++) {
|
||||
const string = src2[i].getAttribute('href');
|
||||
const flag = string.includes('http://');
|
||||
if (!flag) src2[i].setAttribute('href', url + string);
|
||||
if (!flag) src2[i].setAttribute('href', dowUrl + string);
|
||||
}
|
||||
// var imgReg = /<img.*?(?:>|\/>)/gi;
|
||||
// var srcReg = /src=[\'\"]?([^\'\"]*)[\'\"]?/i;
|
||||
@ -45,14 +80,14 @@ export function formatRichText(url, id) {
|
||||
// if (src[1]) {
|
||||
// var newContent = html.replace(
|
||||
// /\<img/gi,
|
||||
// `<img src="${url}${src[1]}"`
|
||||
// `<img src="${dowUrl}${src[1]}"`
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// return this.aaa(url, newContent);
|
||||
// return this.aaa(dowUrl, newContent);
|
||||
}
|
||||
// function aaa(url, html) {
|
||||
// console.log(url);
|
||||
// function aaa(dowUrl, html) {
|
||||
// console.log(dowUrl);
|
||||
// console.log(html);
|
||||
// var aReg = /<a.*?(?:>|\/>)/gi;
|
||||
// var hrefReg = /href=[\'\"]?([^\'\"]*)[\'\"]?/i;
|
||||
@ -61,7 +96,7 @@ export function formatRichText(url, id) {
|
||||
// let src = arr2[i].match(hrefReg);
|
||||
// //获取图片地址
|
||||
// if (src[1]) {
|
||||
// var newContent = html.replace(/\<a/gi, `<a href="${url}${src[1]}"`);
|
||||
// var newContent = html.replace(/\<a/gi, `<a href="${dowUrl}${src[1]}"`);
|
||||
// }
|
||||
// // 替换src
|
||||
// // if (src[0]) {
|
||||
|
@ -297,7 +297,7 @@ export default {
|
||||
ruleForm: {
|
||||
handler: function () {
|
||||
this.$nextTick(() => {
|
||||
this.formatRichText(this.ruleForm.downloadUrl, this.ruleForm.id);
|
||||
this.formatRichText(this.ruleForm.downloadUrl, this.ruleForm.id,this.ruleForm.url);
|
||||
});
|
||||
},
|
||||
},
|
||||
|
@ -198,14 +198,14 @@
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="small"
|
||||
:disabled="scope.row.status === 1"
|
||||
:disabled="scope.row.status == 1"
|
||||
type="text"
|
||||
@click="push([scope.row.id])"
|
||||
>推送</el-button
|
||||
>
|
||||
<el-button
|
||||
size="small"
|
||||
:disabled="scope.row.status === 0"
|
||||
:disabled="scope.row.status == 0"
|
||||
type="text"
|
||||
@click="revoke(scope.row.id)"
|
||||
>撤销</el-button
|
||||
@ -373,8 +373,11 @@ export default {
|
||||
},
|
||||
getList() {
|
||||
this.loading = true
|
||||
getPolicy(this.queryParams).then(({ data }) => {
|
||||
getPolicy(Object.assign({},this.queryParams,{status:this.queryParams.status - 0})).then(({ data }) => {
|
||||
this.libraryList = data.list;
|
||||
this.libraryList.map(item=>{
|
||||
item.status = item.status.toString()
|
||||
})
|
||||
this.total = data.total;
|
||||
this.loading = false
|
||||
});
|
||||
|
Reference in New Issue
Block a user