This commit is contained in:
张成
2025-12-04 10:45:25 +08:00
parent a67383d12c
commit c8b1739313
4 changed files with 23 additions and 30 deletions

View File

@@ -13,20 +13,13 @@ import { getCurrentFullPath } from "@/utils";
import evaluateService from "@/services/evaluateService";
import { useUserActions } from "@/store/userStore";
import { EvaluateCallback, EvaluateScene } from "@/store/evaluateStore";
import { useNtrpLevels } from "@/store/pickerOptionsStore";
import NTRPTestEntryCard from "../NTRPTestEntryCard";
import NtrpPopupGuide from "../NTRPPopupGuide";
import Picker from "../Picker/Picker";
import CloseIcon from "@/static/ntrp/ntrp_popup_close.svg";
import styles from "./index.module.scss";
const ntrpLevels = ["1.5", "2.0", "2.5", "3.0", "3.5", "4.0", "4.5", "4.5+"];
const options = [
ntrpLevels.map((item) => ({
text: item,
value: item,
})),
];
export enum EvaluateType {
EDIT = "edit",
EVALUATE = "evaluate",
@@ -74,6 +67,13 @@ const NTRPEvaluatePopup = (props: NTRPEvaluatePopupProps, ref) => {
const [ntrp, setNtrp] = useState<string>("");
const [guideShow, setGuideShow] = useState(() => showGuide);
const { updateUserInfo } = useUserActions();
const ntrpLevels = useNtrpLevels();
const options = [
ntrpLevels.map((item) => ({
text: item,
value: item,
})),
];
const [evaCallback, setEvaCallback] = useState<EvaluateCallback>({
type: "",
next: () => {},

View File

@@ -8,7 +8,7 @@ import { UserService, PickerOption } from "@/services/userService";
import { PopupPicker } from "@/components/Picker/index";
import { useUserActions, useNicknameChangeStatus } from "@/store/userStore";
import { UserInfoType } from "@/services/userService";
import { useCities, useProfessions } from "@/store/pickerOptionsStore";
import { useCities, useProfessions, useNtrpLevels } from "@/store/pickerOptionsStore";
import { formatNtrpDisplay } from "@/utils/helper";
import { useGlobalState } from "@/store/global";
import evaluateService from "@/services/evaluateService";
@@ -80,6 +80,7 @@ const UserInfoCardComponent: React.FC<UserInfoCardProps> = ({
const nickname_change_status = useNicknameChangeStatus();
const { setShowGuideBar } = useGlobalState();
const { updateUserInfo, updateNickname } = useUserActions();
const ntrpLevels = useNtrpLevels();
const [ntrpTested, setNtrpTested] = useState(false);
// 使用 useRef 记录上一次的 user_info只在真正变化时打印
@@ -674,16 +675,10 @@ const UserInfoCardComponent: React.FC<UserInfoCardProps> = ({
showHeader={true}
title="选择 NTRP 自评水平"
ntrpTested={ntrpTested}
options={[
{ text: "1.5", value: "1.5" },
{ text: "2.0", value: "2.0" },
{ text: "2.5", value: "2.5" },
{ text: "3.0", value: "3.0" },
{ text: "3.5", value: "3.5" },
{ text: "4.0", value: "4.0" },
{ text: "4.5", value: "4.5" },
{ text: "4.5+", value: "4.5+" },
]}
options={ntrpLevels.map((level) => ({
text: level,
value: level,
}))}
type="ntrp"
img={user_info.avatar_url || ""}
visible={ntrp_picker_visible}