visuddhinanda 3 лет назад
Родитель
Сommit
407877c5dd

+ 10 - 2
dashboard/src/pages/studio/anthology/edit.tsx

@@ -18,6 +18,7 @@ import {
 } from "../../../components/api/Article";
 import { get, put } from "../../../request";
 import { useState } from "react";
+import GoBack from "../../../components/studio/GoBack";
 
 interface IFormData {
 	title: string;
@@ -32,12 +33,19 @@ const Widget = () => {
 	const intl = useIntl();
 	const [tocData, setTocData] = useState(listdata);
 	const [title, setTitle] = useState("");
-	const { anthology_id } = useParams(); //url 参数
+	const { studioname, anthology_id } = useParams(); //url 参数
 	let treeList: ListNodeData[] = [];
 
 	return (
 		<>
-			<Card title={title} style={{ margin: "1em" }}>
+			<Card
+				title={
+					<GoBack
+						to={`/studio/${studioname}/anthology/list`}
+						title={title}
+					/>
+				}
+			>
 				<Row>
 					<Col>
 						<ProForm<IFormData>

+ 14 - 10
dashboard/src/pages/studio/article/edit.tsx

@@ -6,7 +6,7 @@ import {
 	ProFormSelect,
 	ProFormTextArea,
 } from "@ant-design/pro-components";
-import { message } from "antd";
+import { Card, message } from "antd";
 import { get, put } from "../../../request";
 import {
 	IArticleDataRequest,
@@ -14,6 +14,8 @@ import {
 } from "../../../components/api/Article";
 import LangSelect from "../../../components/studio/LangSelect";
 import PublicitySelect from "../../../components/studio/PublicitySelect";
+import GoBack from "../../../components/studio/GoBack";
+import { useState } from "react";
 
 interface IFormData {
 	uid: string;
@@ -29,15 +31,16 @@ interface IFormData {
 const Widget = () => {
 	const intl = useIntl();
 	const { studioname, articleid } = useParams(); //url 参数
+	const [title, setTitle] = useState("loading");
 	return (
-		<>
-			<h2>
-				studio/{studioname}/
-				{intl.formatMessage({ id: "columns.studio.article.title" })}
-				/edit/
-				{articleid}
-			</h2>
-
+		<Card
+			title={
+				<GoBack
+					to={`/studio/${studioname}/article/list`}
+					title={title}
+				/>
+			}
+		>
 			<ProForm<IFormData>
 				onFinish={async (values: IFormData) => {
 					// TODO
@@ -70,6 +73,7 @@ const Widget = () => {
 					const res = await get<IArticleResponse>(
 						`/v2/article/${articleid}`
 					);
+					setTitle(res.data.title);
 					return {
 						uid: res.data.uid,
 						title: res.data.title,
@@ -134,7 +138,7 @@ const Widget = () => {
 					/>
 				</ProForm.Group>
 			</ProForm>
-		</>
+		</Card>
 	);
 };
 

+ 14 - 3
dashboard/src/pages/studio/channel/edit.tsx

@@ -6,12 +6,14 @@ import {
 	ProFormTextArea,
 } from "@ant-design/pro-components";
 import { useIntl } from "react-intl";
-import { message, Space } from "antd";
+import { Card, message, Space } from "antd";
 import { IApiResponseChannel } from "../../../components/api/Channel";
 import { get, put } from "../../../request";
 import ChannelTypeSelect from "../../../components/studio/channel/ChannelTypeSelect";
 import LangSelect from "../../../components/studio/LangSelect";
 import PublicitySelect from "../../../components/studio/PublicitySelect";
+import GoBack from "../../../components/studio/GoBack";
+import { useState } from "react";
 
 interface IFormData {
 	name: string;
@@ -25,9 +27,17 @@ const Widget = () => {
 	const intl = useIntl();
 	const { channelid } = useParams(); //url 参数
 	const { studioname } = useParams();
+	const [title, setTitle] = useState("");
 
 	return (
-		<>
+		<Card
+			title={
+				<GoBack
+					to={`/studio/${studioname}/channel/list`}
+					title={title}
+				/>
+			}
+		>
 			<Space>{channelid}</Space>
 			<ProForm<IFormData>
 				onFinish={async (values: IFormData) => {
@@ -44,6 +54,7 @@ const Widget = () => {
 					const res: IApiResponseChannel = await get(
 						`/v2/channel/${channelid}`
 					);
+					setTitle(res.data.name);
 					return {
 						name: res.data.name,
 						type: res.data.type,
@@ -83,7 +94,7 @@ const Widget = () => {
 					<ProFormTextArea width="md" name="summary" label="简介" />
 				</ProForm.Group>
 			</ProForm>
-		</>
+		</Card>
 	);
 };