shenwu 7 months ago
parent
commit
44f9d3bff5

+ 11 - 0
src/Hook/usePay.ts

@@ -0,0 +1,11 @@
+// 支付
+function usePay() {
+    const pay = () => {
+        console.log("支付数据",app.payData)
+    }
+    return {
+        pay
+    }
+
+}
+export default usePay

+ 6 - 1
src/app.tsx

@@ -14,6 +14,7 @@ import { initApp, setApp } from './config'
 // ======引入拦截器=========
 import './interceptor'
 import api from './server/index'
+import { getShortBookInfo } from './server/book/short'
 
 
 
@@ -51,11 +52,15 @@ class App extends Component {
     })
   }
   async componentDidShow(options) {
-    let { scene, query } = options//获取当前小程序进入的场景值
+    let { scene, query ,path} = options//获取当前小程序进入的场景值
     let bookConfig = Taro.getStorageSync("bookConfig")
     if (bookConfig) {
       Book.setData({ bookConfig: JSON.parse(bookConfig) })
     }
+    //阅读页面并且路径存在bookId请求数据
+    if(query?.bookId && path === "pages/book/bookArticle/index"){
+      getShortBookInfo(query?.bookId)
+    }
     indexStore.setData({ scene, query })
     // 启动初始化
     console.log("初始化")

+ 15 - 11
src/components/PupPetry/BookBox/BookboxRowSmall.tsx

@@ -6,18 +6,22 @@ import './index.less'
 import BookStore from "@src/store/book"
 import { setReadLog } from "@src/utils/loginSto";
 export interface BookboxRowSmallProps {
-    bookId: number,//书ID
-    authorName: string,//作者
-    bookName: string,//书名称
-    bookDesc: string,//描述
-    picUrl: string,//封面
-    bookStatus: number,//完本|连载状态
-    wordCount: number,//字数
-    labelInfoList: { name: string }[],//标签
-    readLogId: string,//上次阅读的记录
+    bookInfo: {
+        bookId: number,//书ID
+        authorName: string,//作者
+        bookName: string,//书名称
+        bookDesc: string,//描述
+        picUrl: string,//封面
+        bookStatus: number,//完本|连载状态
+        wordCount: number,//字数
+        labelInfoList: { name: string }[],//标签
+        readLogId: string,//上次阅读的记录
+    }
+    lastReadingTime: string,//最近阅读时间
 }
 function BookboxRowSmall(props: BookboxRowSmallProps) {
-    const { bookName, picUrl, bookDesc, labelInfoList, authorName, bookId, wordCount, bookStatus, readLogId } = props
+    const { lastReadingTime, bookInfo } = props
+    const { bookName, picUrl, authorName, bookId, readLogId } = bookInfo
     const click = () => {
         BookStore.setData({ openBookData: props })
         if (readLogId) {
@@ -35,7 +39,7 @@ function BookboxRowSmall(props: BookboxRowSmallProps) {
                         <View className='bottom'>
                             {
                                 true ? <>
-                                    <Text className='time'>{new Date().toLocaleDateString()}</Text>
+                                    <Text className='time'>{lastReadingTime}</Text>
                                     {/* <Text className='section'>{chapter_name}</Text> */}
                                 </>
                                     :

+ 6 - 2
src/components/TopNavBar/index.tsx

@@ -70,7 +70,12 @@ function CustomNavbar(WrappedComponent, props: Props) {
         }
         //回上级
         gotoBack = () => {
-            Taro.navigateBack()
+            let pages = Taro.getCurrentPages(); //获取当前页面栈
+            if(pages?.length > 1 ){
+                Taro.navigateBack()
+            }else{
+                this.gotoHome() 
+            }
         }
         //回主页
         gotoHome = () => {
@@ -102,7 +107,6 @@ function CustomNavbar(WrappedComponent, props: Props) {
             let { navBar, capsuleWidth } = this.state
             const { indexStore: { navBarTop }, bookStore } = this.props.store
             let stateIndex = bookStore.workDirection
-            console.log(this.props.store.bookStore)
             return <View style={{ height: navBar + navBarTop + 5 }}>
                 <View className='navbarWrap' style={{ paddingTop: navBarTop + 5, height: navBar, backgroundColor: isReloadBook ? bookStore.bookConfig?.off_on ? "#FFF" : "#363738" : "#FFF" }}>
                     <View className='content'>

+ 3 - 0
src/components/bottomModal/index.tsx

@@ -4,6 +4,7 @@ import modalStore from '@src/store/modalStore';
 import './index.less'
 import Vip from './vip';
 import Shubi from './shubi';
+import { setApp } from '@src/config';
 
 interface Props {
     type?: 'vip' | 'shubi'
@@ -16,6 +17,8 @@ const GlobalModal: React.FC<Props> = (props) => {
         const hide = (e) => {
             e.stopPropagation()
             modalStore.hideModal()
+            // 关闭弹窗清空支付数据
+            setApp({ payData: null })
         }
         return <>
             {visible && <View className="modal" onClick={hide}>

+ 1 - 3
src/components/bottomModal/shubi/index.tsx

@@ -5,9 +5,7 @@ function Shubi() {
     return <View className="shubi">
         <View className="shubi_title">订阅本章:11书币</View>
         <View className="shubi_info">余额:0书币+0赠币</View>
-        <ShubiBox data={
-            [100, 200, 300, 400, 500, 600]
-        } />
+        <ShubiBox  />
     </View>
 }
 export default Shubi

+ 2 - 2
src/components/bottomModal/vip/index.tsx

@@ -3,8 +3,8 @@ import './index.less'
 import VipBox from "@src/components/pay/vip";
 function Vip() {
     return <View>
-        <View className="shubi_title">会员本书免费读,可省<Text>50.11</Text>元</View>
-        <VipBox data={[1, 2, 3, 4, 5, 6]} />
+        <View className="shubi_title">会员本书免费读</View>
+        <VipBox />
     </View>
 }
 export default Vip

+ 38 - 12
src/components/pay/shubi/index.tsx

@@ -1,26 +1,52 @@
 import { Radio, RadioGroup, View } from "@tarojs/components";
 import './index.less'
-import { useState } from "react";
-type Props = {
-    data: any[]
+import { useMemo, useState } from "react";
+import { Store } from "@src/app";
+import { inject, observer } from "mobx-react";
+import { setApp } from "@src/config";
+import usePay from "@src/Hook/usePay";
+interface Props {
+    store?: Store;
 }
-function ShubiBox(props: Props) {
-    let { data } = props
+function ShubiBox(props?: Props) {
+    let { pay } = usePay()
     let [eq, setEq] = useState(0)
+    let [payData,setPayData]=useState<any>(null)
     let [ok, setOk] = useState(false)
+    let data = useMemo(() => {
+        let thatData = props?.store?.indexStore?.rechargeTemplate?.find(item => item.templateType === 1)
+        let datas = thatData?.rechargeConfigs[0]?.rechargeConfigList
+        setApp({payData:datas[0]})
+        setPayData(datas[0])
+        return datas
+    }, [props?.store?.indexStore?.rechargeTemplate])
     return <>
         <View className="shubi_box">
             {
-                data?.map((item, index) => {
-                    return <View className={`shubi_box_k ${eq === index ? "ac" : ""}`} onClick={() => { setEq(index) }}>
-                        <View className="shubi_box_num">100</View>
-                        <View className="shubi_box_price">1元</View>
-                        <View className="shubi_box_give">赠100书币</View>
+                data?.map((item: {
+                    color,//背景色
+                    description,//整数购买文案
+                    extra,//右上角描述值
+                    gearType,//充值类型
+                    gift,//赠送
+                    obtain,//获得书币/vip每天价格
+                    price,//价格
+                    subscript,//右上角文案 首充|超值等
+                    vipDays,//vip天数
+                }, index) => {
+                    return <View className={`shubi_box_k ${eq === index ? "ac" : ""}`} onClick={() => {
+                        setEq(index)
+                        setApp({ payData: item })
+                        setPayData(item)
+                    }}>
+                        <View className="shubi_box_num">{item?.obtain}</View>
+                        <View className="shubi_box_price">{item?.price}元</View>
+                        <View className="shubi_box_give">赠{item.gift}书币</View>
                     </View>
                 })
             }
         </View>
-        <View className="shubi_box_btn" onClick={() => { setOk(true) }}>确认协议并以1元充值</View>
+        <View className="shubi_box_btn" onClick={() => { setOk(true); pay() }}>确认协议并支付{payData?.price}元</View>
         <View className="shubi_box_gz">
             <RadioGroup onChange={(e: any) => {
                 setOk(true)
@@ -31,4 +57,4 @@ function ShubiBox(props: Props) {
         </View>
     </>
 }
-export default ShubiBox
+export default inject('store')(observer(ShubiBox))

+ 17 - 2
src/components/pay/vip/index.less

@@ -10,7 +10,22 @@
         border: 2rpx solid #D9D9D9;
         display: inline-block;
         margin-right: 20rpx;
-
+        position: relative;
+        .vip_box_tip{
+            position: absolute;
+            top:0;
+            right: 0;
+            height: 40rpx;
+            font-size: 24rpx;
+            font-weight: 400;
+            font-family: PingFang SC, PingFang SC;
+            color: #FFE2A9;
+            padding: 0 25rpx;
+            background: #000;
+            // color: #fff;
+            line-height: 40rpx;
+            border-radius: 0rpx 12rpx 0 30rpx;
+        }
         .vip_box_title {
             width: 100%;
             height: 44rpx;
@@ -22,7 +37,7 @@
             text-align: center;
             font-style: normal;
             text-transform: none;
-            margin: 36rpx 0 12rpx;
+            margin: 70rpx 0 12rpx;
         }
 
         .vip_box_num {

+ 44 - 13
src/components/pay/vip/index.tsx

@@ -1,13 +1,29 @@
 import { Radio, RadioGroup, ScrollView, View } from "@tarojs/components";
 import './index.less'
-import { useState } from "react";
-type Props = {
-    data: any[]
+import { useMemo, useState } from "react";
+import usePay from "@src/Hook/usePay";
+import { setApp } from "@src/config";
+import { Store } from "@src/app";
+import { inject, observer } from "mobx-react";
+import { getEnum } from "@src/utils";
+interface Props {
+    store?: Store;
 }
-function VipBox(props: Props) {
-    let { data } = props
+function VipBox(props?: Props) {
+    let { pay } = usePay()
     let [eq, setEq] = useState(0)
+    let [payData, setPayData] = useState<any>(null)
+    let vipList = getEnum("VIP_DAYS")
     let [ok, setOk] = useState(false)
+    let data = useMemo(() => {
+        let thatData = props?.store?.indexStore?.rechargeTemplate?.find(item => item.templateType === 2)
+        let datas = thatData?.rechargeConfigs[0]?.rechargeConfigList
+        if (datas?.length > 0) {
+            setApp({payData:datas[0]})
+            setPayData(datas[0])
+        }
+        return datas
+    }, [props?.store?.indexStore?.rechargeTemplate])
     return <>
         <ScrollView
             className='vip_box'
@@ -15,17 +31,32 @@ function VipBox(props: Props) {
             scrollWithAnimation
         >
             {
-                data?.map((item, index) => {
-                    return <View className={`vip_box_k ${eq === index ? "ac" : ""}`} onClick={() => { setEq(index) }}>
-                         <View className="vip_box_title">月卡</View>
-                        <View className="vip_box_num">100元</View>
-                        <View className="vip_box_price">200元</View>
-                        <View className="vip_box_give">0.33元/天</View>
+                data?.map((item: {
+                    color,//背景色
+                    description,//整数购买文案
+                    extra,//右上角描述值
+                    gearType,//充值类型
+                    gift,//赠送
+                    obtain,//获得书币/vip每天价格
+                    price,//价格
+                    subscript,//右上角文案 首充|超值等
+                    vipDays,//vip天数
+                }, index) => {
+                    return <View className={`vip_box_k ${eq === index ? "ac" : ""}`} onClick={() => {
+                        setEq(index)
+                        setApp({ payData: item })
+                        setPayData(item)
+                    }}>
+                        <View className="vip_box_tip">{item?.subscript}</View>
+                        <View className="vip_box_title">{vipList?.find(i=>i.value === item.vipDays)?.text?.replace('会员','')}</View>
+                        <View className="vip_box_num">{item?.price}元</View>
+                        {/* <View className="vip_box_price"></View> */}
+                        <View className="vip_box_give">{item?.obtain}元/天</View>
                     </View>
                 })
             }
         </ScrollView>
-        <View className="vip_box_btn" onClick={() => { setOk(true) }}>确认协议并支付8元</View>
+        <View className="vip_box_btn" onClick={() => { setOk(true); pay() }}>确认协议并支付{payData?.price}元</View>
         <View className="vip_box_gz">
             <RadioGroup onChange={(e: any) => {
                 setOk(true)
@@ -36,4 +67,4 @@ function VipBox(props: Props) {
         </View>
     </>
 }
-export default VipBox
+export default inject('store')(observer(VipBox)) 

+ 13 - 3
src/config.ts

@@ -13,7 +13,9 @@ globalThis.app = {
     proVersion: "",
     payVersion: "",
     iosShowPay: true,
-    envVersion: "develop"
+    envVersion: "develop",
+    payData: null,
+    enumDictList: null,
 }
 
 type ConfigParamList = {}
@@ -88,8 +90,12 @@ export interface App {
     payVersion: string,
     /**ios是否展示支付*/
     iosShowPay: boolean,
+    /**支付数据*/
+    payData: any,
+    /**枚举*/
+    enumDictList: any
     /**小程序环境*/
-    envVersion: "develop" | "trial" | "release"
+    envVersion: "develop" | "trial" | "release",
 }
 export interface SetApp {
     appName?: string;//小程序名称
@@ -109,8 +115,12 @@ export interface SetApp {
     payVersion?: string,
     /**ios是否展示支付*/
     iosShowPay?: boolean,
+    /**支付数据*/
+    payData?: any,
+    /**枚举*/
+    enumDictList?: any,
     /**小程序环境*/
-    envVersion?: "develop" | "trial" | "release"
+    envVersion?: "develop" | "trial" | "release",
 }
 // // 定义全局日志函数
 globalThis.log = app.showLog ? console.log : () => { };

+ 3 - 1
src/interceptor.ts

@@ -2,7 +2,7 @@ import Taro from '@tarojs/taro';
 import api from './server/index';
 import { setApp } from './config';
 import bookStore from '@src/store/book'
-import { getRechargeTemplate } from './server/index/index';
+import { enumDictList, getRechargeTemplate } from './server/index/index';
 import indexStore from './store/index'
 export interface ResData {
     code: number,
@@ -65,6 +65,8 @@ const responseInterceptor = (chain) => {
                 if (chain.requestParams.url.includes("loginInitialize")) {
                     // 存放初始token和app信息
                     setApp({ initToken: data.data.token, appInfo: data.data.appInfo,payVersion:data.data.appInfo.iosPayment })
+                    // 获取枚举
+                    enumDictList()
                     // 登录
                     let user: any = await api.login()
                     // 存放user信息到本地

+ 40 - 28
src/pages/book/BookArticle/index.less

@@ -754,36 +754,48 @@
   /* 可根据需要调整字体大小 */
 }
 
-.vip_btn {
-  width: 690rpx;
-  height: 86rpx;
-  line-height: 86rpx;
-  text-align: center;
-  background: linear-gradient(90deg, #FF2442 0%, #FF5E74 100%);
-  border-radius: 48rpx 48rpx 48rpx 48rpx;
-  font-family: PingFang SC, PingFang SC;
-  font-weight: 500;
-  font-size: 32rpx;
-  color: #FFFFFF;
-  font-style: normal;
-  text-transform: none;
-  margin:30rpx 0 ;
+.pay_btns {
+  .vip_btn {
+    width: 690rpx;
+    height: 86rpx;
+    line-height: 86rpx;
+    text-align: center;
+    border-radius: 48rpx 48rpx 48rpx 48rpx;
+    font-family: PingFang SC, PingFang SC;
+    font-weight: 500;
+    font-size: 32rpx;
+    font-style: normal;
+    text-transform: none;
+  }
+  
+  .shubi_btn {
+    width: 690rpx;
+    height: 86rpx;
+    line-height: 86rpx;
+    text-align: center;
+    background: #FFE7EB;
+    border-radius: 48rpx 48rpx 48rpx 48rpx;
+    font-family: PingFang SC, PingFang SC;
+    font-weight: 500;
+    font-size: 32rpx;
+    color: #FF415B;
+    font-style: normal;
+    text-transform: none;
+  }
+  view {
+    &:nth-child(2){
+      background: linear-gradient(90deg, #FF2442 0%, #FF5E74 100%);
+      color: #FFFFFF;
+      margin: 30rpx 0;
+    }
+    &:nth-child(3){
+      background: #FFE7EB;
+      color: #FF415B;
+    }
+  }
 }
 
-.shubi_btn {
-  width: 690rpx;
-  height: 86rpx;
-  line-height: 86rpx;
-  text-align: center;
-  background: #FFE7EB;
-  border-radius: 48rpx 48rpx 48rpx 48rpx;
-  font-family: PingFang SC, PingFang SC;
-  font-weight: 500;
-  font-size: 32rpx;
-  color: #FF415B;
-  font-style: normal;
-  text-transform: none;
-}
+
 
 // .text-with-lines  {
 //   position: relative;

+ 35 - 28
src/pages/book/BookArticle/index.tsx

@@ -5,7 +5,7 @@ import { View, Text, ScrollView } from '@tarojs/components';
 import { observer, inject } from 'mobx-react';
 import './index.less';
 import TopNavBar from '@src/components/TopNavBar/index';
-import Taro, { useDidHide } from '@tarojs/taro';
+import Taro, { useDidHide, useLoad } from '@tarojs/taro';
 import BookConfigPuP from '@src/components/bookConfigPup';
 import { BookStore } from '@src/store/book';
 import useApi from '@src/Hook/useApi';
@@ -35,6 +35,7 @@ const BookArticle: React.FC<BookArticleProps> = ({ store }) => {
     const [isLoad, setIsLoad] = useState(false)
     const { bookStore, indexStore, modalStore } = store
     const [showPay, setShowPay] = useState(false)//需要付费展示
+    const [showVip, setShowVip] = useState(false)//是否展示vip支付
     const { openBookData } = bookStore
     const [bookConfig, setBookConfig] = useState<Config>({ size: 'pre_21', off_on: true, bg: 'bg_b', lh: 'lh_72' });
     const [pup, setPup] = useState(false);
@@ -43,31 +44,35 @@ const BookArticle: React.FC<BookArticleProps> = ({ store }) => {
     const newReadLogIdRef = useRef("");
     const readLogInterval = useRef<NodeJS.Timeout>()
     const [payType, setPayType] = useState<"shubi" | "vip">("shubi")
+
+
     // 页面显示的操作请求
     useEffect(() => {
         // ComponentDidMount
-        try {
-            Taro.getStorage({
-                key: 'bookConfig',
-                success: (res) => {
-                    setBookConfig(JSON.parse(res.data));
-                },
-                fail: () => {
-                    setConfig({ size: 'pre_21', off_on: true, bg: 'bg_b', lh: 'lh_72' });
-                }
-            });
-        } catch (e) {
-            console.error('Error loading book config:', e);
+        if (openBookData?.bookId) {
+            try {
+                Taro.getStorage({
+                    key: 'bookConfig',
+                    success: (res) => {
+                        setBookConfig(JSON.parse(res.data));
+                    },
+                    fail: () => {
+                        setConfig({ size: 'pre_21', off_on: true, bg: 'bg_b', lh: 'lh_72' });
+                    }
+                });
+            } catch (e) {
+                console.error('Error loading book config:', e);
+            }
+            onReport()
+            //假如存在阅读记录获取对应章节的条数
+            let readLogId = getReadLog(openBookData?.bookId)
+            getBookContent({ pageNum: 1, pageSize: readLogId ? Number(readLogId?.split('-')[1]) : 2 }).then(res => {
+                //继续阅读时跳转到上次阅读的段落
+                console.log("上次阅读到readLogId", readLogId)
+                setCurrentScrollId(readLogId)
+            })
         }
-        onReport()
-        //假如存在阅读记录获取对应章节的条数
-        let readLogId = getReadLog(openBookData?.bookId)
-        getBookContent({ pageNum: 1, pageSize: readLogId ? Number(readLogId?.split('-')[1]) : 2 }).then(res => {
-            //继续阅读时跳转到上次阅读的段落
-            console.log("上次阅读到readLogId", readLogId)
-            setCurrentScrollId(readLogId)
-        })
-    }, []);
+    }, [openBookData?.bookId]);
     // 上报阅读
     const onReport = () => {
         let scene = indexStore.scene
@@ -157,6 +162,7 @@ const BookArticle: React.FC<BookArticleProps> = ({ store }) => {
             backgroundColor: bookConfig.off_on ? '#fff' : '#111'
         });
     }, [bookConfig.off_on]);
+    // 下拉加载
     const onLoad = async () => {
         if (openBookData?.contentData) {
             let { size, current, total, records } = openBookData.contentData
@@ -237,14 +243,15 @@ const BookArticle: React.FC<BookArticleProps> = ({ store }) => {
                 <View onClick={togglePup}>
                     {
                         openBookData?.contentData?.records?.map(item => {
-                            let needPay = item.needPay
-                            let isPay = item.isPay
-                            let showText = true
+                            let needPay = item.needPay //是否付费解锁
+                            let showText = true //是否显示内容
                             let arr = item.paragraphInfo.content?.match(/[^\n]*\n?/g);
-                            if (needPay && !isPay) {
+                            // 是否需要付费
+                            if (needPay) {
                                 showText = false
                                 if (!showPay) {
                                     setShowPay(true)
+                                    setShowVip(item.vipFree)
                                 }
                             }
                             return showText ? <View
@@ -264,10 +271,10 @@ const BookArticle: React.FC<BookArticleProps> = ({ store }) => {
                         })
                     }
 
-                    {showPay && <View>
+                    {showPay && <View className='pay_btns'>
                         <View className='text-with-lines' >剩余内容需付费解锁</View>
                         <IosShowPay>
-                            <View className='vip_btn' onClick={(e) => { payBtn(e, "vip") }}>开通会员,本书免费读</View>
+                            {showVip && <View className='vip_btn' onClick={(e) => { payBtn(e, "vip") }}>开通会员,本书免费读</View>}
                             <View className='shubi_btn' onClick={(e) => { payBtn(e, "shubi") }}>购买本章</View>
                         </IosShowPay>
                     </View>}

+ 0 - 1
src/pages/bookrack/index.tsx

@@ -84,7 +84,6 @@ const Index: React.FC<Props> = ({ store }) => {
             }
         })
     }
-    console.log(modalStore)
     return <View>
         <ScrollViewHoc
             load={load}

+ 28 - 0
src/server/index/index.ts

@@ -1,5 +1,6 @@
 import Taro from "@tarojs/taro";
 import indexStore from "@src/store/index";
+import { setApp } from "@src/config";
 /**
  * 获取小程序组件配置列表
  * */
@@ -120,3 +121,30 @@ export function getRechargeTemplate() {
         }
     })
 }
+/**
+ * 获取枚举
+ * */
+export function enumDictList() {
+    return new Promise(async (resolve, reject) => {
+        try {
+            // 初始化
+            Taro.request({
+                url: '/app/enumDict/list',
+                method: 'GET',
+                success: (res) => {
+                    let enumList = {}
+                    Object.values(res.data?.data?.enums).map((item: any) => {
+                        enumList[item.name] = item
+                    })
+                    setApp({ enumDictList: enumList })
+                    resolve(res)
+                },
+                fail: (err) => {
+                    reject(err);
+                }
+            })
+        } catch (error) {
+            reject(error);
+        }
+    })
+}

+ 0 - 96
src/store/appInfo.tsx

@@ -1,96 +0,0 @@
-// import { observable } from 'mobx'
-
-
-// type ConfigParamList = {}
-// export interface AppInfo {
-//     appCategory: 1 | 2,//1长篇 2短篇
-//     appName: string,//小程序名称
-//     appVersion: string,//小程序版本
-//     configParamList: ConfigParamList[],//小程序配置
-//     distributorId: 1,//分销商ID
-//     enabled: true,//启用状态
-//     homePage: string,//主页路径
-//     id: 4,//
-//     wechatAppId: string,//小程序ID
-//     appPageComponentList: AppPageComponent[],//组件配置
-//     appRechargeTemplateList: RechargeTemplate[],//支付模板
-// }
-// interface RechargeTemplate {
-//     templateDescription: string,//模板描述
-//     templateName: string,//模板名称
-//     templateType: 1 | 2,//模板类型 1书币 2vip
-//     remark: string,//备注
-//     appType: 1 | 2,//1微信 2抖音
-//     id: number,
-//     activateTemplate: boolean,//激活
-//     rechargeConfigs: {
-//         firstRecharge: boolean,//是否是首充档位
-//         rechargeConfigList: Config[],//
-//     }[]
-// }
-// interface Config {
-//     color: boolean,//背景色
-//     description: string,//整数购买文案
-//     extra: string,//右上角描述值
-//     gearType: 1 | 2,//充值类型 1书币 2 vip
-//     gift: string,//赠送
-//     obtain: string,//获得书币/vip每天价格
-//     price: number,//价格
-//     subscript: string,//右上角文案 首充|超值等
-//     vipDays: number,//vip天数
-// }
-// interface AppPageComponent {
-//     pageName: string,//页面名称
-//     pagePath: string,//页面路径
-//     id: number,//组件ID
-//     sharePicUrl: string,//分享图
-//     shareTitles: string,//分享标题
-//     pageDesc: string,//页面描述
-//     appComponentListVOS: {
-//         workDirection: 0 | 1,//男频女频
-//         appComponentListVOS: AppComponent[]
-//     }[]
-// }
-// interface AppComponent {
-//     componentType: "banners" | "hot_books" | "hot_category",
-//     id: number
-// }
-// export interface AppInfoStore {
-//     /**app初始化信息*/
-//     appInfo?: AppInfo,
-//     /**登录后的token*/
-//     token?: string,//token
-//     /**进入的场景*/
-//     scene?: number,
-//     /**分享值*/
-//     shareSources?: any,
-//     /**设置app初始化信息*/
-//     actionAppInfo: (appInfo: AppInfo) => void
-//     /**设置登录后的token*/
-//     actionToken: (token: string) => void
-//     setData: (data: { [key: string]: any }) => void,
-// }
-// /**
-//  * APP初始化信息
-//  * */
-// const appInfoStore: AppInfoStore = observable({
-//     appInfo: undefined,
-//     actionAppInfo(appInfo: AppInfo) {
-//         if (appInfo) {
-//             this.appInfo = appInfo
-//         }
-//     },
-//     actionToken(token: string) {
-//         console.log("设置token", token)
-//         this.token = token
-//     },
-//     setData(data: { [key: string]: any }) {
-//         if (data) {
-//             Object.keys(data).forEach(key => {
-//                 this[key] = data[key]
-//             })
-//         }
-//     },
-// })
-
-// export default appInfoStore

+ 5 - 0
src/utils/index.tsx

@@ -0,0 +1,5 @@
+export const getEnum = (enumName: string) => {
+    console.log("app?.enumDictList",app?.enumDictList,enumName)
+    let arr = app?.enumDictList?.[enumName]?.values
+    return arr?.map(({ value, description }: any) => ({ value, key: value, text: description }))
+}