fix(admin-web): 优化通知表单标签选择体验

- 新建通知时自动刷新可用标签列表
- 添加"刷新标签"按钮方便手动刷新
- 优化空标签提示,说明需勾选"可用于广告定向"
- 改进"指定用户"输入框占位符文本和示例

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2025-12-24 18:33:14 -08:00
parent 41a47b1b53
commit 1b3d545c0d
1 changed files with 24 additions and 5 deletions

View File

@ -138,6 +138,8 @@ export default function NotificationsPage() {
publishedAt: '',
expiresAt: '',
});
// 刷新可用标签列表,确保显示最新创建的标签
loadTags();
setShowModal(true);
};
@ -500,11 +502,28 @@ export default function NotificationsPage() {
{/* 按标签筛选 */}
{formData.targetType === 'BY_TAG' && (
<div className={styles.notifications__formGroup}>
<label> ()</label>
<label style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
<span> ()</span>
<button
type="button"
onClick={loadTags}
style={{
padding: '2px 8px',
fontSize: '12px',
color: '#3b82f6',
background: 'transparent',
border: '1px solid #3b82f6',
borderRadius: '4px',
cursor: 'pointer',
}}
>
</button>
</label>
<div className={styles.notifications__tagSelector}>
{availableTags.length === 0 ? (
<div className={styles.notifications__empty} style={{ padding: '20px' }}>
"用户标签"
"用户标签""可用于广告定向"
</div>
) : (
<div className={styles.notifications__tagList}>
@ -540,13 +559,13 @@ export default function NotificationsPage() {
{/* 指定用户 */}
{formData.targetType === 'SPECIFIC' && (
<div className={styles.notifications__formGroup}>
<label>ID列表</label>
<label>ID列表</label>
<textarea
className={styles.notifications__userIdsInput}
value={formData.userIds}
onChange={(e) => setFormData({ ...formData, userIds: e.target.value })}
placeholder="请输入用户ID每行一个或用逗号分隔"
rows={4}
placeholder="请输入用户账户序列号(如 000000000001每行一个或用逗号分隔&#10;例如:&#10;000000000001&#10;000000000002,000000000003"
rows={6}
/>
<span className={styles.notifications__targetHint}>
{formData.userIds.split(/[\n,]/).filter(s => s.trim()).length}