xy 1 an în urmă
părinte
comite
ede43dd5ec

+ 48 - 0
xs-app/components/read/recharge.vue

@@ -0,0 +1,48 @@
+<template>
+	<view>
+		<uni-popup @touchstart="maskStart" @touchmove="maskTouch" :animation="false" mask-background-color="rgba(0,0,0,0)" ref="recharge"  :background-color="db_color"  @change="change">
+			<recharge-item v-for="(item,index) in rechargeList" :key="index"></recharge-item>
+		</uni-popup>
+	</view>
+</template>
+
+<script setup lang="ts">
+	import { ref,onMounted, reactive } from 'vue';
+	import rechargeItem from './rechargeItem.vue';
+	import { recharge_list_data } from '../../data/data';
+	import { ReadSetting } from '../../stores/readSetting';
+	import { config } from '../../config/config';
+	
+	let db_color = ref('')
+	
+	let recharge = ref(null)
+	
+	let type = 'bottom'
+	
+	
+	let rechargeList= ref<Array<recharge_list_data>>(null)
+	
+	onMounted(()=>{
+		ReadSetting().getRechargeList(config.recharge_stype.CHAPTER_PAGE,(d)=>{
+			rechargeList.value = d
+			// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
+			recharge.value.open(type)
+		})
+	})
+	
+	function maskStart(){
+		
+	}
+	
+	function maskTouch(){
+		
+	}
+	
+	function change(e){
+		
+	}
+	
+</script>
+
+<style lang="scss" scoped>
+</style>

+ 8 - 0
xs-app/components/read/rechargeItem.vue

@@ -0,0 +1,8 @@
+<template>
+</template>
+
+<script>
+</script>
+
+<style>
+</style>

+ 21 - 0
xs-app/config/config.ts

@@ -94,6 +94,12 @@ export class config {
 			book_details(book_id:number) {
 				return config.url_addr.Static + `/bookstatic/book/${book_id}.json`
 			},
+			/**
+			 *  stype 类型 1 章节页面 2 vip充值页面 3 充书币页面
+			 */
+			get_recharge_list(stype:number){
+				return config.url_addr.Static + `/bookstatic/recharge/${config.applet_id}_${stype}.json`
+			}
 		},
 		
 		StatesCode:{
@@ -114,4 +120,19 @@ export class config {
 		BrightDbColor:`#ffffff`, //光亮模式下的底板颜色
 		DarkDbColor:`#000000` //黑暗模式下的底板颜色
 	}
+	
+	public static recharge_stype = {
+		CHAPTER_PAGE:1, //1 章节页面
+		VIP_RECHARGE:2, //2 vip充值页面
+		BOOK_COIN_PAGE:3, //3 充书币页面
+	}
+	
+	/**
+	 * 支付类型 1 抖音支付 2 微信支付 3 内部充值(内部测试)
+	 */
+	public static pay_type = {
+		DOU_YIN:1, //抖音支付
+		WEI_XIN:2, //微信支付
+		NEI_BU:3, //内部充值
+	}
 }

+ 13 - 0
xs-app/data/data.ts

@@ -66,4 +66,17 @@ export class book_item_data{
 	base_path:string;  //章节内容静态地址-需要拼接章节id 例如 /test_books/0/1/1.txt
 	start_read_chapter_id:number = -1; //
 	read_hisroty_time:string='';//阅读时间
+}
+
+export class recharge_list_data {
+	goods_id:number; //	商品ID
+	name:string; //名称
+	amount:number; //金额 单位(分)
+	coin:number; //充值金币
+	give_coin:number; //赠送金币
+	prompt1:string; //描述
+	day:number; //天数
+	base_angle:string; //底角描述
+	is_vip:number; //是否vip 1 是 0 否
+	is_default:number; //默认状态 1 默认 0 否
 }

+ 0 - 2
xs-app/pages/readbook/read.vue

@@ -14,8 +14,6 @@
 		 :scrollHeight="windowHeight*0.6" @clickChar="goToChapter" @Close="showChapterList=false">
 		</chapterCatalog>
 	</view>
-
-
 </template>
 
 <script setup lang="ts">

+ 17 - 2
xs-app/stores/readSetting.ts

@@ -1,10 +1,12 @@
 import {defineStore} from 'pinia';
 import {reactive} from 'vue';
-import { read_setting_data } from '../data/data';
+import { read_setting_data, recharge_list_data } from '../data/data';
 import { config } from '../config/config';
 import { util } from '../framework/util';
+import { http } from '../framework/http';
 export const ReadSetting = defineStore('read-setting',()=>{
 	let data:read_setting_data = reactive(new read_setting_data())
+	let recharge_data:recharge_list_data[] = null
 	async function updateReadSetting(d:read_setting_data){
 		data.fontSizeIndex=d.fontSizeIndex;
 		data.colorBgIndex = d.colorBgIndex;
@@ -48,5 +50,18 @@ export const ReadSetting = defineStore('read-setting',()=>{
 		}
 		return data
 	}
-	return {data,updateReadSetting,getReadSetting,changeFontSize,changeBgColor,changeAutoBuyNextChapter,changeReadMode}
+	
+	function getRechargeList(stype:number,cb:Function){
+		if(recharge_data==null){
+			http.StaticRequest(config.url_confg.Static.get_recharge_list(stype),(err,d)=>{
+				if(d.code==config.url_confg.StatesCode.SUCCESS){
+					recharge_data = d.content
+					cb(recharge_data)
+				}
+			})
+		}else{
+			cb(recharge_data)
+		}
+	}
+	return {data,updateReadSetting,getReadSetting,changeFontSize,changeBgColor,changeAutoBuyNextChapter,changeReadMode,getRechargeList}
 })