Commit 5affa698 authored by 赵振东's avatar 赵振东

feat: 登录页面初步改造

parent 1c6b2de1
This diff is collapsed.
......@@ -23,6 +23,7 @@
"@types/qs": "^6.9.7",
"@types/react-native-vector-icons": "^6.4.12",
"crypto-es": "^1.2.7",
"eslint-plugin-prettier": "^4.2.1",
"i18next": "^20.5.0",
"mobx": "^6.7.0",
"mobx-react-lite": "^3.4.0",
......
export interface BusinessType {
businessTypeId: number;
businessTypeName: string;
businessTypeId: number;
businessTypeName: string;
}
export interface UseType {
memberTypeId: number;
memberTypeName: string;
businessTypes: BusinessType[];
memberTypeId: number;
memberTypeName: string;
businessTypes: BusinessType[];
}
export interface UserRegister {
useType: UseType[];
useType: UseType[];
}
export interface ShopInfo {
id: number;
name: string;
type: number;
environment: number;
property: number;
self: number;
memberOperate: number;
openMro: number;
logoUrl: string;
describe?: any;
state: number;
url: string;
isDefault: number;
createTime: number;
currencyName?: any;
isHelp?: any;
id: number;
name: string;
type: number;
environment: number;
property: number;
self: number;
memberOperate: number;
openMro: number;
logoUrl: string;
describe?: any;
state: number;
url: string;
isDefault: number;
createTime: number;
currencyName: string;
isHelp?: any;
}
export interface OrderMode {
id: number;
platformType: number;
platformWayName: string;
isPitchOn: number;
platformTypeName: string;
id: number;
platformType: number;
platformWayName: string;
isPitchOn: number;
platformTypeName: string;
}
export interface OrderType {
id: number;
platformType: number;
platformWayName: string;
isPitchOn: number;
platformTypeName: string;
id: number;
platformType: number;
platformWayName: string;
isPitchOn: number;
platformTypeName: string;
}
export interface Web {
shopInfo: ShopInfo[];
orderMode: OrderMode[];
orderType: OrderType[];
shopInfo: ShopInfo[];
orderMode: OrderMode[];
orderType: OrderType[];
}
export interface SiteInfo {
id: number;
name: string;
logo: string;
siteUrl: string;
symbol: string;
language: string;
enableMultiTenancy: number;
}
export interface ParamConfigList {
code: string;
value: string;
description?: any;
}
export interface CustomerServiceInfo {
id: number;
platformName: string;
type: number;
paramConfigList: ParamConfigList[];
id: number;
name: string;
logo: string;
siteUrl: string;
symbol: string;
language?: any;
enableMultiTenancy: number;
}
export interface Global {
siteInfo: SiteInfo;
customerServiceInfo: CustomerServiceInfo;
siteInfo: SiteInfo;
customerServiceInfo?: any;
}
export interface SiteList {
name: string;
key: string;
icon: string;
name: string;
key: string;
icon: string;
}
export interface PublicSelect {
siteList: SiteList[];
siteList: SiteList[];
}
export interface RootObject {
userRegister: UserRegister;
web: Web;
global: Global;
publicSelect: PublicSelect;
}
userRegister: UserRegister;
web: Web;
global: Global;
publicSelect: PublicSelect;
}
\ No newline at end of file
/* eslint-disable import/prefer-default-export */
/* 这个文件是动态生成的, 请别随意改动 */
export const AUTO_CREATE_THEME_TYPE = 'science';
export const AUTO_CREATE_THEME_TYPE = 'science'
......@@ -18,16 +18,16 @@ export const ROUTERS = {
Login: {
title: '登入',
component: Login,
headerShown: true,
},
LoginAgreement: {
title: '', // 协议
component: LoginAgreement,
headerShown: true,
},
AccountInfo: {
title: '账号信息',
component: AccountInfo,
headerShown: true,
headerShown: false,
},
// LoginAgreement: {
// title: '', // 协议
// component: LoginAgreement,
// headerShown: true,
// },
// AccountInfo: {
// title: '账号信息',
// component: AccountInfo,
// headerShown: true,
// },
};
......@@ -4,8 +4,8 @@ import { View } from 'react-native';
import { WebView } from 'react-native-webview';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { RootStackScreenProps } from '../../../routers/types';
import { getManageContentNoticeGet } from '../../../services/ManageV2Api';
import type { GetManageContentNoticeGetResponse } from '../../../services/ManageV2Api';
// import { getManageContentNoticeGet } from '../../../services/ManageV2Api';
// import type { GetManageContentNoticeGetResponse } from '../../../services/ManageV2Api';
type LoginAgreementScreenNavigationProp =
RootStackScreenProps<'LoginAgreement'>;
......@@ -21,26 +21,26 @@ const LoginAgreement: React.FC<LoginAgreementScreenNavigationProp> = ({
const {
params: { id },
} = route;
const [columnTypeList, setcolumnTypeList] =
useState<GetManageContentNoticeGetResponse | null>(null);
// const [columnTypeList, setcolumnTypeList] =
// useState<GetManageContentNoticeGetResponse | null>(null);
const safeInset = useSafeAreaInsets();
const findAllByColumnType = async () => {
const res = await getManageContentNoticeGet({ id: `${id}` });
if (res.code === 1000) {
setcolumnTypeList(res.data);
navigation.setOptions({ title: res.data.title });
}
};
// const findAllByColumnType = async () => {
// const res = await getManageContentNoticeGet({ id: `${id}` });
// if (res.code === 1000) {
// setcolumnTypeList(res.data);
// navigation.setOptions({ title: res.data.title });
// }
// };
useEffect(() => {
findAllByColumnType();
// findAllByColumnType();
}, []);
return (
<View style={{ flex: 1, paddingBottom: safeInset.bottom }}>
<WebView source={{ html: columnTypeList?.content || '' }} />
{/* <WebView source={{ html: columnTypeList?.content || '' }} /> */}
</View>
);
};
......
......@@ -2,10 +2,10 @@ import React, { useEffect, useState } from 'react';
import { View, TextInput, Text, TouchableOpacity } from 'react-native';
import Icons from 'react-native-vector-icons/AntDesign';
import Toast from 'react-native-root-toast';
import {
postMemberMobileWechatAppletSends,
getMemberMobileRegisterCountryList,
} from '../../../../services/MemberV2Api';
// import {
// postMemberMobileWechatAppletSends,
// getMemberMobileRegisterCountryList,
// } from '../../../../services/MemberV2Api';
import useAppStyle from '../../../../hooks/useAppStyle';
import AreaCodePopup from '../../../../components/AreaCodePopup';
import type { AreaCodeOption } from '../../../../components/AreaCodePopup';
......@@ -43,16 +43,16 @@ const MobileView: React.FC<any> = (props: Iprops) => {
});
const [countryList, setCountryList] = useState<AreaCodeOption[]>([]);
const fetchCountryList = () => {
getMemberMobileRegisterCountryList().then(res => {
if (res.code === 1000) {
setCountryList(res.data);
}
});
};
// const fetchCountryList = () => {
// getMemberMobileRegisterCountryList().then(res => {
// if (res.code === 1000) {
// setCountryList(res.data);
// }
// });
// };
useEffect(() => {
fetchCountryList();
// fetchCountryList();
}, []);
/* 倒计时 */
......@@ -73,24 +73,24 @@ const MobileView: React.FC<any> = (props: Iprops) => {
};
// 获取国家代码和手机号码位数
const getcode = async () => {
const phone = from.phone;
if (!btnDisabled) {
if (!phone) {
Toast.show('请输入手机号码', { position: Toast.positions.CENTER });
} else {
const param = {
countryCode,
phone,
};
const res = await postMemberMobileWechatAppletSends(param);
if (res.code === 1000) {
hanleCountdown();
Toast.show('发送成功', { position: Toast.positions.CENTER });
}
}
}
};
// const getcode = async () => {
// const phone = from.phone;
// if (!btnDisabled) {
// if (!phone) {
// Toast.show('请输入手机号码', { position: Toast.positions.CENTER });
// } else {
// const param = {
// countryCode,
// phone,
// };
// const res = await postMemberMobileWechatAppletSends(param);
// if (res.code === 1000) {
// hanleCountdown();
// Toast.show('发送成功', { position: Toast.positions.CENTER });
// }
// }
// }
// };
const setKey = (val: string, key: string) => {
const fromData = from;
......@@ -156,7 +156,7 @@ const MobileView: React.FC<any> = (props: Iprops) => {
style={myStyle['mobileView-fromItem-input']}
/>
<TouchableOpacity
onPress={getcode}
// onPress={getcode}
activeOpacity={0.8}
style={myStyle['mobileView-srmCode']}
>
......
......@@ -62,7 +62,7 @@ export default () =>
},
'mobileView-submit': {
marginTop: 30,
backgroundColor: '#EA5504',
backgroundColor: '#00A990',
borderRadius: 8,
paddingVertical: 10,
},
......
......@@ -62,6 +62,7 @@ const SingView: React.FC<any> = (props: Iprops) => {
style={myStyle['mobileView-fromItem-input']}
/>
</View>
<View style={myStyle['mobileView-fromFlex']}>
<TextInput
value={from.password}
......@@ -81,6 +82,7 @@ const SingView: React.FC<any> = (props: Iprops) => {
/>
</TouchableOpacity>
</View>
<TouchableOpacity
style={myStyle['mobileView-submit']}
onPress={login}
......
......@@ -51,7 +51,7 @@ export default () =>
},
'mobileView-submit': {
marginTop: 30,
backgroundColor: '#EA5504',
backgroundColor: '#00A990',
borderRadius: 8,
paddingVertical: 10,
},
......
......@@ -4,16 +4,16 @@ import Toast from 'react-native-root-toast';
import { setAsyncStorage } from '../../utils/storage';
import { encryptedByAES, decryptedByAES } from '../../utils/cryptoAes';
import { useStores } from '../../hooks/useStores';
import {
postMemberMobileWechatAppletLoginPhone,
postMemberMobileWechatAppletLoginAccount,
} from '../../services/MemberV2Api';
import { getManageContentNoticeFindWithOutContent } from '../../services/ManageV2Api';
// import {
// postMemberMobileWechatAppletLoginPhone,
// postMemberMobileWechatAppletLoginAccount,
// } from '../../services/MemberV2Api';
// import { getManageContentNoticeFindWithOutContent } from '../../services/ManageV2Api';
import useAppStyle from '../../hooks/useAppStyle';
import { RootStackScreenProps } from '../../routers/types';
import { USER_INFO } from '../../constants';
import Checkbox from '../../components/Checkbox';
import zhongranLogo from '../../../assets/images/zhongran_logo.png';
import zhongranLogo from '../../../assets/images/gaohuaxue_logo.png';
import MobileView from './components/Mobile';
import SingView from './components/Sing';
import styles from './styles';
......@@ -30,57 +30,59 @@ const Login: React.FC<LoginScreenNavigationProp> = ({ navigation }) => {
const { userStore } = useStores();
const onSubmit = async (data: any) => {
if (!select) {
Toast.show('请阅读并同意相关协议', { position: Toast.positions.CENTER });
return;
}
let fn: Function | null = null;
let obj: any = {};
// const onSubmit = async (data: any) => {
// if (!select) {
// Toast.show('请阅读并同意相关协议', { position: Toast.positions.CENTER });
// return;
// }
// let fn: Function | null = null;
// let obj: any = {};
switch (current) {
case 1:
fn = postMemberMobileWechatAppletLoginPhone;
break;
default:
fn = postMemberMobileWechatAppletLoginAccount;
obj.account = data.account;
obj.password = encryptedByAES(data.password);
obj.shopType = data.shopType;
break;
}
fn?.(current === 1 ? data : obj).then(res => {
if (res.code === 1000) {
setAsyncStorage(USER_INFO, res.data);
// userStore.setUserInfo(res.data);
navigation.replace('BottomTabs', { screen: 'Home' });
return;
} else {
if (current === 1) {
obj.password = decryptedByAES(obj.password);
}
Toast.show(res.message, { position: Toast.positions.CENTER });
return;
}
});
};
// switch (current) {
// case 1:
// fn = postMemberMobileWechatAppletLoginPhone;
// break;
// default:
// fn = postMemberMobileWechatAppletLoginAccount;
// obj.account = data.account;
// obj.password = encryptedByAES(data.password);
// obj.shopType = data.shopType;
// break;
// }
// fn?.(current === 1 ? data : obj).then(res => {
// if (res.code === 1000) {
// setAsyncStorage(USER_INFO, res.data);
// // userStore.setUserInfo(res.data);
// navigation.replace('BottomTabs', { screen: 'Home' });
// return;
// } else {
// if (current === 1) {
// obj.password = decryptedByAES(obj.password);
// }
// Toast.show(res.message, { position: Toast.positions.CENTER });
// return;
// }
// });
// };
const findAllByColumnType = async () => {
const { code, data, message } =
await getManageContentNoticeFindWithOutContent({ columnType: '2' });
if (code === 1000) {
setColumnTypeList(data);
} else {
Toast.show(message, { position: Toast.positions.CENTER });
}
};
// const findAllByColumnType = async () => {
// const { code, data, message } =
// await getManageContentNoticeFindWithOutContent({ columnType: '2' });
// if (code === 1000) {
// setColumnTypeList(data);
// } else {
// Toast.show(message, { position: Toast.positions.CENTER });
// }
// };
const renderComponentByType = () => {
switch (current) {
case 0:
return <SingView submit={onSubmit} />;
// return <SingView submit={onSubmit} />;
return <SingView />;
case 1:
return <MobileView submit={onSubmit} />;
// return <MobileView submit={onSubmit} />;
return <MobileView />;
default:
return null;
}
......@@ -91,14 +93,15 @@ const Login: React.FC<LoginScreenNavigationProp> = ({ navigation }) => {
};
useEffect(() => {
findAllByColumnType();
// findAllByColumnType();
}, []);
return (
<View style={myStyle.container}>
<View style={myStyle.head}>
<Image source={zhongranLogo} style={myStyle.logo} />
<Text style={myStyle.logoTitle}>欢迎来到慧售卖</Text>
<Text style={myStyle.logoTitle}>你好,</Text>
<Text style={myStyle.logoTitle}>欢迎来到高化学商城</Text>
</View>
{/* 登录方式 */}
<View style={myStyle.loginType}>
......@@ -131,7 +134,7 @@ const Login: React.FC<LoginScreenNavigationProp> = ({ navigation }) => {
<Checkbox checked={select} onChange={value => setSelect(value)} />
</View>
<View style={myStyle['sign-signFlex']}>
<Text style={myStyle['sign-signText']}>阅读并同意</Text>
<Text style={myStyle['sign-signText']}>登录即代表您已同意</Text>
{columnTypeList.map((items: any) => (
<Text
key={items.id}
......
......@@ -25,7 +25,7 @@ export default (theme: ThemeStyle) =>
logoTitle: {
fontSize: 24,
color: '#303133',
marginTop: 12,
fontWeight: '500',
},
loginType: {
marginTop: 20,
......@@ -55,7 +55,8 @@ export default (theme: ThemeStyle) =>
sign: {
flexDirection: 'row',
alignItems: 'center',
marginTop: 182,
// marginTop: 182,
marginTop: 100,
},
'sign-signFlex': {
flexDirection: 'row',
......
......@@ -3274,6 +3274,13 @@ eslint-plugin-prettier@3.1.2:
dependencies:
prettier-linter-helpers "^1.0.0"
eslint-plugin-prettier@^4.2.1:
version "4.2.1"
resolved "http://npm.shushangyun.com/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz#651cbb88b1dab98bfd42f017a12fa6b2d993f94b"
integrity sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==
dependencies:
prettier-linter-helpers "^1.0.0"
eslint-plugin-react-hooks@^4.0.4:
version "4.6.0"
resolved "http://npm.shushangyun.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz#4c3e697ad95b77e93f8646aaa1630c1ba607edd3"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment