import React from 'react'
import Taro from '@tarojs/taro'
import './index.scss'

export default (props) => {
  const { person, onLeavePhone } = props

  const callPhone = () => {
    if (person.tel || person.phone) {
      Taro.makePhoneCall({
        phoneNumber: person.tel || person.phone
      })
    }
  }

  return (
    <view className='SystemModel'>
      <text className='Msg'>{`您好，我是${person.name || person.nickname}，有什么可以帮您吗？您可以在这里跟我实时沟通哦~`}</text>
      <text className='Tips'>您还可以通过以下方式快速联系我：</text>
      <view onClick={callPhone}>
        <text className='iconfont icon-dianhua'></text>
        <text>拨打我的电话</text>
      </view>
      <view onClick={onLeavePhone}>
        <text className='iconfont icon-shouji'></text>
        <text>留下您的电话</text>
      </view>
    </view>
  )
}
