提交 2d5ac12d authored 作者: 吴强's avatar 吴强

添加新增人口Detail界面

差异被折叠。
import React, { PureComponent } from 'react';
import { View } from 'react-native';
import { WhiteSpace, List, Picker } from 'antd-mobile';
import { createAction } from '../utils/index';
class PickerComponent extends PureComponent {
onClick = () => {
this.props.dispatch(createAction('domain/fetch')());
this.props.onClick();
};
onPickerChange = (val) => {
let colNum = 1;
const d = [...this.props.data];
const asyncValue = [...val];
if (val[0] !== undefined) {
d.forEach((i) => {
if (i.value === 'zj') {
colNum = 2;
if (!i.children) {
i.children = [{
value: 'zj-nb',
label: '宁波',
}, {
value: 'zj-hz',
label: '杭州',
}];
asyncValue.push('zj-nb');
} else if (val[1] === 'zj-hz') {
i.children.forEach((j) => {
if (j.value === 'zj-hz') {
j.children = [{
value: 'zj-hz-xh',
label: '西湖区',
}];
asyncValue.push('zj-hz-xh');
}
});
colNum = 3;
}
}
});
} else {
colNum = 1;
}
this.props.onPickerChange(val);
};
render() {
const { data, pathVal, cols } = this.props;
return (
<View>
<WhiteSpace size="lg" />
<List style={{ backgroundColor: 'white' }} className="picker-list">
<Picker
data={this.props.data}
cols={this.props.cols}
value={this.props.asyncValue}
data={data}
cols={3}
value={pathVal}
onPickerChange={this.onPickerChange}
onOk={v => console.log(v)}
>
<List.Item arrow="horizontal" onClick={this.onClick}>当前基地</List.Item>
</Picker>
......
......@@ -46,7 +46,7 @@ export default {
},
*getDSRList({ payload }, { take, put, call, select }) {
const { clear, pName } = payload;
console.info(payload);
// console.info(payload);
if (clear === 'clear') {
yield put({ type: 'clearList', payload: {} });
}
......@@ -58,8 +58,8 @@ export default {
datasourceName: 'QueryDSRInfoTable',
};
const result = yield call(getData, coordinate, { pst: size, psz: 10, params: { pName } });
console.info('查询的结果');
console.info(result);
// console.info('查询的结果');
// console.info(result);
const meta = yield call(getMeta, coordinate);
yield put({ type: 'setMetas', payload: meta });
// const result = yield call('', 'query-DSRFWInfo', 'QueryfwTable', { pst: size, psz: 10 });
......
/* eslint-disable prefer-destructuring,guard-for-in */
import { NavigationActions } from 'react-navigation';
import { fetchDomains, switchDomain, currentDomain } from '../services/domain';
import { getDomain, setDomain } from '../utils/auth';
import { delToken, getDomain, setDomain, delDomain, getUser, delUser } from '../utils/auth';
import { logout } from '../services/login';
const findTarget = (list, dmpath) => {
// 循环 list,元素el
// 如果 el.value == dmpath, return el;
// 否则 findTarget(el.children, dmpath)
// 如果找到,返回找到的
// 如果没找到,继续循环
// 循环结束: return null;
for (let i = 0; i < list.length; i++) {
if (list[i].value === dmpath) {
return list[i];
} else {
const data = findTarget(list[i].children, dmpath);
// console.log(data);
if (data) {
return data;
}
}
}
return null;
};
const createData = async (list, dmpath, payload) => {
console.log(list);
console.log(dmpath);
// 根据path用fetchDomains 查出children
let childrens;
let pathArray;
if (dmpath !== '/') {
childrens = await fetchDomains(dmpath);
console.log(childrens);
const childrenPath = childrens[0].path;
pathArray = [...payload, childrenPath];
} else {
pathArray = [...payload];
}
const childrenData = [];
childrens.map(({ name, path }) => {
childrenData.push({ label: name, value: path, children: [] });
return childrenData;
});
// 根据path在list查出需要添加children的对象target
const findData = findTarget(list, dmpath);
findData.children = childrenData;
console.log(findData);
const data = list;
console.log(list);
return { data, pathArray };
};
export default {
namespace: 'domain',
......@@ -8,6 +58,10 @@ export default {
state: {
init: undefined,
list: [],
listChildren: [],
arrayPath: [],
cols: '',
userInfo: '',
},
subscriptions: {
......@@ -20,16 +74,33 @@ export default {
const domain = yield call(getDomain);
const init = domain ? domain.path : undefined;
const list = yield call(fetchDomains, '/', true);
const datas = [];
list.map(({ name, path }) => {
datas.push({ label: name, value: path, children: [] });
return datas;
});
yield put({ type: 'queryInit', payload: init });
yield put({ type: 'queryList', payload: list });
yield put({ type: 'queryArryPath', payload: ['/'] });
yield put({ type: 'queryList', payload: datas });
},
*fetchParam(dmpath, { put, call }) {
const domain = yield call(getDomain);
const init = domain ? domain.path : undefined;
const list = yield call(fetchDomains, dmpath);
yield put({ type: 'queryInit', payload: init });
yield put({ type: 'queryList', payload: list });
*fetchParam({ payload }, { put, call, select }) {
console.log(payload);
let dmpath = '';
if (payload.length === 1) {
dmpath = payload[0];
} else if (payload.length === 2) {
dmpath = payload[1];
} else {
dmpath = payload[2];
}
const { list } = yield select(state => state.domain);
// const target = yield call(findTarget, list, dmpath);
// console.log(target);
const datas = yield call(createData, list, dmpath, payload);
console.log(datas);
yield put({ type: 'queryList', payload: datas.data });
yield put({ type: 'queryArryPath', payload: datas.pathArray });
},
*switch({ payload: domainPath }, { put, call }) {
yield call(switchDomain, domainPath);
......@@ -37,9 +108,29 @@ export default {
yield call(setDomain, name, path);
yield put({ type: 'queryInit', payload: path });
},
*logout(ignored, { put, call }) {
yield call(logout);
yield call(delToken);
yield call(delUser);
yield call(delDomain);
yield put(NavigationActions.navigate({
routeName: 'Login',
}));
},
*getUserInfo(ignored, { put, call }) {
const userInfo = yield call(getUser);
// console.log(userInfo);
yield put({ type: 'queryUserInfo', payload: userInfo });
},
},
reducers: {
queryUserInfo(state, { payload: userInfo }) {
return {
...state,
userInfo,
};
},
queryInit(state, { payload: init }) {
return {
...state,
......@@ -52,6 +143,18 @@ export default {
list,
};
},
queryListChildren(state, { payload: listChildren }) {
return {
...state,
listChildren,
};
},
queryArryPath(state, { payload: arrayPath }) {
return {
...state,
arrayPath,
};
},
},
};
import { getData } from '../../utils/DataTemplate';
import { Toast } from 'antd-mobile';
import { NavigationActions } from 'react-navigation';
import { getData, getMeta } from '../../utils/DataTemplate';
import { datasourceApi } from '../../services/datasource';
export default {
......@@ -6,17 +8,29 @@ export default {
state: {
singularData: {},
enableEdit: false,
metas: [],
},
reducers: {
setList(state, { payload }) {
console.info({ ...state, singularData: payload.singularData });
return { ...state, singularData: payload.singularData };
},
setMeta(state, { payload }) {
return {
...state,
metas: payload,
};
},
setEnable(state, { payload: enableEdit }) {
return { ...state, enableEdit };
},
},
effects: {
*jumpPage({ payload: id }, { put }) {
yield put(NavigationActions.navigate({
routeName: 'HouseDetailEditInfo',
params: { id },
}));
},
*getHouseDetail({ payload }, { call, put }) {
const coordinate = {
containerType: 'module',
......@@ -26,8 +40,10 @@ export default {
const result = yield call(getData, coordinate, { pst: 0, psz: 10, params: { pID: payload } });
const singularData = result[0];
yield put({ type: 'setList', payload: { singularData: { ...singularData } } });
const metas = yield call(getMeta, coordinate);
yield put({ type: 'setMeta', payload: metas });
},
*updateHouseDetail({ payload }, { call }) {
*updateHouseDetail({ payload }, { call, put }) {
const coordinate = {
containerType: 'module',
containerName: 'query-DSRFWInfo',
......@@ -37,6 +53,10 @@ export default {
console.info({ key: payload.id, params: payload.singularData });
const result = yield call(api.update, coordinate, { key: payload.id, params: payload.singularData });
console.info(result);
Toast.success('修改成功!', 0.5);
yield put(NavigationActions.navigate({
routeName: 'HouseList',
}));
},
},
};
......@@ -7,6 +7,7 @@ import DSRInfo from './dangshireninfo/dsrinfo';
import DSRInfoDetail from './dangshireninfo/dsrinfodetail';
import peopleInfo from './peopleInfo/peopleInfo';
import domain from './domain';
import userInfo from './userinfo/userinfo';
export default [
welcome,
......@@ -18,4 +19,5 @@ export default [
DSRInfo,
DSRInfoDetail,
peopleInfo,
userInfo,
];
......@@ -4,7 +4,7 @@
import React from 'react';
import { createForm } from 'rc-form';
import { View, ScrollView } from 'react-native';
import { List, InputItem, Toast, WhiteSpace } from 'antd-mobile';
import { List, InputItem, Toast, WhiteSpace, WingBlank } from 'antd-mobile';
import Icon from 'react-native-vector-icons/FontAwesome';
import { connect } from 'react-redux';
import { createAction } from '../../../utils';
......@@ -118,19 +118,20 @@ class DSRInfoDetailScreen extends React.Component {
return (
<ScrollView>
<WhiteSpace />
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
<Icon.Button
name="edit"
backgroundColor="#08BBF9"
onPress={this.onEdit}
>
编辑
</Icon.Button>
</View>
<WhiteSpace />
<WhiteSpace />
<List>
{
<WingBlank>
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
{/* <Icon.Button
name="edit"
backgroundColor="#08BBF9"
onPress={this.onEdit}
>
编辑
</Icon.Button> */}
</View>
<WhiteSpace />
<List>
{
metas.map((m) => {
return (
<List.Item
......@@ -140,10 +141,10 @@ class DSRInfoDetailScreen extends React.Component {
{m.label}
</List.Item>
);
})
}
</List>
})
}
</List>
</WingBlank>
</ScrollView>
);
}
......
......@@ -10,27 +10,19 @@ import SearchComponent from '../../../components/searchComponent';
class DSRInfoScreeen extends Component {
componentDidMount() {
const { dispatch } = this.props;
console.info('界面加载完成是,输出的searchValue');
console.info(this.props.DSRInfo);
dispatch(createAction('DSRInfo/getDSRList')({ clear: '', pName: this.props.DSRInfo.searchValue }));
}
onSearchSubmit = (pName) => {
console.info('点击搜索时,输出的searchValue前');
console.info(this.props.DSRInfo);
this.props.dispatch(createAction('DSRInfo/getDSRList')({ clear: 'clear', pName }));
console.info('点击搜索时,输出的searchValue后');
console.info(this.props.DSRInfo);
};
onSearchChange = (pName) => {
this.props.dispatch(createAction('DSRInfo/setSearchValue')(pName));
console.info('每次改变的值searchValue');
console.info(this.props.DSRInfo);
};
// 上拉加载更多
onEndReached = () => {
// 以下是制造新数据
if (!this.props.loading) {
console.info('执行了上啦加载');
// console.info('执行了上啦加载');
this.props.dispatch(createAction('DSRInfo/getDSRList')({ clear: '', pName: this.props.DSRInfo.searchValue }));
}
};
......
import React, { Component } from 'react';
import { View, ScrollView } from 'react-native';
import { List, InputItem, Button, Toast } from 'antd-mobile';
import { View, ScrollView, Text } from 'react-native';
import { List, InputItem, Button, Toast, WhiteSpace, WingBlank } from 'antd-mobile';
import Icon from 'react-native-vector-icons/FontAwesome';
import { createForm } from 'rc-form';
import { connect } from 'react-redux';
import { createAction } from '../../../utils/index';
......@@ -11,157 +12,43 @@ class HouseDetail extends Component {
const { dispatch, ListHouse } = this.props;
dispatch(createAction('HouseDetail/getHouseDetail')(ListHouse.houseID));
}
onSubmit = () => {
this.props.form.validateFields({ force: true }, (error, value) => {
if (!error) {
// 校验成功执行这里的代码
this.props.dispatch(createAction('HouseDetail/updateHouseDetail')({ id: this.props.ListHouse.houseID, singularData: value }));
} else {
// 执行出现错误,弹出错处理
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 } }));
const { ListHouse } = this.props;
this.props.dispatch(createAction('HouseDetail/jumpPage')(ListHouse.houseID));
};
render() {
const { getFieldProps } = this.props.form;
const { fwLouCeng } = this.props.HouseDetail.singularData;
if (this.props.HouseDetail.enableEdit === true) {
return (
<View>
<List>
<InputItem
{...getFieldProps('fwBiaMa', {
initialValue: this.props.HouseDetail.singularData.fwBiaMa,
rules: [
{ required: true, message: '房屋编码不允许为空' },
{ validator: this.validateFWBianMa },
],
})}
clear
placeholder="请输入房屋编码"
ref={(el) => { this.customFocusInst = el; }}
>
房屋编码
</InputItem>
<InputItem
{...getFieldProps('fwDiZhi')}
clear
placeholder="请输入"
ref={(el) => { this.customFocusInst = el; }}
>
房屋地址
</InputItem>
<InputItem
{...getFieldProps('fwLouDongHao')}
clear
placeholder="请输入"
ref={(el) => { this.customFocusInst = el; }}
>
楼栋号
</InputItem>
<InputItem
{...getFieldProps('fwLouCeng')}
clear
placeholder="请输入"
ref={(el) => { this.customFocusInst = el; }}
>
楼层
</InputItem>
<InputItem
{...getFieldProps('fwFangHao')}
clear
placeholder="请输入"
ref={(el) => { this.customFocusInst = el; }}
>
房号
</InputItem>
<InputItem
{...getFieldProps('WangGeBianHao')}
clear
placeholder="请输入房屋编码"
ref={(el) => { this.customFocusInst = el; }}
>
网格
</InputItem>
<InputItem
{...getFieldProps('fwSuoShuJieDao')}
clear
placeholder="请输入"
ref={(el) => { this.customFocusInst = el; }}
>
街道
</InputItem>
<InputItem
{...getFieldProps('fwShenBaoMianJi')}
clear
placeholder="请输入"
ref={(el) => { this.customFocusInst = el; }}
>
申报面积
</InputItem>
<List.Item>
<View style={{ flexDirection: 'row' }}>
<Button type="primary" size="large" onClick={this.onSubmit}>Submit</Button>
<Button size="large" onClick={this.onReset}>Reset</Button>
</View>
</List.Item>
</List>
</View>
);
} else {
// console.log(this.props.HouseDetail);
const { singularData, metas } = this.props.HouseDetail;
const list = metas.map(({ key, label }) => {
const data = singularData[key];
return (
<View>
<Button type="primary" size="small" onClick={this.modifyInfo} >编辑</Button>
<ScrollView showsVerticalScrollIndicator={true}>
<List renderHeader={() => 'Basic Style'} className="my-list">
<List.Item
key={(this.props.HouseDetail.singularData.fwBiaMa)}
extra={(this.props.HouseDetail.singularData.fwBiaMa)}
>
房屋编码
</List.Item>
<List.Item
key={(this.props.HouseDetail.singularData.fwDiZhi)}
extra={(this.props.HouseDetail.singularData.fwDiZhi)}
>
房屋地址
</List.Item>
<List.Item
key={(this.props.HouseDetail.singularData.fwLouDongHao)}
extra={(this.props.HouseDetail.singularData.fwLouDongHao)}
>
楼栋号
</List.Item>
<List.Item key={(fwLouCeng)} extra={(fwLouCeng)}>楼层</List.Item>
<List.Item key={(this.props.HouseDetail.singularData.fwFangHao)} extra={(this.props.HouseDetail.singularData.fwFangHao)}>房号</List.Item>
<List.Item key={(this.props.HouseDetail.singularData.WangGeBianHao)} extra={(this.props.HouseDetail.singularData.WangGeBianHao)}>网格</List.Item>
<List.Item key={(this.props.HouseDetail.singularData.fwSuoShuJieDao)} extra={(this.props.HouseDetail.singularData.fwSuoShuJieDao)}>街道</List.Item>
<List.Item key={(this.props.HouseDetail.singularData.fwSuoShuSheQu)} extra={(this.props.HouseDetail.singularData.fwSuoShuSheQu)}>社区</List.Item>
<List.Item key={(this.props.HouseDetail.singularData.fwShenBaoMianJi)} extra={(this.props.HouseDetail.singularData.fwShenBaoMianJi)}>申报面积</List.Item>
<List.Item key={(this.props.HouseDetail.singularData.fwShenBaoMianJi)} extra={(this.props.HouseDetail.singularData.fwShenBaoMianJi)}>申报面积</List.Item>
<List.Item key={(this.props.HouseDetail.singularData.fwShenBaoMianJi)} extra={(this.props.HouseDetail.singularData.fwShenBaoMianJi)}>申报面积</List.Item>
<List.Item key={(this.props.HouseDetail.singularData.fwShenBaoMianJi)} extra={(this.props.HouseDetail.singularData.fwShenBaoMianJi)}>申报面积</List.Item>
<List.Item key={(this.props.HouseDetail.singularData.fwShenBaoMianJi)} extra={(this.props.HouseDetail.singularData.fwShenBaoMianJi)}>申报面积</List.Item>
<List.Item key={(this.props.HouseDetail.singularData.fwShenBaoMianJi)} extra={(this.props.HouseDetail.singularData.fwShenBaoMianJi)}>申报面积</List.Item>
</List>
</ScrollView>
</View>
<List.Item
key={key}
extra={data}
>
{label}
</List.Item>
);
}
});
return (
<View>
<ScrollView>
<View style={{ flex: 1, flexDirection: 'column' }}>
<WhiteSpace />
<View style={{ width: 80, height: 40 }}>
<Button type="primary" onClick={this.modifyInfo}>编辑</Button>
</View>
<WhiteSpace />
<View>
<List className="my-list">
{list}
</List>
</View>
</View>
</ScrollView>
<WhiteSpace />
</View>
);
}
}
export default createForm()(HouseDetail);
......
/**
* Created by zhouhuan on 2017/11/9.
*/
import { StackNavigator } from 'react-navigation';
import HouseDetail from './HouseDetail';
import EditHouseDetail from './editHouseDetail';
const HouseScreen = StackNavigator(
{
HouseDetailInfo: {
screen: HouseDetail,
},
HouseDetailEditInfo: {
screen: EditHouseDetail,
},
},
{
headerMode: 'none',
navigationOptions: {
gesturesEnabled: false,
},
},
);
export default HouseScreen;
......@@ -70,7 +70,7 @@ class ObligeeInfo extends React.Component {
};
render() {
const { sourceData, isDetail, detailData, editable, disabled } = this.props.obligeeInfo;
console.log(this.props.obligeeInfo);
// console.log(this.props.obligeeInfo);
const data = [sourceData];
// console.log(data);
const { getFieldProps } = this.props.form;
......
/**
* Created by zhouhuan on 2017/11/9.
*/
import React from 'react';
import { View, ScrollView, Text } from 'react-native';
import { List, InputItem, Button, Toast, WhiteSpace } from 'antd-mobile';
import { createForm } from 'rc-form';
import { connect } from 'react-redux';
import { createAction } from '../../../utils/index';
@connect(({ HouseDetail, ListHouse }) => ({ HouseDetail, ListHouse }))
class EditHouseDetail extends React.Component {
componentDidMount() {
const { dispatch, ListHouse } = this.props;
dispatch(createAction('HouseDetail/getHouseDetail')(ListHouse.houseID));
}
onSubmit = () => {
this.props.form.validateFields({ force: true }, (error, value) => {
if (!error) {
this.props.dispatch(createAction('HouseDetail/updateHouseDetail')({ id: this.props.ListHouse.houseID, singularData: value }));
} else {
Toast.show('Validation failed');
}
});
};
onReset = () => {
this.props.form.resetFields();
};
render() {
console.log(this.props.HouseDetail);
const { singularData, metas } = this.props.HouseDetail;
const { getFieldProps } = this.props.form;
const list = metas.map(({ key, label }) => {
const data = singularData[key];
return (
<InputItem
{...getFieldProps(key, {
initialValue: data,
})}
clear
ref={(el) => { this.customFocusInst = el; }}
>
{label}
</InputItem>
);
});
return (
<View>
<ScrollView>
<List>
{list}
<List.Item>
<View style={{ flexDirection: 'row' }}>
<Button type="primary"onClick={this.onSubmit}>保存</Button>
</View>
</List.Item>
</List>
</ScrollView>
</View>
);
}
}
export default createForm()(EditHouseDetail);
import { TabNavigator } from 'react-navigation';
import Empty from '../../empty';
import HouseDetail from './HouseDetail';
import HouseScreen from './HouseScreen';
import ObligeeInfo from './ObligeeInfo';
const ErJiScreen = TabNavigator(
{
HouseDetail: {
screen: HouseDetail,
screen: HouseScreen,
navigationOptions: {
lazy: true,
tabBarLabel: '详细信息',
......
import React, { Component } from 'react';
import { View, Text, Image, StyleSheet, ToolbarAndroid } from 'react-native';
import { TabNavigator } from 'react-navigation';
import { View, Text, Image, StyleSheet, ToolbarAndroid, Dimensions } from 'react-native';
import { TabNavigator, StackNavigator } from 'react-navigation';
import Icon from 'react-native-vector-icons/MaterialIcons';
import userInfoPageScreen from './userinfo/index';
import fwInfo from './fwInfo';
......@@ -8,6 +8,7 @@ import peopleInfoErJiScreen from './peopleInfo/index';
import chatsIcon from '../../../image/chats-icon.png';
import Empty from '../empty';
import DSRErJiScreen from './dangshireninfo/index';
import quanshuInfoErJiScreen from './quanshuInfo/index';
import TabBarComponent from '../../components/tabBarComponent';
const Content = TabNavigator({
......@@ -18,7 +19,7 @@ const Content = TabNavigator({
tabBarLabel: '房屋信息',
// Note: By default the icon is only shown on iOS. Search the showIcon option below.
tabBarIcon: () => (
<Icon name="home" size={28} color="#3b5998" />
<Icon name="home" size={28} color="#FFFFFF" />
),
},
},
......@@ -29,21 +30,18 @@ const Content = TabNavigator({
tabBarLabel: '权利人信息',
// Note: By default the icon is only shown on iOS. Search the showIcon option below.
tabBarIcon: () => (
<Icon name="person" size={28} />
<Icon name="person" size={28} color="#FFFFFF" />
),
},
},
QSInfo: {
screen: Empty('权属信息的新增,修改,还可以勾选房子', 'DSRInfoScreen'),
screen: quanshuInfoErJiScreen,
navigationOptions: {
lazy: true,
tabBarLabel: '权属信息',
// Note: By default the icon is only shown on iOS. Search the showIcon option below.
tabBarIcon: () => (
<Image
source={chatsIcon}
style={[styles.icon]}
/>
<Icon name="library-books" size={28} color="#FFFFFF" />
),
},
},
......@@ -54,10 +52,7 @@ const Content = TabNavigator({
tabBarLabel: '人口信息',
// Note: By default the icon is only shown on iOS. Search the showIcon option below.
tabBarIcon: () => (
<Image
source={chatsIcon}
style={[styles.icon]}
/>
<Icon name="group-add" size={28} color="#FFFFFF" />
),
},
},
......@@ -82,45 +77,66 @@ const Content = TabNavigator({
animationEnabled: true,
tabBarOptions: {
activeTintColor: '#e91e63',
inactiveTintColor: 'gray',
inactiveTintColor: '#FFFFFF',
labelStyle: {
fontSize: 12,
},
showIcon: true,
},
});
const MainWindow = StackNavigator(
{
Content: {
screen: Content,
},
personCenter: {
screen: userInfoPageScreen,
},
},
{
headerMode: 'none',
navigationOptions: {
gesturesEnabled: false,
},
},
);
class MainPage extends Component {
onActionSelected = () => {
this.props.navigation.navigate('personCenter');
}
render() {
return (
<View style={{ flex: 1 }}>
<View style={{ height: 36, backgroundColor: '#08BBF9', flexDirection: 'row' }}>
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<View style={{ height: 46, backgroundColor: '#08BBF9', flexDirection: 'row' }}>
{/* <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Text style={{ fontSize: 18, color: 'white', alignSelf: 'center' }}>深圳房屋普查</Text>
</View>
</View> */}
<ToolbarAndroid
title="深圳房屋普查"
style={styles.toolbar}
actions={[{ title: '个人中心', show: 'never' }]}
onActionSelected={this.onActionSelected}
titleColor="#FFFFFF"
/>
</View>
<Content navigation={this.props.navigation} />
<MainWindow navigation={this.props.navigation} />
</View>
);
}
}
MainPage.router = Content.router;
MainPage.router = MainWindow.router;
const styles = StyleSheet.create({
toolbar: {
backgroundColor: '#2196F3',
height: 40,
width: Dimensions.get('window').width,
alignSelf: 'center',
},
icon: {
width: 26,
height: 26,
},
containerToolbar: {
flex: 1,
justifyContent: 'flex-start',
alignItems: 'stretch',
backgroundColor: '#F5FCFF',
},
toolbar: {
backgroundColor: '#e9eaed',
height: 56,
},
});
export default MainPage;
......
......@@ -24,6 +24,9 @@ class AddPeopleInfo extends React.Component {
}
});
};
onEditBack = () => {
this.props.dispatch(createAction('peopleInfo/onEBack')('clear'));
};
validateNoNull = (rule, value, callback) => {
if (value) {
callback();
......@@ -31,9 +34,6 @@ class AddPeopleInfo extends React.Component {
callback(new Error('At least four charactors for account'));
}
};
onEditBack = () => {
this.props.dispatch(createAction('peopleInfo/onEBack')('clear'));
};
render() {
const { getFieldProps } = this.props.form;
const { detailData, metas } = this.props.peopleInfo;
......
/**
* Created by zhouhuan on 2017/11/9.
*/
import { StackNavigator } from 'react-navigation';
import QuanshuList from './quanshuList';
const quanshuInfoErJiScreen = StackNavigator(
{
quanshuInfoList: {
screen: QuanshuList,
},
},
{
headerMode: 'none',
navigationOptions: {
gesturesEnabled: false,
},
},
);
export default quanshuInfoErJiScreen;
/**
* Created by zhouhuan on 2017/11/13.
*/
/**
* Created by zhouhuan on 2017/11/13.
*/
import React, { Component } from 'react';
import { Text, FlatList, View } from 'react-native';
import { WingBlank, WhiteSpace } from 'antd-mobile';
import { connect } from 'react-redux';
import { createAction } from '../../../utils/index';
import FlatListItem from '../../../components/FlatListItem';
import SearchComponent from '../../../components/searchComponent';
@connect(({ DSRInfo }) => ({ DSRInfo/* , loading: !!loading.effects['obligeeInfo/getObligeeInfo'] */ }))
class QuanshuList extends Component {
componentDidMount() {
const { dispatch } = this.props;
dispatch(createAction('DSRInfo/getDSRList')({ clear: '', pName: this.props.DSRInfo.searchValue }));
}
onSearchSubmit = (pName) => {
this.props.dispatch(createAction('DSRInfo/getDSRList')({ clear: 'clear', pName }));
};
onSearchChange = (pName) => {
this.props.dispatch(createAction('DSRInfo/setSearchValue')(pName));
};
// 上拉加载更多
onEndReached = () => {
// 以下是制造新数据
if (!this.props.loading) {
// console.info('执行了上啦加载');
this.props.dispatch(createAction('DSRInfo/getDSRList')({ clear: '', pName: this.props.DSRInfo.searchValue }));
}
};
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" />
<Text>到底了!!!</Text>
<WhiteSpace size="lg" />
</WingBlank>
);
// 空布局
renderEmptyView = () => (
<WingBlank size="lg">
<WhiteSpace size="lg" />
<Text>当前无内容</Text>
<WhiteSpace size="lg" />
</WingBlank>
);
// 下拉刷新
renderRefresh = () => {
if (!this.props.loading) {
this.props.dispatch(createAction('DSRInfo/getDSRList')({ clear: 'clear', pName: this.props.DSRInfo.searchValue }));
}
};
/**
* 使用箭头函数防止不必要的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 (
<View>
<SearchComponent onSearchSubmit={this.onSearchSubmit} onSearchChange={this.onSearchChange} />
<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是加上分割线的高度
/>
</View>
);
}
}
export default QuanshuList;
/* eslint-disable prefer-destructuring */
import React, { PureComponent } from 'react';
import { View, StyleSheet, Dimensions, ScrollView, Text } from 'react-native';
import { View, StyleSheet, Dimensions, ScrollView, Image, Text } from 'react-native';
import { WingBlank, Card, WhiteSpace, List, Button, Toast } from 'antd-mobile';
import { connect } from 'react-redux';
import PickerComponent from '../../../components/pickerComponent';
import { createAction } from '../../../utils/index';
const width = Dimensions.get('window').width;
const height = Dimensions.get('window').height;
// create a component
@connect(({ userInfo }) => ({ userInfo }))
@connect(({ userInfo, domain }) => ({ userInfo, domain }))
class UserInfoHomeScreen extends PureComponent {
componentDidMount() {
this.props.dispatch(createAction('domain/getUserInfo')());
}
onClick = () => {
this.props.dispatch(createAction('domain/fetch')());
};
onPickerChange =(path) => {
// console.log(path);
this.props.dispatch(createAction('domain/fetchParam')(path));
};
onLogout = () => {
console.log('注销');
this.props.dispatch(createAction('domain/logout')());
};
onModify =() => {
Toast.offline('功能正在完善中...', 2);
};
render() {
const { list, listChildren, arrayPath, cols, userInfo } = this.props.domain;
// console.log(arrayPath);
console.log(userInfo);
let datas = [];
if (listChildren.length === 0) {
datas = list;
} else {
datas = listChildren;
}
return (
<View style={{ flex: 1, backgroundColor: '#06C1AE' }}>
<View style={{ position: 'absolute', width, height, backgroundColor: '#06C1AE' }} />
<ScrollView>
<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>
<PickerComponent />
<View style={{ flex: 1 }}>
{/* <View style={{ position: 'absolute', width, height, backgroundColor: '#06C1AE' }} /> */}
<View style={styles.header}>
<View style={styles.userContainer}>
<Image style={styles.avatar} source={require('./touxiang.png')} />
</View>
</View>
<View style={styles.card}>
<WhiteSpace />
<Card>
<Card.Body>
<List>
<List.Item extra={userInfo.name}>姓名</List.Item>
</List>
<List >
<List.Item extra={userInfo.id}>电话号码</List.Item>
</List>
</Card.Body>
</Card>
<WhiteSpace />
</View>
<View>
<WhiteSpace />
<WingBlank>
<Button type="ghost" onClick={this.onModify}>修改密码</Button><WhiteSpace />
<Button type="ghost" onClick={this.onLogout}>注销</Button><WhiteSpace />
</WingBlank>
<WhiteSpace />
</View>
<WingBlank>
<View style={styles.pickerCom}>
<PickerComponent onClick={this.onClick} onPickerChange={this.onPickerChange} data={datas} pathVal={arrayPath} cols={cols} />
</View>
</ScrollView>
</WingBlank>
</View>
);
}
......@@ -44,15 +89,26 @@ const styles = StyleSheet.create({
userContainer: {
flexDirection: 'row',
alignItems: 'center',
margin: 10,
justifyContent: 'center',
marginTop: 20,
},
avatar: {
width: 50,
height: 50,
width: 80,
height: 80,
marginRight: 10,
borderRadius: 25,
borderRadius: 40,
borderWidth: 2,
borderColor: '#51D3C6',
borderColor: '#ffffff',
},
pickerCom: {
// marginTop: 100,
},
card: {
// height: Dimensions.get('window').height / 2,
marginBottom: 30,
},
cardText: {
textAlign: 'right',
},
});
export default UserInfoHomeScreen;
......@@ -30,3 +30,6 @@ export async function login(payload) {
export async function userInfo() {
return request(`${config.apiContextPath}/api/user/info`);
}
export async function logout() {
return post(`${config.apiContextPath}/api/auth/logout`);
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论