|
@@ -11,7 +11,7 @@ import {REQ_STATUS} from "@api/config";
|
|
|
import {
|
|
import {
|
|
|
buildReqReducer, reqChangeEmail,
|
|
buildReqReducer, reqChangeEmail,
|
|
|
reqChangeInfo,
|
|
reqChangeInfo,
|
|
|
- reqChangePass, reqChangePhone,
|
|
|
|
|
|
|
+ reqChangePass, reqChangePhone, reqGameInfo,
|
|
|
reqGetRoutes,
|
|
reqGetRoutes,
|
|
|
reqLogin,
|
|
reqLogin,
|
|
|
reqLogout,
|
|
reqLogout,
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
import {toast} from 'react-toastify';
|
|
import {toast} from 'react-toastify';
|
|
|
import {getHttpMsg, localStorageGet, localStorageSet} from "@utils/helpers";
|
|
import {getHttpMsg, localStorageGet, localStorageSet} from "@utils/helpers";
|
|
|
import {LOCAL_IS_LOGIN, LOCAL_SIGN, LOCAL_USER_INFO} from "@constants/localkey";
|
|
import {LOCAL_IS_LOGIN, LOCAL_SIGN, LOCAL_USER_INFO} from "@constants/localkey";
|
|
|
|
|
+import {reqPayConfig} from "@features/paySlice";
|
|
|
const i18n=global.i18n;
|
|
const i18n=global.i18n;
|
|
|
const generateNavs=(routes)=>{
|
|
const generateNavs=(routes)=>{
|
|
|
const navs=[];
|
|
const navs=[];
|
|
@@ -56,9 +57,9 @@ const generateRoutes=(routes,asyncRoutes=[])=>{
|
|
|
// if (route.path==="#/signin"||route.path==="#/signup"){
|
|
// if (route.path==="#/signin"||route.path==="#/signup"){
|
|
|
// route.component="Login";
|
|
// route.component="Login";
|
|
|
// }
|
|
// }
|
|
|
- // if (route.path==="/slots"){
|
|
|
|
|
- // route.login=1;
|
|
|
|
|
- // }
|
|
|
|
|
|
|
+ if (route.path==="#/pay"){
|
|
|
|
|
+ route.component="deposit";
|
|
|
|
|
+ }
|
|
|
allMap[route.path]=route;
|
|
allMap[route.path]=route;
|
|
|
let type=route.type;
|
|
let type=route.type;
|
|
|
if (type===ROUTE_TYPE_IN||type===ROUTE_TYPE_FULL)inRoutes.push(route);
|
|
if (type===ROUTE_TYPE_IN||type===ROUTE_TYPE_FULL)inRoutes.push(route);
|
|
@@ -136,6 +137,8 @@ const reducerRoutes=(state,action)=>{
|
|
|
if (typeof user=="object"){
|
|
if (typeof user=="object"){
|
|
|
isLogin=1;
|
|
isLogin=1;
|
|
|
userInfo=user;
|
|
userInfo=user;
|
|
|
|
|
+ //请求pay
|
|
|
|
|
+ // global.dispatch(reqPayConfig(user));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
Object.assign(state, {routes:state.routes,asyncRoutes:data,styles:styles,blocks:blocks,...generData,isLogin:isLogin,userInfo:userInfo});
|
|
Object.assign(state, {routes:state.routes,asyncRoutes:data,styles:styles,blocks:blocks,...generData,isLogin:isLogin,userInfo:userInfo});
|
|
@@ -171,7 +174,7 @@ const getMsg=(payload)=>{
|
|
|
// return msg;
|
|
// return msg;
|
|
|
return getHttpMsg(payload);
|
|
return getHttpMsg(payload);
|
|
|
}
|
|
}
|
|
|
-const parseLogin=(state,action,arg)=>{
|
|
|
|
|
|
|
+const parseLogin=(state,action,arg,isShowMsg=true)=>{
|
|
|
let payload=action.payload;
|
|
let payload=action.payload;
|
|
|
let code=payload.code;
|
|
let code=payload.code;
|
|
|
let msg=getMsg(payload);
|
|
let msg=getMsg(payload);
|
|
@@ -184,14 +187,18 @@ const parseLogin=(state,action,arg)=>{
|
|
|
// localStorageSet(LOCAL_IS_LOGIN,1);
|
|
// localStorageSet(LOCAL_IS_LOGIN,1);
|
|
|
let sign=data.sign;
|
|
let sign=data.sign;
|
|
|
if (sign!=null)localStorageSet(LOCAL_SIGN,sign);
|
|
if (sign!=null)localStorageSet(LOCAL_SIGN,sign);
|
|
|
- toast.success(msg);
|
|
|
|
|
|
|
+ if(isShowMsg)toast.success(msg);
|
|
|
|
|
+ //请求pay
|
|
|
|
|
+ // global.dispatch(reqPayConfig(data));
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- toast.error(msg);
|
|
|
|
|
|
|
+ if(isShowMsg)toast.error(msg);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (arg){
|
|
|
|
|
+ let callback=arg.callback;
|
|
|
|
|
+ if (callback!=null)callback(code);
|
|
|
}
|
|
}
|
|
|
- let callback=arg.callback;
|
|
|
|
|
- if (callback!=null)callback(code);
|
|
|
|
|
}
|
|
}
|
|
|
const reducerLogin=(state,action,arg)=>{
|
|
const reducerLogin=(state,action,arg)=>{
|
|
|
// toast.success("success");
|
|
// toast.success("success");
|
|
@@ -273,6 +280,15 @@ const changeEmailStatus=(state,status,arg)=>{
|
|
|
state.modifyStatus.phone=status;
|
|
state.modifyStatus.phone=status;
|
|
|
}
|
|
}
|
|
|
//modify
|
|
//modify
|
|
|
|
|
+//gameinfo
|
|
|
|
|
+const reducerGameInfo=(state,action,arg)=>{
|
|
|
|
|
+ // parseLogin(state,action,arg);
|
|
|
|
|
+ parseLogin(state,action,arg,false);
|
|
|
|
|
+}
|
|
|
|
|
+const gameInfoStatus=(state,status,arg)=>{
|
|
|
|
|
+ state.gameInfoStatus=status;
|
|
|
|
|
+}
|
|
|
|
|
+//gameinfo
|
|
|
export const Main=createSlice({
|
|
export const Main=createSlice({
|
|
|
name: 'main',
|
|
name: 'main',
|
|
|
initialState: {
|
|
initialState: {
|
|
@@ -294,7 +310,8 @@ export const Main=createSlice({
|
|
|
password:REQ_STATUS.NONE,
|
|
password:REQ_STATUS.NONE,
|
|
|
phone:REQ_STATUS.NONE,
|
|
phone:REQ_STATUS.NONE,
|
|
|
email:REQ_STATUS.NONE
|
|
email:REQ_STATUS.NONE
|
|
|
- }
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ gameInfoStatus:REQ_STATUS.NONE
|
|
|
},
|
|
},
|
|
|
reducers: {
|
|
reducers: {
|
|
|
logout:(state, action)=>{
|
|
logout:(state, action)=>{
|
|
@@ -315,6 +332,7 @@ export const Main=createSlice({
|
|
|
buildReqReducer(builder,reqChangeInfo,reducerChangeInfo,changeInfoStatus);
|
|
buildReqReducer(builder,reqChangeInfo,reducerChangeInfo,changeInfoStatus);
|
|
|
buildReqReducer(builder,reqChangePhone,reducerChangePhone,changePhoneStatus);
|
|
buildReqReducer(builder,reqChangePhone,reducerChangePhone,changePhoneStatus);
|
|
|
buildReqReducer(builder,reqChangeEmail,reducerChangeEmail,changeEmailStatus);
|
|
buildReqReducer(builder,reqChangeEmail,reducerChangeEmail,changeEmailStatus);
|
|
|
|
|
+ buildReqReducer(builder,reqGameInfo,reducerGameInfo,gameInfoStatus);
|
|
|
},
|
|
},
|
|
|
})
|
|
})
|
|
|
export const {logout} = Main.actions;
|
|
export const {logout} = Main.actions;
|
|
@@ -437,6 +455,14 @@ export const isLogined=(state)=>{
|
|
|
export const getUserInfo=(state)=>{
|
|
export const getUserInfo=(state)=>{
|
|
|
return state.main.userInfo;
|
|
return state.main.userInfo;
|
|
|
}
|
|
}
|
|
|
|
|
+export const getUserID=(state)=>{
|
|
|
|
|
+ let uid=0;
|
|
|
|
|
+ let userInfo=state.main.userInfo;
|
|
|
|
|
+ if (userInfo){
|
|
|
|
|
+ if (userInfo.UserID!=null)uid=userInfo.UserID;
|
|
|
|
|
+ }
|
|
|
|
|
+ return uid;
|
|
|
|
|
+}
|
|
|
//数据获取
|
|
//数据获取
|
|
|
export default Main.reducer;
|
|
export default Main.reducer;
|
|
|
|
|
|