Commit a13b30a6 authored by 郑云峰's avatar 郑云峰

chore: 格式化代码

parent 37904497
...@@ -6,7 +6,13 @@ ...@@ -6,7 +6,13 @@
* @Description: CellItem 组件 * @Description: CellItem 组件
*/ */
import React from 'react'; import React from 'react';
import { View, Text, TouchableOpacity, ViewStyle, TextStyle } from 'react-native'; import {
View,
Text,
TouchableOpacity,
ViewStyle,
TextStyle,
} from 'react-native';
import { useTheme } from '@react-navigation/native'; import { useTheme } from '@react-navigation/native';
import useAppStyle from '../../hooks/useAppStyle'; import useAppStyle from '../../hooks/useAppStyle';
import { ThemeStyle } from '../../constants/theme'; import { ThemeStyle } from '../../constants/theme';
...@@ -158,9 +164,7 @@ const CellItem: React.FC<CellItemProps> = (props: CellItemProps) => { ...@@ -158,9 +164,7 @@ const CellItem: React.FC<CellItemProps> = (props: CellItemProps) => {
) : ( ) : (
customIcon customIcon
)} */} )} */}
{!customIcon ? null : ( {!customIcon ? null : customIcon}
customIcon
)}
</View> </View>
) : null} ) : null}
<View style={myStyle['list-item-titleWrap']}>{renderTitle()}</View> <View style={myStyle['list-item-titleWrap']}>{renderTitle()}</View>
......
import React, { useState } from 'react' import React, { useState } from 'react';
import { View, ViewStyle, Modal, TouchableOpacity, GestureResponderEvent, ImageResizeMode } from 'react-native' import {
import ImageViewer from 'react-native-image-zoom-viewer' View,
import { IImageInfo } from 'react-native-image-zoom-viewer/built/image-viewer.type' ViewStyle,
import LazyImage from '../LazyImage' Modal,
import defaultImg from '../../../assets/images/default_img.png' TouchableOpacity,
import styles from './styles' GestureResponderEvent,
ImageResizeMode,
} from 'react-native';
import ImageViewer from 'react-native-image-zoom-viewer';
import { IImageInfo } from 'react-native-image-zoom-viewer/built/image-viewer.type';
import LazyImage from '../LazyImage';
import defaultImg from '../../../assets/images/default_img.png';
import styles from './styles';
interface ImageBoxPropsType { interface ImageBoxPropsType {
width?: number | string; width?: number | string;
...@@ -12,14 +19,23 @@ interface ImageBoxPropsType { ...@@ -12,14 +19,23 @@ interface ImageBoxPropsType {
source: string; source: string;
style?: ViewStyle; style?: ViewStyle;
resizeMode?: ImageResizeMode; resizeMode?: ImageResizeMode;
borderRadius?: number, borderRadius?: number;
canPreview?: boolean, canPreview?: boolean;
onPress?: ((event: GestureResponderEvent) => void) | undefined onPress?: ((event: GestureResponderEvent) => void) | undefined;
} }
const ImageBox = (props: ImageBoxPropsType) => { const ImageBox = (props: ImageBoxPropsType) => {
const { width, height, source = "", style, borderRadius, resizeMode = 'contain', canPreview, onPress } = props const {
const [previewVisible, setPreviewVisible] = useState<boolean>(false) width,
height,
source = '',
style,
borderRadius,
resizeMode = 'contain',
canPreview,
onPress,
} = props;
const [previewVisible, setPreviewVisible] = useState<boolean>(false);
const showImgBg = () => { const showImgBg = () => {
if (canPreview && onPress) { if (canPreview && onPress) {
...@@ -29,9 +45,9 @@ const ImageBox = (props: ImageBoxPropsType) => { ...@@ -29,9 +45,9 @@ const ImageBox = (props: ImageBoxPropsType) => {
style={{ width, height, borderRadius, overflow: 'hidden' }} style={{ width, height, borderRadius, overflow: 'hidden' }}
onPress={(e: GestureResponderEvent) => { onPress={(e: GestureResponderEvent) => {
if (canPreview) { if (canPreview) {
setPreviewVisible(true) setPreviewVisible(true);
} else if (onPress) { } else if (onPress) {
onPress(e) onPress(e);
} }
}} }}
> >
...@@ -42,7 +58,7 @@ const ImageBox = (props: ImageBoxPropsType) => { ...@@ -42,7 +58,7 @@ const ImageBox = (props: ImageBoxPropsType) => {
resizeMode={resizeMode} resizeMode={resizeMode}
/> />
</TouchableOpacity> </TouchableOpacity>
) );
} }
return ( return (
<LazyImage <LazyImage
...@@ -51,45 +67,46 @@ const ImageBox = (props: ImageBoxPropsType) => { ...@@ -51,45 +67,46 @@ const ImageBox = (props: ImageBoxPropsType) => {
style={{ width, height, borderRadius, overflow: 'hidden' }} style={{ width, height, borderRadius, overflow: 'hidden' }}
resizeMode={resizeMode} resizeMode={resizeMode}
/> />
) );
} };
return ( return (
<View style={[styles.imageBox, style]}> <View style={[styles.imageBox, style]}>
{ {source ? (
source ? showImgBg() showImgBg()
: ( ) : (
<LazyImage <LazyImage
thumbnailSource={defaultImg} thumbnailSource={defaultImg}
fullSource={{ uri: source }} fullSource={{ uri: source }}
style={{ width, height, borderRadius, overflow: 'hidden' }} style={{ width, height, borderRadius, overflow: 'hidden' }}
resizeMode={resizeMode} resizeMode={resizeMode}
/> />
) )}
} {canPreview && (
{ <Modal
canPreview && ( visible={previewVisible}
<Modal onRequestClose={() => setPreviewVisible(false)}
visible={previewVisible} transparent
onRequestClose={() => setPreviewVisible(false)} >
transparent <ImageViewer
> imageUrls={[{ url: source }] as unknown as IImageInfo[]}
<ImageViewer imageUrls={[{ url: source }] as unknown as IImageInfo[]} index={0} onClick={() => setPreviewVisible(false)} /> index={0}
</Modal> onClick={() => setPreviewVisible(false)}
) />
} </Modal>
)}
</View> </View>
) );
} };
ImageBox.defaultProps = { ImageBox.defaultProps = {
width: 106, width: 106,
height: 106, height: 106,
style: {}, style: {},
resizeMode: "cover", resizeMode: 'cover',
borderRadius: 4, borderRadius: 4,
canPreview: false, canPreview: false,
onPress: undefined, onPress: undefined,
} };
export default ImageBox export default ImageBox;
import { StyleSheet } from 'react-native' import { StyleSheet } from 'react-native';
export default StyleSheet.create({ export default StyleSheet.create({
imageBox: { imageBox: {
overflow: 'hidden', overflow: 'hidden',
}, },
}) });
...@@ -6,7 +6,7 @@ import { ...@@ -6,7 +6,7 @@ import {
Animated, Animated,
ImageResizeMode, ImageResizeMode,
} from 'react-native'; } from 'react-native';
import defaultImg from '../../../assets/images/default_img.png' import defaultImg from '../../../assets/images/default_img.png';
interface LazyImageProps { interface LazyImageProps {
thumbnailSource: any; thumbnailSource: any;
...@@ -25,7 +25,7 @@ const styles = StyleSheet.create({ ...@@ -25,7 +25,7 @@ const styles = StyleSheet.create({
}, },
}); });
const LazyImage: React.FC<LazyImageProps> = (props) => { const LazyImage: React.FC<LazyImageProps> = props => {
const { thumbnailSource, fullSource, style, resizeMode } = props; const { thumbnailSource, fullSource, style, resizeMode } = props;
const opacity = useRef(new Animated.Value(0)).current; const opacity = useRef(new Animated.Value(0)).current;
...@@ -39,35 +39,32 @@ const LazyImage: React.FC<LazyImageProps> = (props) => { ...@@ -39,35 +39,32 @@ const LazyImage: React.FC<LazyImageProps> = (props) => {
return ( return (
<View style={style}> <View style={style}>
{ {fullSource.uri ? (
fullSource.uri ? ( <Animated.Image
<Animated.Image source={fullSource}
source={fullSource} defaultSource={thumbnailSource}
defaultSource={thumbnailSource} style={[
style={[ styles.image,
styles.image, {
{ opacity,
opacity, },
}, ]}
]} resizeMode={resizeMode}
resizeMode={resizeMode} onLoad={onImageLoad}
onLoad={onImageLoad} />
/> ) : (
) : ( <Animated.Image
<Animated.Image source={defaultImg}
source={defaultImg} style={[
style={[ styles.image,
styles.image, {
{ opacity,
opacity, },
}, ]}
]} resizeMode={resizeMode}
resizeMode={resizeMode} onLoad={onImageLoad}
onLoad={onImageLoad} />
/> )}
)
}
</View> </View>
); );
}; };
......
...@@ -6,12 +6,7 @@ ...@@ -6,12 +6,7 @@
* @Description: 加载组件 * @Description: 加载组件
*/ */
import React from 'react'; import React from 'react';
import { import { StyleSheet, ViewStyle, View, Text } from 'react-native';
StyleSheet,
ViewStyle,
View,
Text,
} from 'react-native';
import useAppStyle from '../../hooks/useAppStyle'; import useAppStyle from '../../hooks/useAppStyle';
import Spin from './Spin'; import Spin from './Spin';
import styles from './styles'; import styles from './styles';
......
...@@ -231,11 +231,7 @@ const NoticeBar: React.FC<NoticeBarProps> = (props: NoticeBarProps) => { ...@@ -231,11 +231,7 @@ const NoticeBar: React.FC<NoticeBarProps> = (props: NoticeBarProps) => {
</View> </View>
<View style={[myStyle['boticeBar-content']]}>{renderContent()}</View> <View style={[myStyle['boticeBar-content']]}>{renderContent()}</View>
{hasArrow ? ( {hasArrow ? (
<TouchableOpacity <TouchableOpacity style={[myStyle['boticeBar-action']]}>
style={[
myStyle['boticeBar-action'],
]}
>
{/* <Icons {/* <Icons
size={16} size={16}
// eslint-disable-next-line no-nested-ternary // eslint-disable-next-line no-nested-ternary
......
...@@ -191,32 +191,31 @@ const Search: React.FC<SearchProps> = React.forwardRef( ...@@ -191,32 +191,31 @@ const Search: React.FC<SearchProps> = React.forwardRef(
inputRef.current!.blur(); inputRef.current!.blur();
}, },
}), }),
// eslint-disable-next-line react-hooks/exhaustive-deps, array-bracket-spacing
[inputRef.current], [inputRef.current],
); );
return ( return (
<TouchableOpacity <TouchableOpacity
style={StyleSheet.flatten([
myStyle.search,
showAction && myStyle['search-show-action'],
{
backgroundColor: background,
},
])}
activeOpacity={1}
onPress={handleClick}
>
<View
style={StyleSheet.flatten([ style={StyleSheet.flatten([
myStyle['search-content'], myStyle.search,
shape === 'round' ? myStyle['search-content__round'] : null, showAction && myStyle['search-show-action'],
{
backgroundColor: background,
},
])} ])}
activeOpacity={1}
onPress={handleClick}
> >
{!!label && ( <View
<Text style={myStyle['search-label']}>{label}</Text> style={StyleSheet.flatten([
)} myStyle['search-content'],
<View style={[myStyle['search-control']]}> shape === 'round' ? myStyle['search-content__round'] : null,
{/* {!customLeftIcon ? ( ])}
>
{!!label && <Text style={myStyle['search-label']}>{label}</Text>}
<View style={myStyle['search-control']}>
{/* {!customLeftIcon ? (
<Icons <Icons
type="feather" type="feather"
name={leftIcon} name={leftIcon}
...@@ -227,51 +226,48 @@ const Search: React.FC<SearchProps> = React.forwardRef( ...@@ -227,51 +226,48 @@ const Search: React.FC<SearchProps> = React.forwardRef(
) : ( ) : (
customLeftIcon customLeftIcon
)} */} )} */}
{!customLeftIcon ? null : ( {!customLeftIcon ? null : customLeftIcon}
customLeftIcon <View style={myStyle['search-field-wrap']}>
)} <TextInput
<View ref={inputRef}
style={myStyle['search-field-wrap']} value={value}
> onChangeText={handleChange}
<TextInput placeholder={placeholder}
ref={inputRef} placeholderTextColor={appTheme.fonts.black3}
value={value} returnKeyType="search"
onChangeText={handleChange} returnKeyLabel="搜索"
placeholder={placeholder} autoFocus={focus}
placeholderTextColor={appTheme.fonts.black3} editable={editable}
returnKeyType="search" onSubmitEditing={handleSearchSubmit}
returnKeyLabel="搜索" onBlur={handleBlur}
autoFocus={focus} style={StyleSheet.flatten([
editable={editable} myStyle['search-field'],
onSubmitEditing={handleSearchSubmit} {
onBlur={handleBlur} paddingRight: !clearable
style={StyleSheet.flatten([ ? themeLayout['padding-xs']
myStyle['search-field'], : themeLayout['padding-xs'] + 18,
{ },
paddingRight: !clearable ? themeLayout['padding-xs'] : themeLayout['padding-xs'] + 18, ])}
},
])}
/>
{/* 为了解决 ios 点击 Input 不会触发父级点击事件的问题 */}
{!editable ? (
<View
style={myStyle['search-field-placeholder']}
/> />
) : null} {/* 为了解决 ios 点击 Input 不会触发父级点击事件的问题 */}
</View> {!editable ? (
{clearable && value.length > 0 && ( <View style={myStyle['search-field-placeholder']} />
<TouchableOpacity ) : null}
activeOpacity={0.8} </View>
style={myStyle['search-control-right-icon']} {clearable && value.length > 0 && (
onPress={handleClear} <TouchableOpacity
> activeOpacity={0.8}
{/* <Icons style={myStyle['search-control-right-icon']}
onPress={handleClear}
>
{/* <Icons
name="closecircle" name="closecircle"
size={18} size={18}
color="#C0C4CC" color="#C0C4CC"
/> */} /> */}
</TouchableOpacity> </TouchableOpacity>
)} )}
</View>
</View> </View>
{!!showAction && {!!showAction &&
(!customAction ? ( (!customAction ? (
......
...@@ -4,43 +4,51 @@ ...@@ -4,43 +4,51 @@
* ********** * **********
*/ */
import SELF_CONFIG from '../../../base.config.json' import SELF_CONFIG from '../../../base.config.json';
import { RootObject } from './global' import { RootObject } from './global';
interface newRootObject extends RootObject { interface newRootObject extends RootObject {
appMallInfo: any, appMallInfo: any;
pointMallId: number | undefined, pointMallId: number | undefined;
channelPointMallId: number | undefined, channelPointMallId: number | undefined;
pointMallInfo: any, pointMallInfo: any;
channelPointMallInfo: any, channelPointMallInfo: any;
} }
export const checkUrl = (url: any, defaultUrl: any) => { export const checkUrl = (url: any, defaultUrl: any) => {
if (url && typeof url === 'string') { if (url && typeof url === 'string') {
if (url.indexOf('/') > -1) { if (url.indexOf('/') > -1) {
return url.trim() return url.trim();
} }
return `/${url}`.trim() return `/${url}`.trim();
} }
return defaultUrl return defaultUrl;
} };
const appMallInfo = SELF_CONFIG.web.shopInfo.filter(item => item.environment === 4 && item.type === 1)[0] // app企业商城 const appMallInfo = SELF_CONFIG.web.shopInfo.filter(
item => item.environment === 4 && item.type === 1,
)[0]; // app企业商城
const pointMallInfo = SELF_CONFIG.web.shopInfo.filter(item => item.environment === 4 && item.type === 2)[0] // app积分商城 const pointMallInfo = SELF_CONFIG.web.shopInfo.filter(
item => item.environment === 4 && item.type === 2,
)[0]; // app积分商城
const channelPointMallInfo = SELF_CONFIG.web.shopInfo.filter(item => item.environment === 4 && item.type === 5)[0] // app渠道积分商城 const channelPointMallInfo = SELF_CONFIG.web.shopInfo.filter(
item => item.environment === 4 && item.type === 5,
)[0]; // app渠道积分商城
//@ts-ignore //@ts-ignore
SELF_CONFIG.appMallInfo = appMallInfo // app企业商城信息 SELF_CONFIG.appMallInfo = appMallInfo; // app企业商城信息
//@ts-ignore //@ts-ignore
SELF_CONFIG.pointMallId = pointMallInfo ? pointMallInfo.id : undefined SELF_CONFIG.pointMallId = pointMallInfo ? pointMallInfo.id : undefined;
//@ts-ignore //@ts-ignore
SELF_CONFIG.channelPointMallId = channelPointMallInfo ? channelPointMallInfo.id : undefined SELF_CONFIG.channelPointMallId = channelPointMallInfo
? channelPointMallInfo.id
: undefined;
//@ts-ignore //@ts-ignore
SELF_CONFIG.pointMallInfo = pointMallInfo SELF_CONFIG.pointMallInfo = pointMallInfo;
//@ts-ignore //@ts-ignore
SELF_CONFIG.channelPointMallInfo = channelPointMallInfo SELF_CONFIG.channelPointMallInfo = channelPointMallInfo;
//@ts-ignore //@ts-ignore
export const GlobalConfig: newRootObject = SELF_CONFIG export const GlobalConfig: newRootObject = SELF_CONFIG;
export default {} export default {};
...@@ -8,24 +8,24 @@ import en_US from './en_US'; ...@@ -8,24 +8,24 @@ import en_US from './en_US';
import ko_KR from './ko_KR'; import ko_KR from './ko_KR';
const localeResource: { const localeResource: {
"zh-CN": any, 'zh-CN': any;
"en-US": any, 'en-US': any;
"ko-KR": any, 'ko-KR': any;
} = { } = {
"zh-CN": zh_CN, 'zh-CN': zh_CN,
"en-US": en_US, 'en-US': en_US,
"ko-KR": ko_KR, 'ko-KR': ko_KR,
} };
type Language = keyof typeof localeResource; type Language = keyof typeof localeResource;
const LANGUAGE: Language = (env.LANGUAGE ?? 'zh-CN') as Language const LANGUAGE: Language = (env.LANGUAGE ?? 'zh-CN') as Language;
const languageDetector = { const languageDetector = {
type: 'languageDetector', type: 'languageDetector',
async: true, async: true,
detect: (cb: any) => cb(LANGUAGE), detect: (cb: any) => cb(LANGUAGE),
init: () => { }, init: () => {},
cacheUserLanguage: () => { }, cacheUserLanguage: () => {},
}; };
i18n i18n
...@@ -37,4 +37,4 @@ i18n ...@@ -37,4 +37,4 @@ i18n
resources: localeResource, resources: localeResource,
}); });
export default i18n export default i18n;
export default {} export default {};
export default {} export default {};
...@@ -17,7 +17,7 @@ export const ROUTERS = { ...@@ -17,7 +17,7 @@ export const ROUTERS = {
Login: { Login: {
title: '登入', title: '登入',
component: Login, component: Login,
headerShown: true headerShown: true,
}, },
AccountInfo: { AccountInfo: {
title: '账号信息', title: '账号信息',
......
...@@ -8,9 +8,12 @@ const key = CryptoJS.enc.Utf8.parse('GzSsyLingxi2.0.0'); ...@@ -8,9 +8,12 @@ const key = CryptoJS.enc.Utf8.parse('GzSsyLingxi2.0.0');
export const encryptedByAES = (source: string) => { export const encryptedByAES = (source: string) => {
const password = CryptoJS.enc.Utf8.parse(source); const password = CryptoJS.enc.Utf8.parse(source);
// @ts-ignore // @ts-ignore
const encrypted = CryptoJS.AES.encrypt(password, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 }) // CryptoJS.pad.Pkcs7 const encrypted = CryptoJS.AES.encrypt(password, key, {
return encrypted.toString() // 加密后的base64 mode: CryptoJS.mode.ECB,
} padding: CryptoJS.pad.Pkcs7,
}); // CryptoJS.pad.Pkcs7
return encrypted.toString(); // 加密后的base64
};
/** /**
* @auth xjm * @auth xjm
...@@ -18,6 +21,9 @@ export const encryptedByAES = (source: string) => { ...@@ -18,6 +21,9 @@ export const encryptedByAES = (source: string) => {
*/ */
export const decryptedByAES = (source: string) => { export const decryptedByAES = (source: string) => {
// @ts-ignore // @ts-ignore
const decrypted = CryptoJS.AES.decrypt(source, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 }); // CryptoJS.pad.Pkcs7 const decrypted = CryptoJS.AES.decrypt(source, key, {
return decrypted.toString(CryptoJS.enc.Utf8) // 解密后的原始字符串 mode: CryptoJS.mode.ECB,
} padding: CryptoJS.pad.Pkcs7,
}); // CryptoJS.pad.Pkcs7
return decrypted.toString(CryptoJS.enc.Utf8); // 解密后的原始字符串
};
...@@ -2,14 +2,14 @@ import React, { useEffect, useState } from 'react'; ...@@ -2,14 +2,14 @@ import React, { useEffect, useState } from 'react';
import { View, Text, Image } from 'react-native'; import { View, Text, Image } from 'react-native';
// import { Text, Image, Toast } from '@linkseeks/god-mobile'; // import { Text, Image, Toast } from '@linkseeks/god-mobile';
// import ModeMobile from '@/components/Modemobile'; // import ModeMobile from '@/components/Modemobile';
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 '../../store/useStores'; import useStores from '../../store/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 zhongranLogo from '../../../assets/images/zhongran_logo.png'; import zhongranLogo from '../../../assets/images/zhongran_logo.png';
import ImageBox from '../../components/ImageBox'; import ImageBox from '../../components/ImageBox';
...@@ -18,14 +18,11 @@ import ImageBox from '../../components/ImageBox'; ...@@ -18,14 +18,11 @@ import ImageBox from '../../components/ImageBox';
import styles from './styles'; import styles from './styles';
const Login = () => { const Login = () => {
const LoginTypeText = [ const LoginTypeText = ['密码登录', '手机号码登录'];
'密码登录', const [current, setcurrent] = useState(0); // 0 是账号密码登录
'手机号码登录',
]
const [current, setcurrent] = useState(0) // 0 是账号密码登录
const { userStore } = useStores(); const { userStore } = useStores();
const [toggle, settoggle] = useState<boolean>(false) // 显示手机号模态框 const [toggle, settoggle] = useState<boolean>(false); // 显示手机号模态框
const [countryCode, setCode] = useState('+86') // 手机区号 const [countryCode, setCode] = useState('+86'); // 手机区号
const [phoneLength, setphoneLength] = useState(11); // 手机号码长度 const [phoneLength, setphoneLength] = useState(11); // 手机号码长度
const [select, setSelect] = useState(false); // 设置协议选中 const [select, setSelect] = useState(false); // 设置协议选中
const [columnTypeList, setColumnTypeList] = useState<any>([]); // 协议数据 const [columnTypeList, setColumnTypeList] = useState<any>([]); // 协议数据
...@@ -45,7 +42,10 @@ const Login = () => { ...@@ -45,7 +42,10 @@ const Login = () => {
const onSubmit = async (data: any) => { const onSubmit = async (data: any) => {
if (!select) { if (!select) {
Toast.show({ title: i18n.t('user:user.login.agreement.tips', '请阅读并同意相关协议'), icon: 'none' }); Toast.show({
title: i18n.t('user:user.login.agreement.tips', '请阅读并同意相关协议'),
icon: 'none',
});
return; return;
} }
let fn: Function | null = null; let fn: Function | null = null;
...@@ -53,92 +53,91 @@ const Login = () => { ...@@ -53,92 +53,91 @@ const Login = () => {
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);
Router.reLaunch('root/home') Router.reLaunch('root/home');
return return;
} else { } else {
if (current == 1) { if (current == 1) {
obj.password = decryptedByAES(obj.password) obj.password = decryptedByAES(obj.password);
} }
Toast.show({ title: res.message, icon: 'none' }); Toast.show({ title: res.message, icon: 'none' });
return return;
} }
}) });
} };
const Confirm = (flag) => { const Confirm = flag => {
settoggle(flag); settoggle(flag);
} };
const findAllByColumnType = async () => { const findAllByColumnType = async () => {
const { code, data, message } = await getManageContentNoticeFindWithOutContent({ columnType: "2" }) const { code, data, message } =
await getManageContentNoticeFindWithOutContent({ columnType: '2' });
if (code === 1000) { if (code === 1000) {
setColumnTypeList(data) setColumnTypeList(data);
} else { } else {
Taro.showToast({ title: message, icon: 'none' }); Taro.showToast({ title: message, icon: 'none' });
} }
} };
const webView = (item: any) => { const webView = (item: any) => {
Router.navigateTo('root/richtext', { id: item.id, type: 'sign' }) Router.navigateTo('root/richtext', { id: item.id, type: 'sign' });
} };
useEffect(() => { useEffect(() => {
findAllByColumnType() findAllByColumnType();
}, []) }, []);
/* 选择区号回调 */ /* 选择区号回调 */
const onConfirm = (item) => { const onConfirm = item => {
setCode(item.code) setCode(item.code);
setphoneLength(item.phoneLength) setphoneLength(item.phoneLength);
settoggle(false); settoggle(false);
} };
/* 关闭 */ /* 关闭 */
const onClose = (item) => { const onClose = item => {
settoggle(item.toggle); settoggle(item.toggle);
} };
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 style={myStyle['logoTitle']}>欢迎来到慧售卖</Text>
欢迎来到慧售卖
</Text>
</View> </View>
{/* 登录方式 */} {/* 登录方式 */}
<View style={myStyle.loginType}> <View style={myStyle.loginType}>
{ {LoginTypeText.map((item: any, index: number) => (
LoginTypeText.map((item: any, index: number) => ( <View key={index} style={myStyle['loginType-item']}>
<View key={index} style={myStyle['loginType-item']}> <Text
<Text key={index}
key={index} style={[
style={[ myStyle['loginType-item-text'],
myStyle['loginType-item-text'], index == current
index == current ? myStyle['loginType-item-text__ative'] : undefined, ? myStyle['loginType-item-text__ative']
]} : undefined,
onPress={() => setcurrent(index)} ]}
> onPress={() => setcurrent(index)}
{item} >
</Text> {item}
{index == current ? ( </Text>
<View style={myStyle['loginType-item-line']} /> {index == current ? (
) : null} <View style={myStyle['loginType-item-line']} />
</View> ) : null}
)) </View>
} ))}
</View> </View>
{/* {renderComponentByType()} */} {/* {renderComponentByType()} */}
...@@ -149,14 +148,18 @@ const Login = () => { ...@@ -149,14 +148,18 @@ const Login = () => {
{/* <Image src={select ? require('@/assets/images/Checked-@2x.png') : require('@/assets/images/Default@2x.png')} onClick={() => setSelect(!select)} /> */} {/* <Image src={select ? require('@/assets/images/Checked-@2x.png') : require('@/assets/images/Default@2x.png')} onClick={() => setSelect(!select)} /> */}
<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} style={myStyle['sign-signRight']} onPress={() => webView(items)}>{items.title}</Text> key={items.id}
)) style={myStyle['sign-signRight']}
} onPress={() => webView(items)}
>
{items.title}{' '}
</Text>
))}
</View> </View>
</View> </View>
</View> </View>
) );
} };
export default Login; export default Login;
\ No newline at end of file
...@@ -2,126 +2,127 @@ import { StyleSheet } from 'react-native'; ...@@ -2,126 +2,127 @@ import { StyleSheet } from 'react-native';
import { ThemeStyle } from '../../constants/theme'; import { ThemeStyle } from '../../constants/theme';
import themeLayout from '../../constants/theme/layout'; import themeLayout from '../../constants/theme/layout';
export default (theme: ThemeStyle) => StyleSheet.create({ export default (theme: ThemeStyle) =>
container: { StyleSheet.create({
flex: 1, container: {
justifyContent: 'center', flex: 1,
paddingVertical: 0, justifyContent: 'center',
paddingHorizontal: 23, paddingVertical: 0,
backgroundColor: '#FFFFFF', paddingHorizontal: 23,
}, backgroundColor: '#FFFFFF',
Text: { },
color: '#c0c4cc', Text: {
fontSize: 14, color: '#c0c4cc',
}, fontSize: 14,
head: { },
marginTop: 32, head: {
}, marginTop: 32,
logo: { },
width: 115.03, logo: {
height: 36, width: 115.03,
}, height: 36,
logoTitle: { },
fontSize: 24, logoTitle: {
color: '#303133', fontSize: 24,
marginTop: 12, color: '#303133',
}, marginTop: 12,
loginType: { },
marginTop: 20, loginType: {
flexDirection: 'row', marginTop: 20,
}, flexDirection: 'row',
'loginType-item': { },
position: 'relative', 'loginType-item': {
}, position: 'relative',
'loginType-item-text': { },
fontSize: 14, 'loginType-item-text': {
paddingVertical: 5, fontSize: 14,
marginRight: 12, paddingVertical: 5,
color: '#909399', marginRight: 12,
}, color: '#909399',
'loginType-item-text__ative': { },
color: '#252d37', 'loginType-item-text__ative': {
fontWeight: '900', color: '#252d37',
}, fontWeight: '900',
'loginType-item-line': { },
position: 'absolute', 'loginType-item-line': {
bottom: 0, position: 'absolute',
width: '40%', bottom: 0,
left: '30%', width: '40%',
backgroundColor: '#EA5504', left: '30%',
height: 3, backgroundColor: '#EA5504',
}, height: 3,
sign: { },
flexDirection: 'row', sign: {
alignItems: 'center', flexDirection: 'row',
marginTop: 182, alignItems: 'center',
}, marginTop: 182,
'sign-signFlex': { },
flexDirection: 'row', 'sign-signFlex': {
flex: 1, flexDirection: 'row',
}, flex: 1,
'sign-signText': { },
fontSize: 12, 'sign-signText': {
color: '#909399', fontSize: 12,
}, color: '#909399',
'sign-signRight': { },
color: '#000', 'sign-signRight': {
fontSize: 12, color: '#000',
}, fontSize: 12,
mobileView: {}, },
'mobileView-fromItem': { mobileView: {},
marginTop: 16, 'mobileView-fromItem': {
alignItems: 'center', marginTop: 16,
flexDirection: 'row', alignItems: 'center',
backgroundColor: '#f5f6f7', flexDirection: 'row',
borderRadius: 8, backgroundColor: '#f5f6f7',
paddingHorizontal: 8, borderRadius: 8,
}, paddingHorizontal: 8,
'mobileView-fromItem-code': { },
fontSize: 14, 'mobileView-fromItem-code': {
}, fontSize: 14,
'mobileView-fromItem-input': { },
fontSize: 14, 'mobileView-fromItem-input': {
paddingVertical: 12, fontSize: 14,
}, paddingVertical: 12,
'mobileView-fromItem-placeholderText': { },
fontSize: 14, 'mobileView-fromItem-placeholderText': {
paddingVertical: 12, fontSize: 14,
}, paddingVertical: 12,
'mobileView-fromItem-fill': { },
paddingHorizontal: 10, 'mobileView-fromItem-fill': {
borderRightWidth: 1, paddingHorizontal: 10,
borderColor: '#c8cacd', borderRightWidth: 1,
borderStyle: 'dashed', borderColor: '#c8cacd',
alignItems: 'center', borderStyle: 'dashed',
marginRight: 12, alignItems: 'center',
}, marginRight: 12,
'mobileView-fromItem-fill-image': { },
width: 16, 'mobileView-fromItem-fill-image': {
height: 16, width: 16,
}, height: 16,
'mobileView-fromFlex': { },
marginTop: 16, 'mobileView-fromFlex': {
alignItems: 'center', marginTop: 16,
flexDirection: 'row', alignItems: 'center',
backgroundColor: '#f5f6f7', flexDirection: 'row',
borderRadius: 8, backgroundColor: '#f5f6f7',
paddingHorizontal: 8, borderRadius: 8,
justifyContent: 'space-between', paddingHorizontal: 8,
}, justifyContent: 'space-between',
'mobileView-imgbox': { },
width: 40, 'mobileView-imgbox': {
height: 40, width: 40,
justifyContent: 'flex-end', height: 40,
alignItems: 'center', justifyContent: 'flex-end',
}, alignItems: 'center',
'mobileView-submit': { },
marginTop: 30, 'mobileView-submit': {
backgroundColor: '#EA5504', marginTop: 30,
borderRadius: 8, backgroundColor: '#EA5504',
textAlign: 'center', borderRadius: 8,
fontSize: 14, textAlign: 'center',
color: '#fff', fontSize: 14,
paddingVertical: 10, color: '#fff',
}, paddingVertical: 10,
}); },
});
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