1
This commit is contained in:
@@ -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}>
|
||||
|
||||
Reference in New Issue
Block a user