shenwu 6 meses atrás
pai
commit
87d0ed9b5f

+ 3 - 1
src/interceptor.ts

@@ -3,6 +3,7 @@ import api from './server/index';
 import { setApp } from './config';
 import { setApp } from './config';
 import appInfoStore from '@src/store/appInfo'
 import appInfoStore from '@src/store/appInfo'
 import bookStore from '@src/store/book'
 import bookStore from '@src/store/book'
+import { getRechargeTemplate } from './server/index/index';
 export interface ResData {
 export interface ResData {
     code: number,
     code: number,
     data: any,
     data: any,
@@ -72,9 +73,10 @@ const responseInterceptor = (chain) => {
                 if (chain.requestParams.url.includes("loginInitialize")) {
                 if (chain.requestParams.url.includes("loginInitialize")) {
                     setApp({ initToken: data.data.token })
                     setApp({ initToken: data.data.token })
                     appInfoStore.actionAppInfo(data.data.appInfo)
                     appInfoStore.actionAppInfo(data.data.appInfo)
-                    // let res: any = await api.getAppComponent()
                     let user: any = await api.login()
                     let user: any = await api.login()
                     Taro.setStorageSync("userInfo", user)
                     Taro.setStorageSync("userInfo", user)
+                    let temp: any = await getRechargeTemplate()
+                    console.log("temp", temp)
                     setApp({ appName: data?.data?.appInfo?.appName })
                     setApp({ appName: data?.data?.appInfo?.appName })
                     appInfoStore.setData({ appInfo: data.data.appInfo, })
                     appInfoStore.setData({ appInfo: data.data.appInfo, })
                     // 检测待请求列表中是否存在请求,存在就执行请求
                     // 检测待请求列表中是否存在请求,存在就执行请求

+ 15 - 0
src/pages/book/bookDetails/index.less

@@ -172,5 +172,20 @@
       width: 690px;
       width: 690px;
       height: 96px;
       height: 96px;
     }
     }
+    .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 ;
+    }
   }
   }
 }
 }

+ 4 - 3
src/pages/book/bookDetails/index.tsx

@@ -25,7 +25,7 @@ class BookDetails extends Component<Props> {
     //         imageUrl: this.props.store.bookStore.openBookData?.picUrl
     //         imageUrl: this.props.store.bookStore.openBookData?.picUrl
     //     }
     //     }
     // }
     // }
-    
+
     componentDidShow(options) {
     componentDidShow(options) {
         // Taro.showShareMenu({
         // Taro.showShareMenu({
         //     showShareItems: ["shareAppMessage"],
         //     showShareItems: ["shareAppMessage"],
@@ -42,7 +42,7 @@ class BookDetails extends Component<Props> {
             log(params?.bookId)
             log(params?.bookId)
         }
         }
     }
     }
-  
+
     render() {
     render() {
         let { bookStore } = this.props.store
         let { bookStore } = this.props.store
         let { openBookData } = bookStore
         let { openBookData } = bookStore
@@ -83,7 +83,8 @@ class BookDetails extends Component<Props> {
                     </View>
                     </View>
                     <View className='btn' >
                     <View className='btn' >
                         <Navigator url={`/pages/book/bookArticle/index?bookId=${openBookData?.bookId}`} hoverClass="none">
                         <Navigator url={`/pages/book/bookArticle/index?bookId=${openBookData?.bookId}`} hoverClass="none">
-                            <Image src={require('../../../icon/btn.png')} className='img' />
+                            {/* <Image src={require('../../../icon/btn.png')} className='img' /> */}
+                            <View className='vip_btn' >开始阅读</View>
                         </Navigator>
                         </Navigator>
                     </View>
                     </View>
                 </View>
                 </View>

+ 24 - 1
src/server/index/index.ts

@@ -96,4 +96,27 @@ export function getShortHotBooks(workDirection) {
             reject(error);
             reject(error);
         }
         }
     })
     })
-}
+}
+/**
+ * 获取短篇首页热门书籍列表
+ * */
+export function getRechargeTemplate() {
+    return new Promise(async (resolve, reject) => {
+        try {
+            // 初始化
+            Taro.request({
+                url: '/app/rechargeTemplate/getInfo',
+                method: 'GET',
+                success: (res) => {
+                    indexStore.setData({ rechargeTemplate: res.data.data })
+                    resolve(res)
+                },
+                fail: (err) => {
+                    reject(err);
+                }
+            })
+        } catch (error) {
+            reject(error);
+        }
+    })
+}

+ 5 - 3
src/store/index.ts

@@ -19,8 +19,8 @@ export interface IndexStore {
         name: string,//名称
         name: string,//名称
         showRightButton: boolean,//右侧按钮是否展示
         showRightButton: boolean,//右侧按钮是否展示
         workDirection: number,//频道
         workDirection: number,//频道
-        longBookInfoAppVOS:any[]
-        shortBookInfoAppVOS:any[],//书籍内容
+        longBookInfoAppVOS:any[] | null
+        shortBookInfoAppVOS:any[] | null,//书籍内容
     },//首页热门数据
     },//首页热门数据
     indexHotCategory: {
     indexHotCategory: {
         bookCategoryList: { id: number, name: string }[],//分类
         bookCategoryList: { id: number, name: string }[],//分类
@@ -29,15 +29,17 @@ export interface IndexStore {
         workDirection: number,//频道
         workDirection: number,//频道
     },//首页热门分类
     },//首页热门分类
     indexCategoryId: number,//首页分类选中的id
     indexCategoryId: number,//首页分类选中的id
+    rechargeTemplate:any[],//充值模板数据
     setData: (data: { [key: string]: any }) => void,
     setData: (data: { [key: string]: any }) => void,
 }
 }
-const Index = observable({
+const Index:IndexStore = observable({
     scene: 0,    // 场景值
     scene: 0,    // 场景值
     system: '',  // 系统
     system: '',  // 系统
     navBarTop: 0,//状态栏高度
     navBarTop: 0,//状态栏高度
     navHeight: 0,//导航栏高度
     navHeight: 0,//导航栏高度
     query: null,//本次进入小程序参数
     query: null,//本次进入小程序参数
     indexBanners: [],//首页banner数据
     indexBanners: [],//首页banner数据
+    rechargeTemplate:[],//充值模板数据
     indexHotBooks: {
     indexHotBooks: {
         name: "今日热书",//名称
         name: "今日热书",//名称
         showRightButton: true,//右侧按钮是否展示
         showRightButton: true,//右侧按钮是否展示