ea
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
import { resetuserinfocache, sign, userInfo } from "../../utils/request"
|
||||
|
||||
Component({
|
||||
properties: {
|
||||
visible: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
reward: {
|
||||
type: Number,
|
||||
value: 30,
|
||||
},
|
||||
streakDays: {
|
||||
type: Number,
|
||||
value: 7,
|
||||
},
|
||||
},
|
||||
data: {
|
||||
days: [
|
||||
{ day: 1, label: '1天', today: false },
|
||||
{ day: 2, label: '2天', today: false },
|
||||
{ day: 3, label: '3天', today: false },
|
||||
{ day: 4, label: '4天', today: false },
|
||||
{ day: 5, label: '5天', today: false },
|
||||
{ day: 6, label: '6天', today: false },
|
||||
{ day: 7, label: '今天', today: true },
|
||||
],
|
||||
userInfo: null as any,
|
||||
},
|
||||
|
||||
lifetimes: {
|
||||
attached() {
|
||||
this.setData({ userInfo: wx.getStorageSync('userInfo') })
|
||||
},
|
||||
detached() {
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
noop() { },
|
||||
handleOverlayTap() {
|
||||
this.handleClose()
|
||||
},
|
||||
handleClose() {
|
||||
this.triggerEvent('close')
|
||||
},
|
||||
sign() {
|
||||
if (this.data.userInfo.is_sign) {
|
||||
return;
|
||||
}
|
||||
sign().then((res: any) => {
|
||||
if (!res.code) {
|
||||
this.triggerEvent('close')
|
||||
resetuserinfocache(this);
|
||||
} else {
|
||||
wx.showModal({ title: '温馨提示', content: res.message });
|
||||
}
|
||||
})
|
||||
},
|
||||
handleRule() {
|
||||
this.triggerEvent('rule')
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,19 @@
|
||||
<view wx:if="{{visible}}" class="checkin-overlay" catchtap="handleOverlayTap">
|
||||
<view class="checkin-popup" catchtap="noop">
|
||||
<image class="popup-bg" src="/static/images/sign_bg.png" mode="widthFix"></image>
|
||||
|
||||
<view class="days-row">
|
||||
<view wx:for="{{days}}" wx:key="day" class="day-item {{item.today ? 'today' : ''}}">
|
||||
<text class="day-label">{{item.label}}</text>
|
||||
<image class="day-coin" src="/static/images/sign_glob_icon.png" mode="aspectFit"></image>
|
||||
<view class="day-check">
|
||||
<text></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="close-hotspot" bindtap="handleClose"></view>
|
||||
<view class="receive-hotspot {{userInfo.is_sign ? 'disabled': ''}}" bindtap="sign"></view>
|
||||
<view class="rule-hotspot" bindtap="handleRule"></view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,129 @@
|
||||
.checkin-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 1000;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 32rpx 0;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.disabled {
|
||||
background-color: grey;
|
||||
}
|
||||
|
||||
.checkin-popup {
|
||||
position: relative;
|
||||
width: 670rpx;
|
||||
overflow: hidden;
|
||||
border-radius: 32rpx;
|
||||
}
|
||||
|
||||
.popup-bg {
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.days-row {
|
||||
position: absolute;
|
||||
top: 700rpx;
|
||||
left: 70rpx;
|
||||
right: 56rpx;
|
||||
height: 140rpx;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.day-item {
|
||||
position: relative;
|
||||
width: 58rpx;
|
||||
height: 132rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
color: #4b4f5d;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.day-item.today {
|
||||
width: 72rpx;
|
||||
height: 136rpx;
|
||||
margin-top: -16rpx;
|
||||
padding-top: 16rpx;
|
||||
border-radius: 30rpx;
|
||||
color: #7a4cff;
|
||||
background: #e4cdfd;
|
||||
}
|
||||
|
||||
.day-label {
|
||||
height: 24rpx;
|
||||
line-height: 24rpx;
|
||||
font-size: 19rpx;
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.day-coin {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
margin-top: 17rpx;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.day-check {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
margin-top: -8rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #754cff;
|
||||
box-shadow: 0 2rpx 6rpx rgba(117, 76, 255, 0.24);
|
||||
}
|
||||
|
||||
.day-check text {
|
||||
width: 10rpx;
|
||||
height: 6rpx;
|
||||
border-left: 3rpx solid #ffffff;
|
||||
border-bottom: 3rpx solid #ffffff;
|
||||
transform: rotate(-45deg) translate(1rpx, -1rpx);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.close-hotspot,
|
||||
.receive-hotspot,
|
||||
.rule-hotspot {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.close-hotspot {
|
||||
top: 32rpx;
|
||||
right: 28rpx;
|
||||
width: 84rpx;
|
||||
height: 84rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.receive-hotspot {
|
||||
left: 44rpx;
|
||||
right: 44rpx;
|
||||
bottom: 100rpx;
|
||||
height: 104rpx;
|
||||
border-radius: 52rpx;
|
||||
}
|
||||
|
||||
.rule-hotspot {
|
||||
left: 190rpx;
|
||||
right: 190rpx;
|
||||
bottom: 22rpx;
|
||||
height: 62rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user