feat: 完成头像上传、站点主题配置与UI优化
- 新增附件模型与上传服务,拆分头像上传/管理逻辑 - 重构用户资料接口,移除直接修改头像字段,改用专用上传接口 - 添加站点公开设置API与管理员外观配置页 - 全局替换hover背景为accent-soft,优化交互一致性 - 完善头像组件,支持图片加载失败回退与src更新重置 - 新增用户状态事件总线,解决同页头像更新不及时问题 - 调整依赖包顺序与CI依赖版本 - 重构板块列表接口,新增帖子计数 - 迁移账号设置到用户主页tab,合并重复代码
This commit is contained in:
@@ -8,15 +8,14 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// UpdateProfileRequest 更新资料请求
|
||||
// UpdateProfileRequest 更新资料请求(头像不在此通道,见 /api/upload/avatar)
|
||||
type UpdateProfileRequest struct {
|
||||
Nickname string `json:"nickname"`
|
||||
Avatar string `json:"avatar"`
|
||||
Email string `json:"email"`
|
||||
Signature string `json:"signature"`
|
||||
}
|
||||
|
||||
// UpdateProfile 更新当前登录用户的资料(昵称、头像、邮箱、签名)
|
||||
// UpdateProfile 更新当前登录用户的资料(昵称、邮箱、签名)
|
||||
func (h *Handlers) UpdateProfile(c *gin.Context) {
|
||||
claims := middleware.CurrentUser(c)
|
||||
var req UpdateProfileRequest
|
||||
@@ -25,7 +24,7 @@ func (h *Handlers) UpdateProfile(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
user, err := h.Auth.UpdateProfile(claims.ID, req.Nickname, req.Avatar, req.Email, req.Signature)
|
||||
user, err := h.Auth.UpdateProfile(claims.ID, req.Nickname, req.Email, req.Signature)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user