update
This commit is contained in:
@@ -21,6 +21,9 @@ import LanguageUtils, {
|
||||
} from "../../../Main/Common/LanguageUtils";
|
||||
import AudioManager from "../../../Main/Manager/AudioManager";
|
||||
import { NavigationManager } from "../../manager/NavigationManager";
|
||||
import { PlayerDataService } from "../../network/services/PlayerDataService";
|
||||
import proto from "db://assets/Scripts/proto/proto.pb.js";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass("PersonalPanel")
|
||||
@@ -82,14 +85,25 @@ export class PersonalPanel extends li_BaseView {
|
||||
}
|
||||
}
|
||||
|
||||
private refresh(): void {
|
||||
private async refresh() {
|
||||
const reqData = {};
|
||||
let res = await PlayerDataService.I.reqMyInfo(reqData);
|
||||
console.log("个人信息响应数据:", res);
|
||||
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
|
||||
const resData = res.data;
|
||||
const walletData = DataManager.I.getDataById<WalletData>(DataId.Wallet);
|
||||
walletData.balance = Number(resData.balance);
|
||||
walletData.vipExpire = Number(resData.vipExpire);
|
||||
}
|
||||
|
||||
this.updateUserInfo();
|
||||
this.updateBalance();
|
||||
this.updateVipStatus();
|
||||
}
|
||||
|
||||
private updateUserInfo(): void {
|
||||
private updateUserInfo() {
|
||||
// 更新用户名
|
||||
|
||||
if (this.userNameLabel && this.playerData) {
|
||||
const userName = this.playerData.name || "未设置";
|
||||
this.userNameLabel.string = userName;
|
||||
|
||||
@@ -346,11 +346,16 @@ export class ThemePanel extends li_BaseView {
|
||||
// 刷新 vip失效时间戳
|
||||
private refreshVipExpire() {
|
||||
const walletData = DataManager.I.getDataById<WalletData>(DataId.Wallet);
|
||||
|
||||
const vipExpire = walletData.vipExpire;
|
||||
const leftTime = Utils.formatVipLeftTime(vipExpire);
|
||||
this.vipLeftTime.string = LanguageUtils.getText(
|
||||
"purchasepanel.vip_left"
|
||||
).replace("${leftTime}", leftTime);
|
||||
if (Date.now() > vipExpire) {
|
||||
this.vipLeftTime.string = LanguageUtils.getText("purchasePanel.notVip");
|
||||
} else {
|
||||
const leftTime = Utils.formatVipLeftTime(vipExpire);
|
||||
this.vipLeftTime.string = LanguageUtils.getText(
|
||||
"purchasepanel.vip_left"
|
||||
).replace("${leftTime}", leftTime);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取商品列表
|
||||
|
||||
Reference in New Issue
Block a user