|
|
@@ -1,18 +1,10 @@
|
|
|
-const _Http = getApp().globalData.http,
|
|
|
- MFT = require("../../../../../utils/matchingFeilType");
|
|
|
+const _Http = getApp().globalData.http;
|
|
|
Page({
|
|
|
data: {
|
|
|
isNew: false, //是否为新增
|
|
|
ownerid: null,
|
|
|
ownertable: null,
|
|
|
sys_datafollowupid: 0, //数据ID
|
|
|
- files: {
|
|
|
- images: [],
|
|
|
- viewImages: [],
|
|
|
- videos: [],
|
|
|
- viewVideos: [],
|
|
|
- files: []
|
|
|
- },
|
|
|
type: "",
|
|
|
content: "",
|
|
|
user: {}, //联系人
|
|
|
@@ -51,7 +43,7 @@ Page({
|
|
|
wx.navigateBack()
|
|
|
}, 300)
|
|
|
};
|
|
|
- this.handleFiles(MFT.fileList(res.data.attinfos));
|
|
|
+ this.selectComponent("#Yl_files").handleFiles(res.data.attinfos)
|
|
|
this.setData({
|
|
|
type: res.data.type,
|
|
|
content: res.data.content
|
|
|
@@ -61,42 +53,6 @@ Page({
|
|
|
this.initTemplate()
|
|
|
}
|
|
|
},
|
|
|
- /* 删除文件 */
|
|
|
- deleteFile({
|
|
|
- detail
|
|
|
- }) {
|
|
|
- let e = detail,
|
|
|
- item = e.detail.attachmentid ? e.detail : e.currentTarget.dataset.item;
|
|
|
- _Http.basic({
|
|
|
- "classname": "system.attachment.Attachment",
|
|
|
- "method": "deleteFileLink",
|
|
|
- "content": {
|
|
|
- "linksids": [item.linksid]
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- if (res.msg != '成功') return wx.showToast({
|
|
|
- title: res.data,
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
- let files = this.data.files;
|
|
|
- switch (item.fileType) {
|
|
|
- case "image":
|
|
|
- files.images = files.images.filter(v => v.url != item.url);
|
|
|
- files.viewImages = files.viewImages.filter(v => v.url != item.url);
|
|
|
- break;
|
|
|
- case "video":
|
|
|
- files.videos = files.videos.filter(v => v.url != item.url);
|
|
|
- files.viewVideos = files.viewVideos.filter(v => v.url != item.url);
|
|
|
- break;
|
|
|
- default:
|
|
|
- files.files = files.files.filter(v => v.attachmentid != item.attachmentid);
|
|
|
- break;
|
|
|
- };
|
|
|
- this.setData({
|
|
|
- files
|
|
|
- });
|
|
|
- })
|
|
|
- },
|
|
|
/* 绑定媒体 */
|
|
|
insertImgEdit({
|
|
|
detail
|
|
|
@@ -112,36 +68,11 @@ Page({
|
|
|
}
|
|
|
}).then(res => {
|
|
|
console.log('跟进记录绑定附件', res)
|
|
|
- this.handleFiles(MFT.fileList(res.data));
|
|
|
- })
|
|
|
- },
|
|
|
- /* 处理附件 */
|
|
|
- handleFiles(list) {
|
|
|
- let files = this.data.files;
|
|
|
- list.forEach(v => {
|
|
|
- switch (v.fileType) {
|
|
|
- case "video":
|
|
|
- files.videos.push(v)
|
|
|
- files.viewVideos.push({
|
|
|
- url: v.url,
|
|
|
- type: "video",
|
|
|
- poster: v.subfiles[0].url
|
|
|
- })
|
|
|
- break;
|
|
|
- case "image":
|
|
|
- files.images.push(v)
|
|
|
- files.viewImages.push({
|
|
|
- url: v.url,
|
|
|
- type: "image"
|
|
|
- })
|
|
|
- break;
|
|
|
- default:
|
|
|
- files.files.push(v)
|
|
|
- break;
|
|
|
- }
|
|
|
- });
|
|
|
- this.setData({
|
|
|
- files
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ this.selectComponent("#Yl_files").handleFiles(res.data)
|
|
|
})
|
|
|
},
|
|
|
/* 初始化模板 */
|