Commit de618f1d by 黄日华

收银程序横屏兼容

parent 75151180
...@@ -19,6 +19,18 @@ class HomeLayout extends Component { ...@@ -19,6 +19,18 @@ class HomeLayout extends Component {
source={require('../assets/Vertical/24h.png')} source={require('../assets/Vertical/24h.png')}
/> />
<Text style={styles.titleText}>{appName}</Text> <Text style={styles.titleText}>{appName}</Text>
<View
style={{
flex: 1,
flexDirection: 'row',
justifyContent: 'flex-end',
alignItems: 'flex-end',
paddingRight: 25,
}}>
<Text style={{fontSize: 12, color: '#ccc'}}>
{width} - {height}
</Text>
</View>
</View> </View>
{this.props.children} {this.props.children}
</View> </View>
......
...@@ -11,11 +11,10 @@ const {width, height} = Dimensions.get('window'); ...@@ -11,11 +11,10 @@ const {width, height} = Dimensions.get('window');
class AuthPage extends Component { class AuthPage extends Component {
state = { state = {
isLandscape: false, socket: '',
}; };
async componentDidMount() { async componentDidMount() {
this.setState({isLandscape: width > height});
this.socket = io(axios.defaults.baseURL); this.socket = io(axios.defaults.baseURL);
this.socket.on('storeAuth', this.handleLogin); this.socket.on('storeAuth', this.handleLogin);
this.socket.on('connect', () => { this.socket.on('connect', () => {
...@@ -33,16 +32,15 @@ class AuthPage extends Component { ...@@ -33,16 +32,15 @@ class AuthPage extends Component {
}; };
render() { render() {
const {socket, isLandscape} = this.state; const {socket} = this.state;
console.warn(width, height);
return ( return (
<HomeLayout> <HomeLayout>
<View style={styles.qrcode}> <View style={styles.qrcode}>
<QRCode <QRCode
size={isLandscape ? scaleSize(height * 0.35) : scaleSize(700)} size={width > height ? scaleSize(height * 0.2) : scaleSize(700)}
logo={require('../assets/logo.png')} logo={require('../assets/logo.png')}
backgroundColor="white" backgroundColor="white"
value={`${config.qrHost}/#/store-auth-${socket}`} value={`${config.qrHost}/#/store-auth-${socket || ''}`}
/> />
</View> </View>
</HomeLayout> </HomeLayout>
......
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