diff --git a/pages/task/index.vue b/pages/task/index.vue
index 9fd713e..ac94de0 100644
--- a/pages/task/index.vue
+++ b/pages/task/index.vue
@@ -11,27 +11,32 @@
-
+
- 已连续签到 3 天
-
+ 已连续签到 {{signDays}} 天
+
-
-
+
+
+
+
- {{item.name}}
+ {{item.showText}}
- 连续签到7天即可享受惊喜大礼包
+ 连续签到7天即可获得7元奖励
-
- 点击签到
+
+ {{signInBtn}}
@@ -39,7 +44,9 @@
-
+
{{ item.title}}
@@ -72,6 +79,7 @@
},
list: [],
checked:false,
+ signDays: 0,
signInList: [
{ name: '第一天' },
{ name: '第二天' },
@@ -81,12 +89,50 @@
{ name: '第六天' },
{ name: '第七天' },
],
+ signInBtn: '点击签到',
+ isShowMoneyPay: true,
}
},
onShow() {
this.getTaskdata()
+ this.getsignIn()
+ this.$Request.getT("app/common/type/919", {}).then(res => {
+ if (res.code == 0) {
+ const sysInfo = uni.getSystemInfoSync();
+ let isIos = sysInfo.platform == 'ios'
+ this.isShowMoneyPay = !(res.data.value == '1' && isIos)
+ }
+ });
},
methods: {
+ getsignIn() {
+ this.$Request.getT('app/userSignRecord/getUserSignData', {}).then(res => {
+ if (res.code == 0 ) {
+ this.signInList = res.data.recordList
+ this.signDays = res.data.signDays
+ this.signInList.map((item,index)=>{
+ if (item.showText == '待签到'&&index>0) {
+ this.signInBtn = this.signInList[index-1].status == 0 ? '重新签到' : '点击签到'
+ }
+ let someDate = new Date(item.signDay); // 假设这是需要判断的日期
+ if (item.signDay && this.isToday(someDate)) {
+ this.signInBtn = '已签到'
+ }
+ })
+ } else {
+ uni.showToast({
+ title: res.msg,
+ icon: 'none'
+ })
+ }
+ })
+ },
+ isToday (date) {
+ const today = new Date();
+ return date.getDate() === today.getDate() // 比较日期
+ && date.getMonth() === today.getMonth() // 比较月份
+ && date.getFullYear() === today.getFullYear(); // 比较年份
+ },
/**
* 跳转
* @param {Object} item
@@ -123,16 +169,16 @@
this.$Request.getT('app/taskCenter/taskReceive', data).then(res => {
if (res.code == 0 ) {
uni.showToast({
- title: '领取成功',
+ title: id==15?'签到成功':'领取成功',
icon: 'none'
})
setTimeout(()=>{
this.getTaskdata()
+ this.getsignIn()
},1000)
} else {
- uni.showToast({
- title: res.msg,
- icon: 'none'
+ uni.switchTab({
+ url: "/pages/index/index"
})
}
})
@@ -312,8 +358,20 @@
margin-top: 24rpx;
}
}
+ .signIn-Item.active{
+ .radius{
+ background-color: #EA9EA8;
+
+ }
+ }
+ }
+ .tishi{
+ width: 100%;
+ text-align: center;
+ font-weight: 400;
+ font-size: 20rpx;
+ color: #7F7F7F;
}
-
.signInBtn{
width: 355rpx;
height: 64rpx;