|  | @@ -3,11 +3,10 @@ import { columns } from "./tableConfig"
 | 
	
		
			
				|  |  |  import { useAjax } from "@/Hook/useAjax"
 | 
	
		
			
				|  |  |  import { useModel } from "@umijs/max"
 | 
	
		
			
				|  |  |  import { shortBookInfoList, shortBookInfoParagraphList, shortBookInfoBookConfig, shortBookInfoConfig, shortBookInfoParagraphAllList } from "@/services/miniApp/bookManage"
 | 
	
		
			
				|  |  | -import { MutableRefObject, useEffect, useMemo, useRef, useState } from "react"
 | 
	
		
			
				|  |  | +import {  useEffect, useMemo, useRef, useState } from "react"
 | 
	
		
			
				|  |  |  import { Drawer, message } from "antd"
 | 
	
		
			
				|  |  |  import ReadText from "../components/readText"
 | 
	
		
			
				|  |  |  import formConfig from "./formConfig"
 | 
	
		
			
				|  |  | -import { useSize } from 'ahooks';
 | 
	
		
			
				|  |  |  const wordCountRanges: any = {
 | 
	
		
			
				|  |  |      "": { start: null, end: null }, // 全部
 | 
	
		
			
				|  |  |      "0-2": { start: 0, end: 2 * 10000 },
 | 
	
	
		
			
				|  | @@ -40,10 +39,7 @@ const Page: React.FC = () => {
 | 
	
		
			
				|  |  |      let configInfo = useAjax((params) => shortBookInfoConfig(params))//获取配置信息
 | 
	
		
			
				|  |  |      const formRef = useRef<ProFormInstance>();
 | 
	
		
			
				|  |  |      const actionRef = useRef<ActionType>();
 | 
	
		
			
				|  |  | -    const ref = useRef<any>()
 | 
	
		
			
				|  |  | -    const size = useSize(ref);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    console.log("size", size)
 | 
	
		
			
				|  |  |      // 获取标签和分类
 | 
	
		
			
				|  |  |      useEffect(() => {
 | 
	
		
			
				|  |  |          getLabelAndClassList({ workDirection })
 | 
	
	
		
			
				|  | @@ -109,73 +105,73 @@ const Page: React.FC = () => {
 | 
	
		
			
				|  |  |              })
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | -    return <PageContainer title={false}
 | 
	
		
			
				|  |  | -        tabProps={{ type: 'card' }}
 | 
	
		
			
				|  |  | +    return  <PageContainer title={false}
 | 
	
		
			
				|  |  | +    tabProps={{ type: 'card' }}
 | 
	
		
			
				|  |  | +>
 | 
	
		
			
				|  |  | +    <ProTable<any, any>
 | 
	
		
			
				|  |  | +        params={publicData}
 | 
	
		
			
				|  |  | +        actionRef={actionRef}
 | 
	
		
			
				|  |  | +        headerTitle={"小说列表"}
 | 
	
		
			
				|  |  | +        rowKey={(r) => r.bookId}
 | 
	
		
			
				|  |  | +        search={{
 | 
	
		
			
				|  |  | +            labelWidth: 90,
 | 
	
		
			
				|  |  | +            searchGutter: [10, 15],
 | 
	
		
			
				|  |  | +        }}
 | 
	
		
			
				|  |  | +        scroll={{ x: true}}
 | 
	
		
			
				|  |  | +        loading={getParagraphList?.loading || getList?.loading}
 | 
	
		
			
				|  |  | +        // ghost={true}//去除表格的背景一些配置改变ui
 | 
	
		
			
				|  |  | +        beforeSearchSubmit={(params) => {//处理搜索数据
 | 
	
		
			
				|  |  | +            let newParams = Object.entries(params).reduce((acc: any, [key, value]) => {
 | 
	
		
			
				|  |  | +                // 过滤掉空值,包括空字符串和 null
 | 
	
		
			
				|  |  | +                if (value !== '' && value != null) {
 | 
	
		
			
				|  |  | +                    acc[key] = value;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                if (key === 'wordCount' && value) {
 | 
	
		
			
				|  |  | +                    let obj = wordCountRanges[value]
 | 
	
		
			
				|  |  | +                    acc['startWordCount'] = obj.start
 | 
	
		
			
				|  |  | +                    acc['endWordCount'] = obj.end
 | 
	
		
			
				|  |  | +                    delete acc[key]
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                return acc;
 | 
	
		
			
				|  |  | +            }, {});
 | 
	
		
			
				|  |  | +            return newParams
 | 
	
		
			
				|  |  | +        }}
 | 
	
		
			
				|  |  | +        request={async (params) => {
 | 
	
		
			
				|  |  | +            return await getList.run(params)
 | 
	
		
			
				|  |  | +        }}
 | 
	
		
			
				|  |  | +        columns={columns({ authList: state?.authList, labelList: state.labelList, categoryList: state.categoryList, enumList: state?.enumList, lookBook, closeForm, setWorkDirection })}
 | 
	
		
			
				|  |  | +    />
 | 
	
		
			
				|  |  | +    {/* 付费配置 */}
 | 
	
		
			
				|  |  | +    <BetaSchemaForm<DataItem>
 | 
	
		
			
				|  |  | +        title={"付费配置"}
 | 
	
		
			
				|  |  | +        formRef={formRef}
 | 
	
		
			
				|  |  | +        open={open}
 | 
	
		
			
				|  |  | +        onOpenChange={(b) => { !b && closeForm(b) }}
 | 
	
		
			
				|  |  | +        layoutType={"ModalForm"}
 | 
	
		
			
				|  |  | +        labelCol={{ span: 6 }}
 | 
	
		
			
				|  |  | +        wrapperCol={{ span: 14 }}
 | 
	
		
			
				|  |  | +        // grid={true}
 | 
	
		
			
				|  |  | +        layout='horizontal'
 | 
	
		
			
				|  |  | +        onFinish={submit}
 | 
	
		
			
				|  |  | +        columns={formConfig({ enumList: state?.enumList, paymentType, paragraphList: getParagraphAllList?.data?.data?.map((item: { paragraphInfo: any }) => item.paragraphInfo) })}
 | 
	
		
			
				|  |  | +        loading={add?.loading}
 | 
	
		
			
				|  |  | +    />
 | 
	
		
			
				|  |  | +    {/* 阅读小说 */}
 | 
	
		
			
				|  |  | +    <Drawer
 | 
	
		
			
				|  |  | +        open={!!openBook}
 | 
	
		
			
				|  |  | +        placement="right"
 | 
	
		
			
				|  |  | +        onClose={() => { setOpneBook(null) }}
 | 
	
		
			
				|  |  | +        footer={null}
 | 
	
		
			
				|  |  | +        width={'65%'}
 | 
	
		
			
				|  |  | +        destroyOnClose={true}
 | 
	
		
			
				|  |  | +        // getContainer={false}
 | 
	
		
			
				|  |  | +        styles={{ body: { padding: 0 } }}
 | 
	
		
			
				|  |  | +        closeIcon={false}
 | 
	
		
			
				|  |  | +        title={<div style={{ fontSize: 20 }}>{openBook?.bookName ? openBook?.bookName : ""}</div>}
 | 
	
		
			
				|  |  |      >
 | 
	
		
			
				|  |  | -            <ProTable<any, any>
 | 
	
		
			
				|  |  | -                params={publicData}
 | 
	
		
			
				|  |  | -                actionRef={actionRef}
 | 
	
		
			
				|  |  | -                headerTitle={"短篇小说列表"}
 | 
	
		
			
				|  |  | -                rowKey={(r) => r.bookId}
 | 
	
		
			
				|  |  | -                search={{
 | 
	
		
			
				|  |  | -                    labelWidth: 90,
 | 
	
		
			
				|  |  | -                    searchGutter: [10, 15],
 | 
	
		
			
				|  |  | -                }}
 | 
	
		
			
				|  |  | -                scroll={{x:true,y:500}}
 | 
	
		
			
				|  |  | -                loading={getParagraphList?.loading || getList?.loading}
 | 
	
		
			
				|  |  | -                // ghost={true}//去除表格的背景一些配置改变ui
 | 
	
		
			
				|  |  | -                beforeSearchSubmit={(params) => {//处理搜索数据
 | 
	
		
			
				|  |  | -                    let newParams = Object.entries(params).reduce((acc: any, [key, value]) => {
 | 
	
		
			
				|  |  | -                        // 过滤掉空值,包括空字符串和 null
 | 
	
		
			
				|  |  | -                        if (value !== '' && value != null) {
 | 
	
		
			
				|  |  | -                            acc[key] = value;
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                        if (key === 'wordCount' && value) {
 | 
	
		
			
				|  |  | -                            let obj = wordCountRanges[value]
 | 
	
		
			
				|  |  | -                            acc['startWordCount'] = obj.start
 | 
	
		
			
				|  |  | -                            acc['endWordCount'] = obj.end
 | 
	
		
			
				|  |  | -                            delete acc[key]
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                        return acc;
 | 
	
		
			
				|  |  | -                    }, {});
 | 
	
		
			
				|  |  | -                    return newParams
 | 
	
		
			
				|  |  | -                }}
 | 
	
		
			
				|  |  | -                request={async (params) => {
 | 
	
		
			
				|  |  | -                    return await getList.run(params)
 | 
	
		
			
				|  |  | -                }}
 | 
	
		
			
				|  |  | -                columns={columns({ authList: state?.authList, labelList: state.labelList, categoryList: state.categoryList, enumList: state?.enumList, lookBook, closeForm, setWorkDirection })}
 | 
	
		
			
				|  |  | -            />
 | 
	
		
			
				|  |  | -            {/* 付费配置 */}
 | 
	
		
			
				|  |  | -            <BetaSchemaForm<DataItem>
 | 
	
		
			
				|  |  | -                title={"付费配置"}
 | 
	
		
			
				|  |  | -                formRef={formRef}
 | 
	
		
			
				|  |  | -                open={open}
 | 
	
		
			
				|  |  | -                onOpenChange={(b) => { !b && closeForm(b) }}
 | 
	
		
			
				|  |  | -                layoutType={"ModalForm"}
 | 
	
		
			
				|  |  | -                labelCol={{ span: 6 }}
 | 
	
		
			
				|  |  | -                wrapperCol={{ span: 14 }}
 | 
	
		
			
				|  |  | -                // grid={true}
 | 
	
		
			
				|  |  | -                layout='horizontal'
 | 
	
		
			
				|  |  | -                onFinish={submit}
 | 
	
		
			
				|  |  | -                columns={formConfig({ enumList: state?.enumList, paymentType, paragraphList: getParagraphAllList?.data?.data?.map((item: { paragraphInfo: any }) => item.paragraphInfo) })}
 | 
	
		
			
				|  |  | -                loading={add?.loading}
 | 
	
		
			
				|  |  | -            />
 | 
	
		
			
				|  |  | -            {/* 阅读小说 */}
 | 
	
		
			
				|  |  | -            <Drawer
 | 
	
		
			
				|  |  | -                open={!!openBook}
 | 
	
		
			
				|  |  | -                placement="right"
 | 
	
		
			
				|  |  | -                onClose={() => { setOpneBook(null) }}
 | 
	
		
			
				|  |  | -                footer={null}
 | 
	
		
			
				|  |  | -                width={'65%'}
 | 
	
		
			
				|  |  | -                destroyOnClose={true}
 | 
	
		
			
				|  |  | -                // getContainer={false}
 | 
	
		
			
				|  |  | -                styles={{ body: { padding: 0 } }}
 | 
	
		
			
				|  |  | -                closeIcon={false}
 | 
	
		
			
				|  |  | -                title={<div style={{ fontSize: 20 }}>{openBook?.bookName ? openBook?.bookName : ""}</div>}
 | 
	
		
			
				|  |  | -            >
 | 
	
		
			
				|  |  | -                <ReadText data={openBook} next={lookBook} />
 | 
	
		
			
				|  |  | -            </Drawer>
 | 
	
		
			
				|  |  | -    </PageContainer>
 | 
	
		
			
				|  |  | +        <ReadText data={openBook} next={lookBook} />
 | 
	
		
			
				|  |  | +    </Drawer>
 | 
	
		
			
				|  |  | +</PageContainer>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  export default Page
 |