shenwu 7 månader sedan
förälder
incheckning
b19aa7f6e9

+ 10 - 11
src/components/bookSelect/index.tsx

@@ -36,18 +36,17 @@ const BookSelect = (props: { value?: any, onChange?: (value: any) => void }) =>
         }
         timeOut.current = setTimeout(() => { func() }, wait);
     }, [])
-    useEffect(()=>{
-        if(value && data?.records?.length === 0){
-            console.log("value",value)
-            // api.run({ ...params, ...publicData }).then(res => {
-            //     if (res?.data?.total > 0) {
-            //         setData({ records: res.data.records, total: res.data.total })
-            //     } else {
-            //         setData({ records: [], total: 0 })
-            //     }
-            // })
+    useEffect(() => {
+        if (value && data?.records?.length === 0) {
+            api.run({ pageNum: 1, pageSize: 20, bookId: value, ...publicData }).then(res => {
+                if (res?.data?.total > 0) {
+                    setData({ records: res.data.records, total: res.data.total })
+                } else {
+                    setData({ records: [], total: 0 })
+                }
+            })
         }
-    },[])
+    }, [])
     // 使用自定义防抖函数
     useEffect(() => {
         if (params.bookName) {

+ 6 - 8
src/pages/MiniApp/BookManage/Long/formConfig.tsx

@@ -1,10 +1,12 @@
 import { ProFormColumnsType } from "@ant-design/pro-components";
+import { useModel } from "@umijs/max";
 
 function formConfig(props: { paragraphList?: any[], enumList?: { [key: string]: any }, paymentType: any, paymentCategory: any, isGlobalConfig: boolean }): ProFormColumnsType<{
     name: string;
     state: string;
 }>[] {
     let { paragraphList, enumList, paymentType, paymentCategory, isGlobalConfig } = props
+    let {getEnum} = useModel('global')
     return [
         {
             title: '付费方式',
@@ -26,8 +28,7 @@ function formConfig(props: { paragraphList?: any[], enumList?: { [key: string]:
                 ],
             },
             valueEnum: () => {
-                let arr = enumList?.PAYMENT_TYPE?.values
-                return new Map(arr?.map(({ value, description }: any) => [value, description]))
+                return getEnum("PAYMENT_TYPE","map") 
             }
         },
         {
@@ -45,8 +46,7 @@ function formConfig(props: { paragraphList?: any[], enumList?: { [key: string]:
             },
             hideInForm: paymentType[0] != 2,
             valueEnum: () => {
-                let arr = enumList?.PAYMENT_OPTION?.values
-                return new Map(arr?.map(({ value, description }: any) => [value, description]))
+                return getEnum("PAYMENT_OPTION","map")  
             }
         },
         {
@@ -70,8 +70,7 @@ function formConfig(props: { paragraphList?: any[], enumList?: { [key: string]:
             },
             hideInForm: paymentType[0] == 0,
             valueEnum: () => {
-                let arr = [{ value: 0, description: "现金" }, { value: 1, description: "书币" }]
-                return new Map(arr?.map(({ value, description }: any) => [value, description]))
+                return getEnum("PAYMENT_CATEGORY","map")   
             }
         },
         {//单本
@@ -129,8 +128,7 @@ function formConfig(props: { paragraphList?: any[], enumList?: { [key: string]:
             },
             hideInForm: paymentType[0] == 0 || isGlobalConfig,
             valueEnum: () => {
-                let arr = enumList?.VIP_FREE?.values
-                return new Map(arr?.map(({ value, description }: any) => [value, description]))
+                return getEnum("VIP_FREE","map")   
             }
         },
         {

+ 0 - 3
src/pages/MiniApp/CompConfig/DrawerBox/compFormConfig.tsx

@@ -212,9 +212,6 @@ export function hotBooksConfig(): ProFormColumnsType<any>[] {
                             colProps: {
                                 span: 12
                             },
-                            convertValue:(value)=>{
-                                return value?.toString()
-                            },
                             formItemProps: {
                                 style: { marginBottom: 10 },
                                 rules: [