This commit is contained in:
2025-10-01 11:13:26 +08:00
parent 9cb2ef0b6f
commit 6d416618f7
9 changed files with 116 additions and 25 deletions

View File

@@ -24,6 +24,7 @@
:global(.nut-dialog-content) {
min-width: 280px !important;
text-align: center !important;
}
:global(.nut-dialog-footer) {
@@ -55,11 +56,12 @@
:global(.nut-dialog-footer .nut-button-default) {
color: rgba(22, 24, 35, 0.75) !important;
font-weight: 600 !important;
}
:global(.nut-dialog-footer .nut-button-primary) {
color: #161823 !important;
color: #fff !important;
background: theme.$primary-color !important;
}
:global(.nut-dialog-footer .nut-button:hover) {

View File

@@ -1,7 +1,7 @@
import React, { useState } from 'react';
import { View, Text, Image } from '@tarojs/components';
import Taro from '@tarojs/taro';
import { FollowUser } from '@/services/followService';
import { FollowService, FollowUser } from '@/services/followService';
import './index.scss';
@@ -52,16 +52,17 @@ const FollowUserCard: React.FC<FollowUserCardProps> = ({ user, tabKey, onFollowC
};
// 加入黑名单
const add_to_blacklist = () => {
const add_to_blacklist = async () => {
if (isProcessing) return;
try {
setIsProcessing(true);
// TODO: 加入黑名单逻辑
const res = await FollowService.block_recommend_user(user.id);
if (res) {
Taro.showToast({
title: '不会再为您推荐该用户',
icon: 'none'
});
}
} catch (error) {
console.error('删除推荐人员失败:', error);
Taro.showToast({

View File

@@ -13,6 +13,7 @@ export const API_CONFIG = {
HOSTED_GAMES: '/user/games',
PARTICIPATED_GAMES: '/user/participated',
PARSE_PHONE: '/user/parse_phone',
LOGOUT: '/user/logout',
},
// 文件上传接口

View File

@@ -255,6 +255,24 @@ export class FollowService {
return 'none';
}
}
// 屏蔽推荐用户
static async block_recommend_user(user_id: number): Promise<boolean> {
try {
const response = await httpService.post<any>(
'/user_follow/block_recommend_user',
{ blocked_user_id: user_id, reason: "user_deleted", description: "用户主动删除" },
);
if (response.code === 0) {
return true;
} else {
throw new Error(response.message || '屏蔽推荐用户失败');
}
} catch (error) {
console.error('屏蔽推荐用户失败:', error);
throw error;
}
}
}
export default FollowService;

View File

@@ -4,6 +4,7 @@ import httpService, { ApiResponse } from './httpService';
import uploadFiles from './uploadFiles';
import Taro from '@tarojs/taro';
import getCurrentConfig from '@/config/env';
import { clear_login_state } from "@/services/loginService";
// 用户详情接口
@@ -552,6 +553,25 @@ export class UserService {
}
}
// 注销账户
static async logout(): Promise<void> {
try {
const response = await httpService.post<any>(API_CONFIG.USER.LOGOUT);
const { code, message } = response;
if (code === 0) {
// 清除用户数据
clear_login_state();
Taro.reLaunch({
url: "/login_pages/index/index",
});
} else {
throw new Error(message || '注销账户失败');
}
} catch (error) {
console.error('注销账户失败:', error);
}
}
}
// 从 loginService 移过来的用户相关方法

View File

@@ -9,6 +9,7 @@ import { clear_login_state } from "@/services/loginService";
import { convert_db_gender_to_display } from "@/utils/genderUtils";
import { EditModal } from "@/components";
import img from "@/config/images";
import CommonDialog from '@/components/CommonDialog'
const EditProfilePage: React.FC = () => {
// 用户信息状态
@@ -49,6 +50,7 @@ const EditProfilePage: React.FC = () => {
// 加载状态
const [loading, setLoading] = useState(true);
const [showLogoutDialog, setShowLogoutDialog] = useState(false);
// 编辑弹窗状态
const [edit_modal_visible, setEditModalVisible] = useState(false);
@@ -304,6 +306,11 @@ const EditProfilePage: React.FC = () => {
});
};
// 注销账户
const handle_close_account = () => {
setShowLogoutDialog(true);
}
const onGetPhoneNumber = async (e) => {
if (!e.detail || !e.detail.code) {
Taro.showToast({
@@ -580,7 +587,7 @@ const EditProfilePage: React.FC = () => {
{/* 注销账号 */}
<View className="logout_section">
<View className="logout_button" onClick={handle_logout}>
<View className="logout_button" onClick={handle_close_account}>
<Text className="logout_text"></Text>
</View>
</View>
@@ -687,6 +694,16 @@ const EditProfilePage: React.FC = () => {
onChange={handle_occupation_change}
/>
)}
{/* 取消关注确认弹窗 */}
<CommonDialog
visible={showLogoutDialog}
cancelText="确定注销"
confirmText="再想想"
onCancel={() => {UserService.logout()}}
onConfirm={() => setShowLogoutDialog(false)}
contentTitle="确定要注销账号吗?"
contentDesc="你的账号将会彻底删除,该操作不可恢复。"
/>
</View>
);
};

View File

@@ -257,11 +257,19 @@ const FollowPage: React.FC = () => {
>
<Text className="tab_text">{tab.label}</Text>
{tab.key === 'recommend' && (
<View className="recommend_icon">
<View className="recommend_icon" onClick={(e) => {
e.stopPropagation();
Taro.showModal({
title: '推荐说明',
content: '我们会向你推荐一些可能感兴趣的球友,帮你更快遇见同样热爱运动的人。推荐基于公开信息与社区互动,仅用于球友推荐,不涉及个人隐私。',
showCancel: false,
confirmText: '确认',
confirmColor: '#000',
})
}}>
{/* 推荐图标 SVG */}
<View className="icon_container">
<View className="star_icon" />
</View>
</View>
)}

View File

@@ -5,11 +5,6 @@
font-style: Regular;
color: #3C3C4399;
font-size: 12px;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
overflow: hidden;
.withdrawal-container {
@@ -110,10 +105,13 @@
}
.withdraw_popup {
min-height: unset;
.popup_content {
display: flex;
flex-direction: column;
align-items: center;
user-select: none;
pointer-events: none;
.popup_text {
font-family: DingTalk JinBuTi;

View File

@@ -1,10 +1,11 @@
import React, { useState, useEffect } from "react";
import React, { useState, useEffect, useRef } from "react";
import { View, Text, Input, Button } from "@tarojs/components";
import Taro, { useDidShow } from "@tarojs/taro";
import httpService from "@/services/httpService";
import "./index.scss";
import { CommonPopup } from "@/components";
import { useKeyboardHeight } from '@/store/keyboardStore'
interface WalletInfo {
balance: string;
@@ -15,6 +16,23 @@ interface WalletInfo {
}
const Withdrawal: React.FC = () => {
const inputRef = useRef(null);
// 使用全局键盘状态
const { keyboardHeight, isKeyboardVisible, addListener, initializeKeyboardListener } = useKeyboardHeight()
// 使用全局键盘状态监听
useEffect(() => {
// 初始化全局键盘监听器
initializeKeyboardListener()
// 添加本地监听器
const removeListener = addListener((height, visible) => {
console.log('AiImportPopup 收到键盘变化:', height, visible)
})
return () => {
removeListener()
}
}, [initializeKeyboardListener, addListener])
const [showTips, setShowTips] = useState(false);
const [tipsText, setTipsText] = useState<string>("");
const [inputValue, setInputValue] = useState<string>("0.00");
@@ -33,7 +51,11 @@ const Withdrawal: React.FC = () => {
load_wallet_data();
getWithdrawErrorCodes();
});
useEffect(() => {
if (show_withdraw_popup && inputRef.current) {
inputRef.current.focus();
}
}, [show_withdraw_popup]);
useEffect(() => {
if (show_withdraw_popup) {
setIsFocus(true);
@@ -191,7 +213,6 @@ const Withdrawal: React.FC = () => {
content: message,
showCancel: false,
confirmText: "确认",
confirmColor: "#fff",
});
return;
} else {
@@ -214,6 +235,10 @@ const Withdrawal: React.FC = () => {
}, 100);
}
}
const handlePopupClick = (e) => {
e.stopPropagation();
inputRef.current!.focus();
};
return (
<View className="withdrawal-page" >
<View className="withdrawal-container">
@@ -270,8 +295,9 @@ const Withdrawal: React.FC = () => {
title="提现"
className="withdraw_popup"
hideFooter={true}
style={{ bottom: isKeyboardVisible ? `${keyboardHeight}px` : undefined }}
>
<View className="popup_content">
<View className="popup_content" onClick={handlePopupClick}>
<View className="popup_text">{`¥${inputValue}`}</View>
<View className="password_container">
{
@@ -282,7 +308,7 @@ const Withdrawal: React.FC = () => {
))
}
</View>
<Input focus={isFocus} type="number" style={{ width: "0", height: "0", opacity: "0" }} value={password.filter(item => item !== "").join("")} maxlength={6} onInput={handlePasswordInput} />
<Input ref={inputRef} focus={isFocus} type="number" adjustPosition={false} style={{ width: "0", height: "0", opacity: "0" }} value={password.filter(item => item !== "").join("")} maxlength={6} onInput={handlePasswordInput} />
</View>
</CommonPopup>
</View >