|
@@ -126,7 +126,6 @@ export default {
|
|
userInfo: {},
|
|
userInfo: {},
|
|
dailyBonus: 2800,
|
|
dailyBonus: 2800,
|
|
dailyCoins: 10,
|
|
dailyCoins: 10,
|
|
- lastSignDate: null,
|
|
|
|
showSuccessDialog: false,
|
|
showSuccessDialog: false,
|
|
showAlreadySignedDialog: false,
|
|
showAlreadySignedDialog: false,
|
|
showAuthDialog: false
|
|
showAuthDialog: false
|
|
@@ -134,11 +133,15 @@ export default {
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
hasSignedToday() {
|
|
hasSignedToday() {
|
|
- // 如果没有最后签到日期,说明还没签到过
|
|
|
|
- if (!this.lastSignDate) return false;
|
|
|
|
-
|
|
|
|
- const today = new Date().toLocaleDateString();
|
|
|
|
- return today === this.lastSignDate;
|
|
|
|
|
|
+ if (!this.userInfo.sign_times) return false;
|
|
|
|
+ // 假设 sign_times 是秒级时间戳
|
|
|
|
+ const signDate = new Date(this.userInfo.sign_times * 1000);
|
|
|
|
+ const today = new Date();
|
|
|
|
+ return (
|
|
|
|
+ signDate.getFullYear() === today.getFullYear() &&
|
|
|
|
+ signDate.getMonth() === today.getMonth() &&
|
|
|
|
+ signDate.getDate() === today.getDate()
|
|
|
|
+ );
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
@@ -146,8 +149,6 @@ export default {
|
|
try {
|
|
try {
|
|
const res = await getUserInfo();
|
|
const res = await getUserInfo();
|
|
this.userInfo = res.data;
|
|
this.userInfo = res.data;
|
|
- // 获取本地存储的最后签到日期
|
|
|
|
- this.lastSignDate = localStorage.getItem('lastSignDate');
|
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
console.error('获取用户信息失败:', error);
|
|
console.error('获取用户信息失败:', error);
|
|
}
|
|
}
|