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
import { uploadPermissions } from '../../api/request';
// 获取权限
async function getPermission() {
dd.showLoading()
let data = {
ddUserId: getApp().globalData.userid,
type: 'add',
projectName: 'MING_MEETING'
}
return new Promise((resolve) => {
uploadPermissions(data).then(res => {
dd.hideLoading()
if (res.data.code === 0) {
resolve(res)
}
}).catch(err => {
dd.hideLoading()
})
})
}
// 获取文件信息
export async function getFileInfo() {
const permission = await getPermission()
return new Promise((resolve) => {
dd.uploadAttachmentToDingTalk({
image: { multiple: true, compress: true, max: 9, spaceId: permission.data.data },
space: { spaceId: permission.data.data, compress: true, isCopy: 1, max: 9 },
file: { spaceId: permission.data.data, max: 9 },
types: ["photo", "camera", "space", "file"],
success: (res) => {
console.log(permission.data.data)
console.log(res)
resolve(res)
},
fail: (err) => {
console.log(11)
console.log(err)
}
})
})
}