|  | @@ -3,10 +3,11 @@ 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 { useEffect, useMemo, useRef, useState } from "react"
 | 
	
		
			
				|  |  | +import { MutableRefObject, 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 },
 | 
	
	
		
			
				|  | @@ -39,6 +40,10 @@ 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 })
 | 
	
	
		
			
				|  | @@ -55,7 +60,7 @@ const Page: React.FC = () => {
 | 
	
		
			
				|  |  |      // 看小说
 | 
	
		
			
				|  |  |      const lookBook = (params: any) => {
 | 
	
		
			
				|  |  |          let { id, pageNum, pageSize } = params
 | 
	
		
			
				|  |  | -        return getParagraphList.run({ bookId: id, pageNum, pageSize, backContent: true,...publicData }).then(res => {
 | 
	
		
			
				|  |  | +        return getParagraphList.run({ bookId: id, pageNum, pageSize, backContent: true, ...publicData }).then(res => {
 | 
	
		
			
				|  |  |              setOpneBook({ ...res.data, ...params })
 | 
	
		
			
				|  |  |              return res.data
 | 
	
		
			
				|  |  |          })
 | 
	
	
		
			
				|  | @@ -85,7 +90,7 @@ const Page: React.FC = () => {
 | 
	
		
			
				|  |  |              setOpen(b)
 | 
	
		
			
				|  |  |          } else {
 | 
	
		
			
				|  |  |              // 获取书全部段落
 | 
	
		
			
				|  |  | -            getParagraphAllList.run({ bookId: values.bookId, backContent: true,...publicData }).then(res => {
 | 
	
		
			
				|  |  | +            getParagraphAllList.run({ bookId: values.bookId, backContent: true, ...publicData }).then(res => {
 | 
	
		
			
				|  |  |                  if (res.code === 200) {
 | 
	
		
			
				|  |  |                      setOpen(b)//弹窗开启
 | 
	
		
			
				|  |  |                      if (values) {
 | 
	
	
		
			
				|  | @@ -107,69 +112,71 @@ const Page: React.FC = () => {
 | 
	
		
			
				|  |  |      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],
 | 
	
		
			
				|  |  | -            }}
 | 
	
		
			
				|  |  | -            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>
 | 
	
		
			
				|  |  | +            <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>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  | -export default Page
 | 
	
		
			
				|  |  | +export default Page
 | 
	
		
			
				|  |  | +
 |