index.js
1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import React, {useState} from 'react';
import { StyleSheet, View } from "react-native";
import {SafeAreaView} from 'react-native-safe-area-context';
import {Input, Text} from '@rneui/themed';
import {Button} from '@rneui/base';
import {useDispatch} from 'react-redux';
import {fetchUser} from '../Mine/userSlice';
const SignIn = () => {
const dispatch = useDispatch();
const [username, setUsername] = useState('staff');
const [password, setPassword] = useState('staff');
return (
<SafeAreaView>
<View style={styles.container}>
<Text h4 style={styles.title}>
船舶视频监控
</Text>
<Input
inputContainerStyle={styles.inputEle}
value={username}
placeholder="用户名"
onChangeText={text => setUsername(text)}
/>
<Input
inputContainerStyle={styles.inputEle}
value={password}
placeholder="密码"
onChangeText={text => setPassword(text)}
secureTextEntry={true}
/>
<Button
title="登录"
containerStyle={styles.submitButton}
onPress={() => {
dispatch(
fetchUser({
email: username,
password,
}),
);
}}
/>
</View>
</SafeAreaView>
);
};
const styles = StyleSheet.create({
container: {
height: '100%',
padding: 20,
},
title: {
marginTop: '30%',
marginBottom: 30,
textAlign: 'center',
},
inputEle: {
borderWidth: 1,
borderRadius: 10,
},
submitButton: {
marginLeft: 5,
padding: 5,
},
});
export default SignIn;