提交 e4c6d2f9 authored 作者: zhouhuan's avatar zhouhuan

Merge branch 'wq' of ssh://192.168.1.116:29418/bolan-root/frontend/manager-app-sz into zhouhuan

# Conflicts: # src/routes/main/houseinfo/ObligeeInfo.js # src/routes/main/houseinfo/listhouse.js
...@@ -78,6 +78,11 @@ project.ext.react = [ ...@@ -78,6 +78,11 @@ project.ext.react = [
apply from: "../../node_modules/react-native/react.gradle" apply from: "../../node_modules/react-native/react.gradle"
project.ext.vectoricons = [
iconFontNames: [ 'MaterialIcons.ttf', 'EvilIcons.ttf' ] // Name of the font files you want to copy
]
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
/** /**
* Set this to true to create two separate APKs instead of one: * Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices * - An APK that only works on ARM devices
...@@ -143,6 +148,7 @@ dependencies { ...@@ -143,6 +148,7 @@ dependencies {
compile "com.android.support:appcompat-v7:25.3.1" compile "com.android.support:appcompat-v7:25.3.1"
compile 'com.android.support:multidex:1.0.1' compile 'com.android.support:multidex:1.0.1'
compile "com.facebook.react:react-native:+" // From node_modules compile "com.facebook.react:react-native:+" // From node_modules
compile project(':react-native-vector-icons') // 2017-10-31 wq add
} }
// Run this once to be able to run the application with BUCK // Run this once to be able to run the application with BUCK
......
...@@ -15,6 +15,8 @@ import com.facebook.soloader.SoLoader; ...@@ -15,6 +15,8 @@ import com.facebook.soloader.SoLoader;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.oblador.vectoricons.VectorIconsPackage;// wq add 2017-10-31
public class MainApplication extends Application implements ReactApplication { public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
...@@ -28,7 +30,8 @@ public class MainApplication extends Application implements ReactApplication { ...@@ -28,7 +30,8 @@ public class MainApplication extends Application implements ReactApplication {
return Arrays.<ReactPackage>asList( return Arrays.<ReactPackage>asList(
new MainReactPackage(), new MainReactPackage(),
new RNDeviceInfo(), new RNDeviceInfo(),
new IDCardReactPackage() new IDCardReactPackage(),
new VectorIconsPackage()
); );
} }
......
...@@ -2,4 +2,7 @@ rootProject.name = 'bolanManagerApp' ...@@ -2,4 +2,7 @@ rootProject.name = 'bolanManagerApp'
include ':react-native-device-info' include ':react-native-device-info'
project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android') project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android')
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
include ':app' include ':app'
差异被折叠。
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
"private": true, "private": true,
"devDependencies": { "devDependencies": {
"babel-eslint": "^8.0.1", "babel-eslint": "^8.0.1",
"babel-plugin-import": "^1.6.0", "babel-plugin-import": "^1.6.2",
"babel-preset-flow": "^6.23.0", "babel-preset-flow": "^6.23.0",
"babel-preset-react-native-stage-0": "^1.0.1", "babel-preset-react-native-stage-0": "^1.0.1",
"css-loader": "^0.28.7", "css-loader": "^0.28.7",
"eslint": "^4.10.0", "eslint": "^4.8.0",
"eslint-config-airbnb": "^16.0.0", "eslint-config-airbnb": "^16.0.0",
"eslint-plugin-import": "^2.7.0", "eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^6.0.2", "eslint-plugin-jsx-a11y": "^6.0.2",
...@@ -38,12 +38,12 @@ ...@@ -38,12 +38,12 @@
"fastjson_ref_resolver": "0.0.3", "fastjson_ref_resolver": "0.0.3",
"lodash": "^4.17.4", "lodash": "^4.17.4",
"moment": "^2.19.1", "moment": "^2.19.1",
"rc-form": "^1.5.0", "rc-form": "^1.4.8",
"react": "^16.0.0-beta.5", "react": "^16.0.0-beta.5",
"react-native": "^0.49.5", "react-native": "^0.49.3",
"react-native-device-info": "^0.12.1", "react-native-device-info": "^0.12.1",
"react-navigation": "^1.0.0-beta.16", "react-navigation": "^1.0.0-beta.14",
"react-redux": "^5.0.6", "react-redux": "^5.0.6",
"redux-persist": "^4.10.2" "redux-persist": "^4.10.1"
} }
} }
import React, { PureComponent } from 'react';
import { TouchableOpacity, Text, View, StyleSheet, Dimensions, Image } from 'react-native';
import { Card, WingBlank, WhiteSpace } from 'antd-mobile';
const totalWidth = Dimensions.get('window').width;
class FlatListItem extends PureComponent {
onPress = () => {
this.props.onPressItem(this.props.item.id);
};
render() {
return (
<TouchableOpacity
{...this.props}
style={{ height: 120 }}
onPress={this.onPress}
>
<WingBlank size="lg">
<WhiteSpace size="lg" />
<Card>
<Card.Header
title={this.props.item.fangWuZuoLuo}
extra={<Text style={Styles.cardText}>&gt;&gt;详情</Text>}
/>
<Card.Body>
<Text style={Styles.cardBodyText}>编号:<Text style={Styles.cardBodyText2}>{this.props.item.fwBianMa}</Text></Text>
<Text style={Styles.cardBodyText}>面积:<Text style={Styles.cardBodyText2}>350502199210236034</Text></Text>
<Text style={Styles.cardBodyText}>产权人:<Text style={Styles.cardBodyText2}>户主</Text></Text>
</Card.Body>
</Card>
<WhiteSpace size="lg" />
</WingBlank>
</TouchableOpacity>
);
}
}
const Styles = StyleSheet.create({
row: {
height: 60,
borderBottomWidth: 1,
borderBottomColor: '#ccc',
flexDirection: 'row',
alignItems: 'center',
},
part: {
marginLeft: 5,
flex: 1,
},
unColor: {
color: '#575656',
marginTop: 8,
fontSize: 12,
},
link: {
color: '#1BB7FF',
marginTop: 2,
},
ScrollView: {
flex: 1,
},
container: {
flex: 1,
marginLeft: 10,
marginRight: 10,
flexDirection: 'column',
backgroundColor: 'white',
},
nm: {
color: '#333',
fontSize: 12,
},
nm1: {
color: '#333',
fontSize: 12,
marginLeft: 30,
},
nameView: {
paddingTop: 2,
flexDirection: 'row',
alignItems: 'flex-start',
marginLeft: 1,
},
item: {
flex: 1,
height: 60,
width: totalWidth,
padding: 1,
borderBottomWidth: 2,
borderBottomColor: '#ddd',
flexDirection: 'column',
alignItems: 'flex-start',
justifyContent: 'flex-start',
},
width50: {
marginLeft: 1,
marginRight: 40,
alignItems: 'flex-start',
justifyContent: 'flex-start',
backgroundColor: 'white',
},
rightIcon: {
position: 'absolute',
right: -2,
top: -30,
height: 15,
width: 15,
},
cardText: {
color: '#2196F3',
textAlign: 'right',
},
cardBodyText: {
marginBottom: 10,
marginLeft: 13,
},
});
export default FlatListItem;
/**
* Created by zhouhuan on 2017/11/3.
*/
import React from 'react';
import { Platform, Keyboard } from 'react-native';
import { TabBarBottom, TabBarTop } from 'react-navigation';
class TabBarComponent extends React.PureComponent {
constructor(props) {
super(props);
this.keyboardWillShow = this.keyboardWillShow.bind(this);
this.keyboardWillHide = this.keyboardWillHide.bind(this);
this.state = {
isVisible: true,
};
}
componentWillMount() {
this.keyboardWillShowSub = Keyboard.addListener('keyboardDidShow', this.keyboardWillShow);
this.keyboardWillHideSub = Keyboard.addListener('keyboardDidHide', this.keyboardWillHide);
}
componentWillUnmount() {
this.keyboardWillShowSub.remove();
this.keyboardWillHideSub.remove();
}
keyboardWillShow = () => {
this.setState({
isVisible: false,
});
};
keyboardWillHide = () => {
this.setState({
isVisible: true,
});
};
render() {
const TBB = Platform.select({
ios: TabBarBottom,
android: TabBarTop,
});
return this.state.isVisible ?
<TBB {...this.props} />
:
null;
}
}
export default TabBarComponent;
...@@ -11,7 +11,7 @@ import { processError } from './utils/error'; ...@@ -11,7 +11,7 @@ import { processError } from './utils/error';
const app = dva({ const app = dva({
initialState: {}, initialState: {},
models: [...models, routerModel], models: [...models, routerModel],
extraEnhancers: [autoRehydrate()], extraEnhancers: [autoRehydrate({ log: true })],
onError: processError, onError: processError,
}); });
......
import { unionBy } from 'lodash';
import { NavigationActions } from 'react-navigation';
import { getData, getMeta } from '../../utils/DataTemplate';
export default {
namespace: 'DSRInfo',
state: {
sourceData: [],
metas: [],
DSRID: '',
},
reducers: {
setDSRID(state, { payload }) {
return {
...state,
DSRID: payload,
};
},
setList(state, { payload: { arrayData } }) {
const newSourceData = unionBy(state.sourceData, arrayData, 'id');
return { ...state, sourceData: newSourceData };
},
// 下拉刷新用到的,清空列表的数据
clearList(state) {
return { ...state, sourceData: [] };
},
setMetas(state, { payload }) {
return { ...state, metas: payload };
},
},
effects: {
*jumpPage({ payload: id }, { put }) {
yield put({ type: 'setDSRID', payload: id });
yield put(NavigationActions.navigate({
routeName: 'DSRInfoDetail',
params: { id },
}));
},
*getDSRList({ payload }, { take, put, call, select }) {
if (payload === 'clear') {
yield put({ type: 'clearList', payload: {} });
}
const { sourceData } = yield select(state => state.DSRInfo);
const size = sourceData.length;
const coordinate = {
containerType: 'module',
containerName: 'query-DSRInfo',
datasourceName: 'QueryDSRInfoTable',
};
const result = yield call(getData, coordinate, { pst: size, psz: 10 });
const meta = yield call(getMeta, coordinate);
yield put({ type: 'setMetas', payload: meta });
// const result = yield call('', 'query-DSRFWInfo', 'QueryfwTable', { pst: size, psz: 10 });
for (const row of result) {
yield put({ type: 'addDSR', payload: row });
yield take('addDSR/@@end');
}
},
*addDSR({ payload }, { put }) {
yield put({ type: 'setList', payload: { arrayData: [payload] } });
},
},
};
import { Toast } from 'antd-mobile';
import { NavigationActions } from 'react-navigation';
import { getData, getMeta } from '../../utils/DataTemplate';
import { datasourceApi } from '../../services/datasource';
export default {
namespace: 'DSRInfoDetail',
state: {
singularData: {},
metas: [],
enableEdit: false,
DSRID: '',
},
reducers: {
setList(state, { payload }) {
return { ...state, singularData: payload.singularData };
},
setEnable(state, { payload: enableEdit }) {
return { ...state, enableEdit };
},
setMetas(state, { payload }) {
return { ...state, metas: payload };
},
setDSRID(state, { payload }) {
return {
...state,
DSRID: payload,
};
},
},
effects: {
*getDSRInfoDetail({ payload }, { call, put }) {
const coordinate = {
containerType: 'module',
containerName: 'query-DSRInfo',
datasourceName: 'QueryDSRInfoDetails',
};
const result = yield call(getData, coordinate, { pst: 0, psz: 10, params: { pID: payload } });
const singularData = result[0];
yield put({ type: 'setDSRID', payload });
yield put({ type: 'setList', payload: { singularData: { ...singularData } } });
const metas = yield call(getMeta, coordinate);
yield put({ type: 'setMetas', payload: metas });
},
*updateDSRInfoDetail({ payload }, { call, put }) {
const coordinate = {
containerType: 'module',
containerName: 'query-DSRInfo',
datasourceName: 'QueryDSRInfoDetails',
};
const api = datasourceApi(coordinate);
yield call(api.update, payload.id, payload.singularData);
Toast.success('修改成功!', 1);
yield put(NavigationActions.navigate({
routeName: 'DSRInfoList',
}));
yield put({ type: 'setEnable', payload: false });
},
},
};
...@@ -11,6 +11,7 @@ export default { ...@@ -11,6 +11,7 @@ export default {
state: { state: {
sourceData: {}, sourceData: {},
detailData: {}, detailData: {},
metas: [],
isDetail: false, isDetail: false,
editable: false, editable: false,
disabled: true, disabled: true,
...@@ -38,13 +39,11 @@ export default { ...@@ -38,13 +39,11 @@ export default {
datasourceName: 'QueryDSRInfoDetails', datasourceName: 'QueryDSRInfoDetails',
}; };
const result = yield call(getData, coordinate, { params: { pID: payload } }); const result = yield call(getData, coordinate, { params: { pID: payload } });
console.log(result);
yield put({ type: 'getDSRDetail', payload: { ...result[0] } }); yield put({ type: 'getDSRDetail', payload: { ...result[0] } });
yield put({ type: 'setDetail', payload: true }); yield put({ type: 'setDetail', payload: true });
yield put({ type: 'setEdit', payload: false }); yield put({ type: 'setEdit', payload: false });
}, },
*updateDSRDetail({ payload }, { call, put }) { *updateDSRDetail({ payload }, { call, put }) {
console.log('update');
const coordinate = { const coordinate = {
containerType: 'module', containerType: 'module',
containerName: 'query-DSRInfo', containerName: 'query-DSRInfo',
...@@ -96,6 +95,9 @@ export default { ...@@ -96,6 +95,9 @@ export default {
sourceData: payload, sourceData: payload,
}; };
}, },
setMetas(state, { payload }) {
return { ...state, metas: payload };
},
setDetail(state, { payload }) { setDetail(state, { payload }) {
return { return {
...state, ...state,
......
import { NavigationActions } from 'react-navigation'; import { NavigationActions } from 'react-navigation';
import { getData } from '../../utils/DataTemplate'; import { getData, getMeta } from '../../utils/DataTemplate';
export default { export default {
namespace: 'ListHouse', namespace: 'ListHouse',
state: { state: {
sourceData: [], sourceData: [],
metas: [],
houseID: '', houseID: '',
}, },
reducers: { reducers: {
...@@ -21,6 +22,9 @@ export default { ...@@ -21,6 +22,9 @@ export default {
clearList(state) { clearList(state) {
return { ...state, sourceData: [] }; return { ...state, sourceData: [] };
}, },
setMetas(state, { payload }) {
return { ...state, metas: payload };
},
}, },
effects: { effects: {
*jumpPage({ payload: id }, { put }) { *jumpPage({ payload: id }, { put }) {
...@@ -41,6 +45,8 @@ export default { ...@@ -41,6 +45,8 @@ export default {
datasourceName: 'QueryfwTable', datasourceName: 'QueryfwTable',
}; };
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);
yield put({ type: 'setMetas', payload: meta });
// const result = yield call('', 'query-DSRFWInfo', 'QueryfwTable', { pst: size, psz: 10 }); // 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 });
......
...@@ -3,6 +3,8 @@ import login from './login'; ...@@ -3,6 +3,8 @@ import login from './login';
import listHouse from './houseinfo/listhouse'; import listHouse from './houseinfo/listhouse';
import HouseDetail from './houseinfo/houseDetail'; import HouseDetail from './houseinfo/houseDetail';
import obligeeInfo from './houseinfo/ObligeeInfo'; import obligeeInfo from './houseinfo/ObligeeInfo';
import DSRInfo from './dangshireninfo/dsrinfo';
import DSRInfoDetail from './dangshireninfo/dsrinfodetail';
export default [ export default [
welcome, welcome,
...@@ -10,4 +12,6 @@ export default [ ...@@ -10,4 +12,6 @@ export default [
listHouse, listHouse,
HouseDetail, HouseDetail,
obligeeInfo, obligeeInfo,
DSRInfo,
DSRInfoDetail,
]; ];
/**
* Created by zhouhuan on 2017/10/30.
*/
import React from 'react';
import { createForm } from 'rc-form';
import { View, ScrollView } from 'react-native';
import { List, InputItem, Button, Toast } from 'antd-mobile';
import { connect } from 'react-redux';
import { createAction } from '../../../utils';
@connect(({ DSRInfoDetail }) => ({ DSRInfoDetail }))
class DSRInfoDetailScreen extends React.Component {
componentDidMount() {
const { id } = this.props.navigation.state.params;
this.props.dispatch(createAction('DSRInfoDetail/getDSRInfoDetail')(id));
}
onEdit =() => {
this.props.dispatch(createAction('DSRInfoDetail/setEnable')(true));
};
onSubmit = () => {
this.props.form.validateFields({ force: true }, (error, value) => {
if (!error) {
this.props.dispatch(createAction('DSRInfoDetail/updateDSRInfoDetail')({ id: this.props.DSRInfoDetail.DSRID, singularData: value }));
} else {
Toast.show('Validation failed');
}
});
};
validateNoNull = (rule, value, callback) => {
if (value) {
callback();
} else {
callback(new Error('At least four charactors for account'));
}
};
render() {
const { singularData, metas, enableEdit } = this.props.DSRInfoDetail;
const { getFieldProps } = this.props.form;
return (
<ScrollView>
<List>
{
metas.map((m) => {
if (m.required === true) {
return (
<InputItem
{...getFieldProps(m.key, {
initialValue: singularData[m.key],
rules: [
{ required: true, message: '不允许为空' },
{ validator: this.validateNoNull },
],
})}
clear
placeholder="请输入"
editable={enableEdit}
ref={(el) => { this.customFocusInst = el; }}
>
姓名
</InputItem>
);
} else {
return (
<InputItem
{...getFieldProps(m.key, {
initialValue: singularData[m.key],
})}
clear
placeholder="请输入"
editable={enableEdit}
ref={(el) => { this.customFocusInst = el; }}
>
{m.label}
</InputItem>
);
}
})}
{[1].map(() => {
return (
<List.Item>
<View style={{ flexDirection: 'row' }}>
<Button style={{ marginRight: 8 }} type="primary" onClick={this.onEdit}>编辑</Button>
<Button style={{ marginRight: 8 }} onClick={this.onSubmit}>保存</Button>
</View>
</List.Item>
);
})
}
</List>
</ScrollView>
);
}
}
export default createForm()(DSRInfoDetailScreen);
import React, { Component } from 'react';
import { Text, FlatList } from 'react-native';
import { Card, WingBlank, WhiteSpace } from 'antd-mobile';
import { connect } from 'react-redux';
import { createAction } from '../../../utils/index';
import FlatListItem from '../houseinfo/FlatListItem';
@connect(({ DSRInfo }) => ({ DSRInfo/* , loading: !!loading.effects['obligeeInfo/getObligeeInfo'] */ }))
class DSRInfoScreeen extends Component {
componentDidMount() {
const { dispatch } = this.props;
console.info('初始加载');
dispatch(createAction('DSRInfo/getDSRList')());
}
// 上拉加载更多
onEndReached = () => {
// 以下是制造新数据
if (!this.props.loading) {
console.log('上啦加载')
this.props.dispatch(createAction('DSRInfo/getDSRList')());
}
};
onPressItem = (id) => {
this.props.dispatch(createAction('DSRInfo/jumpPage')(id));
};
getItemLayout = (data, index) => (
{ length: 120, offset: (120 + 1) * index, index }
);
/**
* 此函数用于为给定的item生成一个不重复的Key。
* Key的作用是使React能够区分同类元素的不同个体,以便在刷新时能够确定其变化的位置,减少重新渲染的开销。
* 若不指定此函数,则默认抽取item.key作为key值。
* 若item.key也不存在,则使用数组下标
*
* @param item
* @private
*/
// 这里指定使用数组下标作为唯一索引
keyExtractor = item => `${item.id}`;
// Footer布局
renderFooter = () => (
<WingBlank size="lg">
<WhiteSpace size="lg" />
<Card>
<Card.Body>
<Text>到底了!!!</Text>
</Card.Body>
</Card>
<WhiteSpace size="lg" />
</WingBlank>
);
// 空布局
renderEmptyView = () => (
<WingBlank size="lg">
<WhiteSpace size="lg" />
<Card>
<Card.Body>
<Text>当前无内容</Text>
</Card.Body>
</Card>
<WhiteSpace size="lg" />
</WingBlank>
);
// 下拉刷新
renderRefresh = () => {
if (!this.props.loading) {
this.props.dispatch(createAction('DSRInfo/getDSRList')('clear'));
}
};
/**
* 使用箭头函数防止不必要的re-render;
* 如果使用bind方式来绑定onPressItem,每次都会生成一个新的函数,导致props在===比较时返回false,
* 从而触发自身的一次不必要的重新render,也就是FlatListItem组件每次都会重新渲染。
*
* @param id
* @private
*/
renderItem = ({ item }) => {
return (
<FlatListItem
title={item.dangShiRenXingMing}
meta={this.props.DSRInfo.metas}
item={item}
onPressItem={this.onPressItem}
/>
);
};
render() {
return (
<FlatList
data={this.props.DSRInfo.sourceData}
keyExtractor={this.keyExtractor}
renderItem={this.renderItem}
// 决定当距离内容最底部还有多远时触发onEndReached回调;数值范围0~1,例如:0.5表示可见布局的最底端距离content最底端等于可见布局一半高度的时候调用该回调
onEndReachedThreshold={0.3}
// 当列表被滚动到距离内容最底部不足onEndReacchedThreshold设置的距离时调用
onEndReached={this.onEndReached}
ListFooterComponent={this.renderFooter}
ListEmptyComponent={this.renderEmptyView}
refreshing={this.props.loading || false}
onRefresh={this.renderRefresh}
// 是一个可选的优化,用于避免动态测量内容,+1是加上分割线的高度
/>
);
}
}
export default DSRInfoScreeen;
import { StackNavigator } from 'react-navigation';
import DSRInfoScreen from './DSRInfoScreeen';
import DSRInfoDetailScreen from './DSRInfoDetailScreen';
const DSRErJiScreen = StackNavigator(
{
DSRInfoList: {
screen: DSRInfoScreen,
},
DSRInfoDetail: {
screen: DSRInfoDetailScreen,
},
},
{
headerMode: 'none',
navigationOptions: {
gesturesEnabled: false,
},
},
);
export default DSRErJiScreen;
...@@ -9,7 +9,7 @@ import ErJiScreen from './houseinfo/erJiScreen'; ...@@ -9,7 +9,7 @@ import ErJiScreen from './houseinfo/erJiScreen';
class HouseList extends Component { class HouseList extends Component {
state = { state = {
value: '美食', value: '',
}; };
action = () => { action = () => {
......
import React, { PureComponent } from 'react';
import { TouchableOpacity, Text, View, StyleSheet, Dimensions, Image } from 'react-native';
import { Card, WingBlank, WhiteSpace } from 'antd-mobile';
const totalWidth = Dimensions.get('window').width;
class FlatListItem extends PureComponent {
onPress = () => {
this.props.onPressItem(this.props.item.id);
};
render() {
return (
<TouchableOpacity
{...this.props}
style={{ height: 120 }}
onPress={this.onPress}
>
<WingBlank size="lg">
<WhiteSpace size="lg" />
<Card>
<Card.Header
title={this.props.item.fangWuZuoLuo}
extra={<Text style={Styles.cardText}>&gt;&gt;详情</Text>}
/>
<Card.Body>
<Text style={Styles.cardBodyText}>编号:<Text style={Styles.cardBodyText2}>{this.props.item.fwBianMa}</Text></Text>
<Text style={Styles.cardBodyText}>面积:<Text style={Styles.cardBodyText2}>350502199210236034</Text></Text>
<Text style={Styles.cardBodyText}>产权人:<Text style={Styles.cardBodyText2}>户主</Text></Text>
</Card.Body>
</Card>
<WhiteSpace size="lg" />
</WingBlank>
</TouchableOpacity>
);
}
}
const Styles = StyleSheet.create({
row: {
height: 60,
borderBottomWidth: 1,
borderBottomColor: '#ccc',
flexDirection: 'row',
alignItems: 'center',
},
part: {
marginLeft: 5,
flex: 1,
},
unColor: {
color: '#575656',
marginTop: 8,
fontSize: 12,
},
link: {
color: '#1BB7FF',
marginTop: 2,
},
ScrollView: {
flex: 1,
},
container: {
flex: 1,
marginLeft: 10,
marginRight: 10,
flexDirection: 'column',
backgroundColor: 'white',
},
nm: {
color: '#333',
fontSize: 12,
},
nm1: {
color: '#333',
fontSize: 12,
marginLeft: 30,
},
nameView: {
paddingTop: 2,
flexDirection: 'row',
alignItems: 'flex-start',
marginLeft: 1,
},
item: {
flex: 1,
height: 60,
width: totalWidth,
padding: 1,
borderBottomWidth: 2,
borderBottomColor: '#ddd',
flexDirection: 'column',
alignItems: 'flex-start',
justifyContent: 'flex-start',
},
width50: {
marginLeft: 1,
marginRight: 40,
alignItems: 'flex-start',
justifyContent: 'flex-start',
backgroundColor: 'white',
},
rightIcon: {
position: 'absolute',
right: -2,
top: -30,
height: 15,
width: 15,
},
cardText: {
color: '#2196F3',
textAlign: 'right',
},
cardBodyText: {
marginBottom: 10,
marginLeft: 13,
},
});
export default FlatListItem;
import React, { Component } from 'react'; import React, { Component } from 'react';
import { View, ScrollView, Text } from 'react-native'; import { View, ScrollView } from 'react-native';
import { List, InputItem, Button } from 'antd-mobile'; import { List, InputItem, Button, Toast } from 'antd-mobile';
import { createForm } from 'rc-form'; import { createForm } from 'rc-form';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { createAction } from '../../../utils/index'; import { createAction } from '../../../utils/index';
...@@ -15,28 +15,26 @@ class HouseDetail extends Component { ...@@ -15,28 +15,26 @@ class HouseDetail extends Component {
this.props.form.validateFields({ force: true }, (error, value) => { this.props.form.validateFields({ force: true }, (error, value) => {
if (!error) { if (!error) {
// 校验成功执行这里的代码 // 校验成功执行这里的代码
console.info({ id: this.props.navigation.state.params.id, singularData: value });
this.props.dispatch(createAction('HouseDetail/updateHouseDetail')({ id: this.props.ListHouse.houseID, singularData: value })); this.props.dispatch(createAction('HouseDetail/updateHouseDetail')({ id: this.props.ListHouse.houseID, singularData: value }));
console.log(this.props.form.getFieldsValue());
} else { } else {
// 执行出现错误,弹出错处理 // 执行出现错误,弹出错处理
console.log('Validation failed'); Toast.show('Validation failed');
} }
}); });
} };
onReset = () => { onReset = () => {
this.props.form.resetFields(); this.props.form.resetFields();
} };
validateFWBianMa = (rule, value, callback) => { validateFWBianMa = (rule, value, callback) => {
if (value) { if (value) {
callback(); callback();
} else { } else {
callback(new Error('At least four charactors for account')); callback(new Error('At least four charactors for account'));
} }
} };
modifyInfo = () => { modifyInfo = () => {
this.props.dispatch(createAction({ type: 'setEnable', payload: { enableEdit: true } })); this.props.dispatch(createAction({ type: 'setEnable', payload: { enableEdit: true } }));
} };
render() { render() {
const { getFieldProps } = this.props.form; const { getFieldProps } = this.props.form;
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { View, FlatList, Text } from 'react-native'; import { FlatList, Text } from 'react-native';
import { Card, WingBlank, WhiteSpace } from 'antd-mobile'; import { Card, WingBlank, WhiteSpace } from 'antd-mobile';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { createAction } from '../../../utils'; import { createAction } from '../../../utils';
...@@ -33,38 +33,28 @@ class ListHouContent extends Component { ...@@ -33,38 +33,28 @@ class ListHouContent extends Component {
* 若item.key也不存在,则使用数组下标 * 若item.key也不存在,则使用数组下标
* *
* @param item * @param item
* @param index
* @private * @private
*/ */
// 这里指定使用数组下标作为唯一索引 // 这里指定使用数组下标作为唯一索引
keyExtractor = item => `${item.id}`; keyExtractor = item => `${item.id}`;
// 自定义分割线
renderItemSeparatorComponent = ({ highlighted }) => (
<View style={{ height: 1, backgroundColor: '#ccc' }} />
);
// Footer布局 // Footer布局
renderFooter = () => ( renderFooter = () => (
<WingBlank size="lg"> <WhiteSpace size="lg">
<WhiteSpace size="lg" />
<Card> <Card>
<Card.Body> <Card.Body>
<Text>到底了!!!</Text> <Text>到底了!!!</Text>
</Card.Body> </Card.Body>
</Card> </Card>
<WhiteSpace size="lg" /> </WhiteSpace>
</WingBlank>
); );
// 空布局 // 空布局
renderEmptyView = () => ( renderEmptyView = () => (
<WingBlank size="lg"> <WingBlank size="lg">
<WhiteSpace size="lg" />
<Card> <Card>
<Card.Body> <Card.Body>
<Text>当前无内容</Text> <Text>当前无内容</Text>
</Card.Body> </Card.Body>
</Card> </Card>
<WhiteSpace size="lg" />
</WingBlank> </WingBlank>
); );
// 下拉刷新 // 下拉刷新
...@@ -82,9 +72,10 @@ class ListHouContent extends Component { ...@@ -82,9 +72,10 @@ class ListHouContent extends Component {
* @private * @private
*/ */
renderItem = ({ item }) => { renderItem = ({ item }) => {
// console.log(item);
return ( return (
<FlatListItem <FlatListItem
title={item.fangWuZuoLuo}
meta={this.props.ListHouse.metas}
item={item} item={item}
onPressItem={this.onPressItem} onPressItem={this.onPressItem}
/> />
...@@ -92,7 +83,6 @@ class ListHouContent extends Component { ...@@ -92,7 +83,6 @@ class ListHouContent extends Component {
}; };
render() { render() {
console.log(this.props.ListHouse);
return ( return (
<FlatList <FlatList
data={this.props.ListHouse.sourceData} data={this.props.ListHouse.sourceData}
......
...@@ -6,6 +6,8 @@ import fwInfo from './fwInfo'; ...@@ -6,6 +6,8 @@ import fwInfo from './fwInfo';
import PeopleInfo from './peopleInfo/peopelInfo'; import PeopleInfo from './peopleInfo/peopelInfo';
import chatsIcon from '../../../image/chats-icon.png'; import chatsIcon from '../../../image/chats-icon.png';
import Empty from '../empty'; import Empty from '../empty';
import DSRErJiScreen from './dangshireninfo/index';
import TabBarComponent from '../../components/tabBarComponent';
const Content = TabNavigator({ const Content = TabNavigator({
FWInfo: { FWInfo: {
...@@ -23,7 +25,7 @@ const Content = TabNavigator({ ...@@ -23,7 +25,7 @@ const Content = TabNavigator({
}, },
}, },
DSRInfo: { DSRInfo: {
screen: Empty('权利人信息的新增,修改,还可以添加人口信息', 'DSRInfoScreen'), screen: DSRErJiScreen,
navigationOptions: { navigationOptions: {
lazy: true, lazy: true,
tabBarLabel: '权利人信息', tabBarLabel: '权利人信息',
...@@ -79,7 +81,9 @@ const Content = TabNavigator({ ...@@ -79,7 +81,9 @@ const Content = TabNavigator({
}, },
}, },
}, { }, {
lazy: true,
tabBarPosition: 'bottom', tabBarPosition: 'bottom',
tabBarComponent: TabBarComponent,
animationEnabled: true, animationEnabled: true,
tabBarOptions: { tabBarOptions: {
activeTintColor: '#e91e63', activeTintColor: '#e91e63',
......
/**
* Created by zhouhuan on 2017/11/3.
*/
/**
* Created by zhouhuan on 2017/11/3.
*/
/**
* Created by zhouhuan on 2017/11/2.
*/
...@@ -9,6 +9,50 @@ export const getData = async (coordinate, { pst, psz, params = {}, filters = [], ...@@ -9,6 +9,50 @@ export const getData = async (coordinate, { pst, psz, params = {}, filters = [],
const dsb = await api.query(options); const dsb = await api.query(options);
return getArrayData(dsb, meta); return getArrayData(dsb, meta);
}; };
export const getMeta = async (coordinate) => {
const api = datasourceApi(coordinate);
const meta = await api.meta();
return makeColumns(meta);
};
const parseMetas = (metas) => {
const ret = {};
if (!metas) {
return ret;
}
_.forEach(metas, (value, key) => {
let finalValue;
try {
finalValue = JSON.parse(value);
} catch (err) {
finalValue = value;
}
_.set(ret, key, finalValue);
});
return _.pickBy(ret, _.negate(_.isUndefined));
};
const makeColumns = (meta) => {
return (meta.properties || [])
.filter(property => !property.skip)
.map((property) => {
const props = parseMetas(property.metas);
if (!props.title && props.label) {
props.title = props.label;
}
if (props.order === undefined) {
props.order = 0;
}
if ((props.fixed === true || props.fixed === 'left' || props.fixed === 'right') && props.width === undefined) {
props.width = 150;
}
return _.pickBy({
...props,
key: property.name,
required: property.required,
}, _.negate(_.isUndefined));
})
.filter(c => c.visible !== false);
};
// const tmp = async(ddd) => { // const tmp = async(ddd) => {
// await // await
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论