提交 7958ee2c authored 作者: 吴强's avatar 吴强

Merge branch 'master' of git://192.168.1.116/bolan-root/frontend/manager-app-sz into wq

# Conflicts: # src/models/login.js # src/routes/login.js #提交直接到main
上级 f2267d2b
package com.bolanmanagerapp;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
......
......@@ -2,4 +2,4 @@ rootProject.name = 'bolanManagerApp'
include ':react-native-device-info'
project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android')
include ':app'
include ':app'
\ No newline at end of file
......@@ -15,7 +15,7 @@
"eslint-plugin-react": "^7.4.0",
"flow-bin": "^0.57.3",
"jest-expo": "~20.0.0",
"less": "^3.0.0-alpha.3",
"less": "^3.0.0-pre.4",
"less-loader": "^4.0.5",
"react-test-renderer": "16.0.0-alpha.12",
"style-loader": "^0.19.0"
......@@ -34,9 +34,8 @@
"dependencies": {
"antd-mobile": "^2.0.0",
"dva-core": "^1.1.0",
"rc-form": "^1.4.8",
"fastjson_ref_resolver": "0.0.3",
"lodash": "latest",
"lodash": "^4.17.4",
"moment": "^2.19.1",
"rc-form": "^1.4.8",
"react": "^16.0.0-beta.5",
......
import { NavigationActions } from 'react-navigation';
import { login, userInfo } from '../services/login';
import { errors } from '../utils/error';
import { setToken, setUser } from '../utils/auth';
export default {
namespace: 'login',
......@@ -6,8 +10,28 @@ export default {
reducers: {
},
effects: {
*login({ payload }, { put }) {
console.log(payload);
*login({ payload }, { call, put }) { // 这里的put 代表 跟dispatch一样的功能,只是在effects中叫做put
const payloads = { ...payload, type: 'userName', authType: 'password' };
console.info(payloads);
const result = yield call(login, payloads);
const { tokenId, authResponse, remainedAuthRequirements } = result;
if (authResponse.status !== 'authed' && authResponse.status !== 'skipped') {
throw errors.wrongPassword();
}
console.log(authResponse);
const { requirements } = remainedAuthRequirements;
if (requirements.length > 0) {
throw errors.unsupportedAuthType(requirements);
}
console.log(requirements);
yield call(setToken, tokenId);// 这里的yield ,跟C#中的await一样
const uInfo = yield call(userInfo);
console.log(uInfo);
yield call(setUser, uInfo.id, uInfo.name); // 保存用户名密码
yield put(NavigationActions.navigate({
routeName: 'Main',
}));
},
},
subscriptions: {},
};
......@@ -17,7 +17,7 @@ class Login extends Component {
<View style={LoginStyles.loginView} >
<List renderHeader={() => '深圳查房系统'}>
<InputItem
{...getFieldProps('username')}
{...getFieldProps('userName')}
clear
placeholder="请输入用户名"
ref={(el) => { this.autoFocusInst = el; }}
......@@ -48,36 +48,6 @@ class Login extends Component {
</List>
</View>
);
// return (
// <View style={LoginStyles.loginview}>
// <View style={{
// flexDirection: 'row',
// height: 100,
// marginTop: 1,
// justifyContent: 'center',
// alignItems: 'flex-start',
// }}
// >
// <Image source={require('../../image/login.png')} />
// </View>
// <View style={{ marginTop: 80 }}>
// <EditView
// name="输入用户名/注册手机号"
// onChangeText={(text) => {
// this.userName = text;
// }}
// />
// <EditView
// name="输入密码"
// onChangeText={(text) => {
// this.password = text;
// }}
// />
// <LoginButton name="登录" onPressCallback={this.onPressCallback} />
// <Text style={{ color: '#4A90E2', textAlign: 'center', marginTop: 10 }} >忘记密码?</Text>
// </View>
// </View>
// );
}
}
......
import React, { Component } from 'react';
import { View } from 'react-native';
import { View, Text } from 'react-native';
class HomeScreen extends Component {
render() {
return (
<View>
home
<Text>main</Text>
</View>
);
}
}
export default HomeScreen;
\ No newline at end of file
export default HomeScreen;
......@@ -18,10 +18,12 @@ export async function login(payload) {
},
};
}
console.log(DeviceInfo.getUniqueID());
data.tokenInfo = {
productId: config.productId,
deviceId: `${DeviceInfo.getUniqueID()}`,
};
return post(`${config.apiContextPath}/api/auth/login`, data, {}, {}, false);
}
......
......@@ -45,7 +45,7 @@ const config = {
footerText: '上海铂蓝信息科技有限公司',
logo: `${_contextPath}/logo.png`,
contextPath: _contextPath,
apiContextPath: _apiContextPath,
apiContextPath: `http://192.168.1.22:8080/bm${_apiContextPath}`,
defaultDateFormat,
defaultTimeFormat,
defaultDateTimeFormat,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论