Просмотр исходного кода

Merge pull request #1574 from visuddhinanda/agile

文集修改提交deletedAt
visuddhinanda 2 лет назад
Родитель
Сommit
23621c0a07

+ 20 - 18
dashboard/src/components/anthology/EditableTocTree.tsx

@@ -10,6 +10,7 @@ import {
   IArticleDataResponse,
   IArticleDataResponse,
   IArticleMapAddResponse,
   IArticleMapAddResponse,
   IArticleMapListResponse,
   IArticleMapListResponse,
+  IArticleMapRequest,
   IArticleMapUpdateRequest,
   IArticleMapUpdateRequest,
   IArticleResponse,
   IArticleResponse,
 } from "../api/Article";
 } from "../api/Article";
@@ -45,25 +46,26 @@ const EditableTocTreeWidget = ({
     if (typeof data === "undefined") {
     if (typeof data === "undefined") {
       return;
       return;
     }
     }
-    put<IArticleMapUpdateRequest, IArticleMapAddResponse>(
-      `/v2/article-map/${anthologyId}`,
-      {
-        data: data.map((item) => {
-          let title = "";
-          if (typeof item.title === "string") {
-            title = item.title;
-          }
-          //TODO 整一个string title
-          return {
-            article_id: item.key,
-            level: item.level,
-            title: title,
-            children: item.children,
-          };
-        }),
-        operation: "anthology",
+    const url = `/v2/article-map/${anthologyId}`;
+    const newData: IArticleMapRequest[] = data.map((item) => {
+      let title = "";
+      if (typeof item.title === "string") {
+        title = item.title;
       }
       }
-    )
+      //TODO 整一个string title
+      return {
+        article_id: item.key,
+        level: item.level,
+        title: title,
+        children: item.children,
+        deleted_at: item.deletedAt,
+      };
+    });
+
+    put<IArticleMapUpdateRequest, IArticleMapAddResponse>(url, {
+      data: newData,
+      operation: "anthology",
+    })
       .finally(() => {})
       .finally(() => {})
       .then((json) => {
       .then((json) => {
         if (json.ok) {
         if (json.ok) {

+ 4 - 1
dashboard/src/components/api/Article.ts

@@ -135,8 +135,11 @@ export interface IArticleMapRequest {
   article_id?: string;
   article_id?: string;
   level: number;
   level: number;
   title: string;
   title: string;
+  editor?: IUser;
   children?: number;
   children?: number;
-  deleted_at?: string;
+  deleted_at?: string | null;
+  created_at?: string;
+  updated_at?: string;
 }
 }
 export interface IArticleMapListResponse {
 export interface IArticleMapListResponse {
   ok: boolean;
   ok: boolean;

+ 4 - 1
dashboard/src/components/article/ArticleEdit.tsx

@@ -19,6 +19,7 @@ import PublicitySelect from "../../components/studio/PublicitySelect";
 
 
 import MDEditor from "@uiw/react-md-editor";
 import MDEditor from "@uiw/react-md-editor";
 import ArticlePrevDrawer from "../../components/article/ArticlePrevDrawer";
 import ArticlePrevDrawer from "../../components/article/ArticlePrevDrawer";
+import { IStudio } from "../auth/StudioName";
 
 
 interface IFormData {
 interface IFormData {
   uid: string;
   uid: string;
@@ -48,6 +49,7 @@ const ArticleEditWidget = ({
   const [unauthorized, setUnauthorized] = useState(false);
   const [unauthorized, setUnauthorized] = useState(false);
   const [readonly, setReadonly] = useState(false);
   const [readonly, setReadonly] = useState(false);
   const [content, setContent] = useState<string>();
   const [content, setContent] = useState<string>();
+  const [owner, setOwner] = useState<IStudio>();
 
 
   return unauthorized ? (
   return unauthorized ? (
     <Result
     <Result
@@ -60,7 +62,7 @@ const ArticleEditWidget = ({
     <>
     <>
       {readonly ? (
       {readonly ? (
         <Alert
         <Alert
-          message="该资源为只读,如果需要修改,请联络拥有者分配权限。"
+          message={`该资源为只读,如果需要修改,请联络拥有者${owner?.nickName}分配权限。`}
           type="warning"
           type="warning"
           closable
           closable
           action={
           action={
@@ -108,6 +110,7 @@ const ArticleEditWidget = ({
           let mTitle: string,
           let mTitle: string,
             mReadonly = false;
             mReadonly = false;
           if (res.ok) {
           if (res.ok) {
+            setOwner(res.data.studio);
             mReadonly = res.data.role === "editor" ? false : true;
             mReadonly = res.data.role === "editor" ? false : true;
             setReadonly(mReadonly);
             setReadonly(mReadonly);
             mTitle = res.data.title;
             mTitle = res.data.title;

+ 1 - 0
dashboard/src/components/article/EditableTree.tsx

@@ -115,6 +115,7 @@ function treeToList(treeNode: TreeNodeData[]): ListNodeData[] {
       title: node.title,
       title: node.title,
       level: iTocTreeCurrLevel,
       level: iTocTreeCurrLevel,
       children: children,
       children: children,
+      deletedAt: node.deletedAt,
     });
     });
     if (children > 0) {
     if (children > 0) {
       iTocTreeCurrLevel++;
       iTocTreeCurrLevel++;