This commit is contained in:
张成
2025-09-07 10:06:00 +08:00
parent 955f1003dd
commit 4c36986ade
11 changed files with 403 additions and 220 deletions

View File

@@ -1,4 +1,5 @@
import React from 'react';
import Taro from '@tarojs/taro';
import { View, Text, Image, Button } from '@tarojs/components';
import './index.scss';
@@ -19,6 +20,8 @@ export interface UserInfo {
location: string;
occupation: string;
ntrp_level: string;
phone?: string;
gender?: string;
}
// 用户信息卡片组件属性
@@ -28,10 +31,16 @@ interface UserInfoCardProps {
is_following?: boolean;
on_follow?: () => void;
on_message?: () => void;
on_edit?: () => void;
on_share?: () => void;
}
// 处理编辑用户信息
const on_edit = () => {
Taro.navigateTo({
url: '/pages/userInfo/edit/index'
});
};
// 用户信息卡片组件
export const UserInfoCard: React.FC<UserInfoCardProps> = ({
user_info,
@@ -39,7 +48,6 @@ export const UserInfoCard: React.FC<UserInfoCardProps> = ({
is_following = false,
on_follow,
on_message,
on_edit,
on_share
}) => {
return (
@@ -53,7 +61,7 @@ export const UserInfoCard: React.FC<UserInfoCardProps> = ({
<Text className="nickname">{user_info.nickname}</Text>
<Text className="join_date">{user_info.join_date}</Text>
</View>
<View className='tag_item'>
<View className='tag_item' onClick={on_edit}>
<Image
className="tag_icon"
src={require('../../static/userInfo/edit.svg')}
@@ -105,12 +113,7 @@ export const UserInfoCard: React.FC<UserInfoCardProps> = ({
/>
</Button>
)}
{/* 只有当前用户才显示编辑按钮 */}
{is_current_user && on_edit && (
<Button className="edit_button" onClick={on_edit}>
<Text className="button_text"></Text>
</Button>
)}
{/* 只有当前用户才显示分享按钮 */}
{is_current_user && on_share && (
<Button className="share_button" onClick={on_share}>