细节优化
This commit is contained in:
@@ -7,12 +7,13 @@ import { UserService, PickerOption } from "@/services/userService";
|
||||
import { clear_login_state } from "@/services/loginService";
|
||||
import { convert_db_gender_to_display } from "@/utils/genderUtils";
|
||||
import { EditModal, GeneralNavbar } from "@/components";
|
||||
import img from "@/config/images";
|
||||
// import img from "@/config/images";
|
||||
import CommonDialog from "@/components/CommonDialog";
|
||||
import { useUserActions, useUserInfo } from "@/store/userStore";
|
||||
import { UserInfoType } from "@/services/userService";
|
||||
import { useCities, useProfessions } from "@/store/pickerOptionsStore";
|
||||
import { handleCustomerService } from "@/services/userService";
|
||||
import evaluateService from "@/services/evaluateService";
|
||||
|
||||
const EditProfilePage: React.FC = () => {
|
||||
const { updateUserInfo } = useUserActions();
|
||||
@@ -57,6 +58,8 @@ const EditProfilePage: React.FC = () => {
|
||||
// 城市数据
|
||||
const cities = useCities();
|
||||
|
||||
const [ntrpTested, setNtrpTested] = useState<boolean>(false);
|
||||
|
||||
// 监听store中的用户信息变化,同步到表单状态
|
||||
useEffect(() => {
|
||||
if (user_info && Object.keys(user_info).length > 0) {
|
||||
@@ -74,6 +77,15 @@ const EditProfilePage: React.FC = () => {
|
||||
city: info?.city ?? "",
|
||||
});
|
||||
}
|
||||
|
||||
const getLastResult = async () => {
|
||||
// 获取测试结果
|
||||
const res = await evaluateService.getLastResult();
|
||||
if (res.code === 0) {
|
||||
setNtrpTested(res.data.has_test_in_last_month);
|
||||
}
|
||||
};
|
||||
getLastResult();
|
||||
}, [user_info]);
|
||||
|
||||
// 页面加载时初始化数据
|
||||
@@ -695,9 +707,9 @@ const EditProfilePage: React.FC = () => {
|
||||
>
|
||||
{form_data.phone
|
||||
? form_data.phone.replace(
|
||||
/(\d{3})(\d{4})(\d{4})/,
|
||||
"$1 $2 $3"
|
||||
)
|
||||
/(\d{3})(\d{4})(\d{4})/,
|
||||
"$1 $2 $3"
|
||||
)
|
||||
: "未绑定"}
|
||||
</Button>
|
||||
<Image
|
||||
@@ -822,6 +834,7 @@ const EditProfilePage: React.FC = () => {
|
||||
showHeader={true}
|
||||
title="选择 NTRP 自评水平"
|
||||
confirmText="保存"
|
||||
ntrpTested={ntrpTested}
|
||||
options={[
|
||||
[
|
||||
{ text: "1.5", value: "1.5" },
|
||||
@@ -831,6 +844,7 @@ const EditProfilePage: React.FC = () => {
|
||||
{ text: "3.5", value: "3.5" },
|
||||
{ text: "4.0", value: "4.0" },
|
||||
{ text: "4.5", value: "4.5" },
|
||||
{ text: "4.5+", value: "4.5+" },
|
||||
],
|
||||
]}
|
||||
type="ntrp"
|
||||
@@ -838,7 +852,7 @@ const EditProfilePage: React.FC = () => {
|
||||
visible={ntrp_picker_visible}
|
||||
setvisible={setNtrpPickerVisible}
|
||||
value={
|
||||
form_data.ntrp_level === "0" ? ["3.0"] : [form_data.ntrp_level]
|
||||
form_data.ntrp_level === "0" ? ["2.5"] : [form_data.ntrp_level]
|
||||
}
|
||||
onChange={handle_ntrp_level_change}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user