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
import create from 'dd-store'
import { saveFileInfo, addSchedule, uploadPermissions, previewPermissions, updateMeetingTask } from '../../api/request.js'
import { throttle, debounce, getCreateShowTime } from './../../utils/utils.js'
import pageStore from '../meetingDetail/store';
import { getFileInfo } from '../meetingDetail/uploadFile';
import { checkFullScren } from "../../utils/checkFullScren";
create.Page({
store: pageStore,
data: {
fileInfos: null, //store
description: '',//store
id: '',
isIPX: checkFullScren(),
},
onLoad(query) {
this.setData({
isIPX: checkFullScren()
})
dd.setNavigationBar({
title: '会议文件'
});
// 编辑的时候传了文件ID
if (query && query.id) {
this.setData({
id: query.id
});
}
},
onShow() {
this.update()
},
inputChange: debounce(function (e) {
const value = e.detail.value;
if (value) {
this.store.data.description = value;
this.update();
}
}, 100),
//添加会议文件
async add() {
const res = await getFileInfo();
console.log(res.data)
if (res.code === -1) {
dd.alert({
content: res.msg
})
return
}
let data = []
res.data.map(it => {
this.store.data.fileInfos.push({
fileId: it.fileId,
name: it.fileName,
size: it.fileSize,
spaceId: it.spaceId,
platform: "dingTalk",
mimeType: it.fileType,
})
})
// console.log(this.store.data.fileInfos)
this.update();
},
// 保存
saveUpload: throttle(function () {
const { fileInfos, oldFileInfos, description, oldDescription } = this.store.data;
if (!fileInfos || (fileInfos && fileInfos.length == 0)) {
dd.showToast({
content: '请上传文件'
})
return;
}
//如果实际没有修改,不生成记录
if (this.data.id) {
if (oldFileInfos == JSON.stringify(fileInfos) && description == oldDescription) {
return dd.navigateBack()
}
}
const data = {
meetingId: this.data.id,
platform: 'dingTalk',
remark: description,
fileModel: {
fileList: fileInfos
}
}
updateMeetingTask(data).then(res => {
this.store.data.fileInfos = []
this.store.data.description = ''
this.update();
if (res.data.data) {
const addData = res.data.data[0].commentListDataModelList[0];
addData.updateTime = getCreateShowTime(addData.updateTime);
this.store.data.affairList.unshift(addData);
addData.fileDetailList.forEach(it => this.store.data.files.unshift(it));
this.store.data.isNeedReloadIndexList = true;
if (this.store.data.separateIndex !== -1) {
this.store.data.separateIndex += 1;
}
this.update();
dd.navigateBack();
}
})
}, 1000)
});