提交 dc3dc6cb authored 作者: 吴强's avatar 吴强

添加了身份证读卡

上级 372c8572
...@@ -2,6 +2,7 @@ import { Toast } from 'antd-mobile'; ...@@ -2,6 +2,7 @@ import { Toast } from 'antd-mobile';
import { NavigationActions } from 'react-navigation'; import { NavigationActions } from 'react-navigation';
import { getData, getMeta } from '../../utils/DataTemplate'; import { getData, getMeta } from '../../utils/DataTemplate';
import { datasourceApi } from '../../services/datasource'; import { datasourceApi } from '../../services/datasource';
import { scan } from '../../services/idcard';
export default { export default {
namespace: 'DSRInfoDetail', namespace: 'DSRInfoDetail',
...@@ -15,6 +16,13 @@ export default { ...@@ -15,6 +16,13 @@ export default {
setList(state, { payload }) { setList(state, { payload }) {
return { ...state, singularData: payload.singularData }; return { ...state, singularData: payload.singularData };
}, },
setSingularData(state, { payload }) {
const { singularData } = state;
if (singularData.dangShiRenXingMing !== undefined) {
singularData.dangShiRenXingMing = payload.peopleName;
}
return { ...state, singularData };
},
setEnable(state, { payload: enableEdit }) { setEnable(state, { payload: enableEdit }) {
return { ...state, enableEdit }; return { ...state, enableEdit };
}, },
...@@ -56,5 +64,18 @@ export default { ...@@ -56,5 +64,18 @@ export default {
})); }));
yield put({ type: 'setEnable', payload: false }); yield put({ type: 'setEnable', payload: false });
}, },
*DuKa(ignored, { call, put }) {
try {
Toast.loading('读卡中...', 0);
const result = yield call(scan);
if (result) {
yield put({ type: 'setSingularData', payload: result });
}
Toast.loading('读卡完成', 5);
} finally {
Toast.loading('读卡失败', 10);
}
//
},
}, },
}; };
...@@ -47,7 +47,6 @@ export default { ...@@ -47,7 +47,6 @@ export default {
const result = yield call(getData, coordinate, { pst: size, psz: 10 }); const result = yield call(getData, coordinate, { pst: size, psz: 10 });
const meta = yield call(getMeta, coordinate); const meta = yield call(getMeta, coordinate);
yield put({ type: 'setMetas', payload: meta }); yield put({ type: 'setMetas', payload: meta });
// const result = yield call('', 'query-DSRFWInfo', 'QueryfwTable', { pst: size, psz: 10 });
for (const row of result) { for (const row of result) {
yield put({ type: 'addHouse', payload: row }); yield put({ type: 'addHouse', payload: row });
yield take('addHouse/@@end'); yield take('addHouse/@@end');
......
import { NavigationActions } from 'react-navigation';
import { getData, getMeta } from '../../utils/DataTemplate';
export default { export default {
namespace: 'userInfo', namespace: 'userInfo',
...@@ -9,12 +6,19 @@ export default { ...@@ -9,12 +6,19 @@ export default {
userName: undefined, userName: undefined,
currentJiDiName: undefined, currentJiDiName: undefined,
jidiList: [], jidiList: [],
language: '',
}, },
subscriptions: { subscriptions: {
setup({ dispatch }) { // eslint-disable-line setup({ dispatch }) { // eslint-disable-line
}, },
}, },
reducers: { reducers: {
setlanguage(state, { payload: language }) {
return {
...state,
language,
};
},
setUserName(state, { payload: userName }) { setUserName(state, { payload: userName }) {
return { return {
...state, ...state,
......
...@@ -7,7 +7,6 @@ import { View, ScrollView } from 'react-native'; ...@@ -7,7 +7,6 @@ import { View, ScrollView } from 'react-native';
import { List, InputItem, Button, Toast } from 'antd-mobile'; import { List, InputItem, Button, Toast } from 'antd-mobile';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { createAction } from '../../../utils'; import { createAction } from '../../../utils';
import {scan} from "../../../services/idcard";
@connect(({ DSRInfoDetail }) => ({ DSRInfoDetail })) @connect(({ DSRInfoDetail }) => ({ DSRInfoDetail }))
class DSRInfoDetailScreen extends React.Component { class DSRInfoDetailScreen extends React.Component {
...@@ -39,9 +38,6 @@ class DSRInfoDetailScreen extends React.Component { ...@@ -39,9 +38,6 @@ class DSRInfoDetailScreen extends React.Component {
const { getFieldProps } = this.props.form; const { getFieldProps } = this.props.form;
return ( return (
<ScrollView> <ScrollView>
<Button onClick={() => {
scan().then(res => console.log(res)).catch(err => console.error(err));
}}></Button>
<List> <List>
{ {
metas.map((m) => { metas.map((m) => {
...@@ -83,6 +79,9 @@ class DSRInfoDetailScreen extends React.Component { ...@@ -83,6 +79,9 @@ class DSRInfoDetailScreen extends React.Component {
return ( return (
<List.Item> <List.Item>
<View style={{ flexDirection: 'row' }}> <View style={{ flexDirection: 'row' }}>
<Button onClick={() => {
this.props.dispatch({ type: 'DSRInfoDetail/DuKa' });
}}></Button>
<Button style={{ marginRight: 8 }} type="primary" onClick={this.onEdit}>编辑</Button> <Button style={{ marginRight: 8 }} type="primary" onClick={this.onEdit}>编辑</Button>
<Button style={{ marginRight: 8 }} onClick={this.onSubmit}>保存</Button> <Button style={{ marginRight: 8 }} onClick={this.onSubmit}>保存</Button>
</View> </View>
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Text, FlatList } from 'react-native'; import { Text, FlatList } from 'react-native';
import { Card, WingBlank, WhiteSpace } from 'antd-mobile'; import { WingBlank, WhiteSpace } from 'antd-mobile';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { createAction } from '../../../utils/index'; import { createAction } from '../../../utils/index';
import FlatListItem from '../houseinfo/FlatListItem'; import FlatListItem from '../houseinfo/FlatListItem';
...@@ -16,7 +16,6 @@ class DSRInfoScreeen extends Component { ...@@ -16,7 +16,6 @@ class DSRInfoScreeen extends Component {
onEndReached = () => { onEndReached = () => {
// 以下是制造新数据 // 以下是制造新数据
if (!this.props.loading) { if (!this.props.loading) {
console.log('上啦加载')
this.props.dispatch(createAction('DSRInfo/getDSRList')()); this.props.dispatch(createAction('DSRInfo/getDSRList')());
} }
}; };
...@@ -41,11 +40,7 @@ class DSRInfoScreeen extends Component { ...@@ -41,11 +40,7 @@ class DSRInfoScreeen extends Component {
renderFooter = () => ( renderFooter = () => (
<WingBlank size="lg"> <WingBlank size="lg">
<WhiteSpace size="lg" /> <WhiteSpace size="lg" />
<Card> <Text>到底了!!!</Text>
<Card.Body>
<Text>到底了!!!</Text>
</Card.Body>
</Card>
<WhiteSpace size="lg" /> <WhiteSpace size="lg" />
</WingBlank> </WingBlank>
); );
...@@ -53,11 +48,7 @@ class DSRInfoScreeen extends Component { ...@@ -53,11 +48,7 @@ class DSRInfoScreeen extends Component {
renderEmptyView = () => ( renderEmptyView = () => (
<WingBlank size="lg"> <WingBlank size="lg">
<WhiteSpace size="lg" /> <WhiteSpace size="lg" />
<Card> <Text>当前无内容</Text>
<Card.Body>
<Text>当前无内容</Text>
</Card.Body>
</Card>
<WhiteSpace size="lg" /> <WhiteSpace size="lg" />
</WingBlank> </WingBlank>
); );
......
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { View, StyleSheet, RefreshControl, Dimensions, ScrollView, Text } from 'react-native'; import { View, StyleSheet, Dimensions, ScrollView, Text, Picker } from 'react-native';
import { connect } from 'react-redux';
import { List, InputItem } from 'antd-mobile';
const width = Dimensions.get('window').width; const width = Dimensions.get('window').width;
const height = Dimensions.get('window').height; const height = Dimensions.get('window').height;
// create a component // create a component
@connect(({ userInfo }) => ({ userInfo }))
class UserInfoHomeScreen extends PureComponent { class UserInfoHomeScreen extends PureComponent {
renderHeader=() => {
return (
<View style={styles.header}>
<View style={styles.userContainer}>
<Text style={styles.avatar} />
<View>
<View style={{ flexDirection: 'row' }}>
<Text style={{ color: 'white' }}>素敌</Text>
<Text style={{ marginLeft: 4 }} />
</View>
<Text style={{ color: 'white', marginTop: 4 }}>个人信息</Text>
</View>
</View>
</View>
);
};
render() { render() {
return ( return (
<View style={{ flex: 1, backgroundColor: '#06C1AE'}}> <View style={{ flex: 1, backgroundColor: '#06C1AE' }}>
<View style={{ position: 'absolute', width, height, backgroundColor: '#06C1AE' }} /> <View style={{ position: 'absolute', width, height, backgroundColor: '#06C1AE' }} />
<ScrollView <ScrollView>
refreshControl={ <View style={styles.header}>
<RefreshControl <View style={styles.userContainer}>
refreshing={this.state.isRefreshing} <Text style={styles.avatar} />
onRefresh={() => this.onHeaderRefresh()} <View>
tintColor="gray" <View style={{ flexDirection: 'row' }}>
/> <Text style={{ color: 'white' }}>素敌</Text>
} <Text style={{ marginLeft: 4 }} />
> </View>
{this.renderHeader} <Text style={{ color: 'white', marginTop: 4 }}>个人信息</Text>
</View>
</View>
<List style={{ backgroundColor: 'white' }} className="picker-list">
<Picker
extra="请选择(可选)"
data={district}
title="Areas"
{...getFieldProps('district', {
initialValue: ['340000', '341500', '341502'],
})}
onOk={e => console.log('ok', e)}
onDismiss={e => console.log('dismiss', e)}
>
<List.Item arrow="horizontal">Multiple & cascader</List.Item>
</Picker>
</List>
</View>
</ScrollView> </ScrollView>
</View> </View>
); );
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论