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
import create from 'dd-store';
import pageStore from '../../pages/meetingDetail/store';
import { previewPermissions, previewOss, uploadPermissions, getThirdUserPlatForm } from '../../api/request.js'
import openLink from "dingtalk-jsapi/api/biz/util/openLink";
create.Component({
store: pageStore,
mixins: [],
data: {
logId: '', //store
},
props: {
isCanEdit: true,
isCanDelete: false,
isPreview: true, // 是否点击预览,
},
didMount() {
},
didUpdate() {
},
didUnmount() {
},
methods: {
//移除文件
removeFile(e) {
this.store.data.logId = '';
const fileInfos = this.store.data.fileInfos.filter(it => it.fileId !== e.target.dataset.id);
this.store.data.fileInfos = fileInfos;
this.update();
},
//预览文件
preview(e) {
// 如果出现编辑蒙层时阻止预览的点击事件
if (this.store.data.logId) {
return;
}
if (!this.props.isPreview) {
return
}
const file = e.target.dataset.file
console.log(file)
let data = {
ddUserId: getApp().globalData.userid,
type: 'download',
projectName: 'MING_MEETING',
fileIds: file.fileId
}
uploadPermissions(data).then(res => {
dd.previewFileInDingTalk({
corpId: dd.corpId,
spaceId: res.data.data,
fileId: file.fileId,
fileName: file.name,
fileSize: file.size,
fileType: file.mimeType,
})
})
},
//显示操作框
showOperate(e) {
if (this.props.isCanEdit) {
this.store.data.logId = e.target.dataset.logId;
this.update();
}
},
//删除动态下的文件和描述
deleteFile(e) {
dd.confirm({
title: '删除文件',
content: '确认删除文件吗?',
confirmButtonText: '确定',
cancelButtonText: '取消',
success: (res) => {
if (res.confirm) {
this.props.onDeleteMeetingFile(e.target.dataset.id)
}
}
})
},
//去编辑文件页面
updateFile(e) {
this.store.data.logId = '';
const { fileInfos, description, id } = e.target.dataset.fileView;
this.store.data.oldFileInfos = JSON.stringify(fileInfos);
this.store.data.oldDescription = description;
this.store.data.fileInfos = fileInfos;
this.store.data.description = e.target.dataset.fileView.description;
this.update();
setTimeout(() => {
dd.navigateTo({ url: `./../uploadFile/uploadFile?id=${id}` })
})
}
},
});