fix: PageWriteLevels 上传用户信息时需要传递 userId
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import { ToastManager } from 'db://assets/scripts/utils/ToastManager';
|
|||||||
import { ShareManager } from 'db://assets/scripts/utils/ShareManager';
|
import { ShareManager } from 'db://assets/scripts/utils/ShareManager';
|
||||||
import { StorageManager } from 'db://assets/scripts/utils/StorageManager';
|
import { StorageManager } from 'db://assets/scripts/utils/StorageManager';
|
||||||
import { WxSDK, getUserProfile } from 'db://assets/scripts/utils/WxSDK';
|
import { WxSDK, getUserProfile } from 'db://assets/scripts/utils/WxSDK';
|
||||||
|
import { AuthManager } from 'db://assets/scripts/utils/AuthManager';
|
||||||
import { API_ENDPOINTS, API_TIMEOUT } from 'db://assets/scripts/config/ApiConfig';
|
import { API_ENDPOINTS, API_TIMEOUT } from 'db://assets/scripts/config/ApiConfig';
|
||||||
import { HttpUtil } from 'db://assets/scripts/utils/HttpUtil';
|
import { HttpUtil } from 'db://assets/scripts/utils/HttpUtil';
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
@@ -574,6 +575,13 @@ export class PageWriteLevels extends BaseView {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取当前登录用户的 ID
|
||||||
|
const userId = AuthManager.instance.userId;
|
||||||
|
if (!userId) {
|
||||||
|
console.warn('[PageWriteLevels] 用户未登录,跳过获取用户信息');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const userInfo = await getUserProfile();
|
const userInfo = await getUserProfile();
|
||||||
|
|
||||||
@@ -584,6 +592,7 @@ export class PageWriteLevels extends BaseView {
|
|||||||
const response = await HttpUtil.post(
|
const response = await HttpUtil.post(
|
||||||
API_ENDPOINTS.USER_INFO,
|
API_ENDPOINTS.USER_INFO,
|
||||||
{
|
{
|
||||||
|
userId: userId,
|
||||||
avatarUrl: userInfo.avatarUrl,
|
avatarUrl: userInfo.avatarUrl,
|
||||||
nickName: userInfo.nickName
|
nickName: userInfo.nickName
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user