修改的内容
This commit is contained in:
@@ -233,22 +233,13 @@ export default {
|
|||||||
// 新增操作
|
// 新增操作
|
||||||
if (this.form.sendType === 'grade') {
|
if (this.form.sendType === 'grade') {
|
||||||
// 按年级发送
|
// 按年级发送
|
||||||
// 创建一个临时div来提取纯文本
|
// 直接发送原始内容,保留用户输入的 <a href="..."> 标签,以便后端存入数据库并转换为 Markdown 发送给企业微信
|
||||||
const tempDiv = document.createElement('div')
|
const content = this.form.content || ''
|
||||||
tempDiv.innerHTML = this.form.content
|
const title = this.form.title || ''
|
||||||
// 将可能存在的 a 标签转换为 markdown 链接,其他标签去除
|
|
||||||
const html = this.form.content || ''
|
|
||||||
const md = this.convertHtmlLinkToMarkdown(html)
|
|
||||||
const plainText = md !== null ? md : (tempDiv.textContent || tempDiv.innerText || '')
|
|
||||||
|
|
||||||
// 提取标题的纯文本
|
|
||||||
const titleDiv = document.createElement('div')
|
|
||||||
titleDiv.innerHTML = this.form.title || ''
|
|
||||||
const plainTitle = titleDiv.textContent || titleDiv.innerText || ''
|
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
title: plainTitle,
|
title: title,
|
||||||
content: plainText,
|
content: content,
|
||||||
selectedGrades: this.form.selectedGrades
|
selectedGrades: this.form.selectedGrades
|
||||||
}
|
}
|
||||||
sendNotificationByGrades(data).then(response => {
|
sendNotificationByGrades(data).then(response => {
|
||||||
|
|||||||
Reference in New Issue
Block a user