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