feat: 添加示例作文加载功能
This commit is contained in:
parent
c206175c9e
commit
d2c005fc73
Binary file not shown.
|
After Width: | Height: | Size: 208 KiB |
|
|
@ -9,6 +9,7 @@ import {
|
|||
IMAGE_MAX_SIZE_MB,
|
||||
IMAGE_ALLOWED_TYPES_ESSAY,
|
||||
} from "@/config/index.js";
|
||||
import demoZuowen from "@/assets/demo/zuowen.jpg";
|
||||
|
||||
const API_KEY = GRS_API_KEY;
|
||||
const API_URL = ESSAY_API_URL;
|
||||
|
|
@ -75,6 +76,13 @@ const resetUpload = () => {
|
|||
if (fileInputRef.value) fileInputRef.value.value = "";
|
||||
};
|
||||
|
||||
const loadDemoImage = async () => {
|
||||
const response = await fetch(demoZuowen);
|
||||
const blob = await response.blob();
|
||||
const file = new File([blob], "zuowen.jpg", { type: "image/jpeg" });
|
||||
await handleFile(file);
|
||||
};
|
||||
|
||||
const startCorrection = async () => {
|
||||
if (!originalBase64.value || status.value === "processing") return;
|
||||
status.value = "processing";
|
||||
|
|
@ -217,6 +225,7 @@ const closeLightbox = () => {
|
|||
</div>
|
||||
<p class="upload-title">点击或拖拽上传作文图片</p>
|
||||
<p class="upload-hint">支持 JPG、PNG 格式,最大 10MB</p>
|
||||
<button class="demo-btn" @click.stop="loadDemoImage">示例作文</button>
|
||||
</div>
|
||||
|
||||
<!-- Preview + Action -->
|
||||
|
|
@ -433,6 +442,21 @@ const closeLightbox = () => {
|
|||
color: var(--text-secondary);
|
||||
margin: 0;
|
||||
}
|
||||
.demo-btn {
|
||||
margin-top: 0.75rem;
|
||||
background: rgba(236, 72, 153, 0.1);
|
||||
border: 1px solid rgba(236, 72, 153, 0.3);
|
||||
color: #ec4899;
|
||||
padding: 0.5rem 1.25rem;
|
||||
border-radius: 20px;
|
||||
font-size: 0.875rem;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
.demo-btn:hover {
|
||||
background: rgba(236, 72, 153, 0.2);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
/* Preview */
|
||||
.preview-section {
|
||||
|
|
|
|||
Loading…
Reference in New Issue