优化省市区和占位图片
This commit is contained in:
@@ -6,7 +6,11 @@ import "./index.scss";
|
||||
import { EditModal } from "@/components";
|
||||
import { UserService, PickerOption } from "@/services/userService";
|
||||
import { PopupPicker } from "@/components/Picker/index";
|
||||
import { useUserActions, useNicknameChangeStatus, useLastTestResult } from "@/store/userStore";
|
||||
import {
|
||||
useUserActions,
|
||||
useNicknameChangeStatus,
|
||||
useLastTestResult,
|
||||
} from "@/store/userStore";
|
||||
import { UserInfoType } from "@/services/userService";
|
||||
import {
|
||||
useCities,
|
||||
@@ -82,7 +86,8 @@ const UserInfoCardComponent: React.FC<UserInfoCardProps> = ({
|
||||
}) => {
|
||||
const nickname_change_status = useNicknameChangeStatus();
|
||||
const { setShowGuideBar } = useGlobalState();
|
||||
const { updateUserInfo, updateNickname, fetchLastTestResult } = useUserActions();
|
||||
const { updateUserInfo, updateNickname, fetchLastTestResult } =
|
||||
useUserActions();
|
||||
const ntrpLevels = useNtrpLevels();
|
||||
// 使用全局状态中的测试结果,避免重复调用接口
|
||||
const lastTestResult = useLastTestResult();
|
||||
@@ -295,8 +300,8 @@ const UserInfoCardComponent: React.FC<UserInfoCardProps> = ({
|
||||
|
||||
// 处理地区选择
|
||||
const handle_location_change = (e: any) => {
|
||||
const [country, province, city] = e;
|
||||
handle_field_edit({ country, province, city });
|
||||
const [province, city, district] = e;
|
||||
handle_field_edit({ province, city, district });
|
||||
};
|
||||
|
||||
// 处理NTRP水平选择
|
||||
@@ -307,8 +312,8 @@ const UserInfoCardComponent: React.FC<UserInfoCardProps> = ({
|
||||
|
||||
// 处理职业选择
|
||||
const handle_occupation_change = (e: any) => {
|
||||
const [country, province, city] = e;
|
||||
handle_field_edit("occupation", `${country} ${province} ${city}`);
|
||||
const [firstVal, secondVal, thirdVal] = e;
|
||||
handle_field_edit("occupation", `${firstVal} ${secondVal} ${thirdVal}`);
|
||||
};
|
||||
const handle_edit_modal_cancel = () => {
|
||||
// 关闭编辑弹窗时显示 GuideBar
|
||||
@@ -565,12 +570,12 @@ const UserInfoCardComponent: React.FC<UserInfoCardProps> = ({
|
||||
<Text>选择职业</Text>
|
||||
</View>
|
||||
) : null}
|
||||
{user_info.country || user_info.province || user_info.city ? (
|
||||
{user_info.province || user_info.city || user_info.district ? (
|
||||
<View
|
||||
className="tag_item"
|
||||
onClick={() => editable && handle_open_edit_modal("location")}
|
||||
>
|
||||
<Text className="tag_text">{`${user_info.province}${user_info.city}`}</Text>
|
||||
<Text className="tag_text">{`${user_info.city}${user_info.district}`}</Text>
|
||||
</View>
|
||||
) : is_current_user ? (
|
||||
<View
|
||||
@@ -665,8 +670,8 @@ const UserInfoCardComponent: React.FC<UserInfoCardProps> = ({
|
||||
visible={location_picker_visible}
|
||||
setvisible={setLocationPickerVisible}
|
||||
value={
|
||||
form_data.country
|
||||
? [form_data.country, form_data.province, form_data.city]
|
||||
form_data.province
|
||||
? [form_data.province, form_data.city, form_data.district]
|
||||
: getDefaultOption(cities)
|
||||
}
|
||||
onChange={handle_location_change}
|
||||
@@ -678,15 +683,12 @@ const UserInfoCardComponent: React.FC<UserInfoCardProps> = ({
|
||||
showHeader={true}
|
||||
title="选择 NTRP 自评水平"
|
||||
ntrpTested={ntrpTested}
|
||||
options={ntrpLevels.map((level) => ({
|
||||
text: level,
|
||||
value: level,
|
||||
}))}
|
||||
options={ntrpLevels}
|
||||
type="ntrp"
|
||||
img={user_info.avatar_url || ""}
|
||||
visible={ntrp_picker_visible}
|
||||
setvisible={setNtrpPickerVisible}
|
||||
value={[form_data.ntrp_level || "2.5"]}
|
||||
value={!form_data.ntrp_level ? ["2.5"] : [form_data.ntrp_level]}
|
||||
onChange={handle_ntrp_level_change}
|
||||
/>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user