|
|
@@ -44,8 +44,7 @@ const DiscussionListCardWidget = ({
|
|
|
let url: string = "";
|
|
|
if (typeof topicId !== "undefined") {
|
|
|
url = `/v2/discussion?view=question-by-topic&id=${topicId}`;
|
|
|
- }
|
|
|
- if (typeof resId !== "undefined") {
|
|
|
+ } else if (typeof resId !== "undefined") {
|
|
|
url = `/v2/discussion?view=question&id=${resId}`;
|
|
|
}
|
|
|
if (url === "") {
|
|
|
@@ -88,39 +87,37 @@ const DiscussionListCardWidget = ({
|
|
|
}
|
|
|
|
|
|
return (
|
|
|
- <div>
|
|
|
- <Card title="讨论" extra={"More"}>
|
|
|
- {data.length > 0 ? (
|
|
|
- <CommentList
|
|
|
- onSelect={(
|
|
|
- e: React.MouseEvent<HTMLSpanElement, MouseEvent>,
|
|
|
- comment: IComment
|
|
|
- ) => {
|
|
|
- if (typeof onSelect !== "undefined") {
|
|
|
- onSelect(e, comment);
|
|
|
- }
|
|
|
- }}
|
|
|
- data={data}
|
|
|
- />
|
|
|
- ) : undefined}
|
|
|
+ <Card title="讨论" extra={"More"}>
|
|
|
+ {data.length > 0 ? (
|
|
|
+ <CommentList
|
|
|
+ onSelect={(
|
|
|
+ e: React.MouseEvent<HTMLSpanElement, MouseEvent>,
|
|
|
+ comment: IComment
|
|
|
+ ) => {
|
|
|
+ if (typeof onSelect !== "undefined") {
|
|
|
+ onSelect(e, comment);
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ data={data}
|
|
|
+ />
|
|
|
+ ) : undefined}
|
|
|
|
|
|
- {resId && resType ? (
|
|
|
- <CommentCreate
|
|
|
- contentType="markdown"
|
|
|
- resId={resId}
|
|
|
- resType={resType}
|
|
|
- onCreated={(e: IComment) => {
|
|
|
- const newData = JSON.parse(JSON.stringify(e));
|
|
|
- console.log("create", e);
|
|
|
- if (typeof onItemCountChange !== "undefined") {
|
|
|
- onItemCountChange(data.length + 1);
|
|
|
- }
|
|
|
- setData([...data, newData]);
|
|
|
- }}
|
|
|
- />
|
|
|
- ) : undefined}
|
|
|
- </Card>
|
|
|
- </div>
|
|
|
+ {resId && resType ? (
|
|
|
+ <CommentCreate
|
|
|
+ contentType="markdown"
|
|
|
+ resId={resId}
|
|
|
+ resType={resType}
|
|
|
+ onCreated={(e: IComment) => {
|
|
|
+ const newData = JSON.parse(JSON.stringify(e));
|
|
|
+ console.log("create", e);
|
|
|
+ if (typeof onItemCountChange !== "undefined") {
|
|
|
+ onItemCountChange(data.length + 1);
|
|
|
+ }
|
|
|
+ setData([...data, newData]);
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ ) : undefined}
|
|
|
+ </Card>
|
|
|
);
|
|
|
};
|
|
|
|