writeLogic.js
1.1 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
import {observable} from 'mobx'
import {_taskCreate} from "../service/AppService";
import moment from 'moment'
import Toast from "react-native-simple-toast";
class writeLogic {
@observable
remindDate = ""
@observable
expireDate = ''
@observable
category = ''
@observable
list = []
@observable
text = ''
listId = ""
taskObjectCategory = ""
objectType = ""
async send() {
const options = {
// objectType: this.objectType,
listId: this.listId,
objectType: "MANUAL",
objectName: this.text,
// taskObjectCategory: this.taskObjectCategory,
ObjectCategory: "NONE",
}
if (!!this.remindDate) {
options.needReminding = true
options.remndingTime = this.remindDate
}
if (!!this.expireDate) {
options.hasDeadline = true
options.deadlineDate = moment(new Date(this.expireDate).getTime()).format("YYYY-MM-DD HH:mm:ss")
}
try{
const data = await _taskCreate(options)
const {result,errors,firstErrorMessage,} = data
if(errors.length>0){
Toast.show(firstErrorMessage)
}else {
Toast.show("任务添加成功")
}
}catch(e){
}
}
}
export default writeLogic