index.js
1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// 获取应用实例
const app = getApp()
Page({
data: {
lunbo: [],
admin: "", // 账号
pwd: "", //密码
login: false,
clockData: "", //打卡数据
token:''
},
onShow() {
let token = wx.getStorageSync('token')
if (token == '') {
this.setData({
login: true
})
}else{
this.IndexMyData()
}
this.setData({
token
})
this.getlist()
},
// 关闭
myevent() {
this.setData({
login: false
})
},
// 轮播
getlist() {
var that = this;
app.post("index/Banner", {}).then(res => {
if (res.code == 1) {
that.setData({
lunbo: res.data
})
}
}).catch(err => {
})
},
//获取用户打卡数据
IndexMyData() {
var that = this;
app.post("index/IndexMyData", {}).then(res => {
if (res.code == 1) {
that.setData({
clockData: res.data
})
}
}).catch(err => {
})
},
//
// goToday() {
// wx.navigateTo({
// url: '/pages/first/first',
// })
// },
bindRask() {
if(!this.data.token){
this.setData({
login:true
})
return
}
wx.navigateTo({
url: '/pages/mission/mission',
})
}
})