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

feat: 登录页面初步改造

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