Files
drawlogo/works/devdoc/avatars.html
T
sgp 12f8b65e1c feat(works): 新增成品「开发文档中心 · 甄房」
- 回收 ZhenOS-SH/ruoyi-ui public/devdoc 静态站(16 文件 / 3.69 MB)到 works/devdoc
- 目录页 5 分类 21 条文档 + 10 个子页(业务全流程流程图 mermaid / 菜单图标选型 / 头像素材规范等)
- works.js 追加索引(文档类),works.html 版本 bump
2026-11-15 22:48:48 +08:00

153 lines
6.9 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>默认头像素材库 · 开发文档</title>
<style>
* { box-sizing: border-box; }
body {
margin: 0;
padding: 36px 28px 56px;
background: #f6f8fb;
color: #1f2d3d;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
line-height: 1.7;
}
.wrap { max-width: 1100px; margin: 0 auto; }
a { color: #2f6fed; text-decoration: none; }
a:hover { text-decoration: underline; }
.crumb { font-size: 12px; color: #8a94a6; }
h1 { margin: 10px 0 8px; font-size: 28px; letter-spacing: -.02em; }
.lead { margin: 0; color: #6b7787; font-size: 14px; }
.meta {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
gap: 12px;
margin: 22px 0 28px;
padding: 16px 18px;
background: #fff;
border: 1px solid #e6eaf2;
border-radius: 12px;
}
.meta div { font-size: 12px; color: #6b7787; }
.meta b { display: block; margin-bottom: 2px; color: #1f2d3d; font-size: 13px; }
h2 { margin: 28px 0 8px; font-size: 18px; }
.note {
margin: 10px 0 18px;
padding: 12px 16px;
background: #eef4ff;
border-left: 3px solid #4c6ef5;
border-radius: 6px;
font-size: 13px;
color: #3b4a63;
}
.grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
gap: 12px;
}
.card {
display: flex;
flex-direction: column;
align-items: center;
padding: 16px 10px 12px;
background: #fff;
border: 1px solid #e6eaf2;
border-radius: 10px;
text-align: center;
}
.card img { width: 56px; height: 56px; border-radius: 50%; background: #f1f4fa; }
.card.bg img { width: 64px; height: 64px; }
.name { margin-top: 10px; font-size: 13px; font-weight: 600; }
.file { margin-top: 2px; font-size: 10px; color: #9aa4b5; word-break: break-all; }
code { background: #eef1f6; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; background: #fff; font-size: 13px; }
th, td { padding: 9px 12px; border: 1px solid #e6eaf2; text-align: left; }
th { background: #f3f6fb; font-weight: 600; color: #4a566b; }
.footer { margin-top: 32px; font-size: 12px; color: #9aa4b5; }
</style>
</head>
<body>
<div class="wrap">
<div class="crumb"><a href="./index.html">开发文档</a> / 底层设计 / 默认头像素材库</div>
<h1>默认头像素材库</h1>
<p class="lead">个人中心头像选型、未设置头像时的稳定兜底,以及新用户的默认头像来源。共 40 款,全部为中性人形图标。</p>
<div class="meta">
<div><b>备档日期</b>2026-11-15</div>
<div><b>素材来源</b>画个标素材 API(Lucide <code>user</code>)</div>
<div><b>协议</b>ISC,可商用</div>
<div><b>数量</b>40 款(线框 20 + 背景 20)</div>
<div><b>存放目录</b><code>ruoyi-ui/public/avatars/</code></div>
<div><b>在线预览</b><a href="../avatar-preview.html" target="_blank">avatar-preview.html</a></div>
</div>
<div class="note">
<b>与基座的关系:</b>头像能力全部为新增,不改动 RuoYi 既有登录、用户、权限逻辑。
后端保存接口独立在 <code>ruoyi-estate</code>(<code>PUT /estate/profile/avatar/preset</code>,40 条白名单),
前端仅在个人中心入口与登录信息解析处做兼容,不改框架核心组件。
</div>
<h2>一、分配与兜底规则</h2>
<table>
<tr><th>场景</th><th>规则</th></tr>
<tr><td>用户主动选择</td><td>个人中心 → 头像 → 从 40 款默认头像中选择 → 保存,写入 <code>sys_user.avatar</code></td></tr>
<tr><td>新注册用户</td><td>注册后 <code>avatar</code> 为空,前端按 <code>userId % 40</code> 稳定取一款,均匀分散且不会每次刷新变化</td></tr>
<tr><td>历史空头像用户</td><td>同上规则兜底,无需批量刷库</td></tr>
<tr><td>C 端(官网 / H5)注册用户</td><td>同一套 40 款:未设置时按 `userId % 40` 稳定取款;个人资料页可自选默认头像,写入 `c_user.avatar`。资源分别在 `c-web/public/avatars/` 与 `c-h5/src/static/avatars/`</td></tr>
<tr><td>上传自定义头像</td><td>仍走原裁剪上传逻辑,存 MinIO;选择默认头像不会删除旧对象</td></tr>
<tr><td>合法路径</td><td><code>/avatars/avatar-line-01.svg</code> ~ <code>-20</code>、<code>/avatars/avatar-bg-01.svg</code> ~ <code>-20</code></td></tr>
</table>
<h2>二、线框半身 · 二十色</h2>
<div class="grid" id="grid-line"></div>
<h2>三、浅色渐变背景 · 二十款</h2>
<div class="grid" id="grid-bg"></div>
<div class="footer">
维护提示:新增头像时需同步 ① <code>public/avatars/</code> 文件 ② 前端 <code>src/utils/presetAvatars.js</code>
③ 后端 <code>EstateProfileAvatarController</code> 白名单 ④ 本页清单。
</div>
</div>
<script>
var GROUPS = {
line: [
['01','墨蓝','#3B5BDB'],['02','湖蓝','#1C7ED6'],['03','青碧','#0CA678'],['04','松绿','#2F9E44'],
['05','橄榄','#74B816'],['06','琥珀','#F08C00'],['07','珊瑚','#E8590C'],['08','玫红','#D6336C'],
['09','紫罗兰','#7048E8'],['10','石墨','#495057'],['11','天青','#1098AD'],['12','深青','#0B7285'],
['13','墨绿','#087F5B'],['14','苔绿','#5C940D'],['15','酒红','#A61E4D'],['16','砖红','#C92A2A'],
['17','紫晶','#9C36B5'],['18','蓝紫','#5F3DC4'],['19','赭石','#A0522D'],['20','玄黑','#212529']
],
bg: [
['01','极光蓝紫','#4C6EF5'],['02','晴空蓝','#1C7ED6'],['03','青碧','#0CA678'],['04','森野绿','#2F9E44'],
['05','落日橙','#E8590C'],['06','莓果粉','#D6336C'],['07','星云紫','#7048E8'],['08','深海青','#0B7285'],
['09','石墨蓝','#495057'],['10','赤陶红','#C92A2A'],['11','紫藤','#9C36B5'],['12','冰川青','#1098AD'],
['13','橄榄','#5C940D'],['14','胭脂','#A61E4D'],['15','海军蓝','#3B5BDB'],['16','鸢尾紫','#6D28D9'],
['17','翡翠','#087F5B'],['18','琥珀棕','#B45309'],['19','午夜蓝','#312E81'],['20','陨石灰','#212529']
]
};
function render(key, targetId) {
var wrap = document.getElementById(targetId);
GROUPS[key].forEach(function (row) {
var num = row[0], name = row[1], color = row[2];
var file = key === 'line' ? 'avatar-line-' + num + '.svg' : 'avatar-bg-' + num + '.svg';
var card = document.createElement('div');
card.className = 'card' + (key === 'bg' ? ' bg' : '');
card.innerHTML =
'<img alt="' + name + '" src="../avatars/' + file + '">' +
'<span class="name">' + name + '</span>' +
'<span class="file">' + file + '<br>' + color + '</span>';
wrap.appendChild(card);
});
}
render('line', 'grid-line');
render('bg', 'grid-bg');
</script>
</body>
</html>