提交 1acb55a1 authored 作者: 吴强's avatar 吴强

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

# Conflicts: # src/models/login.js # src/routes/login.js #新做出来的界面,列表。
上级 d3acd936
import { getData } from '../utils/DataTemplate';
import { getData } from '../../utils/DataTemplate';
import { datasourceApi } from '../../services/datasource';
export default {
namespace: 'HouseDetail',
state: {
sourceData: {},
singularData: {},
enableEdit: false,
},
reducers: {
setList(state, { payload: { singularData } }) {
return { ...state, singularData };
setList(state, { payload }) {
console.info({ ...state, singularData: payload.singularData });
return { ...state, singularData: payload.singularData };
},
setEnable(state, { payload: enableEdit }) {
return { ...state, enableEdit };
},
},
effects: {
*getHouseDetail({ payload }, { call }) {
*getHouseDetail({ payload }, { call, put }) {
const coordinate = {
containerType: 'module',
containerName: 'query-DSRFWInfo',
datasourceName: 'QueryfwDetails',
};
const result = yield call(getData, coordinate, { pst: 0, psz: 10, params: { pID: payload } });
const singularData = result[0];
yield put({ type: 'setList', payload: { singularData: { ...singularData } } });
},
*updateHouseDetail({ payload }, { call }) {
const coordinate = {
containerType: 'module',
containerName: 'query-DSRFWInfo',
datasourceName: 'QueryfwDetails',
};
console.info(payload);
const result = yield call(getData, coordinate, { pst: 0, psz: 10, params: { pID: 14 } });
const api = datasourceApi(coordinate);
console.info({ key: payload.id, params: payload.singularData });
const result = yield call(api.update, coordinate, { key: payload.id, params: payload.singularData });
console.info(result);
},
},
......
import welcome from './welcome';
import login from './login';
import listHouse from './houseinfo/listhouse';
import HouseDetail from './houseinfo/houseDetail';
export default [
welcome,
login,
listHouse,
HouseDetail,
];
import React from 'react';
import { connect } from 'react-redux';
import { NavigationActions } from 'react-navigation';
import { View, StyleSheet, Text, Button } from 'react-native';
export default (msg, target) => connect()(({ dispatch }) => {
class Template extends React.PureComponent {
render() {
const action = () => {
this.props.dispatch(NavigationActions.navigate({
routeName: target,
}));
};
return (
<View style={styles.container}>
<Text> { this.props.msg } </Text>
<Button onPress={action} title="Click me" />
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#ffffff',
},
img: {
flex: 1,
width: 400,
height: 200,
resizeMode: 'contain',
},
});
return <Template msg={msg} dispatch={dispatch} />;
});
import React, { Component } from 'react';
import { Image, StyleSheet, View } from 'react-native';
import { View } from 'react-native';
import { Button, SearchBar } from 'antd-mobile';
import chatsIcon from '../../../image/chats-icon.png';
import { StackNavigator, NavigationActions } from 'react-navigation';
import { connect } from 'react-redux';
import ListHouContent from './houseinfo/listhouse';
import { createAction } from '../../utils/index';
import Empty from '../empty';
import ErJiScreen from './houseinfo/erJiScreen';
class fwInfo extends Component {
static navigationOptions = {
lazy: true,
tabBarLabel: '房屋信息',
title: '房屋信息',
headerRight: <Button />,
// Note: By default the icon is only shown on iOS. Search the showIcon option below.
tabBarIcon: () => (
<Image
source={chatsIcon}
style={[styles.icon]}
/>
),
};
class HouseList extends Component {
state = {
value: '美食',
};
action = () => {
console.log('I am clicked!');
this.props.dispatch(NavigationActions.navigate({
routeName: 'ERJi',
}));
};
render() {
return (
<View style={{ flex: 1 }}>
......@@ -41,15 +36,24 @@ class fwInfo extends Component {
});
}}
/>
<ListHouContent />
<Button onClick={this.action}>Click me!</Button>
<ListHouContent navigation={this.props.navigation} />
</View>
);
}
}
const styles = StyleSheet.create({
icon: {
width: 26,
height: 26,
HouseList.router = ListHouContent.router;// 暂时加上,等下看看去掉会不会出错
const fwInfo = StackNavigator(
{
HouseList: { screen: connect()(HouseList) },
ERJi: { screen: ErJiScreen },
SanJiInfo: { screen: Empty('fangWuDetail', 'QuanLiRenScreen') },
},
{
headerMode: 'none',
navigationOptions: {
gesturesEnabled: false,
},
},
});
);
export default fwInfo;
import React, { Component } from 'react';
import { View, StyleSheet, Text } from 'react-native';
import { Button } from 'antd-mobile';
import { View, ScrollView, Text } from 'react-native';
import { List, InputItem, Button } from 'antd-mobile';
import { createForm } from 'rc-form';
import { connect } from 'react-redux';
import { createAction } from '../../../utils/index';
@connect(({ HouseDetail, loading }) => ({ HouseDetail, loading: !!loading.effects['ListHouse/getHouseDetail'] }))
@connect(({ HouseDetail }) => ({ HouseDetail }))
class HouseDetail extends Component {
componentDidMount() {
const { dispatch, navigation } = this.props;
dispatch(createAction('HouseDetail/getHouseDetail')(navigation.state.params.id));
}
onSubmit = () => {
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.navigation.state.params.id, singularData: value }));
console.log(this.props.form.getFieldsValue());
} else {
// 执行出现错误,弹出错处理
console.log('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() {
if (this.props.HouseDetail.enableEdit === true) {
const { getFieldProps } = this.props.form;
if (this.props.HouseDetail.enableEdit === false) {
return (
<View>
<Text>fff</Text>
<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 {
return (
<View>
<Text>ttt</Text>
<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={(this.props.HouseDetail.singularData.fwLouCeng)} extra={(this.props.HouseDetail.singularData.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>
);
}
}
}
export default HouseDetail;
export default createForm()(HouseDetail);
import { TabNavigator } from 'react-navigation';
import Empty from '../../empty';
import HouseDetail from './HouseDetail';
const ErJiScreen = TabNavigator(
{
HouseDetail: {
screen: HouseDetail,
navigationOptions: {
lazy: true,
tabBarLabel: '详细信息',
},
},
QuanLiRenInfo: {
screen: Empty('fangwuDetail', 'QuanLiRenScreen'),
navigationOptions: {
lazy: true,
tabBarLabel: '权利人信息',
},
},
QuanShuInfo: {
screen: Empty('fangwuDetail', 'QuanLiRenScreen'),
navigationOptions: {
lazy: true,
tabBarLabel: '权属信息',
},
},
ChuZuInfo: {
screen: Empty('fangwuDetaildfvdfsdfasfdef', 'SanJiInfo'),
navigationOptions: {
lazy: true,
tabBarLabel: '出租信息',
},
},
},
{
},
);
export default ErJiScreen;
......@@ -18,20 +18,12 @@ class ListHouContent extends Component {
this.props.dispatch(createAction('ListHouse/getHouseList')());
}
};
onPressItem = (id) => {
this.props.navigation.navigate('HouseDetail', { id });
};
getItemLayout = (data, index) => (
{ length: 60, offset: (60 + 1) * index, index }
);
/**
* 使用箭头函数防止不必要的re-render;
* 如果使用bind方式来绑定onPressItem,每次都会生成一个新的函数,导致props在===比较时返回false,
* 从而触发自身的一次不必要的重新render,也就是FlatListItem组件每次都会重新渲染。
*
* @param id
* @private
*/
_onPressItem = (id: string) => {
this.props.dispatch(createAction('ListHouse/setSelected')({ id }));
};
/**
* 此函数用于为给定的item生成一个不重复的Key。
* Key的作用是使React能够区分同类元素的不同个体,以便在刷新时能够确定其变化的位置,减少重新渲染的开销。
......@@ -79,9 +71,7 @@ class ListHouContent extends Component {
/>
);
};
onPressItem = (id) => {
this.props.dispatch(createAction('ListHouse/getHouseDetail')(id));
};
render() {
return (
<FlatList
......
import React, { Component } from 'react';
import { View, Text } from 'react-native';
import { TabNavigator, TabView } from 'react-navigation';
import { View, Text, Image, StyleSheet } from 'react-native';
import { TabNavigator } from 'react-navigation';
import userInfoPageScreen from './userinfopage';
import fwInfo from './fwInfo';
import chatsIcon from '../../../image/chats-icon.png';
const Content = TabNavigator({
FWInfo: {
screen: fwInfo,
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]}
/>
),
},
},
UserInfoPageScreen: {
screen: userInfoPageScreen,
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]}
/>
),
},
},
}, {
tabBarPosition: 'bottom',
......@@ -39,5 +62,13 @@ class MainPage extends Component {
}
}
MainPage.router = Content.router;
const styles = StyleSheet.create({
icon: {
width: 26,
height: 26,
},
});
export default MainPage;
import React, { Component } from 'react';
import { Image, StyleSheet, Button } from 'react-native';
import Icon from '../../../image/chats-icon.png';
import { Button } from 'react-native';
class userInfoPageScreen extends Component {
static navigationOptions = {
tabBarLabel: '个人中心',
tabBarIcon: () => (
<Image
source={Icon}
style={styles.icon}
/>
),
};
render() {
return (
<Button
......@@ -22,10 +11,4 @@ class userInfoPageScreen extends Component {
);
}
}
const styles = StyleSheet.create({
icon: {
width: 26,
height: 26,
},
});
export default userInfoPageScreen;
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论