修改签到
This commit is contained in:
@ -7,62 +7,18 @@
|
||||
<text class="">{{ signDays }}天</text>
|
||||
</view>
|
||||
<view class="row-between u-m-t-32 u-m-l-24 u-m-r-24">
|
||||
<!-- <view class="sigin-day expire column-center">
|
||||
<view class="date mt10">第一天</view>
|
||||
<view class="mt10">
|
||||
<u-image :src="cloudPath + 'img/icon_signin_gray.png'" width="30" height="30"></u-image>
|
||||
</view>
|
||||
<view class="points mt10">x20</view>
|
||||
</view>
|
||||
|
||||
<view class="sigin-day normal column-center">
|
||||
<view class="date mt10">第二天</view>
|
||||
<view class="mt10">
|
||||
<u-image :src="cloudPath + 'img/icon_signin_blue.png'" width="30" height="30"></u-image>
|
||||
</view>
|
||||
<view class="points mt10">x40</view>
|
||||
</view>
|
||||
|
||||
<view class="sigin-day normal column-center">
|
||||
<view class="date mt10">第三天</view>
|
||||
<view class="mt10">
|
||||
<u-image :src="cloudPath + 'img/icon_signin_blue.png'" width="30" height="30"></u-image>
|
||||
</view>
|
||||
<view class="points mt10">x60</view>
|
||||
</view>
|
||||
|
||||
<view class="sigin-day normal column-center">
|
||||
<view class="date mt10">第四天</view>
|
||||
<view class="mt10">
|
||||
<u-image :src="cloudPath + 'img/icon_signin_blue.png'" width="30" height="30"></u-image>
|
||||
</view>
|
||||
<view class="points mt10">x80</view>
|
||||
</view>
|
||||
|
||||
<view class="sigin-day normal column-center">
|
||||
<view class="date mt10">第五天</view>
|
||||
<view class="mt10">
|
||||
<u-image :src="cloudPath + 'img/icon_signin_blue.png'" width="30" height="30"></u-image>
|
||||
</view>
|
||||
<view class="points mt10">x100</view>
|
||||
</view>
|
||||
|
||||
<view class="sigin-day normal column-center">
|
||||
<view class="date mt10">第六天</view>
|
||||
<view class="mt10">
|
||||
<u-image :src="cloudPath + 'img/icon_signin_blue.png'" width="30" height="30"></u-image>
|
||||
</view>
|
||||
<view class="points mt10">x120</view>
|
||||
</view>
|
||||
|
||||
<view class="sigin-day last column-center">
|
||||
<view class="date mt10">第七天</view>
|
||||
<view class="mt10">
|
||||
<u-image :src="cloudPath + 'img/icon_signin_white.png'" width="30" height="30"></u-image>
|
||||
</view>
|
||||
<view class="points mt10">x140</view>
|
||||
</view> -->
|
||||
<view :class="getDayActive(item)" v-for="(item, index) in signList" :key="index">
|
||||
<view
|
||||
:class="[
|
||||
'sigin-day',
|
||||
'column-center',
|
||||
{
|
||||
'current': (currentDay == item.days && canSign == 0),
|
||||
'normal': ((currentDay == item.days && item.status == 1) || (currentDay != item.days && item.status == 1)),
|
||||
'expire': ((currentDay == item.days && item.status == 0) || (currentDay != item.days && item.status == 0))
|
||||
}
|
||||
]"
|
||||
v-for="(item, index) in signList" :key="index"
|
||||
>
|
||||
<view class="date mt10">第{{ item.days }}天</view>
|
||||
<view class="mt10">
|
||||
<!-- <u-image :src="cloudPath + 'img/icon_signin_gray.png'" width="30" height="30"></u-image> -->
|
||||
@ -111,7 +67,7 @@
|
||||
addGrowth: 0,
|
||||
signDays: 0,
|
||||
makeInegral: [],
|
||||
weekDay: 1
|
||||
currentDay: 0
|
||||
}
|
||||
},
|
||||
|
||||
@ -131,14 +87,21 @@
|
||||
let {
|
||||
sign_list
|
||||
} = res.data;
|
||||
console.log("sign_list>>>", sign_list);
|
||||
console.log("sign_list>>>", sign_list.length);
|
||||
|
||||
this.signList = sign_list
|
||||
this.integral = res.data.user.user_integral
|
||||
this.canSign = res.data.user.today_sign
|
||||
this.signDays = res.data.user.days
|
||||
this.weekDay = res.data.user.week_day
|
||||
this.canSign = res.data.user.today_sign // 是否可以签到 1:已签到 0:未签到
|
||||
this.signDays = res.data.user.days // 连续签到天数
|
||||
this.makeInegral = res.data.make_inegral
|
||||
|
||||
// 如果签到天数为0的话,也指向第一天的高亮样式
|
||||
this.currentDay = this.signDays + 1
|
||||
if (this.signDays == 0) {
|
||||
this.currentDay = 1
|
||||
} else if (this.signDays > sign_list.length) {
|
||||
this.currentDay = sign_list.length
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -172,8 +135,7 @@
|
||||
signinCurrent() {
|
||||
return (item) => {
|
||||
// 如果签到天数为0的话,也指向第一天的高亮图片
|
||||
const day = this.signDays || 1
|
||||
if (day == item.days && this.canSign == 0) {
|
||||
if (this.currentDay == item.days && this.canSign == 0) {
|
||||
// 当天日期
|
||||
return `${this.cloudPath}img/icon_signin_white.png`
|
||||
} else if (item.status == 0) {
|
||||
@ -184,27 +146,6 @@
|
||||
return `${this.cloudPath}img/icon_signin_blue.png`
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 处理签到class显示
|
||||
getDayActive() {
|
||||
return (item) => {
|
||||
let obj = {'sigin-day': true, 'column-center': true}
|
||||
|
||||
// 如果签到天数为0的话,也指向第一天的高亮样式
|
||||
const day = this.signDays || 1
|
||||
|
||||
if (day == item.days && this.canSign == 0) {
|
||||
// 当天日期
|
||||
return Object.assign(obj, {'last': true})
|
||||
} else if (item.status == 0) {
|
||||
// 未签到
|
||||
return Object.assign(obj, {'expire': true})
|
||||
} else if (item.status == 1) {
|
||||
// 已签到
|
||||
return Object.assign(obj, {'normal': true})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -245,10 +186,12 @@
|
||||
|
||||
.normal {
|
||||
background-color: #F5F5F4;
|
||||
color: #141414;
|
||||
}
|
||||
|
||||
.last {
|
||||
.current {
|
||||
background: linear-gradient( 137deg, #099DF1 0%, #7BC7F2 100%);
|
||||
color: #141414;
|
||||
}
|
||||
|
||||
.sigin-day {
|
||||
|
||||
Reference in New Issue
Block a user