no message

This commit is contained in:
kuaifan 2025-04-20 09:36:19 +08:00
parent cd0fcb903f
commit 977173d987
2 changed files with 22 additions and 3 deletions

View File

@ -221,7 +221,6 @@ class ReportController extends AbstractController
$report->updateInstance([
"title" => $input["title"],
"type" => $input["type"],
"content" => htmlspecialchars($input["content"]),
]);
} else {
// 生成唯一标识
@ -235,11 +234,25 @@ class ReportController extends AbstractController
"title" => $input["title"],
"type" => $input["type"],
"userid" => $user->userid,
"content" => htmlspecialchars($input["content"]),
]);
}
$report->save();
// 保存内容
$content = $input["content"];
preg_match_all("/<img\s+src=\"data:image\/(png|jpg|jpeg|webp);base64,(.*?)\"/s", $content, $matchs);
foreach ($matchs[2] as $key => $text) {
$tmpPath = "uploads/report/" . Carbon::parse($report->created_at)->format("Ym") . "/" . $report->id . "/attached/";
Base::makeDir(public_path($tmpPath));
$tmpPath .= md5($text) . "." . $matchs[1][$key];
if (Base::saveContentImage(public_path($tmpPath), base64_decode($text))) {
$paramet = getimagesize(public_path($tmpPath));
$content = str_replace($matchs[0][$key], '<img src="' . Base::fillUrl($tmpPath) . '" original-width="' . $paramet[0] . '" original-height="' . $paramet[1] . '"', $content);
}
}
$report->content = htmlspecialchars($content);
$report->save();
// 删除关联
$report->Receives()->delete();
if ($input["receive_content"]) {

View File

@ -40,7 +40,7 @@
</div>
</li>
</ul>
<div class="report-content user-select-auto" v-html="data.content"></div>
<div ref="reportContent" @click="onClick" class="report-content user-select-auto" v-html="data.content"></div>
</div>
</div>
</template>
@ -92,6 +92,12 @@ export default {
this.loadIng--;
});
},
onClick({target}) {
if (target.nodeName === "IMG") {
const list = $A.getTextImagesInfo(this.$refs.reportContent?.outerHTML);
this.$store.dispatch("previewImage", {index: target.currentSrc, list})
}
}
}
}
</script>