优化
This commit is contained in:
@@ -27,10 +27,10 @@ const EditProfilePage: React.FC = () => {
|
||||
nickname: info?.nickname ?? "",
|
||||
personal_profile: info?.personal_profile ?? "",
|
||||
occupation: info?.occupation ?? "",
|
||||
ntrp_level: info?.ntrp_level ?? "2.5",
|
||||
ntrp_level: info?.ntrp_level ?? "",
|
||||
phone: info?.phone ?? "",
|
||||
gender: info?.gender ?? "",
|
||||
birthday: info?.birthday ?? "2000-01-01",
|
||||
birthday: info?.birthday ?? "",
|
||||
country: info?.country ?? "",
|
||||
province: info?.province ?? "",
|
||||
city: info?.city ?? "",
|
||||
@@ -68,10 +68,10 @@ const EditProfilePage: React.FC = () => {
|
||||
nickname: info?.nickname ?? "",
|
||||
personal_profile: info?.personal_profile ?? "",
|
||||
occupation: info?.occupation ?? "",
|
||||
ntrp_level: info?.ntrp_level ?? "2.5",
|
||||
ntrp_level: info?.ntrp_level ?? "",
|
||||
phone: info?.phone ?? "",
|
||||
gender: info?.gender ?? "",
|
||||
birthday: info?.birthday ?? "2000-01-01",
|
||||
birthday: info?.birthday ?? "",
|
||||
country: info?.country ?? "",
|
||||
province: info?.province ?? "",
|
||||
city: info?.city ?? "",
|
||||
@@ -350,15 +350,15 @@ const EditProfilePage: React.FC = () => {
|
||||
|
||||
// 处理NTRP水平选择
|
||||
const handle_ntrp_level_change = (e: any) => {
|
||||
if (!Array.isArray(e) || e.length === 0 || e[0] === undefined) {
|
||||
Taro.showToast({
|
||||
title: "请选择NTRP水平",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
// if (!Array.isArray(e) || e.length === 0 || e[0] === undefined) {
|
||||
// Taro.showToast({
|
||||
// title: "请选择NTRP水平",
|
||||
// icon: "none",
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
const ntrp_level_value = e[0];
|
||||
handle_field_edit("ntrp_level", String(ntrp_level_value));
|
||||
handle_field_edit("ntrp_level", ntrp_level_value);
|
||||
};
|
||||
|
||||
// 处理职业选择
|
||||
@@ -543,7 +543,11 @@ const EditProfilePage: React.FC = () => {
|
||||
<Text className="item_label">性别</Text>
|
||||
</View>
|
||||
<View className="item_right">
|
||||
<Text className="item_value">
|
||||
<Text
|
||||
className={`item_value ${
|
||||
form_data.gender ? "" : "placeholder"
|
||||
}`}
|
||||
>
|
||||
{convert_db_gender_to_display(form_data.gender)}
|
||||
</Text>
|
||||
<Image
|
||||
@@ -572,7 +576,13 @@ const EditProfilePage: React.FC = () => {
|
||||
<Text className="item_label">生日</Text>
|
||||
</View>
|
||||
<View className="item_right">
|
||||
<Text className="item_value">{form_data.birthday}</Text>
|
||||
<Text
|
||||
className={`item_value ${
|
||||
form_data.birthday ? "" : "placeholder"
|
||||
}`}
|
||||
>
|
||||
{form_data.birthday || "选择生日"}
|
||||
</Text>
|
||||
<Image
|
||||
className="arrow_icon"
|
||||
src={require("@/static/list/icon-list-right-arrow.svg")}
|
||||
@@ -597,7 +607,11 @@ const EditProfilePage: React.FC = () => {
|
||||
<Text className="item_label">简介</Text>
|
||||
</View>
|
||||
<View className="item_right">
|
||||
<Text className="item_value">
|
||||
<Text
|
||||
className={`item_value ${
|
||||
form_data.personal_profile ? "" : "placeholder"
|
||||
}`}
|
||||
>
|
||||
{form_data.personal_profile.replace(/\n/g, " ") ||
|
||||
"介绍一下自己"}
|
||||
</Text>
|
||||
@@ -626,7 +640,19 @@ const EditProfilePage: React.FC = () => {
|
||||
<Text className="item_label">地区</Text>
|
||||
</View>
|
||||
<View className="item_right">
|
||||
<Text className="item_value">{`${form_data.country} ${form_data.province} ${form_data.city}`}</Text>
|
||||
<Text
|
||||
className={`item_value ${
|
||||
form_data.country ||
|
||||
form_data.province ||
|
||||
form_data.city
|
||||
? ""
|
||||
: "placehoder"
|
||||
}`}
|
||||
>
|
||||
{form_data.country || form_data.province || form_data.city
|
||||
? `${form_data.country} ${form_data.province} ${form_data.city}`
|
||||
: "选择所在地区"}
|
||||
</Text>
|
||||
<Image
|
||||
className="arrow_icon"
|
||||
src={require("@/static/list/icon-list-right-arrow.svg")}
|
||||
@@ -648,7 +674,13 @@ const EditProfilePage: React.FC = () => {
|
||||
<Text className="item_label">NTRP 水平</Text>
|
||||
</View>
|
||||
<View className="item_right">
|
||||
<Text className="item_value">{form_data.ntrp_level}</Text>
|
||||
<Text
|
||||
className={`item_value ${
|
||||
form_data.ntrp_level ? "" : "placeholder"
|
||||
}`}
|
||||
>
|
||||
{form_data.ntrp_level || "测测你的 NTRP 水平"}
|
||||
</Text>
|
||||
<Image
|
||||
className="arrow_icon"
|
||||
src={require("@/static/list/icon-list-right-arrow.svg")}
|
||||
@@ -669,8 +701,18 @@ const EditProfilePage: React.FC = () => {
|
||||
/>
|
||||
<Text className="item_label">职业</Text>
|
||||
</View>
|
||||
<View className="item_right">
|
||||
<Text className="item_value">{form_data.occupation}</Text>
|
||||
<View
|
||||
className={`item_right ${
|
||||
form_data.occupation ? "" : "placeholder"
|
||||
}`}
|
||||
>
|
||||
<Text
|
||||
className={`item_value ${
|
||||
form_data.occupation ? "" : "placeholder"
|
||||
}`}
|
||||
>
|
||||
{form_data.occupation || "填写你的职业"}
|
||||
</Text>
|
||||
<Image
|
||||
className="arrow_icon"
|
||||
src={require("@/static/list/icon-list-right-arrow.svg")}
|
||||
@@ -769,7 +811,7 @@ const EditProfilePage: React.FC = () => {
|
||||
onCancel={handle_edit_modal_cancel}
|
||||
validationMessage={
|
||||
editing_field === "nickname"
|
||||
? "请填写 2-24 个字符,不包括 @<>/等无效字符"
|
||||
? "请填写 2-24 个字符,不包括 @<>/等无效字符。30 天内可修改 4 次昵称,12.5 前还可修改 4 次。"
|
||||
: "请填写 2-100 个字符"
|
||||
}
|
||||
/>
|
||||
@@ -803,9 +845,9 @@ const EditProfilePage: React.FC = () => {
|
||||
visible={birthday_picker_visible}
|
||||
setvisible={setBirthdayPickerVisible}
|
||||
value={[
|
||||
new Date(form_data.birthday).getFullYear(),
|
||||
new Date(form_data.birthday).getMonth() + 1,
|
||||
new Date(form_data.birthday).getDate(),
|
||||
new Date(form_data.birthday || Date.now()).getFullYear(),
|
||||
new Date(form_data.birthday || Date.now()).getMonth() + 1,
|
||||
new Date(form_data.birthday || Date.now()).getDate(),
|
||||
]}
|
||||
type="day"
|
||||
onChange={handle_birthday_change}
|
||||
@@ -836,22 +878,20 @@ const EditProfilePage: React.FC = () => {
|
||||
confirmText="保存"
|
||||
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+" },
|
||||
],
|
||||
{ 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+" },
|
||||
]}
|
||||
type="ntrp"
|
||||
// img={(user_info as UserInfoType)?.avatar_url}
|
||||
visible={ntrp_picker_visible}
|
||||
setvisible={setNtrpPickerVisible}
|
||||
value={form_data.ntrp_level === "" ? ["2.5"] : [form_data.ntrp_level]}
|
||||
value={[form_data.ntrp_level || "2.5"]}
|
||||
onChange={handle_ntrp_level_change}
|
||||
/>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user