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
124
125
126
127
128
129
130
131
132
import create from 'dd-store'
import exampleStore from '/stores/exampleStore'
import { deleteSchedule, getScheduleDetail, uploadPermissions, previewPermissions } from '../../api/request.js'
create.Page({
store: exampleStore,
useAll: true,
data: {
title: '',
location: '',
startTime: '',
endTime: '',
weeks: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
week: '',
isAcrossDay: true,
uploadSpaceId: '',
previewSpaceId: '',
scheduleItem: '',
planDate: '',
scheduleTemplateId: ''
},
onLoad(event) {
let scheduleItem = JSON.parse(event.scheduleItem)
this.setData({
scheduleItem: scheduleItem
})
dd.setNavigationBar({
title: '会议详情'
})
},
onShow() {
let data = {
id: this.data.scheduleItem.id,
planDate: this.data.scheduleItem.planDate,
templateId: this.data.scheduleItem.scheduleTemplateId
}
getScheduleDetail(data).then(res => {
this.setData({
title: res.data.data.title,
location: res.data.data.location,
startTime: res.data.data.startTime,
endTime: res.data.data.endTime,
week: this.data.weeks[new Date(res.data.data.startTime).getDay() - 1]
})
this.store.data.userList = res.data.data.userList
this.store.data.aheadTimes = res.data.data.aheadTimes
this.store.data.remark = res.data.data.remark
this.acrossDay(res.data.data.startTime, res.data.data.endTime)
this.update()
return uploadPermissions()
}).then(res => {
this.setData({
uploadSpaceId: res.data.data
})
})
},
// 是否跨天
acrossDay(time1, time2) {
let isAcrossDay = ''
if (JSON.stringify(this.dealTime(time1)) === JSON.stringify(this.dealTime(time2))) {
isAcrossDay = false
} else {
isAcrossDay = true
}
this.setData({
isAcrossDay: isAcrossDay
})
},
// 处理时间
dealTime(time) {
let time1 = time.replace(/-/g, "/")
let date = new Date(time1)
let day = date.getDate()
let year = date.getFullYear()
let month = date.getMonth() + 1
return {
year: year,
month: month,
day: day
}
},
// 上传文件
upload() {
const _that = this
dd.uploadAttachmentToDingTalk({
image: { multiple: true, compress: false, max: 9, spaceId: this.data.uploadSpaceId },
space: { spaceId: this.data.uploadSpaceId, isCopy: 1, max: 9 },
file: { spaceId: this.data.uploadSpaceId, max: 1 },
types: ["photo", "camera", "space"],//PC端仅支持["photo","file","space"]
success: (res) => {
previewPermissions(res.data[0].fileId).then(success => {
_that.setData({
previewSpaceId: success.data.data
})
_that.preview(res.data[0].fileId, res.data[0].fileSize, res.data[0].fileType, res.data[0].fileName)
})
},
fail: (err) => {
dd.alert({
content: JSON.stringify(err)
})
}
})
},
// 跳转下一页
nextPage(event) {
switch (event.target.dataset.nextPage) {
case 'participants':
dd.navigateTo({ url: `./../attendingSituation/attendingSituation?userList=${JSON.stringify(this.store.data.userList)}` })
break;
case 'edit':
console.log(this.data.scheduleItem.id)
dd.navigateTo({ url: `./../createOrEditSchedule/createOrEditSchedule?scheduleItem=${JSON.stringify(this.data.scheduleItem)}` })
break;
}
},
// 预览文件
preview(fileId, fileSize, fileType, fileName) {
dd.previewFileInDingTalk({
corpId: dd.corpId,
spaceId: this.data.previewSpaceId,
fileId: fileId,
fileName: fileName,
fileSize: fileSize,
fileType: fileType
})
}
});