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