shenwu 7 月之前
父節點
當前提交
6159dc4041

+ 10 - 1
src/Hook/useAjax.tsx

@@ -22,7 +22,7 @@ export interface AjaxPromise {
  * @returns data 请求结果数据
  * @returns initData 初始data
  * */
-export function useAjax(fnc: (params?: any) => Promise<any>, options?: { type: 'table' }): AjaxPromise {
+export function useAjax(fnc: (params?: any) => Promise<any>, options?: { type: 'table' | "noPage" }): AjaxPromise {
     // const {message}= App.useApp()
     const [loading, setLoding] = useState(false)//状态
     const [data, setData] = useState<any>()//数据
@@ -51,6 +51,15 @@ export function useAjax(fnc: (params?: any) => Promise<any>, options?: { type: '
                     success: res.success
                 }
             }
+            if(options?.type === 'noPage'){
+                return {
+                    current: 1,
+                    data: res.data,
+                    pageSize: 20,
+                    total: res.data.length,
+                    success: true
+                }
+            }
             return res//返回data
         }).catch(err => {
             console.log(err)

+ 1 - 0
src/pages/Distributor/Account/index.tsx

@@ -16,6 +16,7 @@ const Page: React.FC = () => {
                 return await getList.run(params)
             }}
             columns={columns()}
+            scroll={{ x: "auto" }}
             // bordered
         />
     </PageContainer>

+ 1 - 0
src/pages/Distributor/DyMiniApp/index.tsx

@@ -13,6 +13,7 @@ const Page: React.FC = () => {
             search={{
                 labelWidth: 120,
             }}
+            scroll={{ x: "auto" }}
             request={async (params) => {
                 return await getList.run(params)
             }}

+ 1 - 0
src/pages/Distributor/WxMiniApp/index.tsx

@@ -13,6 +13,7 @@ const Page: React.FC = () => {
             search={{
                 labelWidth: 120,
             }}
+            scroll={{ x: "auto" }}
             request={async (params) => {
                 return await getList.run(params)
             }}

+ 0 - 5
src/pages/MiniApp/BookManage/components/readBook/index.tsx

@@ -1,4 +1,3 @@
-import { useVirtualList } from "ahooks";
 import { Button, Col, Row, Image, Spin, Space, Drawer, Empty } from "antd";
 import { JSXElementConstructor, Key, ReactElement, ReactFragment, ReactPortal, useEffect, useMemo, useRef, useState } from "react";
 import { MyIcon } from "@/global";
@@ -7,11 +6,7 @@ function ReadBook(props: { next: (listData: { id: number }) => Promise<any>, lis
     let { next, listData } = props;
     const divRef = useRef<HTMLDivElement>(null);
     let { token } = useToken()
-    const [isFetching, setIsFetching] = useState(true);
-    const [newData, setNewData] = useState<any>(null);
     const [content, setContent] = useState<any>(null)
-    const containerRef = useRef(null);
-    const wrapperRef = useRef(null);
     useEffect(() => {
         const handleKeyDown = (event: KeyboardEvent) => {
             if (divRef.current) {