homeLogic.js
1.49 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
import {observable} from 'mobx'
import {_summary, _count} from "../service/AppService";
import Toast from "react-native-simple-toast";
import {ownerUserId} from "../service/rpc";
console.log("id", ownerUserId)
export default class homeLogic {
@observable
text = ''
@observable
list = []
@observable
count = {
star: '',
overStar: "",
today: "",
overToday: "",
week: "",
overWeek: "",
myOverdueCount:"",
myTaskCount:""
}
@observable
loading = false
@observable
change=false
async getCount() {
try {
const data = await _count({ownerUserId})
const {errors, firstErrorMessage, starredOverdueCount, starredTaskCount, todayOverdueCount, todayTaskCount, weekOverdueCount, weekTaskCount,myTaskCount,myOverdueCount} = data
if (errors.length > 0) {
Toast.show(firstErrorMessage)
} else {
this.count.star = starredTaskCount
this.count.overStar = starredOverdueCount
this.count.today = todayTaskCount
this.count.overToday = todayOverdueCount
this.count.week = weekTaskCount
this.count.overWeek = weekOverdueCount
this.count.myOverdueCount=myOverdueCount
this.count.myTaskCount=myTaskCount
}
} catch (e) {
}
this.loading = false
}
async getList() {
this.loading = true
try {
const data = await _summary({
ownerUserId,
})
const {errors, firstErrorMessage, result} = data
if (errors.length > 0) {
Toast.show(firstErrorMessage)
} else {
this.list.replace(result)
}
} catch (e) {
}
this.change=!this.change
}
}