record.js
2.81 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
// pages/index/record/record.js
import request from '../../../api/request.js'
Page({
/**
* 页面的初始数据
*/
data: {
tabindex: 0,
showAdd: false,
taskList: [],
tempList: [
// {name:'自定义模板',url: '/img/answer/zdy.png'},
// {name:'英语模板',url: '/img/answer/english.png'},
// {name:'数学模板',url: '/img/answer/math.png'},
]
},
//打卡记录列表
getTaskList() {
request({
url: `/wx/task/cardTaskList`,
method: 'post',
data: {
"oneselfFlag": this.data.tabindex + 1 ,
"page": 1,
"pageSize": 999,
"userId": wx.getStorageSync("userInfo_id")
},
}).then(res => {
if (res.code == 0) {
this.setData({
taskList: res.rows
})
} else {
wx.showToast({
title: res.msg,
icon: 'none',
duration: 1500
})
}
})
},
//模板列表
getTempList() {
request({
url: `/wx/temp/tempList`,
method: 'post',
data: {},
}).then(res => {
if (res.code == 0) {
this.setData({
tempList: res.data
})
} else {
wx.showToast({
title: res.msg,
icon: 'none',
duration: 1500
})
}
})
},
//打卡
toShow(e) {
this.getTempList()
this.setData({
showAdd: true
})
},
//关闭
closeAdd() {
this.setData({
showAdd: false
})
},
//选择模板
toPunch(e) {
let obj = e.currentTarget.dataset
let id = obj.value ? obj.value.id :0
wx.navigateTo({
url: `../../index/newPunch/newPunch?tempId=${id}`
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getTaskList()
},
//切换
handleTab(e) {
this.setData({
tabindex: e.detail.index
})
this.getTaskList()
},
// 打卡成果
handleAchievement(e) {
wx.navigateTo({
url: '/pages/index/achievement/achievement?valueId='+e.currentTarget.dataset.valueid ,
})
},
// 去打卡
handleDetail(e) {
wx.navigateTo({
url: '/pages/index/punchDetail/punchDetail?valueId='+e.currentTarget.dataset.valueid ,
})
},
// 统一返回
handleBack() {
wx.navigateBack()
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})