|
@@ -48,6 +48,32 @@ Component({
|
|
|
* 组件的方法列表
|
|
|
*/
|
|
|
methods: {
|
|
|
+ /* 是否收藏 */
|
|
|
+ isCollect() {
|
|
|
+ _Http.basic({
|
|
|
+ "classname": "system.attachment.MediaCenter",
|
|
|
+ "method": this.data.fileSelected.isCollect == 0 ? "collectAttachment" : "uncollectAttachment",
|
|
|
+ "content": {
|
|
|
+ "collecttype": "营销物料",
|
|
|
+ "attachmentid": this.data.fileSelected.attachmentid
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ wx.showToast({
|
|
|
+ title: this.data.fileSelected.isCollect == 0 ? '收藏成功' : "取消收藏",
|
|
|
+ })
|
|
|
+ let list = this.data.list,
|
|
|
+ index = this.data.fileSelected.queryrow - 1;
|
|
|
+ this.data.tabActiveTitle == '列表' ? list[index].isCollect = this.data.fileSelected.isCollect == 0 ? 1 : 0 : list.splice(index, 1);
|
|
|
+ this.setData({
|
|
|
+ list
|
|
|
+ })
|
|
|
+ this.closeShow();
|
|
|
+ })
|
|
|
+ },
|
|
|
/* 获得列表 */
|
|
|
getList(init = false) {
|
|
|
if (init.detail != undefined) init = init.detail;
|
|
@@ -126,30 +152,13 @@ Component({
|
|
|
/* 关闭修改 */
|
|
|
closeShow() {
|
|
|
this.setData({
|
|
|
- fileSelected: {},
|
|
|
show: false
|
|
|
})
|
|
|
- },
|
|
|
- addToFavorites() {
|
|
|
- console.log(this.data.fileSelected)
|
|
|
- _Http.basic({
|
|
|
- "classname": "system.attachment.MediaCenter",
|
|
|
- "method": "collectAttachment",
|
|
|
- "content": {
|
|
|
- "collecttype": "媒体中心",
|
|
|
- "attachmentid": this.data.fileSelected.attachmentid
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- console.log(res)
|
|
|
- if (res.msg != '成功') return wx.showToast({
|
|
|
- title: res.data,
|
|
|
- icon: "none"
|
|
|
- })
|
|
|
- this.closeShow();
|
|
|
- wx.showToast({
|
|
|
- title: '收藏成功',
|
|
|
+ setTimeout(() => {
|
|
|
+ this.setData({
|
|
|
+ fileSelected: {}
|
|
|
})
|
|
|
- })
|
|
|
+ }, 150)
|
|
|
},
|
|
|
}
|
|
|
})
|