瀏覽代碼

fix(compiler): fix bug

shylock 2 年之前
父節點
當前提交
fb0d1fffac

+ 0 - 2
config/routes.ts

@@ -58,8 +58,6 @@
   },
   {
     path: '/roomList',
-    name: '房间列表',
-    icon: 'file',
     component: './Home/Room',
   },
   {

+ 1 - 1
src/pages/EditionManagement/index.tsx

@@ -144,7 +144,7 @@ const EditionManagement: React.FC = () => {
       dataIndex: 'force_update',
       key: 'force_update',
       render: (v) => (
-        <span style={{ color: `${v ? '#ff1515' : '#3dae00'}` }}>{v ? '强制' : '不强制'}</span>
+        <span style={{ color: `${v ? 'red' : 'green'}` }}>{v ? '强制' : '不强制'}</span>
       ),
     },
     {

+ 28 - 2
src/pages/cms/ArticleManagement/index.tsx

@@ -1,11 +1,12 @@
 import React, { useEffect, useState } from 'react';
-import { Button, Card, Form, Input, message, Modal, Space, Table } from 'antd';
+import { Button, Card, Form, Input, message, Modal, Select, Space, Table } from 'antd';
 import type { ColumnsType } from 'antd/es/table';
 import moment from 'moment/moment';
 import { PlusCircleOutlined, ReloadOutlined, SearchOutlined } from '@ant-design/icons';
 import Edit from '@/pages/cms/ArticleManagement/edit';
 import { PageContainer } from '@ant-design/pro-components';
 import { queryArticle, delArticle } from '@/services/cms/ArticleManagement';
+import { queryColumn } from '@/services/cms/ColumnList';
 
 interface DataType {
   title: string;
@@ -25,7 +26,8 @@ const ArticleManagement: React.FC = () => {
   const [visible, setVisible] = useState(false);
   const [editData, setEditData] = useState(null);
   const [pagination, setPagination] = useState({ total: 0, current: 1, pageSize: 10 });
-  const [dataList, setDataList]: any = useState([]);
+  const [dataList, setDataList] = useState([]);
+  const [columnList, setColumnList] = useState([]);
 
   // 获取列表数据
   const getList = () => {
@@ -44,9 +46,20 @@ const ArticleManagement: React.FC = () => {
     });
   };
 
+  // 获取栏目列表数据
+  const getColumnList = () => {
+    queryColumn({ q: 'list' }).then((res) => {
+      if (res && res.code === 0) {
+        setColumnList(res.data.list);
+      }
+    });
+  };
+
   useEffect(() => {
     setLoading(true);
     getList();
+
+    getColumnList();
   }, []);
 
   //  搜索
@@ -185,6 +198,19 @@ const ArticleManagement: React.FC = () => {
             <Form.Item name="title" label="文章标题">
               <Input placeholder="请输入文章标题" />
             </Form.Item>
+            <Form.Item name="column_id" label="所属栏目">
+              <Select style={{ width: '175px' }} placeholder="请选择所属栏目">
+                {columnList && columnList.length
+                  ? columnList.map((el: any) => {
+                      return (
+                        <Select.Option value={el.record_id} key={el.record_id}>
+                          {el.name}
+                        </Select.Option>
+                      );
+                    })
+                  : null}
+              </Select>
+            </Form.Item>
             <Form.Item style={{ marginBottom: '10px' }}>
               <Space>
                 <Button type="primary" htmlType="submit">

+ 22 - 4
src/pages/cms/ColumnList/index.tsx

@@ -1,6 +1,6 @@
 import React, { useEffect, useState } from 'react';
 import { PageContainer } from '@ant-design/pro-components';
-import { Button, Card, Form, Input, message, Modal, Space, Table } from 'antd';
+import { Button, Card, Form, Input, message, Modal, Select, Space, Table } from 'antd';
 import { PlusCircleOutlined, ReloadOutlined, SearchOutlined } from '@ant-design/icons';
 import type { ColumnsType } from 'antd/es/table';
 import moment from 'moment';
@@ -29,7 +29,7 @@ const ColumnList: React.FC = () => {
   const [visible, setVisible] = useState(false);
   const [editData, setEditData] = useState(null);
   const [pagination, setPagination] = useState({ total: 0, current: 1, pageSize: 10 });
-  const [dataList, setDataList]: any = useState([]);
+  const [dataList, setDataList] = useState([]);
 
   // 获取列表数据
   const getList = () => {
@@ -148,7 +148,12 @@ const ColumnList: React.FC = () => {
       title: '状态',
       dataIndex: 'status',
       key: 'status',
-      render: (v) => v && <span>{{ 1: '启用', 2: '停用' }[v]}</span>,
+      render: (v) =>
+        v && (
+          <span style={{ color: `${{ 1: 'green', 2: 'red' }[v]}` }}>
+            {{ 1: '启用', 2: '停用' }[v]}
+          </span>
+        ),
     },
     {
       title: '创建者',
@@ -203,9 +208,22 @@ const ColumnList: React.FC = () => {
       <div>
         <Card>
           <Form form={form} layout="inline" onFinish={onFinish}>
-            <Form.Item name="name" label="栏目名称">
+            <Form.Item name="like_name" label="栏目名称">
               <Input placeholder="请输入栏目名称" />
             </Form.Item>
+            <Form.Item name="like_code" label="栏目编号">
+              <Input placeholder="请输入栏目编号" />
+            </Form.Item>
+            <Form.Item name="status" label="状态">
+              <Select style={{ width: '175px' }} placeholder="请选择状态">
+                <Select.Option key={1} value={1}>
+                  启用
+                </Select.Option>
+                <Select.Option key={2} value={2}>
+                  停用
+                </Select.Option>
+              </Select>
+            </Form.Item>
             <Form.Item style={{ marginBottom: '10px' }}>
               <Space>
                 <Button type="primary" htmlType="submit">