Commit 98c6b890 by 王崇仁

刷脸页面和收银台添加跳转无障碍按钮

parent 94961a92
...@@ -20,6 +20,7 @@ import {counterInterval} from './utils/authInterval'; ...@@ -20,6 +20,7 @@ import {counterInterval} from './utils/authInterval';
import {counterLogin} from './utils/authLogin'; import {counterLogin} from './utils/authLogin';
import {host} from './utils/config'; import {host} from './utils/config';
import pack from '../package.json'; import pack from '../package.json';
import AutoClick from './utils/AutoClick';
const {width: _width, height: _height} = Dimensions.get('window'); const {width: _width, height: _height} = Dimensions.get('window');
...@@ -80,13 +81,15 @@ class App extends React.Component { ...@@ -80,13 +81,15 @@ class App extends React.Component {
this.setState({ready: true}); this.setState({ready: true});
} }
componentDidMount() { async componentDidMount() {
if (process.env.NODE_ENV === 'production') if (process.env.NODE_ENV === 'production')
Speech.speak(`当前版本${pack.version}`); Speech.speak(`当前版本${pack.version}`);
codePush.sync(); codePush.sync();
AppState.addEventListener('change', newState => { AppState.addEventListener('change', async newState => {
if (newState === 'active') { if (newState === 'active') {
codePush.sync(); // 检查更新 codePush.sync(); // 检查更新
let autoClick = await AutoClick.isSettingsOn(); // 展示按钮
this.props.dispatch({type: 'admin/autoClick', autoClick});
} }
}); });
} }
......
...@@ -7,6 +7,7 @@ export default { ...@@ -7,6 +7,7 @@ export default {
state: { state: {
auth: {}, auth: {},
socket: '', socket: '',
autoClick: true,
}, },
reducers: { reducers: {
setAuth(state, {id, auth, login}) { setAuth(state, {id, auth, login}) {
...@@ -35,6 +36,10 @@ export default { ...@@ -35,6 +36,10 @@ export default {
state.socket = socket; state.socket = socket;
return {...state}; return {...state};
}, },
autoClick(state, {autoClick}) {
state.autoClick = autoClick;
return {...state};
},
}, },
effects: { effects: {
*auth(action, {put, call}) { *auth(action, {put, call}) {
......
...@@ -23,6 +23,7 @@ import {qrHost} from '../utils/config'; ...@@ -23,6 +23,7 @@ import {qrHost} from '../utils/config';
import Icons from 'react-native-vector-icons/MaterialIcons'; import Icons from 'react-native-vector-icons/MaterialIcons';
import AutoClick from '../utils/AutoClick'; import AutoClick from '../utils/AutoClick';
@connect(({admin}) => ({admin}))
class FacePage extends Component { class FacePage extends Component {
state = { state = {
phoneModal: false, // 显示输入电话号码弹窗 phoneModal: false, // 显示输入电话号码弹窗
...@@ -37,7 +38,7 @@ class FacePage extends Component { ...@@ -37,7 +38,7 @@ class FacePage extends Component {
tip: '', tip: '',
tipsModal: false, tipsModal: false,
faceType: 'wxpay', faceType: 'wxpay',
sleep: false, sleep: true,
loadingModal: false, loadingModal: false,
qrCode: '', qrCode: '',
goTipsModal: false, goTipsModal: false,
...@@ -504,7 +505,7 @@ class FacePage extends Component { ...@@ -504,7 +505,7 @@ class FacePage extends Component {
} else { } else {
flag = ''; flag = '';
} }
let {dispatch} = this.props; let {dispatch, admin} = this.props;
if (faceType === 'alipay') { if (faceType === 'alipay') {
styles.header = {...styles.header, backgroundColor: '#1b7dc7'}; styles.header = {...styles.header, backgroundColor: '#1b7dc7'};
styles.btnCome = {...styles.btnCome, backgroundColor: '#1b7dc7'}; styles.btnCome = {...styles.btnCome, backgroundColor: '#1b7dc7'};
...@@ -596,14 +597,14 @@ class FacePage extends Component { ...@@ -596,14 +597,14 @@ class FacePage extends Component {
/> />
</Touch> </Touch>
</View> </View>
{this.state.setting && ( {!admin.autoClick && (
<Touch <Touch
onPress={this.setting} onPress={this.setting}
style={{ style={{
position: 'absolute', position: 'absolute',
width: 100, width: scaleSize(100),
height: 100, height: scaleSize(100),
bottom: 200, bottom: scaleSize(200),
right: 0, right: 0,
backgroundColor: 'rgba(0,0,0,0.1)', backgroundColor: 'rgba(0,0,0,0.1)',
alignItems: 'center', alignItems: 'center',
...@@ -613,7 +614,7 @@ class FacePage extends Component { ...@@ -613,7 +614,7 @@ class FacePage extends Component {
}}> }}>
<Icons <Icons
name="accessibility" name="accessibility"
style={{fontSize: 60, color: '#fff'}} style={{fontSize: setSpText(60), color: '#fff'}}
/> />
</Touch> </Touch>
)} )}
......
...@@ -534,7 +534,7 @@ class VerticalPage extends Component { ...@@ -534,7 +534,7 @@ class VerticalPage extends Component {
style={{ style={{
width: '10%', width: '10%',
flexDirection: 'column', flexDirection: 'column',
justifyContent: 'center', position: 'relative',
}}> }}>
<View <View
style={{ style={{
...@@ -572,20 +572,24 @@ class VerticalPage extends Component { ...@@ -572,20 +572,24 @@ class VerticalPage extends Component {
/> />
</Touch> </Touch>
</View> </View>
{this.state.setting && ( {!admin.autoClick && (
<Touch <Touch
onPress={this.setting} onPress={this.setting}
style={{ style={{
position: 'absolute',
width: scaleSize(100),
height: scaleSize(100),
bottom: scaleSize(100),
right: 0,
backgroundColor: 'rgba(0,0,0,0.1)', backgroundColor: 'rgba(0,0,0,0.1)',
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
borderRadius: 10, borderRadius: 10,
paddingBottom: 20, zIndex: 999,
paddingTop: 20,
}}> }}>
<Icons <Icons
name="accessibility" name="accessibility"
style={{fontSize: 60, color: '#fff'}} style={{fontSize: setSpText(60), color: '#fff'}}
/> />
</Touch> </Touch>
)} )}
......
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