shenwu 8 tháng trước cách đây
mục cha
commit
0a0e71a505

+ 1 - 1
config/defaultSettings.ts

@@ -13,7 +13,7 @@ const Settings: ProLayoutProps & {
   colorPrimary: '#1890ff',
   layout: 'mix',
   contentWidth: 'Fluid',
-  fixedHeader: false,
+  fixedHeader: true,
   fixSiderbar: true,
   colorWeak: false,
   title: '分销商平台',

+ 2 - 1
src/app.tsx

@@ -96,11 +96,12 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
     onPageChange: (location) => {
       hasHandledCode300 = false
       // const { location } = history;
-      // // 假如在小程序页面,用户回退到分销商页面重置地址禁止回退到分销平台
+      // // 在小程序页面禁止用户点击回退按钮返回分享页面
       if(sessionStorage.getItem("menuType") == 'miniApp' && location?.pathname?.match(/^\/distributor/)){
         console.log("miniApp",location)
         history.replace('/miniApp');
       }
+      // 在分销平台首页禁止用户点击回退按钮返回到小程序页面
       if(sessionStorage.getItem("menuType")=='distributor' && location?.pathname?.match(/^\/miniApp/)){
         console.log("distributor",location)
         history.replace('/distributor');

+ 1 - 0
src/pages/MiniApp/BookManage/Long/index.tsx

@@ -118,6 +118,7 @@ const Page: React.FC = () => {
             actionRef={actionRef}
             headerTitle={"长篇篇小说列表"}
             rowKey={(r) => r.bookId}
+            scroll={{x:true,y:500}}
             search={{
                 labelWidth: 90,
                 searchGutter: [10, 15],

+ 73 - 66
src/pages/MiniApp/BookManage/Short/index.tsx

@@ -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
+

+ 1 - 0
src/pages/MiniApp/BookManage/Short/tableConfig.tsx

@@ -49,6 +49,7 @@ export const columns = (props: { authList?: any[], labelList?: any[], enumList?:
             key: 'authorId',
             ellipsis: true,
             hideInSearch: true,
+            width:500,
             render: (a, b) => {
                 let { bookName, wordCount, labelInfoList, bookStatus, categoryInfo, authorInfo, score } = b?.shortBookInfoVO
                 let arr = enumList?.BOOK_STATUS?.values

+ 2 - 3
src/pages/MiniApp/BookManage/components/readText/index.tsx

@@ -8,7 +8,6 @@ function ReadText(props: { next: (data: { pageNum: number, pageSize: number, id:
     const [isFetching, setIsFetching] = useState(true);
     const [newData, setNewData] = useState<any>(null);
     let { token } = useToken()
-    console.log(data)
     // 存放首次的size
     useEffect(() => {
         setNewData(data);
@@ -95,10 +94,10 @@ function ReadText(props: { next: (data: { pageNum: number, pageSize: number, id:
                 <Spin spinning={!data?.size}>
                     {
                         newData?.records?.map((item: { paragraphInfo: { id: number, content: string, paragraphNo: number } }) => {
-                            return <>
+                            return <div key={item.paragraphInfo.id}>
                                 {data.beginPayParagraphNo === item.paragraphInfo.paragraphNo && <Divider plain dashed><strong style={{ fontSize: 20, color: token.colorErrorText }}>以下内容为收费内容</strong></Divider>}
                                 <div style={{ fontSize: 17, lineHeight: 2 }} key={item.paragraphInfo.id} dangerouslySetInnerHTML={{ __html: item.paragraphInfo.content.replace(/\n/g, '<br/>') }} />
-                            </>
+                            </div>
                         })
                     }
                 </Spin>

+ 1 - 0
src/pages/MiniApp/Consume/index.tsx

@@ -21,6 +21,7 @@ const Page: React.FC = () => {
                 distributorId: initialState?.currentUser?.distributorId,
                 appType: initialState?.selectApp?.appType || ""
             }}
+            scroll={{x:true,y:500}}
             headerTitle={"消费订单列表"}
             rowKey={(r) => r.id}
             search={{

+ 1 - 0
src/pages/MiniApp/PayLog/Long/index.tsx

@@ -10,6 +10,7 @@ const Page: React.FC = () => {
     return <PageContainer title={false}
     >
         <ProTable<any, any>
+            scroll={{ x: true, y: 500 }}
             params={{
                 miniappId: initialState?.selectApp?.id || "",
                 distributorId: initialState?.currentUser?.distributorId,

+ 2 - 1
src/pages/MiniApp/PayLog/Short/index.tsx

@@ -10,10 +10,11 @@ const Page: React.FC = () => {
     return <PageContainer title={false}
     >
         <ProTable<any, any>
+            scroll={{ x: true, y: 500 }}
             params={{
                 miniappId: initialState?.selectApp?.id || "",
                 distributorId: initialState?.currentUser?.distributorId,
-             appType:initialState?.selectApp?.appType || ""
+                appType: initialState?.selectApp?.appType || ""
             }}
             headerTitle={"短篇小说充值记录列表"}
             rowKey={(r) => r.id}

+ 1 - 0
src/pages/MiniApp/ReadLog/Long/index.tsx

@@ -10,6 +10,7 @@ const Page: React.FC = () => {
     return <PageContainer title={false}
     >
         <ProTable<any, any>
+            scroll={{ x: true, y: 500 }}
             params={{
                 miniappId: initialState?.selectApp?.id || "",
                 distributorId: initialState?.currentUser?.distributorId,

+ 1 - 0
src/pages/MiniApp/ReadLog/Short/index.tsx

@@ -11,6 +11,7 @@ const Page: React.FC = () => {
         title={false}
     >
         <ProTable<any, any>
+            scroll={{ x: true, y: 500 }}
             params={{
                 miniappId: initialState?.selectApp?.id || "",
                 distributorId: initialState?.currentUser?.distributorId,