From a760e46e8bd9f7668c70c7e70e0711af72197906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Sat, 11 Oct 2025 20:21:47 +0800 Subject: [PATCH] =?UTF-8?q?feat(doctor):=20=E9=87=8D=E6=9E=84=E5=8C=BB?= =?UTF-8?q?=E7=94=9F=E7=94=B3=E8=AF=B7=E9=A1=B5=E9=9D=A2=E5=B9=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E7=94=A8=E6=88=B7=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 重构医生申请页面,移除旧的表单字段,添加微信昵称和头像获取功能 - 实现微信头像上传功能,支持临时显示和服务器上传 - 添加手机号获取功能,通过微信授权获取用户手机号 -优化表单验证逻辑,增加昵称和头像的必填验证 - 移除旧的用户类型选择和证书上传功能 - 更新页面标题从"AddApply"改为"AddDoctor"-修复邀请关系处理逻辑,确保邀请人ID正确传递- 优化页面加载逻辑,依赖用户ID变化重新加载数据 - 移除错误显示逻辑,简化页面结构 - 更新商品列表组件,优化瀑布流布局和样式 -优化商品详情页面,调整底部按钮样式和咨询按钮大小 - 移除页面中的邀请提示弹窗,改为控制台输出 - 更新分类页面逻辑,根据首页导航获取商品分类 - 移除配置加载时的冗余代码,优化加载逻辑 - 更新API接口,移除旧的文章模型和接口定义 - 添加导航和网站字段模型的新属性支持 --- config/app.ts | 2 - src/api/cms/cmsArticle/index.ts | 13 + src/api/cms/cmsNavigation/index.ts | 14 +- src/api/cms/cmsNavigation/model/index.ts | 2 + src/api/cms/cmsWebsiteField/model/index.ts | 4 +- src/api/cmsArticle/index.ts | 218 ---------- src/api/cmsArticle/model/index.ts | 132 ------ src/api/shop/shopOrder/index.ts | 2 +- src/app.ts | 10 +- src/doctor/apply/add.tsx | 480 ++++++++++++++------- src/doctor/index.tsx | 24 +- src/hooks/useConfig.ts | 5 +- src/pages/category/category.tsx | 5 +- src/shop/category/components/GoodsList.tsx | 89 ++-- src/shop/goodsDetail/index.tsx | 10 +- 15 files changed, 442 insertions(+), 568 deletions(-) delete mode 100644 src/api/cmsArticle/index.ts delete mode 100644 src/api/cmsArticle/model/index.ts diff --git a/config/app.ts b/config/app.ts index 042be01..9a19de2 100644 --- a/config/app.ts +++ b/config/app.ts @@ -8,5 +8,3 @@ export const BaseUrl = API_BASE_URL; export const Version = 'v3.0.8'; // 版权信息 export const Copyright = 'WebSoft Inc.'; - -// java -jar CertificateDownloader.jar -k 0kF5OlPr482EZwtn9zGufUcqa7ovgxRL -m 1723321338 -f ./apiclient_key.pem -s 2B933F7C35014A1C363642623E4A62364B34C4EB -o ./ diff --git a/src/api/cms/cmsArticle/index.ts b/src/api/cms/cmsArticle/index.ts index 94339ec..9d95918 100644 --- a/src/api/cms/cmsArticle/index.ts +++ b/src/api/cms/cmsArticle/index.ts @@ -216,3 +216,16 @@ export async function getCmsArticleByCode(code: string) { } return Promise.reject(new Error(res.message)); } + +/** + * 根据code查询文章 + */ +export async function getByCode(code: string) { + const res = await request.get>( + '/cms/cms-article/getByCode/' + code + ); + if (res.code === 0 && res.data) { + return res.data; + } + return Promise.reject(new Error(res.message)); +} diff --git a/src/api/cms/cmsNavigation/index.ts b/src/api/cms/cmsNavigation/index.ts index c293d18..cd892e2 100644 --- a/src/api/cms/cmsNavigation/index.ts +++ b/src/api/cms/cmsNavigation/index.ts @@ -1,6 +1,7 @@ import request from '@/utils/request'; import type { ApiResult, PageResult } from '@/api'; import type { CmsNavigation, CmsNavigationParam } from './model'; +import type {CmsArticle} from "@/api/cms/cmsArticle/model"; /** * 分页查询网站导航记录表 @@ -122,4 +123,15 @@ export async function getNavigationByPath(params: CmsNavigationParam) { return Promise.reject(new Error(res.message)); } - +/** + * 根据code查询导航 + */ +export async function getByCode(code: string) { + const res = await request.get>( + '/cms/cms-navigation/getByCode/' + code + ); + if (res.code === 0 && res.data) { + return res.data; + } + return Promise.reject(new Error(res.message)); +} diff --git a/src/api/cms/cmsNavigation/model/index.ts b/src/api/cms/cmsNavigation/model/index.ts index cdd4f0c..9452bb2 100644 --- a/src/api/cms/cmsNavigation/model/index.ts +++ b/src/api/cms/cmsNavigation/model/index.ts @@ -113,5 +113,7 @@ export interface CmsNavigationParam extends PageParam { parentId?: number; hide?: number; model?: string; + home?: number; + position?: number; keywords?: string; } diff --git a/src/api/cms/cmsWebsiteField/model/index.ts b/src/api/cms/cmsWebsiteField/model/index.ts index 222f79f..00a9874 100644 --- a/src/api/cms/cmsWebsiteField/model/index.ts +++ b/src/api/cms/cmsWebsiteField/model/index.ts @@ -43,7 +43,6 @@ export interface Config { siteName?: string; siteLogo?: string; domain?: string; - apiUrl?: string; icpNo?: string; copyright?: string; loginBgImg?: string; @@ -58,4 +57,7 @@ export interface Config { sysLogo?: string; vipText?: string; vipComments?: string; + deliveryText?: string; + guaranteeText?: string; + openComments?: string; } diff --git a/src/api/cmsArticle/index.ts b/src/api/cmsArticle/index.ts deleted file mode 100644 index 608c0e5..0000000 --- a/src/api/cmsArticle/index.ts +++ /dev/null @@ -1,218 +0,0 @@ -import request from '@/utils/request'; -import type {ApiResult, PageResult} from '@/api'; -import type {CmsArticle, CmsArticleParam} from './model'; - -/** - * 分页查询文章 - */ -export async function pageCmsArticle(params: CmsArticleParam) { - const res = await request.get>>( - '/cms/cms-article/page', - params - ); - if (res.code === 0) { - return res.data; - } - return Promise.reject(new Error(res.message)); -} - -/** - * 查询文章列表 - */ -export async function listCmsArticle(params?: CmsArticleParam) { - const res = await request.get>( - '/cms/cms-article', - params - ); - if (res.code === 0 && res.data) { - return res.data; - } - return Promise.reject(new Error(res.message)); -} - -/** - * 添加文章 - */ -export async function addCmsArticle(data: CmsArticle) { - const res = await request.post>( - '/cms/cms-article', - data - ); - if (res.code === 0) { - return res.message; - } - return Promise.reject(new Error(res.message)); -} - -/** - * 修改文章 - */ -export async function updateCmsArticle(data: CmsArticle) { - const res = await request.put>( - '/cms/cms-article', - data - ); - if (res.code === 0) { - return res.message; - } - return Promise.reject(new Error(res.message)); -} - -/** - * 删除文章 - */ -export async function removeCmsArticle(id?: number) { - const res = await request.del>( - '/cms/cms-article/' + id - ); - if (res.code === 0) { - return res.message; - } - return Promise.reject(new Error(res.message)); -} - -/** - * 批量删除文章 - */ -export async function removeBatchCmsArticle(data: (number | undefined)[]) { - const res = await request.del>( - '/cms/cms-article/batch', - { - data - } - ); - if (res.code === 0) { - return res.message; - } - return Promise.reject(new Error(res.message)); -} - -/** - * 根据id查询文章 - */ -export async function getCmsArticle(id: number) { - const res = await request.get>( - '/cms/cms-article/' + id - ); - if (res.code === 0 && res.data) { - return res.data; - } - return Promise.reject(new Error(res.message)); -} - -export async function getCount(params?: CmsArticleParam) { - const res = await request.get>('/cms/cms-article/data', { - params - }); - if (res.code === 0) { - return res.data; - } - return Promise.reject(new Error(res.message)); -} - -/** - * 上一篇 - * @param params - */ -export async function getPrevious(params?: CmsArticleParam) { - const res = await request.get>( - '/cms/cms-article/getPrevious/' + params?.articleId, - { - params - } - ); - if (res.code === 0) { - return res.data; - } - return Promise.reject(new Error(res.message)); -} - -/** - * 下一篇 - * @param params - */ -export async function getNext(params?: CmsArticleParam) { - const res = await request.get>( - '/cms/cms-article/getNext/' + params?.articleId, - { - params - } - ); - if (res.code === 0) { - return res.data; - } - return Promise.reject(new Error(res.message)); -} - -/** - * 验证文章密码 - * @param params - */ -export async function checkArticlePassword(params?: CmsArticleParam) { - const res = await request.get>( - '/cms/cms-article/checkArticlePassword', - { - params - } - ); - if (res.code === 0) { - return res.message; - } - return Promise.reject(new Error(res.message)); -} - -export async function findTags(params?: CmsArticleParam) { - const res = await request.get>( - '/cms/cms-article/findTags', - { - params - } - ); - if (res.code === 0) { - return res.data; - } - return Promise.reject(new Error(res.message)); -} - -export async function pageTags(params?: CmsArticleParam) { - const res = await request.get>( - '/cms/cms-article/pageTags', - { - params - } - ); - if (res.code === 0) { - return res.data; - } - return Promise.reject(new Error(res.message)); -} - -/** - * 按IDS查询文章 - * @param params - */ -export async function getByIds(params?: CmsArticleParam) { - const res = await request.get>( - '/cms/cms-article/getByIds', - { - params - } - ); - if (res.code === 0) { - return res.data; - } - return Promise.reject(new Error(res.message)); -} - -/** - * 根据code查询文章 - */ -export async function getByCode(code: string) { - const res = await request.get>( - '/cms/cms-article/getByCode/' + code - ); - if (res.code === 0 && res.data) { - return res.data; - } - return Promise.reject(new Error(res.message)); -} diff --git a/src/api/cmsArticle/model/index.ts b/src/api/cmsArticle/model/index.ts deleted file mode 100644 index 5206b48..0000000 --- a/src/api/cmsArticle/model/index.ts +++ /dev/null @@ -1,132 +0,0 @@ -import type { PageParam } from '@/api/index'; - -/** - * 文章 - */ -export interface CmsArticle { - // 文章ID - articleId?: number; - // 文章标题 - title?: string; - // 文章类型 0常规 1视频 - type?: number; - // 文章模型 - model?: string; - // 文章详情页模板 - detail?: string; - // banner图片 - banner?: string; - // 列表显示方式(10小图展示 20大图展示) - showType?: number; - // 话题 - topic?: string; - // 标签 - tags?: any; - // 栏目ID - categoryId?: number; - // 栏目名称 - categoryName?: string; - // 封面图 - image?: string; - // 价格 - price?: number; - startTime?: any; - endTime?: any; - // 缩列图 - thumbnail?: string; - // 来源 - source?: string; - // 产品概述 - overview?: string; - // 虚拟阅读量(仅用作展示) - virtualViews?: number; - // 实际阅读量 - actualViews?: number; - // 购买人数 - bmUsers?: number; - // 浏览权限(0公开 1会员 2密码) - permission?: number; - // 访问密码 - password?: string; - // 确认密码 - password2?: string; - // 发布来源客户端 (APP、H5、小程序等) - platform?: string; - // 文章附件 - files?: string; - // 视频地址 - video?: string; - // 接受的文件类型 - accept?: string; - // 经度 - longitude?: string; - // 纬度 - latitude?: string; - // 所在省份 - province?: string; - // 所在城市 - city?: string; - // 所在辖区 - region?: string; - // 街道地址 - address?: string; - // 点赞数 - likes?: number; - // pdf地址 - pdfUrl?: string; - // 评论数 - commentNumbers?: number; - // 提醒谁看 - toUsers?: string; - // 文章内容 - content?: string; - // 是否推荐 - recommend?: number; - // 用户ID - userId?: number; - // 排序(数字越小越靠前) - sortNumber?: number; - // 备注 - comments?: string; - // 状态, 0已发布, 1待审核 2已驳回 3违规内容 - status?: number; - // 是否删除, 0否, 1是 - deleted?: number; - // 租户id - tenantId?: number; - // 创建时间 - createTime?: string; - // 修改时间 - updateTime?: string; - // 父级id - parentId?: number; - nickname?: string; - username?: string; - author?: string; - shopId?: number; - tenantName?: string; - logo?: string; - fileList?: any; - // 编辑器类型 - editor?: number; -} - -/** - * 文章搜索条件 - */ -export interface CmsArticleParam extends PageParam { - articleId?: number; - articleIds?: string; - categoryId?: number; - parentId?: number; - status?: number; - // 是否推荐 - recommend?: number; - keywords?: string; - // 验证密码 - password?: string; - password2?: string; - tags?: string; - detail?: string; - sceneType?: string; -} diff --git a/src/api/shop/shopOrder/index.ts b/src/api/shop/shopOrder/index.ts index ca1e805..c2637c4 100644 --- a/src/api/shop/shopOrder/index.ts +++ b/src/api/shop/shopOrder/index.ts @@ -118,7 +118,7 @@ export interface WxPayResult { */ export async function createOrder(data: OrderCreateRequest) { const res = await request.post>( - '/shop/shop-order', + '/shop/shop-order', data ); if (res.code === 0) { diff --git a/src/app.ts b/src/app.ts index 94746fc..3997a8e 100644 --- a/src/app.ts +++ b/src/app.ts @@ -11,7 +11,7 @@ import { useConfig } from "@/hooks/useConfig"; // 引入新的自定义Hook function App(props: { children: any; }) { const { refetch: handleTheme } = useConfig(); // 使用新的Hook - + const reload = () => { Taro.login({ success: (res) => { @@ -78,11 +78,7 @@ function App(props: { children: any; }) { // 显示邀请提示 setTimeout(() => { - Taro.showToast({ - title: `检测到邀请信息 ID:${inviteParams.inviter}`, - icon: 'success', - duration: 3000 - }) + console.log(`检测到邀请信息 ID:${inviteParams.inviter}`) }, 1000) } else { @@ -102,4 +98,4 @@ function App(props: { children: any; }) { return props.children } -export default App \ No newline at end of file +export default App diff --git a/src/doctor/apply/add.tsx b/src/doctor/apply/add.tsx index d2f5f87..2a12d33 100644 --- a/src/doctor/apply/add.tsx +++ b/src/doctor/apply/add.tsx @@ -1,69 +1,208 @@ import {useEffect, useState, useRef} from "react"; -import {Loading, CellGroup, Input, Form, Radio, InputNumber, TextArea, ConfigProvider} from '@nutui/nutui-react-taro' +import {Loading, CellGroup, Input, Form, Avatar, Button, Space} from '@nutui/nutui-react-taro' import {Edit} from '@nutui/icons-react-taro' import Taro from '@tarojs/taro' -import {Image} from '@tarojs/components'; +import {View} from '@tarojs/components' import FixedButton from "@/components/FixedButton"; -import {DictData} from "@/api/system/dict-data/model"; -import {listDictData} from "@/api/system/dict-data"; -import {addShopUser, getShopUser} from "@/api/shop/shopUser"; -import {ShopUser} from "@/api/shop/shopUser/model"; -import {uploadFile} from "@/api/system/file"; import {useUser} from "@/hooks/useUser"; +import {TenantId} from "@/config/app"; +import {updateUser} from "@/api/system/user"; +import {User} from "@/api/system/user/model"; +import {getStoredInviteParams, handleInviteRelation} from "@/utils/invite"; +import {addShopDealerUser} from "@/api/shop/shopDealerUser"; +import {listUserRole, updateUserRole} from "@/api/system/userRole"; -const customTheme = { - nutuiInputnumberButtonWidth: '30px', - nutuiInputnumberButtonHeight: '30px', - nutuiInputnumberButtonBorderRadius: '2px', - nutuiInputnumberButtonBackgroundColor: `#f4f4f4`, - nutuiInputnumberInputHeight: '30px', - nutuiInputnumberInputMargin: '0 2px', +// 类型定义 +interface ChooseAvatarEvent { + detail: { + avatarUrl: string; + }; } -const AddApply = () => { - const {user} = useUser() +interface InputEvent { + detail: { + value: string; + }; +} + +const AddDoctor = () => { + const {user, loginUser} = useUser() const [loading, setLoading] = useState(true) - const [FormData, setFormData] = useState() - const [userType, setUserType] = useState() + const [FormData, setFormData] = useState() const formRef = useRef(null) const reload = async () => { - const userId = Taro.getStorageSync('UserId') - if(!userId || userId == '') return - const shopUser = await getShopUser(Number(Taro.getStorageSync('UserId'))) - if(shopUser){ - console.log(shopUser.type,'shopUsershopUsershopUsershopUsershopUsershopUsershopUser') + const inviteParams = getStoredInviteParams() + if (inviteParams?.inviter) { setFormData({ - ...shopUser, - type : Number(shopUser.type) + ...user, + refereeId: Number(inviteParams.inviter), + // 清空昵称,强制用户手动输入 + nickname: '', + }) + } else { + // 如果没有邀请参数,也要确保昵称为空 + setFormData({ + ...user, + nickname: '', }) } - const userType = await listDictData({dictCode: 'UserType'}) - if(userType){ - setUserType(userType) + } + + + const uploadAvatar = ({detail}: ChooseAvatarEvent) => { + // 先更新本地显示的头像(临时显示) + const tempFormData = { + ...FormData, + avatar: `${detail.avatarUrl}`, } + setFormData(tempFormData) + + Taro.uploadFile({ + url: 'https://server.websoft.top/api/oss/upload', + filePath: detail.avatarUrl, + name: 'file', + header: { + 'content-type': 'application/json', + TenantId + }, + success: async (res) => { + const data = JSON.parse(res.data); + if (data.code === 0) { + const finalAvatarUrl = `${data.data.thumbnail}` + + try { + // 使用 useUser hook 的 updateUser 方法更新头像 + await updateUser({ + avatar: finalAvatarUrl + }) + + Taro.showToast({ + title: '头像上传成功', + icon: 'success', + duration: 1500 + }) + } catch (error) { + console.error('更新用户头像失败:', error) + } + + // 无论用户信息更新是否成功,都要更新本地FormData + const finalFormData = { + ...tempFormData, + avatar: finalAvatarUrl + } + setFormData(finalFormData) + + // 同步更新表单字段 + if (formRef.current) { + formRef.current.setFieldsValue({ + avatar: finalAvatarUrl + }) + } + } else { + // 上传失败,恢复原来的头像 + setFormData({ + ...FormData, + avatar: user?.avatar || '' + }) + Taro.showToast({ + title: '上传失败', + icon: 'error' + }) + } + }, + fail: (error) => { + console.error('上传头像失败:', error) + Taro.showToast({ + title: '上传失败', + icon: 'error' + }) + // 恢复原来的头像 + setFormData({ + ...FormData, + avatar: user?.avatar || '' + }) + } + }) } // 提交表单 const submitSucceed = async (values: any) => { - if (!FormData?.age || FormData?.age == 0) { - Taro.showToast({ - title: `请填写年龄`, - icon: 'error' - }); - return; - } try { + // 验证必填字段 + if (!values.phone && !FormData?.phone) { + Taro.showToast({ + title: '请先获取手机号', + icon: 'error' + }); + return; + } + + // 验证昵称:必须填写且不能是默认的微信昵称 + const nickname = values.realName || FormData?.nickname || ''; + if (!nickname || nickname.trim() === '') { + Taro.showToast({ + title: '请填写昵称', + icon: 'error' + }); + return; + } + + // 检查是否为默认的微信昵称(常见的默认昵称) + const defaultNicknames = ['微信用户', 'WeChat User', '微信昵称']; + if (defaultNicknames.includes(nickname.trim())) { + Taro.showToast({ + title: '请填写真实昵称,不能使用默认昵称', + icon: 'error' + }); + return; + } + + // 验证昵称长度 + if (nickname.trim().length < 2) { + Taro.showToast({ + title: '昵称至少需要2个字符', + icon: 'error' + }); + return; + } + + if (!values.avatar && !FormData?.avatar) { + Taro.showToast({ + title: '请上传头像', + icon: 'error' + }); + return; + } + console.log(values,FormData) + + const roles = await listUserRole({userId: user?.userId}) + console.log(roles, 'roles...') + // 准备提交的数据 - await addShopUser({ - userId: Taro.getStorageSync('UserId'), - type: values.type, - username: user?.username, - nickname: user?.nickname, + await updateUser({ + userId: user?.userId, + nickname: values.realName || FormData?.nickname, + phone: values.phone || FormData?.phone, + avatar: values.avatar || FormData?.avatar, + refereeId: values.refereeId || FormData?.refereeId + }); + + await addShopDealerUser({ + userId: user?.userId, realName: values.realName || FormData?.nickname, - phone: values.phone || FormData?.phone + mobile: values.phone || FormData?.phone, + refereeId: values.refereeId || FormData?.refereeId }) + if (roles.length > 0) { + await updateUserRole({ + ...roles[0], + roleId: 1848 + }) + } + + Taro.showToast({ title: `注册成功`, icon: 'success' @@ -78,6 +217,127 @@ const AddApply = () => { } } + // 获取微信昵称 + const getWxNickname = (nickname: string) => { + // 更新表单数据 + const updatedFormData = { + ...FormData, + nickname: nickname + } + setFormData(updatedFormData); + + // 同步更新表单字段 + if (formRef.current) { + formRef.current.setFieldsValue({ + realName: nickname + }) + } + } + + /* 获取用户手机号 */ + const handleGetPhoneNumber = ({detail}: { detail: { code?: string, encryptedData?: string, iv?: string } }) => { + const {code, encryptedData, iv} = detail + Taro.login({ + success: (loginRes) => { + if (code) { + Taro.request({ + url: 'https://server.websoft.top/api/wx-login/loginByMpWxPhone', + method: 'POST', + data: { + authCode: loginRes.code, + code, + encryptedData, + iv, + notVerifyPhone: true, + refereeId: 0, + sceneType: 'save_referee', + tenantId: TenantId + }, + header: { + 'content-type': 'application/json', + TenantId + }, + success: async function (res) { + if (res.data.code == 1) { + Taro.showToast({ + title: res.data.message, + icon: 'error', + duration: 2000 + }) + return false; + } + // 登录成功 + const token = res.data.data.access_token; + const userData = res.data.data.user; + console.log(userData, 'userData...') + // 使用useUser Hook的loginUser方法更新状态 + loginUser(token, userData); + + if (userData.phone) { + console.log('手机号已获取', userData.phone) + const updatedFormData = { + ...FormData, + phone: userData.phone, + // 不自动填充微信昵称,保持用户已输入的昵称 + nickname: FormData?.nickname || '', + // 只在没有头像时才使用微信头像 + avatar: FormData?.avatar || userData.avatar + } + setFormData(updatedFormData) + + // 更新表单字段值 + if (formRef.current) { + formRef.current.setFieldsValue({ + phone: userData.phone, + // 不覆盖用户已输入的昵称 + realName: FormData?.nickname || '', + avatar: FormData?.avatar || userData.avatar + }) + } + + Taro.showToast({ + title: '手机号获取成功', + icon: 'success', + duration: 1500 + }) + } + + + // 处理邀请关系 + if (userData?.userId) { + try { + const inviteSuccess = await handleInviteRelation(userData.userId) + if (inviteSuccess) { + Taro.showToast({ + title: '邀请关系建立成功', + icon: 'success', + duration: 2000 + }) + } + } catch (error) { + console.error('处理邀请关系失败:', error) + } + } + + // 显示登录成功提示 + // Taro.showToast({ + // title: '注册成功', + // icon: 'success', + // duration: 1500 + // }) + + // 不需要重新启动小程序,状态已经通过useUser更新 + // 可以选择性地刷新当前页面数据 + // await reload(); + } + }) + } else { + console.log('登录失败!') + } + } + }) + } + // 处理固定按钮点击事件 const handleFixedButtonClick = () => { // 触发表单提交 @@ -88,25 +348,17 @@ const AddApply = () => { console.log(error, 'err...') } - const uploadImg1 = () => { - uploadFile().then(data => { - setFormData({ - ...FormData, - uploadImg1: data.url - }) - }); - } - useEffect(() => { reload().then(() => { setLoading(false) }) - }, []); // 依赖用户ID,当用户变化时重新加载 + }, [user?.userId]); // 依赖用户ID,当用户变化时重新加载 // 当FormData变化时,同步更新表单字段值 useEffect(() => { if (formRef.current && FormData) { formRef.current.setFieldsValue({ + refereeId: FormData.refereeId, phone: FormData.phone, avatar: FormData.avatar, realName: FormData.nickname @@ -128,106 +380,42 @@ const AddApply = () => { onFinish={(values) => submitSucceed(values)} onFinishFailed={(errors) => submitFailed(errors)} > + - {JSON.stringify(FormData)} - - { - setFormData({ - ...FormData, - type: value - }) - }} - > - {userType?.map((item) => ( - - {item.label} - - ))} - - - - { - setFormData({ - ...FormData, - realName: value - }) - }} - /> - - - - - 男 - - - 女 - - + + - - - { - setFormData({ - ...FormData, - age: Number(value) - }) - }} - min={0} - max={120} - step={1} + + + - + + + + - -