import React from 'react'; import { View, Image } from '@tarojs/components'; import { ActionSheet, Cell } from '@antmjs/vantui'; import { ROLES, ROLE_CITIZEN } from '@/utils/user'; import logo from '@/assets/image/logo.png'; import avatar from '@/assets/icons/avatar.png'; import style from './head.module.less'; export default (props) => { const { user = {}, duty, onDutyChange } = props; const { dutyList = [] } = user; const role = ROLES[duty || ROLE_CITIZEN]; const [show, setShow] = React.useState(false); const actions = React.useMemo(() => { return dutyList.map(x => ({name: ROLES[x], value: x})); }, [dutyList]); const onClick = () => { if (dutyList.length < 1) return; setShow(true); } const onSelect = (e) => { onDutyChange(e.detail.value) } return ( Hi, {user.name}! {role} setShow(false)} onSelect={onSelect} /> ) }