Qa.tsx 844 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { Collapse } from "antd";
  2. import DiscussionTopic from "../discussion/DiscussionTopic";
  3. import type { TResType } from "../discussion/DiscussionListCard";
  4. const { Panel } = Collapse;
  5. interface IQaCtl {
  6. id: string;
  7. title?: string;
  8. resId?: string;
  9. resType?: TResType;
  10. }
  11. const QaCtl = ({ id, title, resType }: IQaCtl) => {
  12. return (
  13. <Collapse bordered={false}>
  14. <Panel header={title} key="1">
  15. {resType ? (
  16. <DiscussionTopic resType={resType} topicId={id} hideTitle hideReply />
  17. ) : (
  18. "resType error"
  19. )}
  20. </Panel>
  21. </Collapse>
  22. );
  23. };
  24. interface IWidget {
  25. props: string;
  26. }
  27. const Widget = ({ props }: IWidget) => {
  28. const prop = JSON.parse(atob(props)) as IQaCtl;
  29. console.log(prop);
  30. return (
  31. <>
  32. <QaCtl {...prop} />
  33. </>
  34. );
  35. };
  36. export default Widget;