import {FC} from "react";
import {Text, View} from "@tarojs/components";
import styles from '../userInfo.module.scss'
import Img from "@/components/image/image";

interface Props {
  data: User | null
}

const Info: FC<Props> = ({data}) => {


  return (
    <>
      <View className={styles.box} style={{height: '184rpx'}}>
        <Img width={120} height={120} src={data?.avatar || ''} className={styles.image} errorType='avatar'/>
        <View className='ml-2'>
          <View>
            <Text className='font-weight font-32'>{data?.name}</Text>
            <Text
              className={data?.is_lock ? styles.tag_muted : styles.tag}>
              {data?.is_lock ? '禁用' : '正常'}
            </Text>
          </View>
          <View className='text-muted font-28'
                style={{marginTop: '2px'}}>
            {['学员', '管理员', '超级管理员'][data?.role_type || 0]}
          </View>
        </View>
      </View>

      <View className={`${styles.box}`} style={{display: 'block', margin: '16rpx 0', padding: '0 32rpx'}}>
        <View className={styles.information} style={{borderBottom: "1px solid #F5F8F7"}}>
          <Text style={{width: '100px', display: 'inline-block'}}>学员编号</Text>
          <Text>{data?.id}号</Text>
        </View>
        <View className={styles.information}>
          <Text style={{width: '100px', display: 'inline-block'}}>手机号</Text>
          <Text>{data?.phone_number}</Text>
        </View>
      </View>
    </>
  )
}

export default Info
