细节优化

This commit is contained in:
2025-12-01 11:37:59 +08:00
parent f389397227
commit 675ecb536d
7 changed files with 101 additions and 68 deletions

View File

@@ -1,17 +1,13 @@
// 编辑资料页面样式
.edit_profile_page {
height: 100vh; // position: relative;
background: radial-gradient(circle at 50% 0,
/* 光晕圆心在顶部中间 */
rgba(191, 255, 239, 0.9) 0px,
/* 中间更深的浅蓝 */
rgba(191, 255, 239, 0.5) 200px,
/* 100px 处开始淡化 */
#fafafa 300px,
/* 到 200px 变成白色 */
#fafafa 100%
/* 200px 以下全白 */
);
background: radial-gradient(
circle at 50% 0,
/* 光晕圆心在顶部中间 */ rgba(191, 255, 239, 0.9) 0px,
/* 中间更深的浅蓝 */ rgba(191, 255, 239, 0.5) 200px,
/* 100px 处开始淡化 */ #fafafa 300px,
/* 到 200px 变成白色 */ #fafafa 100% /* 200px 以下全白 */
);
position: relative;
// overflow: hidden;
box-sizing: border-box;
@@ -56,7 +52,7 @@
display: flex;
justify-content: center;
&>.detail-navigator-back-icon {
& > .detail-navigator-back-icon {
width: 32px;
height: 32px;
}
@@ -353,7 +349,7 @@
}
&.group {
border: 1px solid rgba(0, 0, 0, 0.06);
border: 0.5pt solid rgba(0, 0, 0, 0.06);
border-radius: 16px;
overflow: hidden;
@@ -368,7 +364,7 @@
}
&:first-child {
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
border-bottom: 0.5pt solid rgba(0, 0, 0, 0.06);
}
}
}
@@ -389,4 +385,4 @@
color: rgba(0, 0, 0, 0.6);
}
}
}
}

View File

@@ -7,12 +7,13 @@ import { UserService, PickerOption } from "@/services/userService";
import { clear_login_state } from "@/services/loginService";
import { convert_db_gender_to_display } from "@/utils/genderUtils";
import { EditModal, GeneralNavbar } from "@/components";
import img from "@/config/images";
// import img from "@/config/images";
import CommonDialog from "@/components/CommonDialog";
import { useUserActions, useUserInfo } from "@/store/userStore";
import { UserInfoType } from "@/services/userService";
import { useCities, useProfessions } from "@/store/pickerOptionsStore";
import { handleCustomerService } from "@/services/userService";
import evaluateService from "@/services/evaluateService";
const EditProfilePage: React.FC = () => {
const { updateUserInfo } = useUserActions();
@@ -57,6 +58,8 @@ const EditProfilePage: React.FC = () => {
// 城市数据
const cities = useCities();
const [ntrpTested, setNtrpTested] = useState<boolean>(false);
// 监听store中的用户信息变化同步到表单状态
useEffect(() => {
if (user_info && Object.keys(user_info).length > 0) {
@@ -74,6 +77,15 @@ const EditProfilePage: React.FC = () => {
city: info?.city ?? "",
});
}
const getLastResult = async () => {
// 获取测试结果
const res = await evaluateService.getLastResult();
if (res.code === 0) {
setNtrpTested(res.data.has_test_in_last_month);
}
};
getLastResult();
}, [user_info]);
// 页面加载时初始化数据
@@ -695,9 +707,9 @@ const EditProfilePage: React.FC = () => {
>
{form_data.phone
? form_data.phone.replace(
/(\d{3})(\d{4})(\d{4})/,
"$1 $2 $3"
)
/(\d{3})(\d{4})(\d{4})/,
"$1 $2 $3"
)
: "未绑定"}
</Button>
<Image
@@ -822,6 +834,7 @@ const EditProfilePage: React.FC = () => {
showHeader={true}
title="选择 NTRP 自评水平"
confirmText="保存"
ntrpTested={ntrpTested}
options={[
[
{ text: "1.5", value: "1.5" },
@@ -831,6 +844,7 @@ const EditProfilePage: React.FC = () => {
{ 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"
@@ -838,7 +852,7 @@ const EditProfilePage: React.FC = () => {
visible={ntrp_picker_visible}
setvisible={setNtrpPickerVisible}
value={
form_data.ntrp_level === "0" ? ["3.0"] : [form_data.ntrp_level]
form_data.ntrp_level === "0" ? ["2.5"] : [form_data.ntrp_level]
}
onChange={handle_ntrp_level_change}
/>

View File

@@ -96,8 +96,9 @@ const OtherUserPage: React.FC = () => {
nickname: userData.nickname || "",
avatar_url: userData.avatar_url || "",
join_date: userData.subscribe_time
? `${new Date(userData.subscribe_time).getFullYear()}${new Date(userData.subscribe_time).getMonth() + 1
}月加入`
? `${new Date(userData.subscribe_time).getFullYear()}${
new Date(userData.subscribe_time).getMonth() + 1
}月加入`
: "",
stats: {
following_count: userData.stats?.following_count || 0,
@@ -132,35 +133,35 @@ const OtherUserPage: React.FC = () => {
}, [user_id]);
// 分类球局数据(使用 useCallback 包装,避免每次渲染都创建新函数)
const classifyGameRecords = useCallback((
game_records: GameRecord[]
): { notEndGames: GameRecord[]; finishedGames: GameRecord[] } => {
const now = new Date().getTime();
return game_records.reduce(
(result, cur) => {
let { end_time } = cur;
end_time = end_time.replace(/\s/, "T");
new Date(end_time).getTime() > now
? result.notEndGames.push(cur)
: result.finishedGames.push(cur);
return result;
},
{
notEndGames: [] as GameRecord[],
finishedGames: [] as GameRecord[],
}
);
}, []);
const classifyGameRecords = useCallback(
(
game_records: GameRecord[]
): { notEndGames: GameRecord[]; finishedGames: GameRecord[] } => {
const now = new Date().getTime();
return game_records.reduce(
(result, cur) => {
let { end_time } = cur;
end_time = end_time.replace(/\s/, "T");
new Date(end_time).getTime() > now
? result.notEndGames.push(cur)
: result.finishedGames.push(cur);
return result;
},
{
notEndGames: [] as GameRecord[],
finishedGames: [] as GameRecord[],
}
);
},
[]
);
// 加载球局数据(使用 useCallback 包装,避免每次渲染都创建新函数)
const load_game_data = useCallback(async () => {
if (!user_id) return;
try {
set_loading(true);
const games_data = await UserService.get_user_games(
user_id,
active_tab
);
const games_data = await UserService.get_user_games(user_id, active_tab);
const sorted_games = games_data.sort((a, b) => {
return (
new Date(a.original_start_time.replace(/\s/, "T")).getTime() -
@@ -214,7 +215,9 @@ const OtherUserPage: React.FC = () => {
const handle_send_message = useCallback(() => {
if (!user_info.id) return;
Taro.navigateTo({
url: `/mode_user/message/chat/index?user_id=${user_info.id}&nickname=${user_info.nickname || ""}`,
url: `/mode_user/message/chat/index?user_id=${user_info.id}&nickname=${
user_info.nickname || ""
}`,
});
}, [user_info.id, user_info.nickname]);
@@ -237,7 +240,11 @@ const OtherUserPage: React.FC = () => {
// };
return (
<ScrollView scrollY className="other_user_page" refresherBackground="#FAFAFA">
<ScrollView
scrollY
className="other_user_page"
refresherBackground="#FAFAFA"
>
{/* <CustomNavbar>
<View className="navbar_content">
<View className="navbar_back" onClick={() => Taro.navigateBack()}>
@@ -303,11 +310,11 @@ const OtherUserPage: React.FC = () => {
isShowNoData={game_records.length === 0}
errorImg="ICON_LIST_EMPTY_CARD"
emptyText="暂无球局信息"
loadMoreMatches={() => { }}
loadMoreMatches={() => {}}
collapse={true}
style={{ paddingBottom: 0, overflow: "hidden" }}
listLoadErrorWrapperHeight="267px"
listLoadErrorWidth="100%"
listLoadErrorWidth="320px"
listLoadErrorHeight="152px"
defaultShowNum={3}
/>
@@ -346,11 +353,11 @@ const OtherUserPage: React.FC = () => {
isShowNoData={ended_game_records.length === 0}
errorImg="ICON_LIST_EMPTY_CARD"
emptyText="暂无球局信息"
loadMoreMatches={() => { }}
loadMoreMatches={() => {}}
collapse={true}
style={{ paddingBottom: "90px", overflow: "hidden" }}
listLoadErrorWrapperHeight="220px"
listLoadErrorWidth="100%"
listLoadErrorWidth="320px"
listLoadErrorHeight="152px"
defaultShowNum={3}
/>