提交 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 = [
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:
* - An APK that only works on ARM devices
......@@ -143,6 +148,7 @@ dependencies {
compile "com.android.support:appcompat-v7:25.3.1"
compile 'com.android.support:multidex:1.0.1'
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
......
......@@ -15,6 +15,8 @@ import com.facebook.soloader.SoLoader;
import java.util.Arrays;
import java.util.List;
import com.oblador.vectoricons.VectorIconsPackage;// wq add 2017-10-31
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
......@@ -28,7 +30,8 @@ public class MainApplication extends Application implements ReactApplication {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new RNDeviceInfo(),
new IDCardReactPackage()
new IDCardReactPackage(),
new VectorIconsPackage()
);
}
......
......@@ -2,4 +2,7 @@ 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'
\ No newline at end of file
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
include ':app'
......@@ -2947,6 +2947,20 @@
"merge": "1.2.0"
}
},
"execa": {
"version": "0.7.0",
"resolved": "http://registry.npm.taobao.org/execa/download/execa-0.7.0.tgz",
"integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=",
"requires": {
"cross-spawn": "5.1.0",
"get-stream": "3.0.0",
"is-stream": "1.1.0",
"npm-run-path": "2.0.2",
"p-finally": "1.0.0",
"signal-exit": "3.0.2",
"strip-eof": "1.0.0"
}
},
"exenv": {
"version": "1.2.2",
"resolved": "http://registry.npm.taobao.org/exenv/download/exenv-1.2.2.tgz",
......@@ -3316,6 +3330,11 @@
"resolved": "http://registry.npm.taobao.org/get-caller-file/download/get-caller-file-1.0.2.tgz",
"integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U="
},
"get-stream": {
"version": "3.0.0",
"resolved": "http://registry.npm.taobao.org/get-stream/download/get-stream-3.0.0.tgz",
"integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ="
},
"getpass": {
"version": "0.1.7",
"resolved": "http://registry.npm.taobao.org/getpass/download/getpass-0.1.7.tgz",
......@@ -5018,7 +5037,6 @@
"version": "2.0.0",
"resolved": "http://registry.npm.taobao.org/locate-path/download/locate-path-2.0.0.tgz",
"integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=",
"dev": true,
"requires": {
"p-locate": "2.0.0",
"path-exists": "3.0.0"
......@@ -5027,8 +5045,7 @@
"path-exists": {
"version": "3.0.0",
"resolved": "http://registry.npm.taobao.org/path-exists/download/path-exists-3.0.0.tgz",
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
"dev": true
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU="
}
}
},
......@@ -5236,6 +5253,14 @@
"resolved": "http://registry.npm.taobao.org/media-typer/download/media-typer-0.3.0.tgz",
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
},
"mem": {
"version": "1.1.0",
"resolved": "http://registry.npm.taobao.org/mem/download/mem-1.1.0.tgz",
"integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=",
"requires": {
"mimic-fn": "1.1.0"
}
},
"merge": {
"version": "1.2.0",
"resolved": "http://registry.npm.taobao.org/merge/download/merge-1.2.0.tgz",
......@@ -5595,6 +5620,14 @@
"resolved": "http://registry.npm.taobao.org/normalize.css/download/normalize.css-7.0.0.tgz",
"integrity": "sha1-q/sd2CRwZ04DIrU86xqvQSk45L8="
},
"npm-run-path": {
"version": "2.0.2",
"resolved": "http://registry.npm.taobao.org/npm-run-path/download/npm-run-path-2.0.2.tgz",
"integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=",
"requires": {
"path-key": "2.0.1"
}
},
"npmlog": {
"version": "2.0.4",
"resolved": "http://registry.npm.taobao.org/npmlog/download/npmlog-2.0.4.tgz",
......@@ -5754,17 +5787,20 @@
"resolved": "http://registry.npm.taobao.org/os-tmpdir/download/os-tmpdir-1.0.2.tgz",
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ="
},
"p-finally": {
"version": "1.0.0",
"resolved": "http://registry.npm.taobao.org/p-finally/download/p-finally-1.0.0.tgz",
"integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4="
},
"p-limit": {
"version": "1.1.0",
"resolved": "http://registry.npm.taobao.org/p-limit/download/p-limit-1.1.0.tgz",
"integrity": "sha1-sH/y2aXYi+yAYDWJWiurZqJ5iLw=",
"dev": true
"integrity": "sha1-sH/y2aXYi+yAYDWJWiurZqJ5iLw="
},
"p-locate": {
"version": "2.0.0",
"resolved": "http://registry.npm.taobao.org/p-locate/download/p-locate-2.0.0.tgz",
"integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=",
"dev": true,
"requires": {
"p-limit": "1.1.0"
}
......@@ -5824,6 +5860,11 @@
"integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=",
"dev": true
},
"path-key": {
"version": "2.0.1",
"resolved": "http://registry.npm.taobao.org/path-key/download/path-key-2.0.1.tgz",
"integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A="
},
"path-parse": {
"version": "1.0.5",
"resolved": "http://registry.npm.taobao.org/path-parse/download/path-parse-1.0.5.tgz",
......@@ -7000,6 +7041,147 @@
"prop-types": "15.6.0"
}
},
"react-native-vector-icons": {
"version": "4.4.2",
"resolved": "http://registry.npm.taobao.org/react-native-vector-icons/download/react-native-vector-icons-4.4.2.tgz",
"integrity": "sha1-CQ9C7gOWxMxOrg3apRgCi6jfQMc=",
"requires": {
"lodash": "4.17.4",
"prop-types": "15.6.0",
"yargs": "8.0.2"
},
"dependencies": {
"camelcase": {
"version": "4.1.0",
"resolved": "http://registry.npm.taobao.org/camelcase/download/camelcase-4.1.0.tgz",
"integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0="
},
"cliui": {
"version": "3.2.0",
"resolved": "http://registry.npm.taobao.org/cliui/download/cliui-3.2.0.tgz",
"integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=",
"requires": {
"string-width": "1.0.2",
"strip-ansi": "3.0.1",
"wrap-ansi": "2.1.0"
},
"dependencies": {
"string-width": {
"version": "1.0.2",
"resolved": "http://registry.npm.taobao.org/string-width/download/string-width-1.0.2.tgz",
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
"requires": {
"code-point-at": "1.1.0",
"is-fullwidth-code-point": "1.0.0",
"strip-ansi": "3.0.1"
}
}
}
},
"find-up": {
"version": "2.1.0",
"resolved": "http://registry.npm.taobao.org/find-up/download/find-up-2.1.0.tgz",
"integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=",
"requires": {
"locate-path": "2.0.0"
}
},
"is-fullwidth-code-point": {
"version": "1.0.0",
"resolved": "http://registry.npm.taobao.org/is-fullwidth-code-point/download/is-fullwidth-code-point-1.0.0.tgz",
"integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
"requires": {
"number-is-nan": "1.0.1"
}
},
"load-json-file": {
"version": "2.0.0",
"resolved": "http://registry.npm.taobao.org/load-json-file/download/load-json-file-2.0.0.tgz",
"integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=",
"requires": {
"graceful-fs": "4.1.11",
"parse-json": "2.2.0",
"pify": "2.3.0",
"strip-bom": "3.0.0"
}
},
"os-locale": {
"version": "2.1.0",
"resolved": "http://registry.npm.taobao.org/os-locale/download/os-locale-2.1.0.tgz",
"integrity": "sha1-QrwpAKa1uL0XN2yOiCtlr8zyS/I=",
"requires": {
"execa": "0.7.0",
"lcid": "1.0.0",
"mem": "1.1.0"
}
},
"path-type": {
"version": "2.0.0",
"resolved": "http://registry.npm.taobao.org/path-type/download/path-type-2.0.0.tgz",
"integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=",
"requires": {
"pify": "2.3.0"
}
},
"read-pkg": {
"version": "2.0.0",
"resolved": "http://registry.npm.taobao.org/read-pkg/download/read-pkg-2.0.0.tgz",
"integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=",
"requires": {
"load-json-file": "2.0.0",
"normalize-package-data": "2.4.0",
"path-type": "2.0.0"
}
},
"read-pkg-up": {
"version": "2.0.0",
"resolved": "http://registry.npm.taobao.org/read-pkg-up/download/read-pkg-up-2.0.0.tgz",
"integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=",
"requires": {
"find-up": "2.1.0",
"read-pkg": "2.0.0"
}
},
"strip-bom": {
"version": "3.0.0",
"resolved": "http://registry.npm.taobao.org/strip-bom/download/strip-bom-3.0.0.tgz",
"integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM="
},
"which-module": {
"version": "2.0.0",
"resolved": "http://registry.npm.taobao.org/which-module/download/which-module-2.0.0.tgz",
"integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho="
},
"yargs": {
"version": "8.0.2",
"resolved": "http://registry.npm.taobao.org/yargs/download/yargs-8.0.2.tgz",
"integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=",
"requires": {
"camelcase": "4.1.0",
"cliui": "3.2.0",
"decamelize": "1.2.0",
"get-caller-file": "1.0.2",
"os-locale": "2.1.0",
"read-pkg-up": "2.0.0",
"require-directory": "2.1.1",
"require-main-filename": "1.0.1",
"set-blocking": "2.0.0",
"string-width": "2.1.1",
"which-module": "2.0.0",
"y18n": "3.2.1",
"yargs-parser": "7.0.0"
}
},
"yargs-parser": {
"version": "7.0.0",
"resolved": "http://registry.npm.taobao.org/yargs-parser/download/yargs-parser-7.0.0.tgz",
"integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=",
"requires": {
"camelcase": "4.1.0"
}
}
}
},
"react-navigation": {
"version": "1.0.0-beta.16",
"resolved": "http://registry.npm.taobao.org/react-navigation/download/react-navigation-1.0.0-beta.16.tgz",
......@@ -7982,6 +8164,11 @@
"is-utf8": "0.2.1"
}
},
"strip-eof": {
"version": "1.0.0",
"resolved": "http://registry.npm.taobao.org/strip-eof/download/strip-eof-1.0.0.tgz",
"integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8="
},
"strip-json-comments": {
"version": "2.0.1",
"resolved": "http://registry.npm.taobao.org/strip-json-comments/download/strip-json-comments-2.0.1.tgz",
......
......@@ -4,11 +4,11 @@
"private": true,
"devDependencies": {
"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-react-native-stage-0": "^1.0.1",
"css-loader": "^0.28.7",
"eslint": "^4.10.0",
"eslint": "^4.8.0",
"eslint-config-airbnb": "^16.0.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
......@@ -38,12 +38,12 @@
"fastjson_ref_resolver": "0.0.3",
"lodash": "^4.17.4",
"moment": "^2.19.1",
"rc-form": "^1.5.0",
"rc-form": "^1.4.8",
"react": "^16.0.0-beta.5",
"react-native": "^0.49.5",
"react-native": "^0.49.3",
"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",
"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';
const app = dva({
initialState: {},
models: [...models, routerModel],
extraEnhancers: [autoRehydrate()],
extraEnhancers: [autoRehydrate({ log: true })],
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 {
state: {
sourceData: {},
detailData: {},
metas: [],
isDetail: false,
editable: false,
disabled: true,
......@@ -38,13 +39,11 @@ export default {
datasourceName: 'QueryDSRInfoDetails',
};
const result = yield call(getData, coordinate, { params: { pID: payload } });
console.log(result);
yield put({ type: 'getDSRDetail', payload: { ...result[0] } });
yield put({ type: 'setDetail', payload: true });
yield put({ type: 'setEdit', payload: false });
},
*updateDSRDetail({ payload }, { call, put }) {
console.log('update');
const coordinate = {
containerType: 'module',
containerName: 'query-DSRInfo',
......@@ -96,6 +95,9 @@ export default {
sourceData: payload,
};
},
setMetas(state, { payload }) {
return { ...state, metas: payload };
},
setDetail(state, { payload }) {
return {
...state,
......
import { NavigationActions } from 'react-navigation';
import { getData } from '../../utils/DataTemplate';
import { getData, getMeta } from '../../utils/DataTemplate';
export default {
namespace: 'ListHouse',
state: {
sourceData: [],
metas: [],
houseID: '',
},
reducers: {
......@@ -21,6 +22,9 @@ export default {
clearList(state) {
return { ...state, sourceData: [] };
},
setMetas(state, { payload }) {
return { ...state, metas: payload };
},
},
effects: {
*jumpPage({ payload: id }, { put }) {
......@@ -41,6 +45,8 @@ export default {
datasourceName: 'QueryfwTable',
};
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: 'addHouse', payload: row });
......
......@@ -3,6 +3,8 @@ import login from './login';
import listHouse from './houseinfo/listhouse';
import HouseDetail from './houseinfo/houseDetail';
import obligeeInfo from './houseinfo/ObligeeInfo';
import DSRInfo from './dangshireninfo/dsrinfo';
import DSRInfoDetail from './dangshireninfo/dsrinfodetail';
export default [
welcome,
......@@ -10,4 +12,6 @@ export default [
listHouse,
HouseDetail,
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';
class HouseList extends Component {
state = {
value: '美食',
value: '',
};
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 { View, ScrollView, Text } from 'react-native';
import { List, InputItem, Button } from 'antd-mobile';
import { View, ScrollView } from 'react-native';
import { List, InputItem, Button, Toast } from 'antd-mobile';
import { createForm } from 'rc-form';
import { connect } from 'react-redux';
import { createAction } from '../../../utils/index';
......@@ -15,28 +15,26 @@ class HouseDetail extends Component {
this.props.form.validateFields({ force: true }, (error, value) => {
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 }));
console.log(this.props.form.getFieldsValue());
} else {
// 执行出现错误,弹出错处理
console.log('Validation failed');
Toast.show('Validation failed');
}
});
}
};
onReset = () => {
this.props.form.resetFields();
}
};
validateFWBianMa = (rule, value, callback) => {
if (value) {
callback();
} else {
callback(new Error('At least four charactors for account'));
}
}
};
modifyInfo = () => {
this.props.dispatch(createAction({ type: 'setEnable', payload: { enableEdit: true } }));
}
};
render() {
const { getFieldProps } = this.props.form;
......
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 { connect } from 'react-redux';
import { createAction } from '../../../utils';
......@@ -33,38 +33,28 @@ class ListHouContent extends Component {
* 若item.key也不存在,则使用数组下标
*
* @param item
* @param index
* @private
*/
// 这里指定使用数组下标作为唯一索引
keyExtractor = item => `${item.id}`;
// 自定义分割线
renderItemSeparatorComponent = ({ highlighted }) => (
<View style={{ height: 1, backgroundColor: '#ccc' }} />
);
// Footer布局
renderFooter = () => (
<WingBlank size="lg">
<WhiteSpace size="lg" />
<WhiteSpace size="lg">
<Card>
<Card.Body>
<Text>到底了!!!</Text>
</Card.Body>
</Card>
<WhiteSpace size="lg" />
</WingBlank>
</WhiteSpace>
);
// 空布局
renderEmptyView = () => (
<WingBlank size="lg">
<WhiteSpace size="lg" />
<Card>
<Card.Body>
<Text>当前无内容</Text>
</Card.Body>
</Card>
<WhiteSpace size="lg" />
</WingBlank>
);
// 下拉刷新
......@@ -82,9 +72,10 @@ class ListHouContent extends Component {
* @private
*/
renderItem = ({ item }) => {
// console.log(item);
return (
<FlatListItem
title={item.fangWuZuoLuo}
meta={this.props.ListHouse.metas}
item={item}
onPressItem={this.onPressItem}
/>
......@@ -92,7 +83,6 @@ class ListHouContent extends Component {
};
render() {
console.log(this.props.ListHouse);
return (
<FlatList
data={this.props.ListHouse.sourceData}
......
......@@ -6,6 +6,8 @@ import fwInfo from './fwInfo';
import PeopleInfo from './peopleInfo/peopelInfo';
import chatsIcon from '../../../image/chats-icon.png';
import Empty from '../empty';
import DSRErJiScreen from './dangshireninfo/index';
import TabBarComponent from '../../components/tabBarComponent';
const Content = TabNavigator({
FWInfo: {
......@@ -23,7 +25,7 @@ const Content = TabNavigator({
},
},
DSRInfo: {
screen: Empty('权利人信息的新增,修改,还可以添加人口信息', 'DSRInfoScreen'),
screen: DSRErJiScreen,
navigationOptions: {
lazy: true,
tabBarLabel: '权利人信息',
......@@ -79,7 +81,9 @@ const Content = TabNavigator({
},
},
}, {
lazy: true,
tabBarPosition: 'bottom',
tabBarComponent: TabBarComponent,
animationEnabled: true,
tabBarOptions: {
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 = [],
const dsb = await api.query(options);
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) => {
// await
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论