zhaoxiaohai %!s(int64=3) %!d(string=hai) anos
pai
achega
89499fb2d0

+ 11 - 5
pages/tabbar/smartStore/modules/viewPage.js

@@ -54,18 +54,24 @@ Component({
      */
     methods: {
         /* 是否收藏 */
-        isCollect() {
-            const isCollect = this.data.fileSelected.isCollect;
+        changeCollect() {
+            const {
+                isCollect,
+                attachmentid,
+                rowindex
+            } = this.data.fileSelected;
+            console.log(isCollect)
             _Http.basic({
                 "classname": "system.attachment.MediaCenter",
                 "method": isCollect == 0 ? "collectAttachment" : "uncollectAttachment",
                 "content": {
                     "collecttype": "营销物料",
-                    "attachmentid": this.data.fileSelected.attachmentid
+                    "attachmentid": attachmentid
                 }
             }).then(res => {
+                console.log(res)
                 if (res.msg != '成功') return wx.showToast({
-                    title: res.data,
+                    title: res.msg,
                     icon: "none"
                 })
                 wx.showToast({
@@ -73,7 +79,7 @@ Component({
                     icon: "none"
                 })
                 let list = this.data.list,
-                    index = this.data.fileSelected.queryrow - 1;
+                    index = rowindex - 1;
                 this.data.tabActiveTitle == '列表' ? list[index].isCollect = isCollect == 0 ? 1 : 0 : list.splice(index, 1);
                 this.setData({
                     list

+ 1 - 1
pages/tabbar/smartStore/modules/viewPage.wxml

@@ -17,7 +17,7 @@
         <image src="{{fileSelected.cover}}" />
         <view class="line-1">{{fileSelected.document}}</view>
     </view>
-    <navigator url='#' class="option" bindtap="isCollect">
+    <navigator url='#' class="option" bindtap="changeCollect">
         <block wx:if="{{fileSelected.isCollect==0}}">
             <van-icon class="icon star-o" name="star-o" />收藏
         </block>