refactor(customer): 优化客户数据查询和表单字段校验

- 移除新增客户页面对手机号的必填和格式校验
- 修改手机号字段标签为“手机号/微信号”,取消必填和长度限制
- 新增判断当前用户是否为超级管理员逻辑
- 抽取并统一构建客户查询参数方法,根据权限动态设置筛选条件
- 优化客户列表数据获取逻辑,支持超级管理员查看全部客户
- 调整依赖项,更新使用了新构建的查询参数函数
- 增强状态统计接口参数构建,统一调用参数生成函数
- 优化副作用 Hook 依赖,保证数据加载时机正确
This commit is contained in:
2026-06-04 16:12:22 +08:00
parent f4c2a64f8d
commit af35c9281d
3 changed files with 12 additions and 5 deletions

View File

@@ -168,7 +168,10 @@ function UserCard() {
isLoggedIn ? (
<Avatar size="large" src={user?.avatar} shape="round"/>
) : (
<Button className={'text-black'} open-type="getPhoneNumber" onGetPhoneNumber={handleGetPhoneNumber}>
<Button className={'text-black'} style={{
maxWidth: '100px',
height: '100%',
}} open-type="getPhoneNumber" onGetPhoneNumber={handleGetPhoneNumber}>
<Avatar size="large" src={user?.avatar} shape="round"/>
</Button>
)

View File

@@ -6,7 +6,7 @@ import {ArrowRight, LogisticsError} from '@nutui/icons-react-taro'
import {useUser} from '@/hooks/useUser'
const UserCell = () => {
const {logoutUser} = useUser();
const {logoutUser, isAdmin} = useUser();
const onLogout = () => {
Taro.showModal({
@@ -28,15 +28,19 @@ const UserCell = () => {
<>
<View className={'p-4'}>
{isAdmin() && (
<Cell.Group divider={true}>
<Cell
className="nutui-cell-clickable"
title="后台管理"
title={
<Text style={{color: '#f97316', fontWeight: 500}}></Text>
}
align="center"
extra={<ArrowRight color="#cccccc" size={18}/>}
extra={<ArrowRight color="#f97316" size={18}/>}
onClick={() => Taro.reLaunch({url: '/pages/index/index'})}
/>
</Cell.Group>
)}
<Cell.Group divider={true}>
<Cell

View File

@@ -58,7 +58,7 @@
border: 1px solid rgba(15, 118, 110, 0.22);
border-radius: 999px;
background: #ecfdf5;
color: #0f766e;
color: #0f3076;
white-space: nowrap;
}