Pārlūkot izejas kodu

添加用户电话号码和配置功能

在`mainSlice.js`中,添加了对用户电话号码的检查和操作。在配置(conf)部分中增加了`popWheel`、`popBindPhone`、`firstBonus` 和 `openRelief`选项。在`App.js`中,根据`popWheel`配置决定是否显示转盘。优化了状态存储和获取相关的代码。
PigTech 2 gadi atpakaļ
vecāks
revīzija
614d5dca52
2 mainītis faili ar 25 papildinājumiem un 3 dzēšanām
  1. 3 2
      src/App.js
  2. 22 1
      src/features/mainSlice.js

+ 3 - 2
src/App.js

@@ -44,7 +44,7 @@ import Layout from "@layout/Layout";
 import {
     getBFP,
     getFetchStatus,
-    getHallServerUrl, getKickState, getOpenPay, getPromoteInstall,
+    getHallServerUrl, getKickState, getOpenPay, getPromoteInstall,getPopWheel,
     getUserID,
     getUserInfo,
     isLogined,
@@ -101,6 +101,7 @@ const App = () => {
     // const {preLocation,gameID}=usePreviousRoute();
     const serverKick=useSelector(getKickState);
     const promoteInstall=useSelector(getPromoteInstall);
+    const popWheel=useSelector(getPopWheel);
     const openPay=useSelector(getOpenPay);
     const muiTheme = createTheme({
         direction: direction,
@@ -283,7 +284,7 @@ const App = () => {
             if (times>0){
                 if (pathname==="/"){
                     if(hash==null||hash===""){
-                        setIsShowWheel(true);
+                        if(popWheel)setIsShowWheel(true);
                         return;
                     }
                 }

+ 22 - 1
src/features/mainSlice.js

@@ -166,6 +166,7 @@ const reducerRoutes=(state,action)=>{
         let user=json.user;
         let isLogin=0;
         let userInfo={};
+        let hasPhone=0;
         if (user){
             if (typeof user=="object"){
                 isLogin=1;
@@ -175,6 +176,10 @@ const reducerRoutes=(state,action)=>{
                 // global.dispatch(reqPayConfig(user));
                 let sign=user.sign;
                 if (sign!=null)localStorageSet(LOCAL_SIGN,sign);
+
+                if(user.Phone!==""&&user.Phone.startsWith(user.RegisterLocation)){
+                    hasPhone=1;
+                }
             }
         }
         let conf=json.conf;
@@ -182,6 +187,10 @@ const reducerRoutes=(state,action)=>{
         let promoteInstall=0;
         let guest=0;
         let upgradeBonus=0;
+        let popWheel=0;
+        let popBindPhone=0;
+        let firstBonus=0;
+        let openRelief=0;
         if (conf){
             if (!!conf.hall)hallServerUrl=conf.hall;
             if (!!conf.DOLLAR)global.DOLLAR=conf.DOLLAR;
@@ -196,10 +205,19 @@ const reducerRoutes=(state,action)=>{
             //guest
             if (!!conf.guest)guest=conf.guest;
             if (!!conf.upgradeBonus)upgradeBonus=conf.upgradeBonus;
+            //弹出转盘
+            if (!!conf.popWheel)popWheel=conf.popWheel;
+            //弹出绑定电话奖励,并显示浮标
+            if (!!conf.popBindPhone)popBindPhone=hasPhone?0:conf.popBindPhone;
+            //显示首冲浮标
+            if (!!conf.firstBonus)firstBonus=conf.firstBonus;
+            //显示救济浮标
+            if (!!conf.openRelief)openRelief=conf.openRelief;
         }
         //favorites
         // let favorites=getFavorites(json.favorites);
-        Object.assign(state, {routes:state.routes,asyncRoutes:data,styles:styles,blocks:blocks,...generData,isLogin:isLogin,userInfo:userInfo,hallServerUrl:hallServerUrl,promoteInstall:promoteInstall,guest:guest,upgradeBonus:upgradeBonus});
+        Object.assign(state, {routes:state.routes,asyncRoutes:data,styles,blocks,...generData,isLogin:isLogin,userInfo,hallServerUrl,promoteInstall,guest,upgradeBonus,popWheel,popBindPhone,firstBonus,openRelief});
+        // Object.assign(state, {routes:state.routes,asyncRoutes:data,styles:styles,blocks:blocks,...generData,isLogin:isLogin,userInfo:userInfo,hallServerUrl:hallServerUrl,promoteInstall:promoteInstall,guest:guest,upgradeBonus:upgradeBonus});
     }
 }
 const routesStatus=(state,status,arg)=>{
@@ -769,6 +787,9 @@ export const getKickState=(state)=>{
 export const getPromoteInstall=(state)=>{
     return state.main.promoteInstall;
 }
+export const getPopWheel=(state)=>{
+    return state.main.popWheel;
+}
 export const getOpenPay=(state)=>{
     return state.main.openPay;
 }