import React from 'react';
import { View, Image, Button } from '@tarojs/components';
import Icon from '@/assets/image/WeChat.png';
import { useModel } from '@/store';
import style from './bottom.module.less';

export default (props) => {

  const { signinByPhone } = useModel('user');

  const onGetPhoneNumber = (e) => {
    const code = e.detail.code;
    signinByPhone(code).then(props.onSuccess);
  }

  return (
    <View>
      <View className={style['txt-box2']}>—— 没有账号？微信登录 ——</View>
      <View className={style['img-box2']}>
        <Button openType="getPhoneNumber" onGetPhoneNumber={onGetPhoneNumber}>
          <Image className={style['img-wechat']}
            src={Icon}
          />
        </Button>
      </View>
      <View className={style['wechat-login']}>微信登录</View>
    </View>
  )
}
