This commit is contained in:
liuyuan
2025-07-24 17:48:32 +08:00
parent 938dd816f0
commit 565f61f29c
33 changed files with 7150 additions and 7126 deletions

View File

@@ -450,26 +450,41 @@ export default {
},
getInnerHtml(html) {
const div = document.createElement("div");
div.innerHTML = html;
const children = Array.from(div.children).slice(1); // 跳过 h1
return children.map((e) => e.outerHTML).join("");
},
// Regular expression to capture all HTML tags excluding the first <h1> tag
const h1Match = html.match(/<h1[^>]*>.*?<\/h1>/);
// If an <h1> is found, remove it and process the rest
if (h1Match) {
// Remove the first <h1> and its content, then return the rest of the HTML
html = html.replace(h1Match[0], '');
}
// Return the remaining HTML
return html;
},
getTitleHtml(html, key) {
const div = document.createElement("div");
div.innerHTML = html;
var str = [
"chiefComplaint",
"historyOfPresentIllness",
"physicaExamination",
"treatmentPlan",
].includes(key)
? `<span style="color:#F56C6C;margin-right:4px">*</span>`
: "";
return div.querySelector("h1")
? div.querySelector("h1").outerHTML || "<h1></h1>"
: "";
},
const str = [
"chiefComplaint",
"historyOfPresentIllness",
"physicaExamination",
"treatmentPlan",
].includes(key)
? `<span style="color:#F56C6C;margin-right:4px">*</span>`
: "";
// Regular expression to capture the first <h1> element in the HTML
const h1Match = html.match(/<h1[^>]*>(.*?)<\/h1>/);
if (h1Match) {
// If an <h1> is found, return it with the prepended star if needed
return `<h1>${str}${h1Match[1]}</h1>`;
} else {
// If no <h1> is found, return an empty <h1>
return "<h1></h1>";
}
},
async checkPermision() {
var result = await permission.premissionCheck("CAMERA_EXTERNAL_STORAGE");
if (result != 1) {