shenwu 9 kuukautta sitten
vanhempi
commit
9da46b20dc

+ 28 - 70
config/routes.tsx

@@ -48,76 +48,7 @@ const newMenu = [
     name: 'miniApp.book',
     icon: 'icon-xiaoshuo-wx',
     access: 'isShow',
-    routes: [
-      {
-        path: '/miniApp/book',
-        redirect: '/miniApp/book/short',
-      },
-      {
-        path: '/miniApp/book/short',
-        name: "short",
-        component: './MiniApp/BookManage/Short',
-      },
-      {
-        path: '/miniApp/book/long',
-        name: 'long',
-        component: './MiniApp/BookManage/Long',
-      },
-    ],
-  },
-  // 阅读记录
-  {
-    path: '/miniApp/readLog',
-    name: 'miniApp.readLog',
-    icon: 'icon-yuedu-2-wx',
-    access: 'isShow',
-    routes: [
-      {
-        path: '/miniApp/readLog',
-        redirect: '/miniApp/readLog/short',
-      },
-      {
-        path: '/miniApp/readLog/short',
-        name: "short",
-        component: './MiniApp/ReadLog/Short',
-      },
-      {
-        path: '/miniApp/readLog/long',
-        name: 'long',
-        component: './MiniApp/ReadLog/Long',
-      },
-    ],
-  },
-  // 充值记录
-  {
-    path: '/miniApp/payLog',
-    name: 'miniApp.payLog',
-    icon: 'icon-chongzhi01-wx',
-    access: 'isShow',
-    routes: [
-      {
-        path: '/miniApp/payLog',
-        redirect: '/miniApp/payLog/short',
-      },
-      {
-        path: '/miniApp/payLog/short',
-        name: "short",
-        component: './MiniApp/PayLog/Short',
-      },
-      {
-        path: '/miniApp/payLog/long',
-        name: 'long',
-        component: './MiniApp/PayLog/Long',
-      },
-    ],
-  },
-  // 消费订单管理
-  {
-    name: 'miniApp.consume',
-    icon: 'icon-xiaofei-wx',
-    path: '/miniApp/consume',
-    access: "isShow",
-    component: './MiniApp/Consume',
+    component: './MiniApp/BookManage',
   },
   // 小程序端管理
   {
@@ -135,6 +66,33 @@ const newMenu = [
     access: "isShow",
     component: './MiniApp/ModuleConfig',
   },
+  {
+    name:"miniApp.dataManage",
+    icon: 'icon-shuju-wx',
+    path: '/miniApp/dataManage',
+    access: "isShow",
+    routes: [
+      {
+        path: '/miniApp/dataManage',
+        redirect: '/miniApp/payLog',
+      },
+      {
+        path: '/miniApp/dataManage/payLog',
+        name: "payLog",
+        component: './MiniApp/PayLog',
+      },
+      {
+        path: '/miniApp/dataManage/readLog',
+        name: "readLog",
+        component: './MiniApp/ReadLog',
+      },
+      {
+        name: 'consume',
+        path: '/miniApp/dataManage/consume',
+        component: './MiniApp/Consume',
+      }
+    ],
+  }
 ]
 export default [
   {

+ 5 - 2
src/access.ts

@@ -1,16 +1,19 @@
 /**
  * @see https://umijs.org/docs/max/access#access
  * */
-export default function access(initialState: { menuType: "distributor" | "miniApp" }) {
+export default function access(initialState: { menuType: "distributor" | "miniApp",selectApp:{id:number} }) {
   return {
     isShow: (route: { name: string; }) => {
       if(initialState?.menuType){
         const { menuType } = initialState;
         let regex = new RegExp(`^${menuType}\\.`);
+        // //与2取余为0时设为小说
+        // if(initialState.selectApp.id % 2 === 0 && route.name.match(/(\.long$)|(\.short$)/)){
+        //   return route.name.match(/\.long$/)
+        // }
         return route.name.match(regex)
       }
       return false
-    
     },//路由名称包含menuType才显示
   };
 }

+ 1 - 1
src/global.tsx

@@ -5,7 +5,7 @@ import { createFromIconfontCN } from '@ant-design/icons';
 import nocover from '../public/nocover.jpg'
 const { pwa } = defaultSettings;
 const isHttps = document.location.protocol === 'https:';
-export let scriptUrl = "//at.alicdn.com/t/c/font_4644725_rof7okshv7t.js"//线上icon
+export let scriptUrl = "//at.alicdn.com/t/c/font_4644725_7r9n7yn0h2a.js"//线上icon
 // 自定义icon组件用于线上icon
 export const MyIcon = createFromIconfontCN({
   scriptUrl// 在 iconfont.cn 上生成

+ 4 - 9
src/locales/zh-CN/menu.ts

@@ -55,16 +55,11 @@ export default {
   "menu.distributor.dyMiniApp":"抖音小程序管理",
   "menu.distributor.account":"账号管理",
   // 小程序页面
-  "menu.miniApp.consume":"消费订单管理",
   "menu.miniApp.payModuleConfig":"书币充值模板管理",
   "menu.miniApp.appManage":"小程序组件管理",
   "menu.miniApp.book":"小说管理",
-  "menu.miniApp.book.short":"短篇小说",
-  "menu.miniApp.book.long":"长篇小说",
-  "menu.miniApp.readLog":"阅读记录",
-  "menu.miniApp.readLog.short":"短篇小说",
-  "menu.miniApp.readLog.long":"长篇小说",
-  "menu.miniApp.payLog":"充值记录",
-  "menu.miniApp.payLog.short":"短篇小说",
-  "menu.miniApp.payLog.long":"长篇小说",
+  "menu.miniApp.dataManage":"数据统计",
+  "menu.miniApp.dataManage.payLog":"充值记录",
+  "menu.miniApp.dataManage.readLog":"阅读记录",
+  "menu.miniApp.dataManage.consume":"书币消耗记录",
 };

+ 67 - 71
src/pages/MiniApp/BookManage/Short/index.tsx

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

+ 11 - 0
src/pages/MiniApp/BookManage/index.tsx

@@ -0,0 +1,11 @@
+import { useModel } from '@umijs/max'
+import LongPage from './Long'
+import ShortPage from './Short'
+function Index() {
+    let { selectApp }: any = useModel("@@initialState", (model) => ({
+        selectApp: model.initialState?.selectApp
+    }))
+    // 临时条件后期从selectApp中获取参数判断小程序是长篇还是短篇
+    return selectApp?.id % 2 !== 0 ? <LongPage /> : <ShortPage />
+}
+export default Index

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

@@ -22,7 +22,7 @@ const Page: React.FC = () => {
                 appType: initialState?.selectApp?.appType || ""
             }}
             scroll={{x:true,y:500}}
-            headerTitle={"消费订单列表"}
+            headerTitle={"书币消耗列表"}
             rowKey={(r) => r.id}
             search={{
                 labelWidth: 120,

+ 2 - 2
src/pages/MiniApp/PayLog/Long/index.tsx

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

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

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

+ 11 - 0
src/pages/MiniApp/PayLog/index.tsx

@@ -0,0 +1,11 @@
+import { useModel } from '@umijs/max'
+import LongPage from './Long'
+import ShortPage from './Short'
+function Index() {
+    let { selectApp }: any = useModel("@@initialState", (model) => ({
+        selectApp: model.initialState?.selectApp
+    }))
+    // 临时条件后期从selectApp中获取参数判断小程序是长篇还是短篇
+    return selectApp?.id % 2 !== 0 ? <LongPage /> : <ShortPage />
+}
+export default Index

+ 2 - 2
src/pages/MiniApp/ReadLog/Long/index.tsx

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

+ 2 - 2
src/pages/MiniApp/ReadLog/Short/index.tsx

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

+ 11 - 0
src/pages/MiniApp/ReadLog/index.tsx

@@ -0,0 +1,11 @@
+import { useModel } from '@umijs/max'
+import LongPage from './Long'
+import ShortPage from './Short'
+function Index() {
+    let { selectApp }: any = useModel("@@initialState", (model) => ({
+        selectApp: model.initialState?.selectApp
+    }))
+    // 临时条件后期从selectApp中获取参数判断小程序是长篇还是短篇
+    return selectApp?.id % 2 !== 0 ? <LongPage /> : <ShortPage />
+}
+export default Index

+ 1 - 1
src/services/miniApp/payLog/index.tsx

@@ -13,7 +13,7 @@ export interface Params extends Page{
     merchantOrderId:string,//商户订单号
     startTime?:string,//开始时间
     endTime?:string,//结束时间
-    changeType?:string,//书币变更类型(1:书币充值、2:参加活动获取、3:抽奖获取 、-1:阅读长篇小说消费、-2:阅读短篇小说消费)
+    changeType?:string,//书币变更类型(1:书币充值、2:参加活动获取、3:抽奖获取 、-1:阅读小说消费、-2:阅读小说消费)
     orderStatus?:string,//订单状态:1 待支付、2 已支付
     orderType?:string,//订单类型:1:书币充值、2:vip充值、3:购买整本)
     payChannel?:string,//支付渠道(1:微信小程序支付)