nieyuge 2 jaren geleden
bovenliggende
commit
cc57ec5d31
4 gewijzigde bestanden met toevoegingen van 55 en 14 verwijderingen
  1. 0 1
      src/components/useLogin.tsx
  2. 18 4
      src/pages/navigations/me.tsx
  3. 37 8
      src/pages/navigations/wallet.tsx
  4. 0 1
      src/router/index.tsx

+ 0 - 1
src/components/useLogin.tsx

@@ -73,7 +73,6 @@ export const useLoginCom = (props: any) => {
 		await setStorageData('userInfo', {});
 		setIsLogin(false);
 		setUserInfo({});
-		Alert.alert('log out success');
 	};
 
 	useEffect(() => {

+ 18 - 4
src/pages/navigations/me.tsx

@@ -26,7 +26,7 @@ const Me = (props: any) => {
 								uri: userInfo.avatarUrl,
 							}}
 						/>
-						<Text>{userInfo.nickName}</Text>
+						<Text style={styles.userName}>{userInfo.nickName}</Text>
 					</View>
 					<View style={styles.logOutContain}>
 						<View style={styles.logOutBtn}>
@@ -37,9 +37,11 @@ const Me = (props: any) => {
 							/>
 						</View>
 						<View style={styles.tips}>
-							<Text>Version 1.0.2|</Text>
-							<Text>用户协议|</Text>
-							<Text>隐私协议</Text>
+							<Text style={styles.tipsText}>Version 1.0.2</Text>
+							<Text style={styles.tipsText}>  |  </Text>
+							<Text style={styles.tipsText}>用户协议</Text>
+							<Text style={styles.tipsText}>  |  </Text>
+							<Text style={styles.tipsText}>隐私协议</Text>
 						</View>
 					</View>
 				</View>
@@ -96,8 +98,12 @@ const styles = StyleSheet.create({
 		flex: 1,
 		alignItems: 'center',
 		justifyContent: 'space-between',
+		backgroundColor: '#fff',
 	},
 	userInfo: {
+		display: 'flex',
+		alignItems: 'center',
+		justifyContent: 'center',
 		marginTop: 80,
 	},
 	userPhoto: {
@@ -106,6 +112,10 @@ const styles = StyleSheet.create({
 		height: 100,
 		borderRadius: 50,
 	},
+	userName: {
+		fontSize: 18,
+		fontWeight: 'bold',
+	},
 	logOutContain: {
 		marginBottom: 30,
 	},
@@ -121,6 +131,10 @@ const styles = StyleSheet.create({
 		flexDirection: 'row',
 		justifyContent: 'center',
 	},
+	tipsText: {
+		color: '#B8B',
+		fontSize: 12,
+	},
 	modalContain: {
 		width: 300,
 		height: 165,

+ 37 - 8
src/pages/navigations/wallet.tsx

@@ -1,12 +1,41 @@
 import React from 'react';
-import { Text, View } from 'react-native';
-
-const Wallet = () => {
-	return (
-		<View style={{ flex: 1 }}>
-			<Text>Wallet page</Text>
-		</View>
-	);
+import { LoginView } from '@/components/loginView';
+import { DenetWebview } from '@/components/webview';
+import { useLoginCom } from '@/components/useLogin';
+import messageCenter from '@/utils/messageCenter';
+
+interface Props {
+    navigation: any;
+}
+
+let webref: any;
+
+const onMessage = async (event: any) => {
+    let { info, data } = (event.nativeEvent.data && JSON.parse(event.nativeEvent.data)) || {};
+    switch (info.actionType) {
+        case 'IFRAME_GET_EXTENSION_STORGE_DATA':
+            info.target = webref;
+            messageCenter.send({ info, data });
+            break;
+    }
+}
+
+const Wallet = (props: Props) => {
+	const { isLogin, goTwitterAuthorize } = useLoginCom(props);
+
+    if (isLogin === false) {
+        return (
+            <LoginView goLogin={goTwitterAuthorize}></LoginView>
+        );
+    } else {
+        return (
+            <DenetWebview
+                onMessageHandle={onMessage}
+                refHandle={r => (webref = r)}
+                uri="http://localhost:3000/nav-wallet-index">
+            </DenetWebview>
+        );
+    }
 };
 
 export default Wallet;

+ 0 - 1
src/router/index.tsx

@@ -65,7 +65,6 @@ export const NavTabScreen = () => {
 			<Tab.Screen
 				name="Wallet"
 				options={{
-					headerShown: false,
 					tabBarIcon: ({ focused }) => {
 						return !!focused ? (
 							<SvgXml