样式优化
This commit is contained in:
@@ -41,7 +41,7 @@ import { useCities, useProfessions } from "@/store/pickerOptionsStore";
|
||||
|
||||
// 用户信息卡片组件属性
|
||||
interface UserInfoCardProps {
|
||||
editable: boolean,
|
||||
editable: boolean;
|
||||
user_info: Partial<UserInfoType>;
|
||||
is_current_user: boolean;
|
||||
is_following?: boolean;
|
||||
@@ -85,8 +85,8 @@ export const UserInfoCard: React.FC<UserInfoCardProps> = ({
|
||||
const [form_data, set_form_data] = useState<Partial<UserInfoType>>({});
|
||||
|
||||
useDidShow(() => {
|
||||
set_form_data({ ...user_info })
|
||||
})
|
||||
set_form_data({ ...user_info });
|
||||
});
|
||||
|
||||
// 职业数据
|
||||
const professions = useProfessions();
|
||||
@@ -188,8 +188,8 @@ export const UserInfoCard: React.FC<UserInfoCardProps> = ({
|
||||
) {
|
||||
await updateUserInfo({ ...field });
|
||||
set_form_data((prev) => {
|
||||
return { ...prev, ...field }
|
||||
})
|
||||
return { ...prev, ...field };
|
||||
});
|
||||
// 更新本地状态
|
||||
// setFormData((prev) => ({ ...prev, ...field }));
|
||||
// setUserInfo((prev) => ({ ...prev, ...field }));
|
||||
@@ -198,8 +198,8 @@ export const UserInfoCard: React.FC<UserInfoCardProps> = ({
|
||||
const update_data = { [field as string]: value };
|
||||
await updateUserInfo(update_data);
|
||||
set_form_data((prev) => {
|
||||
return { ...prev, ...update_data }
|
||||
})
|
||||
return { ...prev, ...update_data };
|
||||
});
|
||||
// 更新本地状态
|
||||
// setFormData((prev) => ({ ...prev, [field as string]: value }));
|
||||
// setUserInfo((prev) => ({ ...prev, [field as string]: value }));
|
||||
@@ -287,7 +287,7 @@ export const UserInfoCard: React.FC<UserInfoCardProps> = ({
|
||||
}
|
||||
|
||||
return defaultOptions;
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<View className="user_info_card">
|
||||
@@ -308,6 +308,7 @@ export const UserInfoCard: React.FC<UserInfoCardProps> = ({
|
||||
<View className="tag_item" onClick={on_edit}>
|
||||
<Image
|
||||
className="tag_icon"
|
||||
style="gap: 0;"
|
||||
src={require("../../static/userInfo/edit.svg")}
|
||||
/>
|
||||
</View>
|
||||
@@ -335,7 +336,8 @@ export const UserInfoCard: React.FC<UserInfoCardProps> = ({
|
||||
</Text>
|
||||
<Text className="stat_label">粉丝</Text>
|
||||
</View>
|
||||
<View className="stat_item clickable"
|
||||
<View
|
||||
className="stat_item clickable"
|
||||
onClick={() => onTab?.("hosted")}
|
||||
>
|
||||
<Text className="stat_number">
|
||||
@@ -343,7 +345,8 @@ export const UserInfoCard: React.FC<UserInfoCardProps> = ({
|
||||
</Text>
|
||||
<Text className="stat_label">主办</Text>
|
||||
</View>
|
||||
<View className="stat_item clickable"
|
||||
<View
|
||||
className="stat_item clickable"
|
||||
onClick={() => onTab?.("participated")}
|
||||
>
|
||||
<Text className="stat_number">
|
||||
@@ -430,7 +433,8 @@ export const UserInfoCard: React.FC<UserInfoCardProps> = ({
|
||||
className="tag_item"
|
||||
onClick={() => {
|
||||
editable && handle_open_edit_modal("ntrp_level");
|
||||
}}>
|
||||
}}
|
||||
>
|
||||
<Text className="tag_text">{`NTRP ${user_info.ntrp_level}`}</Text>
|
||||
</View>
|
||||
) : is_current_user ? (
|
||||
@@ -448,7 +452,8 @@ export const UserInfoCard: React.FC<UserInfoCardProps> = ({
|
||||
className="tag_item"
|
||||
onClick={() => {
|
||||
editable && handle_open_edit_modal("occupation");
|
||||
}}>
|
||||
}}
|
||||
>
|
||||
<Text className="tag_text">
|
||||
{user_info.occupation.split(" ")[2]}
|
||||
</Text>
|
||||
@@ -466,7 +471,8 @@ export const UserInfoCard: React.FC<UserInfoCardProps> = ({
|
||||
{user_info.country || user_info.province || user_info.city ? (
|
||||
<View
|
||||
className="tag_item"
|
||||
onClick={() => editable && handle_open_edit_modal("location")}>
|
||||
onClick={() => editable && handle_open_edit_modal("location")}
|
||||
>
|
||||
<Text className="tag_text">{`${user_info.province}${user_info.city}`}</Text>
|
||||
</View>
|
||||
) : is_current_user ? (
|
||||
@@ -534,7 +540,11 @@ export const UserInfoCard: React.FC<UserInfoCardProps> = ({
|
||||
options={cities}
|
||||
visible={location_picker_visible}
|
||||
setvisible={setLocationPickerVisible}
|
||||
value={form_data.country ? [form_data.country, form_data.province, form_data.city] : getDefaultOption(cities)}
|
||||
value={
|
||||
form_data.country
|
||||
? [form_data.country, form_data.province, form_data.city]
|
||||
: getDefaultOption(cities)
|
||||
}
|
||||
onChange={handle_location_change}
|
||||
/>
|
||||
)}
|
||||
@@ -558,7 +568,9 @@ export const UserInfoCard: React.FC<UserInfoCardProps> = ({
|
||||
img={user_info.avatar_url || ""}
|
||||
visible={ntrp_picker_visible}
|
||||
setvisible={setNtrpPickerVisible}
|
||||
value={form_data.ntrp_level === "0" ? ["3.0"] : [form_data.ntrp_level]}
|
||||
value={
|
||||
form_data.ntrp_level === "0" ? ["3.0"] : [form_data.ntrp_level]
|
||||
}
|
||||
onChange={handle_ntrp_level_change}
|
||||
/>
|
||||
)}
|
||||
@@ -570,7 +582,11 @@ export const UserInfoCard: React.FC<UserInfoCardProps> = ({
|
||||
options={professions}
|
||||
visible={occupation_picker_visible}
|
||||
setvisible={setOccupationPickerVisible}
|
||||
value={form_data.occupation ? [...form_data.occupation.split(" ")] : getDefaultOption(professions)}
|
||||
value={
|
||||
form_data.occupation
|
||||
? [...form_data.occupation.split(" ")]
|
||||
: getDefaultOption(professions)
|
||||
}
|
||||
onChange={handle_occupation_change}
|
||||
/>
|
||||
)}
|
||||
@@ -711,8 +727,9 @@ export const GameTabs: React.FC<GameTabsProps> = ({
|
||||
<Text className="tab_text">{hosted_text}</Text>
|
||||
</View>
|
||||
<View
|
||||
className={`tab_item ${active_tab === "participated" ? "active" : ""
|
||||
}`}
|
||||
className={`tab_item ${
|
||||
active_tab === "participated" ? "active" : ""
|
||||
}`}
|
||||
onClick={() => on_tab_change("participated")}
|
||||
>
|
||||
<Text className="tab_text">{participated_text}</Text>
|
||||
|
||||
Reference in New Issue
Block a user