This commit is contained in:
熊丽君
2021-08-17 08:41:17 +08:00
parent d27bf459d1
commit 96054835fd
5 changed files with 127 additions and 103 deletions

View File

@ -12,26 +12,19 @@ export function formatRichText(url, id) {
for (let i = 0; i < src.length; i++) {
const string = src[i].getAttribute('src');
endUrl.push(string);
const flag = string.includes('http://');
// 域名存在
if (status) {
if (i == src.length - 1) {
const data = {
startUrl: url,
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);
}
});
}
if (endUrl.length) {
const data = {
startUrl: url,
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);
}
} else {
// 域名不存在并且不包含http
if (!flag) src[i].setAttribute('src', url + string);
}
});
}
// let src2 = document.querySelectorAll('#text .ql-editor a');
let src2 = document.querySelectorAll('#text a');