From 6d416618f78cc6ed1756f54b58072dd32e6dd27b Mon Sep 17 00:00:00 2001 From: Ultrame <1019265060@qq.com> Date: Wed, 1 Oct 2025 11:13:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CommonDialog/index.module.scss | 6 ++- src/components/FollowUserCard/index.tsx | 17 +++++---- src/config/api.ts | 1 + src/services/followService.ts | 18 +++++++++ src/services/userService.ts | 22 ++++++++++- src/user_pages/edit/index.tsx | 19 +++++++++- src/user_pages/follow/index.tsx | 12 +++++- src/user_pages/withdrawal/index.scss | 8 ++-- src/user_pages/withdrawal/index.tsx | 38 ++++++++++++++++--- 9 files changed, 116 insertions(+), 25 deletions(-) diff --git a/src/components/CommonDialog/index.module.scss b/src/components/CommonDialog/index.module.scss index 10c6e0a..1fe88f8 100644 --- a/src/components/CommonDialog/index.module.scss +++ b/src/components/CommonDialog/index.module.scss @@ -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) { diff --git a/src/components/FollowUserCard/index.tsx b/src/components/FollowUserCard/index.tsx index cf4c077..acee46f 100644 --- a/src/components/FollowUserCard/index.tsx +++ b/src/components/FollowUserCard/index.tsx @@ -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 = ({ user, tabKey, onFollowC }; // 加入黑名单 - const add_to_blacklist = () => { + const add_to_blacklist = async () => { if (isProcessing) return; - try { setIsProcessing(true); - // TODO: 加入黑名单逻辑 - Taro.showToast({ - title: '不会再为您推荐该用户', - icon: 'none' - }); + const res = await FollowService.block_recommend_user(user.id); + if (res) { + Taro.showToast({ + title: '不会再为您推荐该用户', + icon: 'none' + }); + } } catch (error) { console.error('删除推荐人员失败:', error); Taro.showToast({ diff --git a/src/config/api.ts b/src/config/api.ts index 763f263..94de38c 100644 --- a/src/config/api.ts +++ b/src/config/api.ts @@ -13,6 +13,7 @@ export const API_CONFIG = { HOSTED_GAMES: '/user/games', PARTICIPATED_GAMES: '/user/participated', PARSE_PHONE: '/user/parse_phone', + LOGOUT: '/user/logout', }, // 文件上传接口 diff --git a/src/services/followService.ts b/src/services/followService.ts index 0589ee1..dafe4a5 100644 --- a/src/services/followService.ts +++ b/src/services/followService.ts @@ -255,6 +255,24 @@ export class FollowService { return 'none'; } } + + // 屏蔽推荐用户 + static async block_recommend_user(user_id: number): Promise { + try { + const response = await httpService.post( + '/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; \ No newline at end of file diff --git a/src/services/userService.ts b/src/services/userService.ts index aeeea04..7e07a28 100644 --- a/src/services/userService.ts +++ b/src/services/userService.ts @@ -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 { + try { + const response = await httpService.post(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 移过来的用户相关方法 @@ -639,7 +659,7 @@ export const handleCustomerService = async (): Promise => { // 客服备用方案 const showCustomerServiceFallback = (customerInfo?: any) => { const options = ['拨打客服电话', '复制邮箱地址']; - + // 如果没有客服信息,只显示通用提示 if (!customerInfo?.phoneNumber && !customerInfo?.email) { Taro.showModal({ diff --git a/src/user_pages/edit/index.tsx b/src/user_pages/edit/index.tsx index a8c2819..a4e43bb 100644 --- a/src/user_pages/edit/index.tsx +++ b/src/user_pages/edit/index.tsx @@ -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 = () => { {/* 注销账号 */} - + 注销账号 @@ -687,6 +694,16 @@ const EditProfilePage: React.FC = () => { onChange={handle_occupation_change} /> )} + {/* 取消关注确认弹窗 */} + {UserService.logout()}} + onConfirm={() => setShowLogoutDialog(false)} + contentTitle="确定要注销账号吗?" + contentDesc="你的账号将会彻底删除,该操作不可恢复。" + /> ); }; diff --git a/src/user_pages/follow/index.tsx b/src/user_pages/follow/index.tsx index 59fd76b..49bcccb 100644 --- a/src/user_pages/follow/index.tsx +++ b/src/user_pages/follow/index.tsx @@ -257,11 +257,19 @@ const FollowPage: React.FC = () => { > {tab.label} {tab.key === 'recommend' && ( - + { + e.stopPropagation(); + Taro.showModal({ + title: '推荐说明', + content: '我们会向你推荐一些可能感兴趣的球友,帮你更快遇见同样热爱运动的人。推荐基于公开信息与社区互动,仅用于球友推荐,不涉及个人隐私。', + showCancel: false, + confirmText: '确认', + confirmColor: '#000', + }) + }}> {/* 推荐图标 SVG */} - )} diff --git a/src/user_pages/withdrawal/index.scss b/src/user_pages/withdrawal/index.scss index c9ab7da..7455877 100644 --- a/src/user_pages/withdrawal/index.scss +++ b/src/user_pages/withdrawal/index.scss @@ -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; diff --git a/src/user_pages/withdrawal/index.tsx b/src/user_pages/withdrawal/index.tsx index bfb37b7..5494d7e 100644 --- a/src/user_pages/withdrawal/index.tsx +++ b/src/user_pages/withdrawal/index.tsx @@ -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(""); const [inputValue, setInputValue] = useState("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); @@ -51,7 +73,7 @@ const Withdrawal: React.FC = () => { setShowTips(true); setTipsText("单笔提现金额不能超过 200元"); } else { - setShowTips(false); + setShowTips(false); } }; @@ -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 ( @@ -270,8 +295,9 @@ const Withdrawal: React.FC = () => { title="提现" className="withdraw_popup" hideFooter={true} + style={{ bottom: isKeyboardVisible ? `${keyboardHeight}px` : undefined }} > - + {`¥${inputValue}`} { @@ -282,7 +308,7 @@ const Withdrawal: React.FC = () => { )) } - item !== "").join("")} maxlength={6} onInput={handlePasswordInput} /> + item !== "").join("")} maxlength={6} onInput={handlePasswordInput} />