فهرست منبع

basic 不能新建术语

visuddhinanda 2 سال پیش
والد
کامیت
a8ac28039a
1فایلهای تغییر یافته به همراه9 افزوده شده و 1 حذف شده
  1. 9 1
      dashboard/src/components/term/TermList.tsx

+ 9 - 1
dashboard/src/components/term/TermList.tsx

@@ -20,6 +20,8 @@ import TermExport from "./TermExport";
 import DataImport from "../admin/relation/DataImport";
 import DataImport from "../admin/relation/DataImport";
 import TermModal from "./TermModal";
 import TermModal from "./TermModal";
 import { getSorterUrl } from "../../utils";
 import { getSorterUrl } from "../../utils";
+import { useAppSelector } from "../../hooks";
+import { currentUser } from "../../reducers/current-user";
 
 
 interface IItem {
 interface IItem {
   sn: number;
   sn: number;
@@ -39,6 +41,7 @@ interface IWidget {
 }
 }
 const TermListWidget = ({ studioName, channelId }: IWidget) => {
 const TermListWidget = ({ studioName, channelId }: IWidget) => {
   const intl = useIntl();
   const intl = useIntl();
+  const currUser = useAppSelector(currentUser);
 
 
   const showDeleteConfirm = (id: string[], title: string) => {
   const showDeleteConfirm = (id: string[], title: string) => {
     Modal.confirm({
     Modal.confirm({
@@ -319,7 +322,12 @@ const TermListWidget = ({ studioName, channelId }: IWidget) => {
           <TermExport channelId={channelId} studioName={studioName} />,
           <TermExport channelId={channelId} studioName={studioName} />,
           <TermModal
           <TermModal
             trigger={
             trigger={
-              <Button key="button" icon={<PlusOutlined />} type="primary">
+              <Button
+                key="button"
+                icon={<PlusOutlined />}
+                type="primary"
+                disabled={currUser?.roles?.includes("basic")}
+              >
                 {intl.formatMessage({ id: "buttons.create" })}
                 {intl.formatMessage({ id: "buttons.create" })}
               </Button>
               </Button>
             }
             }