Merge branch 'test' of git.backyard.segmentfault.com:opensource/answer into test

This commit is contained in:
aichy126 2022-12-01 16:22:14 +08:00
commit f651529ba1
3 changed files with 19 additions and 3 deletions

View File

@ -1222,7 +1222,7 @@ ui:
btn_submit: Save
not_found_props: "Required property {{ key }} not found."
page_review:
review: Reivew
review: Review
proposed: proposed
question_edit: Question edit
answer_edit: Answer edit

View File

@ -60,6 +60,11 @@ const Ask = () => {
const [formData, setFormData] = useState<FormDataItem>(initFormData);
const [checked, setCheckState] = useState(false);
const [focusType, setForceType] = useState('');
const resetForm = () => {
setFormData(initFormData);
setCheckState(false);
setForceType('');
};
const editorRef = useRef<EditorRef>({
getHtml: () => '',
@ -75,7 +80,11 @@ const Ask = () => {
const { data: similarQuestions = { list: [] } } = useQueryQuestionByTitle(
isEdit ? '' : formData.title.value,
);
useEffect(() => {
if (!isEdit) {
resetForm();
}
}, [isEdit]);
const { data: revisions = [] } = useQueryRevisions(qid);
useEffect(() => {

View File

@ -3,7 +3,13 @@ import { Container, Row, Col, Alert, Stack, Button } from 'react-bootstrap';
import { Link } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { BaseUserCard, FormatTime, Empty, DiffContent } from '@/components';
import {
BaseUserCard,
FormatTime,
Empty,
DiffContent,
PageTitle,
} from '@/components';
import { getReviewList, revisionAudit } from '@/services';
import { pathFactory } from '@/router/pathFactory';
import type * as Type from '@/common/interface';
@ -119,6 +125,7 @@ const Index: FC = () => {
}, []);
return (
<Container className="pt-2 mt-4 mb-5">
<PageTitle title={t('review')} />
<Row>
<Col lg={{ span: 7, offset: 1 }}>
<h3 className="mb-4">{t('review')}</h3>