feat: @提及功能优化 + 默认头像改用SVG图标
- 评论区有效@提及渲染为蓝色链接跳转/space/{uid},无效@保持纯文本
- 输入@触发悬浮窗,根据输入实时搜索用户(含头像+等级)
- 无匹配时显示未搜索到用户,选中后插入为@用户名 格式(尾部空格)
- 悬浮窗定位于输入光标上方,不遮挡输入内容
- 后端Comment新增Mentions字段,批量加载提及映射供前端判断
- SearchUsers/parseMentions 统一限制LV2+用户
- 所有默认头像由首字符文字改为统一SVG人形图标(nav/home/space/mention等7处)
This commit is contained in:
@ -25,6 +25,9 @@ type Comment struct {
|
||||
ReplyToName string `gorm:"-:migration;<-:false" json:"reply_to_name,omitempty"`
|
||||
// RepliesCount 回复数(非DB字段,查询填充)
|
||||
RepliesCount int `gorm:"-:migration;<-:false" json:"replies_count,omitempty"`
|
||||
// Mentions 有效@提及映射 username -> uid(非DB字段,批量查询填充)
|
||||
// 前端据此判断 @username 是否为有效提及并生成链接
|
||||
Mentions map[string]uint `gorm:"-" json:"mentions,omitempty"`
|
||||
}
|
||||
|
||||
// CommentMention @提及映射(绑定UID,不是username,支持改名后自动更新显示名)
|
||||
@ -39,6 +42,7 @@ type UserSearchResult struct {
|
||||
UID uint `json:"uid"`
|
||||
Username string `json:"username"`
|
||||
Level int `json:"level"`
|
||||
Avatar string `json:"avatar"`
|
||||
}
|
||||
|
||||
// AdminCommentRow 后台评论列表行
|
||||
|
||||
Reference in New Issue
Block a user