refactor(request): 移除旧版请求工具并优化错误处理- 删除了 request-legacy.ts及相关文件
- 更新了所有 API 文件的导入路径 -优化了请求工具的错误处理逻辑 - 移除了冗余的调试信息 - 保留了关键的错误信息
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
pageShopDealerApply,
|
||||
updateShopDealerApply
|
||||
} from "@/api/shop/shopDealerApply";
|
||||
import {getShopDealerUser} from "@/api/shop/shopDealerUser";
|
||||
|
||||
const AddUserAddress = () => {
|
||||
const {user} = useUser()
|
||||
@@ -63,6 +64,23 @@ const AddUserAddress = () => {
|
||||
|
||||
// 提交表单
|
||||
const submitSucceed = async (values: any) => {
|
||||
if(!values.refereeId){
|
||||
return Taro.showToast({
|
||||
title: '请填写邀请人ID',
|
||||
icon: 'error'
|
||||
});
|
||||
}
|
||||
// 验证邀请人ID是否存在
|
||||
try {
|
||||
await getShopDealerUser(values.refereeId);
|
||||
} catch (error) {
|
||||
console.error('验证邀请人失败:', error);
|
||||
return Taro.showToast({
|
||||
title: '邀请人ID不存在',
|
||||
icon: 'error'
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
// 准备提交的数据
|
||||
const submitData = {
|
||||
@@ -123,11 +141,7 @@ const AddUserAddress = () => {
|
||||
if (loading) {
|
||||
return <Loading className={'px-2'}>加载中</Loading>
|
||||
}
|
||||
console.log(FormData,'FromData')
|
||||
|
||||
if(!FormData){
|
||||
return <Loading className={'px-2'}>加载中</Loading>
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<Form
|
||||
@@ -146,8 +160,8 @@ const AddUserAddress = () => {
|
||||
<Form.Item name="mobile" label="手机号" initialValue={user?.mobile} required>
|
||||
<Input placeholder="请输入手机号" disabled={true} maxLength={11}/>
|
||||
</Form.Item>
|
||||
<Form.Item name="refereeId" label="推荐人ID" initialValue={FormData?.refereeId} required>
|
||||
<Input placeholder="推荐人ID"/>
|
||||
<Form.Item name="refereeId" label="邀请人ID" initialValue={FormData?.refereeId} required>
|
||||
<Input placeholder="邀请人ID"/>
|
||||
</Form.Item>
|
||||
</CellGroup>
|
||||
</Form>
|
||||
|
||||
Reference in New Issue
Block a user