ZHIWEI666 commited on
Commit
23fc4ef
·
verified ·
1 Parent(s): 1e515d5

Upload 62 files

Browse files
前端页面/profile/个人设置表单组件.js CHANGED
@@ -370,7 +370,14 @@ export function createSettingsForm(initialUserData, onCancelCallback, onSaveSucc
370
  }
371
  );
372
  container.querySelector("#btn-clear-banner").onclick = () => {
373
- bannerUrl = null;
 
 
 
 
 
 
 
374
  pendingBannerFile = null;
375
  pendingBannerDataUrl = null;
376
  bannerPreview.style.backgroundImage = "none";
 
370
  }
371
  );
372
  container.querySelector("#btn-clear-banner").onclick = () => {
373
+ // 🔧 清除必须传空串而非 null:云端 PUT /api/users/{account} 的更新循环只写非 None 值
374
+ // (见 router_users_profile.py「遍历请求中的字段,只更新非空值」),传 null 等同于
375
+ // 「本次没改这个字段」而被跳过,云端旧图残留 —— 表现为点清除并保存后提示成功,
376
+ // 但自己和他人在创作者榜单里看到的背景图依然存在。空串则会真实落库,
377
+ // 且下游 hasBanner / bannerImageUrl 等判断都按 falsy 正确处理。
378
+ // 注意上方 `let bannerUrl = userData.bannerUrl || null` 的初值仍保持 null:那是「本次未涉及该字段」
379
+ // 的语义,可防止 userData 恰好缺 bannerUrl 时把云端图误清掉。
380
+ bannerUrl = "";
381
  pendingBannerFile = null;
382
  pendingBannerDataUrl = null;
383
  bannerPreview.style.backgroundImage = "none";
前端页面/task/任务详情组件.js CHANGED
@@ -335,7 +335,7 @@ ${escapeHtml(task.description)}</div>
335
  ` : ""}
336
 
337
  <!-- 操作按钮区域 -->
338
- <div id="action-buttons" style="display: flex; flex-direction: column; gap: 10px; margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--border-color, #333);
339
  </div>
340
  `;
341
 
 
335
  ` : ""}
336
 
337
  <!-- 操作按钮区域 -->
338
+ <div id="action-buttons" style="display: flex; flex-direction: column; gap: 10px; margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--border-color, #333);">
339
  </div>
340
  `;
341