12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- import { savePosts, getPostsDetail, updatePosts } from "@/services/posts";
- import { getStoreList } from "@/services/stock";
- import {
- PageContainer,
- ProForm,
- ProFormSelect,
- ProFormText,
- } from "@ant-design/pro-components";
- import { useNavigate, useSearchParams } from "react-router-dom";
- import { Card, Typography, message, Row, Button, Space } from "antd";
- import { useEffect, useRef, useState } from "react";
- import Wangeditor from "@/components/Wangeditor";
- const { Title } = Typography;
- export default (props) => {
- const [searchParams] = useSearchParams();
- const id = searchParams.get("id");
- const [data, setData] = useState({});
- const [url, setUrl] = useState("");
- const navigate = useNavigate();
-
- const formRef = useRef();
-
- useEffect(() => {
- if (id) {
- getPostsDetail(id).then((res) => {
- setData(res);
- setUrl(res.filesList[0]?.fileAddr);
- });
- }
- }, [id]);
-
- return (
- <Card extra={<Button onClick={() => navigate(-1)}> 返回</Button>}>
- <Title level={2} style={{ marginBottom: "2em" }}>
- {data.title}
- </Title>
- <div dangerouslySetInnerHTML={{ __html: data?.detail }}></div>
- {url && (
- <div style={{marginTop:"2em"}}>
- <a
- href={`${url}`}
- download
- // rel="noopener noreferrer"
- // key="link"
- >
- {url?.substring(url?.lastIndexOf("/") + 1)}
- </a>
- </div>
- )}
- </Card>
- );
- };
|