42 lines
799 B
TypeScript
42 lines
799 B
TypeScript
import message from "../../utils/message"
|
|
import { info, sign } from "../../service/user-api"
|
|
|
|
// pages/sign/index.ts
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
signToday: false,
|
|
continuousDays: 0,
|
|
dayTextArray:[
|
|
{text:'一',value:5},
|
|
{text:'二',value:10},
|
|
{text:'三',value:15},
|
|
{text:'四',value:20},
|
|
{text:'五',value:25},
|
|
{text:'六',value:30},
|
|
{text:'七',value:35},
|
|
]
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad() {
|
|
info().then(res=>{
|
|
this.setData(res)
|
|
})
|
|
},
|
|
onSignTag(){
|
|
message.showLoading({})
|
|
sign().then(res=>{
|
|
message.hideLoading()
|
|
this.setData(res)
|
|
}).catch(err=>{
|
|
message.hideLoading()
|
|
message.toast(err.message)
|
|
})
|
|
}
|
|
}) |