diff --git a/code/web/client/assets/videos/cross_loading.mp4 b/code/web/client/assets/videos/cross_loading.mp4 new file mode 100644 index 0000000..aa6b925 Binary files /dev/null and b/code/web/client/assets/videos/cross_loading.mp4 differ diff --git a/code/web/client/src/sections/auth/containers/login.jsx b/code/web/client/src/sections/auth/containers/login.jsx index d3ca792..764fef5 100644 --- a/code/web/client/src/sections/auth/containers/login.jsx +++ b/code/web/client/src/sections/auth/containers/login.jsx @@ -8,90 +8,90 @@ import { IconLock, IconUser } from '@douyinfe/semi-icons'; import '../style.less' const Login = props => { - const { dispatch, user, error, actions, apiRoot, isRequesting } = props - const form = useRef(); + const { dispatch, user, error, actions, apiRoot, isRequesting } = props + const form = useRef(); - useEffect(() => { - if (error) { - Toast.error(error); - form.current.setValue('password', '') - } - }, [error]) + useEffect(() => { + if (error) { + Toast.error(error); + form.current.setValue('password', '') + } + }, [error]) - useEffect(() => { - if (user && user.authorized) { - dispatch(push('/')); - localStorage.setItem('fs_iot_auth_selected_sider', JSON.stringify([])) - localStorage.setItem('fs_iot_auth_open_sider', JSON.stringify([])) - } - }, [user]) + useEffect(() => { + if (user && user.authorized) { + dispatch(push('/')); + localStorage.setItem('fs_iot_auth_selected_sider', JSON.stringify([])) + localStorage.setItem('fs_iot_auth_open_sider', JSON.stringify([])) + } + }, [user]) - return ( -
-
-
- + position: 'relative', + }}> +
+
+ +
+
{ + dispatch(login(values.username, values.password)).then(res => { + const data = res.payload.user + dispatch(actions.layout.initWebSocket({ ioUrl: apiRoot, token: data.token })) + }) + }} + getFormApi={formApi => form.current = formApi} + > + } + style={{ background: 'rgba(24, 89, 193, 0.08)', height: 40, marginTop: 26 }} + /> + } + style={{ background: 'rgba(24, 89, 193, 0.08)', height: 40 }} + /> + +
-
{ - dispatch(login(values.username, values.password)).then(res => { - const data = res.payload.user - dispatch(actions.layout.initWebSocket({ ioUrl: apiRoot, token: data.token })) - }) - }} - getFormApi={formApi => form.current = formApi} - > - } - style={{ background: 'rgba(24, 89, 193, 0.08)', height: 40, marginTop: 26 }} - /> - } - style={{ background: 'rgba(24, 89, 193, 0.08)', height: 40 }} - /> - - -
-
- ); +
+ ); } function mapStateToProps (state) { - const { auth, global } = state; - return { - user: auth.user, - error: auth.error, - actions: global.actions, - apiRoot: global.apiRoot, - isRequesting: auth.isRequesting - } + const { auth, global } = state; + return { + user: auth.user, + error: auth.error, + actions: global.actions, + apiRoot: global.apiRoot, + isRequesting: auth.isRequesting + } } export default connect(mapStateToProps)(Login); \ No newline at end of file