Browse Source

Merge pull request #2043 from visuddhinanda/agile

在文集中新建文章,可见性和语言与文集相同
visuddhinanda 2 years ago
parent
commit
3e65ed7ecd

+ 6 - 1
dashboard/src/components/anthology/EditableTocTree.tsx

@@ -6,6 +6,7 @@ import { get as getUiLang } from "../../locales";
 
 import { get, post, put } from "../../request";
 import {
+  IAnthologyDataResponse,
   IArticleCreateRequest,
   IArticleDataResponse,
   IArticleMapAddResponse,
@@ -25,10 +26,12 @@ import { fullUrl, randomString } from "../../utils";
 interface IWidget {
   anthologyId?: string;
   studioName?: string;
+  anthology?: IAnthologyDataResponse;
   onSelect?: Function;
 }
 const EditableTocTreeWidget = ({
   anthologyId,
+  anthology,
   studioName,
   onSelect,
 }: IWidget) => {
@@ -140,9 +143,10 @@ const EditableTocTreeWidget = ({
             `/v2/article`,
             {
               title: "new article",
-              lang: getUiLang(),
+              lang: anthology?.lang ?? getUiLang(),
               studio: studioName,
               anthologyId: anthologyId,
+              status: anthology?.status ?? undefined,
             }
           );
 
@@ -174,6 +178,7 @@ const EditableTocTreeWidget = ({
       />
       <ArticleDrawer
         articleId={viewArticle?.id}
+        anthologyId={anthologyId}
         type="article"
         open={openViewer}
         title={viewArticle?.title_text}

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

@@ -129,6 +129,7 @@ export interface IArticleCreateRequest {
   studio: string;
   anthologyId?: string;
   parentId?: string;
+  status?: number;
 }
 
 export interface IAnthologyCreateRequest {

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

@@ -105,6 +105,7 @@ const ArticleDrawerWidget = ({
           para={para}
           channelId={channelId}
           articleId={articleId}
+          anthologyId={anthologyId}
           mode={mode}
           onArticleEdit={(value: IArticleDataResponse) => {
             setDrawerTitle(value.title_text);

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

@@ -3,7 +3,6 @@ import React, { useEffect, useState } from "react";
 import { IArticleDataResponse } from "../api/Article";
 
 import ArticleEdit from "./ArticleEdit";
-import ArticleEditTools from "./ArticleEditTools";
 
 interface IWidget {
   trigger?: React.ReactNode;

+ 1 - 0
dashboard/src/pages/studio/anthology/edit.tsx

@@ -66,6 +66,7 @@ const Widget = () => {
                 <EditableTocTree
                   studioName={anthologyInfo?.studio.realName}
                   anthologyId={anthology_id}
+                  anthology={anthologyInfo}
                 />
               ),
             },