This commit is contained in:
2025-11-22 15:46:23 +08:00
parent b2b665dfb6
commit cba231ab3d
11 changed files with 197 additions and 127 deletions

View File

@@ -8,16 +8,17 @@ interface IProps {
errorImg?: string;
btnText?: string;
btnImg?: string;
height?: string
}
const ListLoadError = (props: IProps) => {
const { reload, text, errorImg, btnText, btnImg } = props;
const { reload, text, errorImg, btnText, btnImg, height = "unset" } = props;
const handleReload = () => {
reload && typeof reload === "function" && reload();
};
return (
<View className={styles.listLoadError}>
<View className={styles.listLoadError} style={{ height }}>
<Image
className={styles.listLoadErrorImg}
src={errorImg ? img[errorImg] : img.ICON_LIST_LOAD_ERROR}

View File

@@ -18,10 +18,11 @@ import styles from "./index.module.scss";
function NTRPTestEntryCard(props: {
type: EvaluateScene;
evaluateCallback?: EvaluateCallback;
callback?: (flag) => void;
}) {
const [testFlag, setTestFlag] = useState(false);
const [hasTestInLastMonth, setHasTestInLastMonth] = useState(false);
const { type, evaluateCallback } = props;
const { type, evaluateCallback, callback } = props;
const userInfo = useUserInfo();
const { setCallback } = useEvaluate();
const { fetchUserInfo } = useUserActions();
@@ -41,6 +42,7 @@ function NTRPTestEntryCard(props: {
if (res.code === 0) {
setTestFlag(res.data.has_test_record);
setHasTestInLastMonth(res.data.has_test_in_last_month);
callback?.(res.data.has_test_in_last_month);
}
};
init();

View File

@@ -52,6 +52,7 @@ const PopupPicker = ({
const [defaultValue, setDefaultValue] = useState<(string | number)[]>([]);
const [defaultOptions, setDefaultOptions] = useState<PickerOption[][]>([]);
const [pickerCurrentValue, setPickerCurrentValue] = useState<(string | number)[]>(value);
const [tested, setTested] = useState(false)
const changePicker = (options: any[], values: any, columnIndex: number) => {
// 更新 Picker 的当前值
@@ -126,6 +127,9 @@ const PopupPicker = ({
}
}
}, [visible, value]);
const callback = (tested: boolean) => {
setTested(tested)
}
return (
<>
<CommonPopup
@@ -142,9 +146,9 @@ const PopupPicker = ({
zIndex={1000}
style={style}
>
{type === "ntrp" && (
{type === "ntrp" && !tested && (
<View className={styles.evaluateCardWrap}>
<NTRPTestEntryCard type={EvaluateScene.userEdit} />
<NTRPTestEntryCard callback={(flag) => callback(flag)} type={EvaluateScene.userEdit} />
</View>
// <View className={`${styles["examination-btn"]}}`}>
// <View className={`${styles["text-container"]}}`}>

View File

@@ -486,7 +486,7 @@ const UserInfoCardComponent: React.FC<UserInfoCardProps> = ({
<Text></Text>
</View>
) : null}
{user_info.ntrp_level !== "0" ? (
{user_info.ntrp_level !== "" ? (
<View
className="tag_item"
onClick={() => {

View File

@@ -29,6 +29,7 @@ const ListContainer = (props) => {
collapse = false,
defaultShowNum,
evaluateFlag,
listLoadErrorHeight,
} = props;
const timerRef = useRef<NodeJS.Timeout | null>(null);
const loadingStartTimeRef = useRef<number | null>(null);
@@ -156,6 +157,7 @@ const ListContainer = (props) => {
btnText={btnText}
btnImg={btnImg}
text={emptyText || "暂无数据"}
height={listLoadErrorHeight || ""}
/>
);
}

View File

@@ -131,6 +131,7 @@ const MyselfPageContent: React.FC = () => {
const handle_wallet = () => {
(Taro as any).navigateTo({
url: "/user_pages/wallet/index",
// url: "/user_pages/other/index?userid=18",
});
};
@@ -213,6 +214,7 @@ const MyselfPageContent: React.FC = () => {
loadMoreMatches={() => {}}
collapse={true}
style={{ paddingBottom: 0, overflow: "hidden" }}
listLoadErrorHeight="320px"
defaultShowNum={3}
/>
</ScrollView>
@@ -231,6 +233,7 @@ const MyselfPageContent: React.FC = () => {
loadMoreMatches={() => {}}
collapse={true}
style={{ paddingBottom: "90px", overflow: "hidden" }}
listLoadErrorHeight="320px"
defaultShowNum={3}
/>
</ScrollView>

View File

@@ -194,8 +194,7 @@ function Intro() {
});
}
Taro.redirectTo({
url: `/other_pages/ntrp-evaluate/index?stage=${type}${
type === StageType.RESULT ? `&id=${id}` : ""
url: `/other_pages/ntrp-evaluate/index?stage=${type}${type === StageType.RESULT ? `&id=${id}` : ""
}`,
});
}
@@ -639,13 +638,12 @@ function Result() {
}
const currentPage = getCurrentFullPath();
Taro.redirectTo({
url: `/login_pages/index/index${
currentPage ? `?redirect=${encodeURIComponent(currentPage)}` : ""
url: `/login_pages/index/index${currentPage ? `?redirect=${encodeURIComponent(currentPage)}` : ""
}`,
});
}
function handleGo() {}
function handleGo() { }
return (
<View className={styles.resultContainer}>

View File

@@ -1,12 +1,16 @@
// 编辑资料页面样式
.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;
@@ -52,7 +56,7 @@
display: flex;
justify-content: center;
& > .detail-navigator-back-icon {
&>.detail-navigator-back-icon {
width: 32px;
height: 32px;
}
@@ -341,6 +345,31 @@
font-size: 16px;
line-height: 1.4em;
color: #000000;
&.close_account {
color: #fe3c31;
}
}
}
&.group {
border: 1px solid rgba(0, 0, 0, 0.12);
border-radius: 16px;
overflow: hidden;
.logout_button {
border: unset;
border-radius: unset;
Image {
width: 20px;
height: 20px;
margin-right: 12px;
}
&:first-child {
border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}
}
}
}

View File

@@ -12,6 +12,7 @@ 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";
const EditProfilePage: React.FC = () => {
const { updateUserInfo } = useUserActions();
@@ -414,6 +415,8 @@ const EditProfilePage: React.FC = () => {
}
};
const handleAddGroup = () => {}
const getDefaultOption = (options) => {
if (!Array.isArray(options) || options.length === 0) {
return [];
@@ -703,10 +706,14 @@ const EditProfilePage: React.FC = () => {
</View>
</View>
{/* 注销账号 */}
<View className="logout_section">
<View className="logout_button" onClick={handle_close_account}>
<Text className="logout_text"></Text>
<View className="logout_section group">
<View className="logout_button" onClick={handleCustomerService}>
<Image src={require("@/static/wallet/custom-service.svg")}></Image>
<Text className="logout_text"></Text>
</View>
<View className="logout_button" onClick={handleAddGroup}>
<Image src={require("@/static/userInfo/chat.svg")}></Image>
<Text className="logout_text"></Text>
</View>
</View>
@@ -716,6 +723,13 @@ const EditProfilePage: React.FC = () => {
<Text className="logout_text">退</Text>
</View>
</View>
{/* 注销账号 */}
<View className="logout_section">
<View className="logout_button" onClick={handle_close_account}>
<Text className="logout_text close_account"></Text>
</View>
</View>
</>
)}
</View>
@@ -741,7 +755,8 @@ const EditProfilePage: React.FC = () => {
}
/>
{/* 性别选择弹窗 */}
{gender_picker_visible && (
{
gender_picker_visible && (
<PopupPicker
showHeader={true}
title="选择性别"
@@ -758,9 +773,11 @@ const EditProfilePage: React.FC = () => {
value={form_data.gender === "" ? ["0"] : [form_data.gender]}
onChange={handle_gender_change}
/>
)}
)
}
{/* 生日选择弹窗 */}
{birthday_picker_visible && (
{
birthday_picker_visible && (
<PopupPicker
minYear={1970}
maxYear={new Date().getFullYear()}
@@ -777,9 +794,11 @@ const EditProfilePage: React.FC = () => {
type="day"
onChange={handle_birthday_change}
/>
)}
)
}
{/* 地区选择弹窗 */}
{location_picker_visible && (
{
location_picker_visible && (
<PopupPicker
showHeader={true}
title="选择地区"
@@ -794,9 +813,11 @@ const EditProfilePage: React.FC = () => {
}
onChange={handle_location_change}
/>
)}
)
}
{/* NTRP水平选择弹窗 */}
{ntrp_picker_visible && (
{
ntrp_picker_visible && (
<PopupPicker
showHeader={true}
title="选择 NTRP 自评水平"
@@ -821,9 +842,11 @@ const EditProfilePage: React.FC = () => {
}
onChange={handle_ntrp_level_change}
/>
)}
)
}
{/* 职业选择弹窗 */}
{occupation_picker_visible && (
{
occupation_picker_visible && (
<PopupPicker
showHeader={true}
title="选择职业"
@@ -838,7 +861,8 @@ const EditProfilePage: React.FC = () => {
}
onChange={handle_occupation_change}
/>
)}
)
}
{/* 取消关注确认弹窗 */}
<CommonDialog
visible={showLogoutDialog}
@@ -851,7 +875,7 @@ const EditProfilePage: React.FC = () => {
contentTitle="确定要注销账号吗?"
contentDesc="你的账号将会彻底删除,该操作不可恢复。"
/>
</View>
</View >
);
};

View File

@@ -7,6 +7,7 @@ import { FollowService, FollowUser } from '@/services/followService';
import { withAuth } from '@/components';
import './index.scss';
import CommonDialog from '@/components/CommonDialog'
import { useUserActions } from "@/store/userStore";
// 标签页类型
type TabType = 'mutual_follow' | 'following' | 'follower' | 'recommend';
@@ -20,6 +21,7 @@ const TAB_CONFIG = [
];
const FollowPage: React.FC = () => {
const { fetchUserInfo } = useUserActions();
// 获取页面参数,支持指定默认标签页
const instance = Taro.getCurrentInstance();
const default_tab = (instance.router?.params?.tab as TabType) || 'mutual_follow';
@@ -145,6 +147,7 @@ const FollowPage: React.FC = () => {
if (is_following) {
await FollowService.follow_user(user_id);
updateFollowStatus(user_id, is_following);
fetchUserInfo()
// Taro.showToast({
// title: '关注成功',
// icon: 'success'
@@ -219,6 +222,7 @@ const FollowPage: React.FC = () => {
await FollowService.unfollow_user(deleteConfirm.userId!);
closeDeleteConfirm();
updateFollowStatus(deleteConfirm.userId!, false);
fetchUserInfo()
// Taro.showToast({
// title: '取消关注成功',
// icon: 'success'

View File

@@ -16,8 +16,10 @@ import { UserService, UserInfoType } from "@/services/userService";
import * as LoginService from "@/services/loginService";
import { useGlobalState } from "@/store/global";
import { GeneralNavbar } from "@/components";
import { useUserActions } from "@/store/userStore";
const OtherUserPage: React.FC = () => {
const { fetchUserInfo } = useUserActions();
// 获取页面参数
const instance = Taro.getCurrentInstance();
const user_id = instance.router?.params?.userid;
@@ -182,6 +184,7 @@ const OtherUserPage: React.FC = () => {
is_following
);
setIsFollowing(new_follow_status);
fetchUserInfo()
Taro.showToast({
title: new_follow_status ? "关注成功" : "已取消关注",
icon: "success",