提交 87d9c2bb 编写于 作者: YYYTDMS's avatar YYYTDMS

330_合并地图完成

上级 ef3ecccb
......@@ -10,7 +10,6 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:usesCleartextTraffic="true"
android:allowBackup="false"
android:usesCleartextTraffic="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
......
......@@ -16,7 +16,7 @@ class MyHeader extends Component {
backgroundColor="transparent"
barStyle="dark-content"
/>
<Divider style={styles.divider} />
{/*<Divider style={styles.divider} />*/}
<Header
backgroundColor={'#CE9561'}
centerComponent={{
......
import {Component} from 'react';
import React from 'react';
import {
Dimensions,
Image,
View,
Text,
StyleSheet,
TouchableOpacity,
Dimensions,
Image,
View,
Text,
StyleSheet,
TouchableOpacity, ToastAndroid,
} from 'react-native';
const deviceWidthDp = Dimensions.get('window').width;
const deviceHeightDp = Dimensions.get('window').height;
import DropDownModal from '../SingleComponent/DropDownModal';
import RadioView from '../SingleComponent/RadioView';
import {PanResponder} from 'react-native';
/**
* 偏好设置界面
*/
class SettingView extends Component {
constructor() {
super();
this.state = {
flag: null,
building: null,
floor: null,
buildsListsetting: null,
};
}
checkCallBack = id => {
this.setState({
flag: id,
});
};
_selectbuilding = (index, value) => {
console.log(index + '--' + value);
this.setState({
building: value,
});
};
_selectfloor = (index, value) => {
console.log(index + '--' + value);
this.setState({
floor: index + 1,
constructor() {
super();
this.state = {
flag: null,
building: null,
floor: null,
buildsListsetting: null,
};
}
_panResponder = PanResponder.create({
onStartShouldSetPanResponder: () => true,
onMoveShouldSetPanResponder: () => true,
onPanResponderGrant: () => {
// console.log('开始移动:');
},
onPanResponderMove: (evt, gs) => {
// console.log('正在移动:X轴:' + gs.dx + ',Y轴:' + gs.dy);
},
onPanResponderRelease: (evt, gs) => {
// console.log('结束移动:X轴移动了:' + gs.dx + ',Y轴移动了:' + gs.dy);
if (gs.dx > 50) {
// console.log('由左向右');
} else if (gs.dx < -50) {
// console.log('由右向左');
} else if (gs.dy > 50) {
// console.log('由上向下');
} else if (gs.dy < -50) {
// console.log('由下向上');
// this.props.navigation.back();
this.props.navigation.goBack()
}
},
});
};
componentDidMount() {
const {buildsListsort} = this.props.route.params;
const {x1, x2, x3, zl, d1, d2, d3, w1, w2, w3, w4} =
this.props.route.params.buildsListsort;
const buildName = [x1, x2, x3, zl, d1, d2, d3, w1, w2, w3, w4];
if (JSON.stringify(buildsListsort) == '{}') {
console.log('');
} else {
console.log('传参', buildsListsort);
for (let i = 0; i < buildName.length; i++) {
buildName[i].sort((a, b) => {
return a.people_num - b.people_num;
checkCallBack = id => {
this.setState({
flag: id,
});
};
_selectbuilding = (index, value) => {
console.log(index + '--' + value);
this.setState({
building: value,
});
};
_selectfloor = (index, value) => {
console.log(index + '--' + value);
this.setState({
floor: index + 1,
});
}
this.setState({buildsListsetting: buildsListsort}, () => {
console.log('回调', this.state.buildsListsetting);
});
};
componentDidMount() {
const {buildsListsort} = this.props.route.params;
const {x1, x2, x3, zl, d1, d2, d3, w1, w2, w3, w4} =
this.props.route.params.buildsListsort;
const buildName = [x1, x2, x3, zl, d1, d2, d3, w1, w2, w3, w4];
if (JSON.stringify(buildsListsort) == '{}') {
console.log('');
} else {
console.log('传参', buildsListsort);
for (let i = 0; i < buildName.length; i++) {
buildName[i].sort((a, b) => {
return a.people_num - b.people_num;
});
}
this.setState({buildsListsetting: buildsListsort}, () => {
console.log('回调', this.state.buildsListsetting);
});
}
}
}
render() {
const {navigation} = this.props;
const {buildsListsort} = this.props.route.params;
// console.log('pppppp', this.state.buildsListsetting);
// console.log('处理后', buildsListsort);
return (
<View style={styles.container}>
<View style={styles.box1}>
<Image
source={require('../../../images/Map/Behavior.png')}
style={styles.box1image}
/>
<Text style={styles.box1text}>偏好设置</Text>
</View>
<View style={styles.box2}>
<DropDownModal
data={[
'西3楼',
'西2楼',
'西1楼',
'中楼',
'东1楼',
'东2楼',
'东3楼',
'文1楼',
'东2楼',
'东3楼',
'东4楼',
]}
title={'区域'}
imgSource={require('../../../images/Map/regionalRules.png')}
onChoosed={this._selectbuilding}
/>
</View>
<View style={styles.box3}>
<DropDownModal
data={['1楼', '2楼', '3楼', '4楼', '5楼']}
title={'楼层'}
imgSource={require('../../../images/Map/floor.png')}
onChoosed={this._selectfloor}
/>
</View>
<View style={styles.box4}>
<Image
source={require('../../../images/Map/Mytalent.png')}
style={styles.box4image}
/>
<View style={{flex: 2}}>
<Text style={styles.text}>人少</Text>
</View>
render() {
const {navigation} = this.props;
const {buildsListsort} = this.props.route.params;
// console.log('pppppp', this.state.buildsListsetting);
// console.log('处理后', buildsListsort);
return (
<View style={styles.container} {...this._panResponder.panHandlers}>
<View style={styles.box1}>
<Image
source={require('../../../images/Map/Behavior.png')}
style={styles.box1image}
/>
<Text style={styles.box1text}>偏好设置</Text>
</View>
<View style={styles.box2}>
<DropDownModal
data={[
'西3楼',
'西2楼',
'西1楼',
'中楼',
'东1楼',
'东2楼',
'东3楼',
'文1楼',
'东2楼',
'东3楼',
'东4楼',
]}
title={'区域'}
imgSource={require('../../../images/Map/regionalRules.png')}
onChoosed={this._selectbuilding}
/>
</View>
<View style={styles.box3}>
<DropDownModal
data={['1楼', '2楼', '3楼', '4楼', '5楼']}
title={'楼层'}
imgSource={require('../../../images/Map/floor.png')}
onChoosed={this._selectfloor}
/>
</View>
<View style={styles.box4}>
<Image
source={require('../../../images/Map/Mytalent.png')}
style={styles.box4image}
/>
<RadioView
id={1}
onCheck={this.checkCallBack}
checked={this.state.flag === 1}
/>
<View style={{flex: 2}}>
<Text style={styles.text}>人少</Text>
</View>
<View style={{flex: 2}}>
<Text style={styles.text}>人多</Text>
</View>
<RadioView
id={1}
onCheck={this.checkCallBack}
checked={this.state.flag === 1}
/>
<RadioView
id={2}
onCheck={this.checkCallBack}
checked={this.state.flag === 2}
/>
<View style={{flex: 1.5}} />
</View>
<View style={styles.box5}>
<TouchableOpacity
style={{
backgroundColor: '#F6C354',
width: deviceWidthDp / 4,
height: deviceHeightDp / 20,
marginBottom: 20,
justifyContent: 'center',
marginRight: 30,
}}
onPress={() => {
// console.log('this.state.flag', this.state.flag);
// console.log('this.state.building', this.state.building);
// console.log('this.state.floor', this.state.floor);
if (
this.state.flag == null ||
this.state.building == null ||
this.state.floor == null
) {
alert('请设置偏好,微笑');
} else {
navigation.navigate('RecommendView', {
list: this.state.buildsListsetting,
build: this.state.building,
floor: this.state.floor,
flag: this.state.flag,
});
}
}}>
<Text style={{color: '#FFFFFF', textAlign: 'center'}}>
开始匹配
</Text>
</TouchableOpacity>
</View>
<View style={{flex: 10}}>
<Image
source={require('../../../images/Map/loading.png')}
style={styles.box5image}
/>
</View>
</View>
);
}
<View style={{flex: 2}}>
<Text style={styles.text}>人多</Text>
</View>
<RadioView
id={2}
onCheck={this.checkCallBack}
checked={this.state.flag === 2}
/>
<View style={{flex: 1.5}}/>
</View>
<View style={styles.box5}>
<TouchableOpacity
style={{
backgroundColor: '#F6C354',
width: deviceWidthDp / 4,
height: deviceHeightDp / 20,
marginBottom: 20,
justifyContent: 'center',
marginRight: 30,
}}
onPress={() => {
// console.log('this.state.flag', this.state.flag);
// console.log('this.state.building', this.state.building);
// console.log('this.state.floor', this.state.floor);
if (
this.state.flag == null ||
this.state.building == null ||
this.state.floor == null
) {
ToastAndroid.show('请设置偏好~~(^v^)', 500);
} else {
navigation.navigate('RecommendView', {
list: this.state.buildsListsetting,
build: this.state.building,
floor: this.state.floor,
flag: this.state.flag,
});
}
}}>
<Text style={{color: '#FFFFFF', textAlign: 'center'}}>
开始匹配
</Text>
</TouchableOpacity>
</View>
<View style={{flex: 10}}>
<Image
source={require('../../../images/Map/loading.png')}
style={styles.box5image}
/>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flexDirection: 'column',
flex: 1,
backgroundColor: '#F6B972',
},
box1: {
flexDirection: 'row',
flex: 1,
justifyContent: 'center',
// backgroundColor: 'black',
},
box1image: {
height: deviceHeightDp / 25,
width: deviceWidthDp / 25,
resizeMode: 'contain',
},
box1text: {
textAlign: 'center',
paddingTop: 5,
color: '#FFFFFF',
},
box2: {
flex: 1,
},
box3: {
flex: 1,
},
box4: {
flexDirection: 'row',
flex: 1,
},
box4image: {
width: null,
height: null,
flex: 1.2,
resizeMode: 'contain',
},
text: {
fontSize: 22,
color: '#FFFFFF',
textAlignVertical: 'center',
flex: 1,
textAlign: 'right',
},
box5: {
flex: 1,
alignItems: 'flex-end',
},
box5image: {
width: null,
height: null,
flex: 1,
resizeMode: 'contain',
},
box6: {
flex: 1,
},
container: {
flexDirection: 'column',
flex: 1,
backgroundColor: '#F6B972',
},
box1: {
flexDirection: 'row',
flex: 1,
justifyContent: 'center',
// backgroundColor: 'black',
},
box1image: {
height: deviceHeightDp / 25,
width: deviceWidthDp / 25,
resizeMode: 'contain',
},
box1text: {
textAlign: 'center',
paddingTop: 5,
color: '#FFFFFF',
},
box2: {
flex: 1,
},
box3: {
flex: 1,
},
box4: {
flexDirection: 'row',
flex: 1,
},
box4image: {
width: null,
height: null,
flex: 1.2,
resizeMode: 'contain',
},
text: {
fontSize: 22,
color: '#FFFFFF',
textAlignVertical: 'center',
flex: 1,
textAlign: 'right',
},
box5: {
flex: 1,
alignItems: 'flex-end',
},
box5image: {
width: null,
height: null,
flex: 1,
resizeMode: 'contain',
},
box6: {
flex: 1,
},
});
export default SettingView;
......@@ -11,6 +11,7 @@ class Home extends Component {
}
UNSAFE_componentWillMount() {
if (Platform.OS === 'android') {
BackHandler.addEventListener('hardwareBackPress', this.onBackAndroid);
}
......@@ -24,6 +25,7 @@ class Home extends Component {
onBackAndroid = () => {
//禁用返回键
if (this.lastBackPressed && this.lastBackPressed + 2000 >= Date.now()) {
BackHandler.exitApp(); //直接退出APP
......
......@@ -4513,6 +4513,11 @@ jsonify@~0.0.0:
array-includes "^3.1.4"
object.assign "^4.1.2"
kdbush@^3.0.0:
version "3.0.0"
resolved "https://registry.npmmirror.com/kdbush/-/kdbush-3.0.0.tgz#f8484794d47004cc2d85ed3a79353dbe0abc2bf0"
integrity sha512-hRkd6/XW4HTsA9vjVpY9tuXJYLSlelnkTmVFu4M9/7MIYQtFcHpbugAU7UbOfjOiVSVYl2fqgBuJ32JUmRo5Ew==
kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0:
version "3.2.2"
resolved "https://registry.npmmirror.com/kind-of/-/kind-of-3.2.2.tgz"
......@@ -5034,6 +5039,11 @@ mkdirp@^0.5.1:
dependencies:
minimist "^1.2.6"
moment@^2.29.3:
version "2.29.3"
resolved "https://registry.npmmirror.com/moment/-/moment-2.29.3.tgz#edd47411c322413999f7a5940d526de183c031f3"
integrity sha512-c6YRvhEo//6T2Jz/vVtYzqBzwvPT95JBQ+smCytzf7c50oMZRsR/a4w88aD34I+/QVSfnoAnSBFPJHItlOMJVw==
ms@2.0.0:
version "2.0.0"
resolved "https://registry.npmmirror.com/ms/-/ms-2.0.0.tgz"
......@@ -5596,7 +5606,7 @@ prompts@^2.0.1, prompts@^2.4.0:
kleur "^3.0.3"
sisteransi "^1.0.5"
prop-types@*, prop-types@^15.5.10, prop-types@^15.6.0, prop-types@^15.7.2, prop-types@^15.8.1:
prop-types@*, prop-types@^15.5.10, prop-types@^15.5.8, prop-types@^15.6.0, prop-types@^15.7.2, prop-types@^15.8.1:
version "15.8.1"
resolved "https://registry.npmmirror.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5"
integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==
......@@ -5683,6 +5693,13 @@ react-native-action-button@^2.8.5:
dependencies:
prop-types "^15.5.10"
react-native-amap3d@^3.0.7:
version "3.0.7"
resolved "https://registry.npmmirror.com/react-native-amap3d/-/react-native-amap3d-3.0.7.tgz#51c38ef14d15d55abf52ac0dd34d762a0b88eabd"
integrity sha512-bvER80OSLh/vQe8blY0Cr0NZCD3Yc0pcddOZU+51wS9r8z75QqDFW7lATvDsk3d5PDn+hUYK1XPyKG7rdBf8qw==
dependencies:
supercluster "^7.1.4"
react-native-codegen@^0.0.13:
version "0.0.13"
resolved "https://registry.npmmirror.com/react-native-codegen/-/react-native-codegen-0.0.13.tgz"
......@@ -5693,6 +5710,19 @@ react-native-codegen@^0.0.13:
jscodeshift "^0.13.1"
nullthrows "^1.1.1"
react-native-common-date-picker@^2.3.7:
version "2.3.7"
resolved "https://registry.npmmirror.com/react-native-common-date-picker/-/react-native-common-date-picker-2.3.7.tgz#c9fc6759a36e99e5ab230e9bd3171cad7472e4e3"
integrity sha512-XAell1MdBDjOkmHl6PxkNRstUvdrQmj36tu2zgTPR/EA3Db0Sr/LhwO+pdcA3XlJ7bPWt89tNantM16obzBz6Q==
react-native-drawer@^2.5.1:
version "2.5.1"
resolved "https://registry.npmmirror.com/react-native-drawer/-/react-native-drawer-2.5.1.tgz#08b9314184f48c724f1b467f8859797369798654"
integrity sha512-cxcQNbSWy5sbGi7anSVp6EDr6JarOBMY9lbFOeLFeVYbONiudoqRKbgEsSDgSw3/LFCLvUXK5zdjXCOedeytxQ==
dependencies:
prop-types "^15.5.8"
tween-functions "^1.0.1"
react-native-elements@^3.4.2:
version "3.4.2"
resolved "https://registry.npmmirror.com/react-native-elements/-/react-native-elements-3.4.2.tgz"
......@@ -5774,6 +5804,11 @@ react-native-tab-navigator@^0.3.4:
immutable "^3.8.1"
prop-types "^15.5.10"
react-native-table-component@^1.2.2:
version "1.2.2"
resolved "https://registry.npmmirror.com/react-native-table-component/-/react-native-table-component-1.2.2.tgz#1c9bdcd8f1fd7edf10d1e93ebc3b7877ecd74def"
integrity sha512-7bbsi5431iWcjj3toASh8lFHGi6AG/+MTd4M7GuksXKxx/CFs/Qwv1Ys7D2wgyuYKe3hxWNfSVrteFj0tOYXYw==
react-native-vector-icons@^9.1.0:
version "9.1.0"
resolved "https://registry.npmmirror.com/react-native-vector-icons/-/react-native-vector-icons-9.1.0.tgz#52eaa205f5954d567b7048eb93d58ac854a2c59e"
......@@ -6619,6 +6654,13 @@ sudo-prompt@^9.0.0:
resolved "https://registry.npmmirror.com/sudo-prompt/-/sudo-prompt-9.2.1.tgz"
integrity sha512-Mu7R0g4ig9TUuGSxJavny5Rv0egCEtpZRNMrZaYS1vxkiIxGiGUwoezU3LazIQ+KE04hTrTfNPgxU5gzi7F5Pw==
supercluster@^7.1.4:
version "7.1.5"
resolved "https://registry.npmmirror.com/supercluster/-/supercluster-7.1.5.tgz#65a6ce4a037a972767740614c19051b64b8be5a3"
integrity sha512-EulshI3pGUM66o6ZdH3ReiFcvHpM3vAigyK+vcxdjpJyEbIIrtbmBdY23mGgnI24uXiGFvrGq9Gkum/8U7vJWg==
dependencies:
kdbush "^3.0.0"
supports-color@^5.3.0:
version "5.5.0"
resolved "https://registry.npmmirror.com/supports-color/-/supports-color-5.5.0.tgz"
......@@ -6804,6 +6846,11 @@ tsutils@^3.17.1:
dependencies:
tslib "^1.8.1"
tween-functions@^1.0.1:
version "1.2.0"
resolved "https://registry.npmmirror.com/tween-functions/-/tween-functions-1.2.0.tgz#1ae3a50e7c60bb3def774eac707acbca73bbc3ff"
integrity sha512-PZBtLYcCLtEcjL14Fzb1gSxPBeL7nWvGhO5ZFPGqziCcr8uvHp0NDmdjBchp6KHL+tExcg0m3NISmKxhU394dA==
type-check@^0.4.0, type-check@~0.4.0:
version "0.4.0"
resolved "https://registry.npmmirror.com/type-check/-/type-check-0.4.0.tgz"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册