blob: 15be459ac5fbe1a3d21aaf0160480d58974b40b6 [file] [log] [blame]
2130105001e07a12025-06-09 18:00:40 +08001import React from 'react';
2import { Avatar } from 'antd';
3import frameImage from './avatar-frame.png'; // 头像框图片素材
4import './AvatarWithFrame.css';
5
6const AvatarWithFrame = () => {
7 // 从localStorage获取用户数据
8 const userData = JSON.parse(localStorage.getItem('user')) || {};
9 const { image, decoration = '' } = userData;
10
11 // 检查是否包含头像框
12 const hasFrame = decoration.includes('头像框');
13
14 return (
15 <div className="avatar-container">
16 {/* 头像 */}
17 <Avatar
18 src={image}
19 size={80}
20 className={`user-avatar ${hasFrame ? 'with-frame' : ''}`}
21 />
22
23 {/* 头像框图片 - 根据decoration显示 */}
24 {hasFrame && (
25 <img
26 src={frameImage}
27 alt="头像框"
28 className="avatar-frame-image"
29 />
30 )}
31 </div>
32 );
33};
34
35export default AvatarWithFrame;