ea
This commit is contained in:
@@ -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')
|
||||
},
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user