浏览代码

feat: 类别

chenlei 1 年之前
父节点
当前提交
ae44138b55

+ 1 - 1
package.json

@@ -80,7 +80,7 @@
     "workbox-webpack-plugin": "^6.4.1"
   },
   "scripts": {
-    "start": "cross-env REACT_APP_API_URL=http://192.168.20.61:8059 REACT_APP_IMG_PUBLIC=/api node scripts/start.js",
+    "start": "cross-env REACT_APP_API_URL=https://sit-qiushoubwg.4dage.com REACT_APP_IMG_PUBLIC=/ node scripts/start.js",
     "build": "cross-env PUBLIC_URL=./ REACT_APP_API_URL=https://sit-qiushoubwg.4dage.com REACT_APP_IMG_PUBLIC= node scripts/build.js"
   },
   "eslintConfig": {

+ 19 - 0
src/pages/Collection/constants.ts

@@ -12,3 +12,22 @@ export const LEVEL_TYPE = [
     value: "三级",
   },
 ];
+
+export const CATEGORY_TYPE = [
+  {
+    label: "三维文物",
+    value: "三维文物",
+  },
+  {
+    label: "平面文物",
+    value: "平面文物",
+  },
+  {
+    label: "油画",
+    value: "油画",
+  },
+  {
+    label: "电子书",
+    value: "电子书",
+  },
+];

+ 17 - 10
src/pages/Collection/create-or-edit/index.tsx

@@ -10,7 +10,7 @@ import {
 import { DatePicker, Form, FormInstance, Input, Select } from "antd";
 import { useCallback, useEffect, useRef, useState } from "react";
 import { useNavigate, useParams } from "react-router-dom";
-import { LEVEL_TYPE } from "../constants";
+import { CATEGORY_TYPE, LEVEL_TYPE } from "../constants";
 import { collectionApi } from "@/api";
 import { dayjs, formatDate } from "@dage/utils";
 
@@ -106,9 +106,9 @@ export default function CollectionCreateOrEditPage() {
               <Form
                 ref={formRef}
                 labelCol={{ span: 2 }}
-                initialValues={{
-                  dictLevel: LEVEL_TYPE[0].value,
-                }}
+                // initialValues={{
+                //   dictLevel: LEVEL_TYPE[0].value,
+                // }}
               >
                 <Form.Item
                   label="标题"
@@ -122,6 +122,13 @@ export default function CollectionCreateOrEditPage() {
                     showCount
                   />
                 </Form.Item>
+                <Form.Item label="类别" name="dictType">
+                  <Select
+                    style={{ width: 220 }}
+                    options={CATEGORY_TYPE}
+                    placeholder="请选择"
+                  />
+                </Form.Item>
                 <Form.Item label="时代" name="dictAge">
                   <Input
                     className="w220"
@@ -138,12 +145,12 @@ export default function CollectionCreateOrEditPage() {
                     showCount
                   />
                 </Form.Item>
-                <Form.Item
-                  label="级别"
-                  name="dictLevel"
-                  rules={[{ required: true, message: "请选择" }]}
-                >
-                  <Select style={{ width: 220 }} options={LEVEL_TYPE} />
+                <Form.Item label="级别" name="dictLevel">
+                  <Select
+                    style={{ width: 220 }}
+                    options={LEVEL_TYPE}
+                    placeholder="请选择"
+                  />
                 </Form.Item>
                 <Form.Item label="来源" name="dictSource">
                   <Input

+ 9 - 9
src/pages/Collection/index.tsx

@@ -3,22 +3,22 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
 import { debounce } from "lodash";
 import { DageTableActions } from "@dage/pc-components";
 import { useNavigate, useSearchParams } from "react-router-dom";
-import { LEVEL_TYPE } from "./constants";
+import { CATEGORY_TYPE } from "./constants";
 import { collectionApi } from "@/api";
 
-const ALL_LEVEL_TYPE = [
+const ALL_CATEGORY_TYPE = [
   {
     label: "全部",
     value: "",
   },
-  ...LEVEL_TYPE,
+  ...CATEGORY_TYPE,
 ];
 
 const DEFAULT_PARAMS = {
   pageNum: 1,
   pageSize: 20,
   searchKey: "",
-  dictLevel: ALL_LEVEL_TYPE[0].value,
+  dictType: ALL_CATEGORY_TYPE[0].value,
 };
 
 export default function CollectionPage() {
@@ -30,7 +30,7 @@ export default function CollectionPage() {
   const [params, setParams] = useState({
     ...DEFAULT_PARAMS,
     searchKey: searchParams.get("searchKey") || "",
-    dictLevel: searchParams.get("dictLevel") || ALL_LEVEL_TYPE[0].value,
+    dictType: searchParams.get("dictType") || ALL_CATEGORY_TYPE[0].value,
   });
   const [total, setTotal] = useState(0);
 
@@ -110,9 +110,9 @@ export default function CollectionPage() {
   useEffect(() => {
     setSearchParams({
       searchKey: params.searchKey,
-      dictLevel: params.dictLevel,
+      dictType: params.dictType,
     });
-  }, [params.searchKey, params.dictLevel, setSearchParams]);
+  }, [params.searchKey, params.dictType, setSearchParams]);
 
   useEffect(() => {
     getList();
@@ -151,8 +151,8 @@ export default function CollectionPage() {
         <Form.Item label="搜索项" name="searchKey">
           <Input placeholder="请输入" maxLength={10} showCount allowClear />
         </Form.Item>
-        <Form.Item label="级别" name="dictLevel">
-          <Select style={{ width: 220 }} options={ALL_LEVEL_TYPE} />
+        <Form.Item label="类别" name="dictType">
+          <Select style={{ width: 220 }} options={ALL_CATEGORY_TYPE} />
         </Form.Item>
         <Form.Item>
           <Button type="primary" onClick={() => navigate("/collection/create")}>

+ 1 - 0
src/pages/Layout/components/Menu/index.tsx

@@ -45,6 +45,7 @@ export const LayoutMenu: FC<LayoutMenuProps> = memo(
             key: path,
             icon: (
               <Image
+                preview={false}
                 src={require(`@/assets/images/icon-${index + 1}-min.png`)}
                 width={45}
                 height={45}