Skip to content
This repository has been archived by the owner on Nov 28, 2024. It is now read-only.

Commit

Permalink
optim resp-show & fix file reupload function
Browse files Browse the repository at this point in the history
  • Loading branch information
Weidows committed Dec 15, 2023
1 parent 6ff9dca commit ff90ea2
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 19 deletions.
4 changes: 4 additions & 0 deletions react-app/src/components/FileCard/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,7 @@
@apply text-indigo-500 text-lg;
@apply dark:text-indigo-300;
}

h1, h2, h3, h4, h5, h6 {
font-size: none;
}
25 changes: 21 additions & 4 deletions react-app/src/components/FileCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export interface FileCardCommonProps {

done: boolean;
// TODO
overview: string;
overview: any;

mentionables: People[];
mentioned: People[];
Expand Down Expand Up @@ -154,9 +154,26 @@ export function FileCard(props: FileCardProps) {
<div className="w-full">
<h2> 处理结果 </h2>
<DashedSparator className={s("my-4")} />
<pre className={s("overview white-space:pre")}>
{props.overview}
</pre>
{props.overview && (
<div className={s("overview")}>
{Object.entries(props.overview).map(([key, value]) => (
<div key={key}>
<h3 className={s("university-recommends")}>{key}</h3>

{Object.entries(value as any).map(([key, value]) => (
<div key={key}>
<div className={s("university-info")}>
<p>
{key}: {value as string}
</p>
</div>
</div>
))}
<br></br>
</div>
))}
</div>
)}
<DashedSparator className={s("my-4")} />
{/* <div className={s("card horizontal bordered")}>
<div className="flex flex-row space-x-4 items-center flex-1 w-0">
Expand Down
28 changes: 13 additions & 15 deletions react-app/src/pages/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,12 @@ const Home = () => {
// TODO 组件还是单选状态
const files = event.target.files;
if (!files) return;

for (let i = 0; i < files.length; i++) {
processFile(files[i]);
}

// 置空, 否则重复点同一个文件不触发
event.target.value = "";
};

// 处理文件拖拽/点击上传后的操作
Expand All @@ -160,7 +162,7 @@ const Home = () => {
filesize: file.size,
uploadProgress: 0,
done: false,
overview: "",
overview: {},
mentioned: [],
mentionables: [],
};
Expand Down Expand Up @@ -223,7 +225,9 @@ const Home = () => {
case TabIDsEnum.StudyAbroadPlanning:
updateProps({
...fileProps,
overview: "处理中, 请稍候...",
overview: {
提示: { "1": "处理中, 请稍候...", "2": "预计时长1~2分钟" },
},
});
GetStudyAboardPlanning(payload)
.then((response) => {
Expand All @@ -233,7 +237,7 @@ const Home = () => {
done: true,
mentioned: [],
mentionables: [],
overview: JSON.stringify(response.data, undefined, 2),
overview: response.data,
grade: 0,
});
})
Expand Down Expand Up @@ -521,15 +525,13 @@ const Home = () => {
<p> 拖拽文件到此处发送 </p>
</div>
<div
className={s("upload-button")}
onClick={() =>
document
.getElementById("reports-review-file-upload")
?.click()
document.getElementById("file-input")?.click()
}
className={s("upload-button")}
>
<input
id="reports-review-file-upload"
id="file-input"
type="file"
onChange={handleFileSelect}
style={{ display: "none" }}
Expand Down Expand Up @@ -608,15 +610,11 @@ const Home = () => {
<div
className={s("upload-button")}
onClick={() =>
document
.getElementById(
"study-abroad-planning-file-upload"
)
?.click()
document.getElementById("file-input")?.click()
}
>
<input
id="study-abroad-planning-file-upload"
id="file-input"
type="file"
onChange={handleFileSelect}
style={{ display: "none" }}
Expand Down

0 comments on commit ff90ea2

Please sign in to comment.