Commit 74ea0e13 by 修福龙

操作失败提示弹窗

parent 19357b33
import React, {Component} from 'react';
import {Modal, View, Text, Image} from 'react-native';
import ModalStyles from './Modal/styles';
import {font} from '../utils/common';
import {scaleSize, setSpText} from '../utils/screen';
import Touch from './Touch';
const mStyles = {
...ModalStyles,
innerContainer: {
...ModalStyles.innerContainer,
},
header: {
...ModalStyles.header,
fontSize: font.title,
},
};
class TipsModal extends Component {
render() {
const {
tip,
title,
leftText,
rightText,
leftTouch,
rightTouch,
faceType,
...props
} = this.props;
if (faceType === 'alipay') {
styles.header = {...styles.header, backgroundColor: '#1b7dc7'};
styles.right = {
...styles.right,
backgroundColor: '#1b7dc7',
};
styles.call = {
...styles.call,
color: '#1b7dc7',
};
}
return (
<Modal styles={mStyles} {...props}>
<View style={styles.modalBackgroundStyle}>
<View style={styles.modal}>
<View style={styles.header}>
<Image
source={require('../assets/Vertical/tip_modal.png')}
style={styles.image}
tintColor="white"
/>
<Text style={styles.title}>{title}</Text>
</View>
<View style={styles.container}>
<Text style={styles.tip}>{tip}</Text>
</View>
<View style={styles.footer}>
<Touch style={styles.left} onPress={() => leftTouch()}>
<Text style={styles.call}>{leftText}</Text>
</Touch>
<Touch style={styles.right} onPress={() => rightTouch()}>
<Text style={styles.reset}>{rightText}</Text>
</Touch>
</View>
</View>
</View>
</Modal>
);
}
}
const styles = {
modalBackgroundStyle: {
flex: 1,
backgroundColor: 'rgba(0, 0, 0, 0.5)',
},
modal: {
height: '35%',
width: '80%',
marginLeft: '10%',
marginTop: '40%',
borderRadius: 20,
backgroundColor: '#fff',
flexDirection: 'column',
},
header: {
flex: 0.25,
flexDirection: 'row',
alignItems: 'center',
backgroundColor: '#2BA245',
borderTopLeftRadius: 20,
borderTopRightRadius: 20,
},
image: {
width: scaleSize(60),
height: scaleSize(60),
marginLeft: scaleSize(20),
marginRight: scaleSize(20),
},
title: {
fontSize: setSpText(45),
color: '#fff',
},
container: {
flex: 0.45,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
padding: scaleSize(60),
},
tip: {
textAlign: 'center',
fontSize: setSpText(65),
},
footer: {
flex: 0.3,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
},
left: {
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
width: '50%',
height: '100%',
borderTopColor: '#ccc',
borderTopWidth: 1,
borderBottomLeftRadius: 20,
backgroundColor: '#f0f0f0',
},
call: {
fontSize: setSpText(65),
color: '#2BA245',
},
right: {
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
width: '50%',
height: '100%',
backgroundColor: '#2BA245',
borderBottomRightRadius: 20,
},
reset: {
fontSize: setSpText(65),
color: '#fff',
},
};
export default TipsModal;
...@@ -7,6 +7,7 @@ import Touch from '../components/Touch'; ...@@ -7,6 +7,7 @@ import Touch from '../components/Touch';
import PhoneModal from '../components/PhoneModal'; import PhoneModal from '../components/PhoneModal';
import VerifyCodeModal from '../components/VerifyCodeModal'; import VerifyCodeModal from '../components/VerifyCodeModal';
import OrderDetailsModal from '../components/OrderDetailsModal'; import OrderDetailsModal from '../components/OrderDetailsModal';
import TipsModal from '../components/TipsModal';
import delay from '../utils/delay'; import delay from '../utils/delay';
import Speech from '../utils/Speech'; import Speech from '../utils/Speech';
import WxFacepay from '../utils/WxFacepay'; import WxFacepay from '../utils/WxFacepay';
...@@ -15,7 +16,7 @@ import phone from '../assets/Vertical/phone.png'; ...@@ -15,7 +16,7 @@ import phone from '../assets/Vertical/phone.png';
import {onTalkCall, leaveTalkCall} from '../utils/agora'; import {onTalkCall, leaveTalkCall} from '../utils/agora';
import Toast from '../components/Toast'; import Toast from '../components/Toast';
import Screensaver from '../components/Screensaver'; import Screensaver from '../components/Screensaver';
import {width, setSpText, scaleSize, scaleHeight} from '../utils/screen'; import {width, setSpText, scaleSize} from '../utils/screen';
class FacePage extends Component { class FacePage extends Component {
state = { state = {
...@@ -97,18 +98,6 @@ class FacePage extends Component { ...@@ -97,18 +98,6 @@ class FacePage extends Component {
} }
}; };
// handleClose = () => {
// this.setState({
// phoneModal: false,
// });
// };
//
// handleCodeClose = () => {
// this.setState({
// verifyCodeModal: false,
// });
// };
handleOrderClose = () => { handleOrderClose = () => {
this.setState({ this.setState({
orderDetailsModal: false, orderDetailsModal: false,
...@@ -402,6 +391,11 @@ class FacePage extends Component { ...@@ -402,6 +391,11 @@ class FacePage extends Component {
}, 18888); }, 18888);
}; };
closeTips = async () => {
await this.setState({tipsModal: false});
await this.face();
};
render() { render() {
const { const {
verifyCodeModal, verifyCodeModal,
...@@ -432,9 +426,6 @@ class FacePage extends Component { ...@@ -432,9 +426,6 @@ class FacePage extends Component {
<PhoneModal <PhoneModal
visible={phoneModal} visible={phoneModal}
transparent transparent
// maskClosable
// onClose={this.handleClose}
// onRequestClose={this.handleClose}
onCall={this.onCall} onCall={this.onCall}
onSubmit={this.onSubmit} onSubmit={this.onSubmit}
faceType={faceType} faceType={faceType}
...@@ -442,9 +433,6 @@ class FacePage extends Component { ...@@ -442,9 +433,6 @@ class FacePage extends Component {
<VerifyCodeModal <VerifyCodeModal
visible={verifyCodeModal} visible={verifyCodeModal}
transparent transparent
// maskClosable
// onClose={this.handleCodeClose}
// onRequestClose={this.handleCodeClose}
onCall={this.onCall} onCall={this.onCall}
onSubmit={this.onCodeSubmit} onSubmit={this.onCodeSubmit}
faceType={faceType} faceType={faceType}
...@@ -465,6 +453,17 @@ class FacePage extends Component { ...@@ -465,6 +453,17 @@ class FacePage extends Component {
current={current} current={current}
faceType={faceType} faceType={faceType}
/> />
<TipsModal
visible={tipsModal}
transparent
title={'操作失败'}
tip={tip}
leftText={'呼叫客服'}
rightText={'重新识别'}
leftTouch={this.onCall}
rightTouch={this.closeTips}
faceType={faceType}
/>
<View style={styles.header}> <View style={styles.header}>
<View style={styles.title}> <View style={styles.title}>
<View style={styles.left}> <View style={styles.left}>
...@@ -491,28 +490,6 @@ class FacePage extends Component { ...@@ -491,28 +490,6 @@ class FacePage extends Component {
style={{flex: 1, width}} style={{flex: 1, width}}
/> />
</Touch> </Touch>
{tipsModal && tip && (
<View style={styles.modal}>
<Touch
onPress={() => this.setState({tipsModal: false, tip: ''})}
feedback={false}
style={styles.tips}>
<Text style={styles.tipText}>{tip}</Text>
</Touch>
<Touch
onPress={this.onCall}
feedback={false}
style={styles.callTouch}>
<View style={styles.callTips}>
<Text style={styles.callTipsText}>呼叫客服</Text>
<Image
source={require('../assets/up.png')}
style={styles.callTipsImg}
/>
</View>
</Touch>
</View>
)}
</View> </View>
<Touch onPress={this.face} style={styles.btnCome} feedback={false}> <Touch onPress={this.face} style={styles.btnCome} feedback={false}>
<View style={styles.click}> <View style={styles.click}>
...@@ -583,7 +560,6 @@ const styles = { ...@@ -583,7 +560,6 @@ const styles = {
}, },
header: { header: {
flex: 0.2, flex: 0.2,
// backgroundColor: '#00CD66',
backgroundColor: 'rgb(0,205,102)', backgroundColor: 'rgb(0,205,102)',
width: '100%', width: '100%',
flexDirection: 'column', flexDirection: 'column',
...@@ -641,13 +617,11 @@ const styles = { ...@@ -641,13 +617,11 @@ const styles = {
flex: 0.7, flex: 0.7,
}, },
faceGif: { faceGif: {
// flex: 0.7,
position: 'relative', position: 'relative',
zIndex: 2, zIndex: 2,
}, },
btnCome: { btnCome: {
flex: 0.15, flex: 0.15,
// backgroundColor: '#00CD66',
backgroundColor: 'rgb(0,205,102)', backgroundColor: 'rgb(0,205,102)',
width: '80%', width: '80%',
borderRadius: 30, borderRadius: 30,
...@@ -664,12 +638,10 @@ const styles = { ...@@ -664,12 +638,10 @@ const styles = {
clickText: { clickText: {
fontSize: setSpText(70), fontSize: setSpText(70),
color: '#fff', color: '#fff',
// marginTop: scaleSize(50),
}, },
wxpay: { wxpay: {
width: scaleSize(90), width: scaleSize(90),
height: scaleSize(80), height: scaleSize(80),
// marginTop: width > 471 ? 30 : 24,
marginRight: scaleSize(20), marginRight: scaleSize(20),
}, },
up: { up: {
...@@ -679,7 +651,6 @@ const styles = { ...@@ -679,7 +651,6 @@ const styles = {
footer: { footer: {
flex: 0.2, flex: 0.2,
width: '100%', width: '100%',
// backgroundColor: '#44c571',
backgroundColor: 'rgb(68, 197, 114)', backgroundColor: 'rgb(68, 197, 114)',
}, },
call: { call: {
...@@ -696,7 +667,6 @@ const styles = { ...@@ -696,7 +667,6 @@ const styles = {
callText: { callText: {
fontSize: setSpText(150), fontSize: setSpText(150),
color: '#fff', color: '#fff',
// marginLeft: -50,
}, },
onCall: { onCall: {
flex: 0.2, flex: 0.2,
...@@ -712,61 +682,6 @@ const styles = { ...@@ -712,61 +682,6 @@ const styles = {
color: '#fff', color: '#fff',
marginLeft: scaleSize(-100), marginLeft: scaleSize(-100),
}, },
modal: {
// flex: 0.2,
marginTop: '30%',
width: '100%',
height: scaleHeight(400),
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
position: 'absolute',
zIndex: 999,
},
tips: {
flexDirection: 'row',
backgroundColor: '#FC4000',
width: '70%',
// height: '18%',
height: scaleHeight(400),
justifyContent: 'center',
alignItems: 'center',
marginRight: scaleSize(15),
},
tipText: {
fontSize: setSpText(70),
color: '#fff',
textAlign: 'center',
},
callTouch: {
width: '30%',
// height: '18%',
height: scaleHeight(400),
marginLeft: scaleSize(15),
backgroundColor: '#FC4000',
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
},
callTips: {
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
// backgroundColor: '#FC4000',
// width: '30%',
// height: '18%',
// marginLeft: 5,
},
callTipsText: {
fontSize: setSpText(70),
color: '#fff',
textAlign: 'center',
paddingTop: scaleSize(30),
},
callTipsImg: {
width: scaleSize(150),
height: scaleSize(150),
},
}; };
export default connect(({store}) => ({store}))(FacePage); export default connect(({store}) => ({store}))(FacePage);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment