1
This commit is contained in:
@@ -13,20 +13,13 @@ import { getCurrentFullPath } from "@/utils";
|
|||||||
import evaluateService from "@/services/evaluateService";
|
import evaluateService from "@/services/evaluateService";
|
||||||
import { useUserActions } from "@/store/userStore";
|
import { useUserActions } from "@/store/userStore";
|
||||||
import { EvaluateCallback, EvaluateScene } from "@/store/evaluateStore";
|
import { EvaluateCallback, EvaluateScene } from "@/store/evaluateStore";
|
||||||
|
import { useNtrpLevels } from "@/store/pickerOptionsStore";
|
||||||
import NTRPTestEntryCard from "../NTRPTestEntryCard";
|
import NTRPTestEntryCard from "../NTRPTestEntryCard";
|
||||||
import NtrpPopupGuide from "../NTRPPopupGuide";
|
import NtrpPopupGuide from "../NTRPPopupGuide";
|
||||||
import Picker from "../Picker/Picker";
|
import Picker from "../Picker/Picker";
|
||||||
import CloseIcon from "@/static/ntrp/ntrp_popup_close.svg";
|
import CloseIcon from "@/static/ntrp/ntrp_popup_close.svg";
|
||||||
import styles from "./index.module.scss";
|
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 {
|
export enum EvaluateType {
|
||||||
EDIT = "edit",
|
EDIT = "edit",
|
||||||
EVALUATE = "evaluate",
|
EVALUATE = "evaluate",
|
||||||
@@ -74,6 +67,13 @@ const NTRPEvaluatePopup = (props: NTRPEvaluatePopupProps, ref) => {
|
|||||||
const [ntrp, setNtrp] = useState<string>("");
|
const [ntrp, setNtrp] = useState<string>("");
|
||||||
const [guideShow, setGuideShow] = useState(() => showGuide);
|
const [guideShow, setGuideShow] = useState(() => showGuide);
|
||||||
const { updateUserInfo } = useUserActions();
|
const { updateUserInfo } = useUserActions();
|
||||||
|
const ntrpLevels = useNtrpLevels();
|
||||||
|
const options = [
|
||||||
|
ntrpLevels.map((item) => ({
|
||||||
|
text: item,
|
||||||
|
value: item,
|
||||||
|
})),
|
||||||
|
];
|
||||||
const [evaCallback, setEvaCallback] = useState<EvaluateCallback>({
|
const [evaCallback, setEvaCallback] = useState<EvaluateCallback>({
|
||||||
type: "",
|
type: "",
|
||||||
next: () => {},
|
next: () => {},
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { UserService, PickerOption } from "@/services/userService";
|
|||||||
import { PopupPicker } from "@/components/Picker/index";
|
import { PopupPicker } from "@/components/Picker/index";
|
||||||
import { useUserActions, useNicknameChangeStatus } from "@/store/userStore";
|
import { useUserActions, useNicknameChangeStatus } from "@/store/userStore";
|
||||||
import { UserInfoType } from "@/services/userService";
|
import { UserInfoType } from "@/services/userService";
|
||||||
import { useCities, useProfessions } from "@/store/pickerOptionsStore";
|
import { useCities, useProfessions, useNtrpLevels } from "@/store/pickerOptionsStore";
|
||||||
import { formatNtrpDisplay } from "@/utils/helper";
|
import { formatNtrpDisplay } from "@/utils/helper";
|
||||||
import { useGlobalState } from "@/store/global";
|
import { useGlobalState } from "@/store/global";
|
||||||
import evaluateService from "@/services/evaluateService";
|
import evaluateService from "@/services/evaluateService";
|
||||||
@@ -80,6 +80,7 @@ const UserInfoCardComponent: React.FC<UserInfoCardProps> = ({
|
|||||||
const nickname_change_status = useNicknameChangeStatus();
|
const nickname_change_status = useNicknameChangeStatus();
|
||||||
const { setShowGuideBar } = useGlobalState();
|
const { setShowGuideBar } = useGlobalState();
|
||||||
const { updateUserInfo, updateNickname } = useUserActions();
|
const { updateUserInfo, updateNickname } = useUserActions();
|
||||||
|
const ntrpLevels = useNtrpLevels();
|
||||||
const [ntrpTested, setNtrpTested] = useState(false);
|
const [ntrpTested, setNtrpTested] = useState(false);
|
||||||
|
|
||||||
// 使用 useRef 记录上一次的 user_info,只在真正变化时打印
|
// 使用 useRef 记录上一次的 user_info,只在真正变化时打印
|
||||||
@@ -674,16 +675,10 @@ const UserInfoCardComponent: React.FC<UserInfoCardProps> = ({
|
|||||||
showHeader={true}
|
showHeader={true}
|
||||||
title="选择 NTRP 自评水平"
|
title="选择 NTRP 自评水平"
|
||||||
ntrpTested={ntrpTested}
|
ntrpTested={ntrpTested}
|
||||||
options={[
|
options={ntrpLevels.map((level) => ({
|
||||||
{ text: "1.5", value: "1.5" },
|
text: level,
|
||||||
{ text: "2.0", value: "2.0" },
|
value: level,
|
||||||
{ 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+" },
|
|
||||||
]}
|
|
||||||
type="ntrp"
|
type="ntrp"
|
||||||
img={user_info.avatar_url || ""}
|
img={user_info.avatar_url || ""}
|
||||||
visible={ntrp_picker_visible}
|
visible={ntrp_picker_visible}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { UserService } from "@/services/userService";
|
|||||||
export interface PickerOptionState {
|
export interface PickerOptionState {
|
||||||
cities: any[];
|
cities: any[];
|
||||||
professions: any[];
|
professions: any[];
|
||||||
|
ntrpLevels: string[];
|
||||||
getCities: () => Promise<any>;
|
getCities: () => Promise<any>;
|
||||||
getProfessions: () => Promise<any>;
|
getProfessions: () => Promise<any>;
|
||||||
}
|
}
|
||||||
@@ -12,6 +13,7 @@ export interface PickerOptionState {
|
|||||||
export const usePickerOption = create<PickerOptionState>((set) => ({
|
export const usePickerOption = create<PickerOptionState>((set) => ({
|
||||||
cities: [],
|
cities: [],
|
||||||
professions: [],
|
professions: [],
|
||||||
|
ntrpLevels: ["1.5", "2.0", "2.5", "3.0", "3.5", "4.0", "4.5", "4.5+"],
|
||||||
getCities: async () => {
|
getCities: async () => {
|
||||||
try {
|
try {
|
||||||
const res = await UserService.getCities();
|
const res = await UserService.getCities();
|
||||||
@@ -37,3 +39,4 @@ export const usePickerOption = create<PickerOptionState>((set) => ({
|
|||||||
export const useCities = () => usePickerOption((state) => state.cities);
|
export const useCities = () => usePickerOption((state) => state.cities);
|
||||||
export const useProfessions = () =>
|
export const useProfessions = () =>
|
||||||
usePickerOption((state) => state.professions);
|
usePickerOption((state) => state.professions);
|
||||||
|
export const useNtrpLevels = () => usePickerOption((state) => state.ntrpLevels);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import {
|
|||||||
useNicknameChangeStatus,
|
useNicknameChangeStatus,
|
||||||
} from "@/store/userStore";
|
} from "@/store/userStore";
|
||||||
import { UserInfoType } from "@/services/userService";
|
import { UserInfoType } from "@/services/userService";
|
||||||
import { useCities, useProfessions } from "@/store/pickerOptionsStore";
|
import { useCities, useProfessions, useNtrpLevels } from "@/store/pickerOptionsStore";
|
||||||
import { handleCustomerService } from "@/services/userService";
|
import { handleCustomerService } from "@/services/userService";
|
||||||
import evaluateService from "@/services/evaluateService";
|
import evaluateService from "@/services/evaluateService";
|
||||||
|
|
||||||
@@ -24,6 +24,7 @@ const EditProfilePage: React.FC = () => {
|
|||||||
// 直接从store获取用户信息,确保响应式更新
|
// 直接从store获取用户信息,确保响应式更新
|
||||||
const user_info = useUserInfo();
|
const user_info = useUserInfo();
|
||||||
const nickname_change_status = useNicknameChangeStatus();
|
const nickname_change_status = useNicknameChangeStatus();
|
||||||
|
const ntrpLevels = useNtrpLevels();
|
||||||
|
|
||||||
// 表单状态,基于store中的用户信息初始化
|
// 表单状态,基于store中的用户信息初始化
|
||||||
const getInitialFormData = () => {
|
const getInitialFormData = () => {
|
||||||
@@ -894,16 +895,10 @@ const EditProfilePage: React.FC = () => {
|
|||||||
title="选择 NTRP 自评水平"
|
title="选择 NTRP 自评水平"
|
||||||
confirmText="保存"
|
confirmText="保存"
|
||||||
ntrpTested={ntrpTested}
|
ntrpTested={ntrpTested}
|
||||||
options={[
|
options={ntrpLevels.map((level) => ({
|
||||||
{ text: "1.5", value: "1.5" },
|
text: level,
|
||||||
{ text: "2.0", value: "2.0" },
|
value: level,
|
||||||
{ 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+" },
|
|
||||||
]}
|
|
||||||
type="ntrp"
|
type="ntrp"
|
||||||
// img={(user_info as UserInfoType)?.avatar_url}
|
// img={(user_info as UserInfoType)?.avatar_url}
|
||||||
visible={ntrp_picker_visible}
|
visible={ntrp_picker_visible}
|
||||||
|
|||||||
Reference in New Issue
Block a user