|
|
@@ -1,4 +1,11 @@
|
|
|
-import { _decorator, Component, Node } from 'cc';
|
|
|
+/*
|
|
|
+ * @Author: mojunshou 1637302775@qq.com
|
|
|
+ * @Date: 2025-04-19 11:04:19
|
|
|
+ * @LastEditors: mojunshou 1637302775@qq.com
|
|
|
+ * @LastEditTime: 2025-04-28 15:25:52
|
|
|
+ * @Description:
|
|
|
+ */
|
|
|
+import { _decorator } from 'cc';
|
|
|
import { oops } from 'db://oops-framework/core/Oops';
|
|
|
import VMParent from 'db://oops-framework/libs/model-view/VMParent';
|
|
|
import { UIID } from '../../common/config/GameUIConfig';
|
|
|
@@ -11,13 +18,11 @@ const { ccclass, property } = _decorator;
|
|
|
|
|
|
@ccclass('ReservePopup')
|
|
|
export class ReservePopup extends VMParent {
|
|
|
-
|
|
|
-
|
|
|
data: any = {
|
|
|
nickName: "小白",
|
|
|
time: "2025-04-28",
|
|
|
money: 1000,
|
|
|
- goldNum: 10
|
|
|
+ goldNum: 1
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -28,15 +33,14 @@ export class ReservePopup extends VMParent {
|
|
|
}
|
|
|
|
|
|
//更新数据
|
|
|
-
|
|
|
-
|
|
|
updateData() {
|
|
|
if (DeviceUtil.isAndroid && DeviceUtil.isNative) {
|
|
|
- this.data.nickName = smc.account.AccountModel.accountName;
|
|
|
+ let name = smc.account.AccountModel.accountName
|
|
|
+ //超过五位数就用***代替
|
|
|
+ this.data.nickName = Format.truncateCustom(name);
|
|
|
this.data.money = Format.formatWxCoin(smc.account.AccountModel.wxCoin);
|
|
|
- this.data.goldNum = smc.account.AccountModel.goldCoin;
|
|
|
//当前时间的后三天,只要年月日
|
|
|
- // this.data.time =
|
|
|
+ this.data.time = this.getThreeDaysLater();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -44,7 +48,6 @@ export class ReservePopup extends VMParent {
|
|
|
|
|
|
async btn_confirm() {
|
|
|
//加载微信转账中
|
|
|
- // await oops.gui.open(UIID.WechaatTransfer);
|
|
|
oops.gui.remove(UIID.ReservePopup);
|
|
|
this.updateState();
|
|
|
}
|
|
|
@@ -57,6 +60,19 @@ export class ReservePopup extends VMParent {
|
|
|
})
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ // 获取当前日期后三天的日期(格式:YYYY-MM-DD)
|
|
|
+ getThreeDaysLater(): string {
|
|
|
+ const date = new Date();
|
|
|
+ date.setDate(date.getDate() + 3); // 自动处理跨月/年逻辑[5](@ref)
|
|
|
+
|
|
|
+ // 补零处理
|
|
|
+ const year = date.getFullYear();
|
|
|
+ const month = (date.getMonth() + 1).toString().padStart(2, '0'); // 月份从0开始需+1[4](@ref)
|
|
|
+ const day = date.getDate().toString().padStart(2, '0'); // 日期补零[2](@ref)
|
|
|
+
|
|
|
+ return `${year}-${month}-${day}`;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|