浏览代码

营销物料

zhaoxiaohai 2 年之前
父节点
当前提交
0efbe852ff

+ 3 - 1
pages/tabbar/smartStore/index.wxml

@@ -1 +1,3 @@
-<viewPage />
+<view style="height: 100vh; overflow: hidden;">
+    <viewPage />
+</view>

+ 13 - 10
pages/tabbar/smartStore/modules/flies.js

@@ -7,37 +7,40 @@ Component({
         list: {
             type: Array,
             value: []
+        },
+        checkedId: {
+            type: String,
+            value: 0
+        },
+        changeId: {
+            type: Function
         }
     },
     options: {
         addGlobalClass: true
     },
-
     /**
      * 组件的初始数据
      */
     data: {
-        checked: false
+        show: false,
+        fileSelected: {},
     },
-
     /**
      * 组件的方法列表
      */
     methods: {
-        /* 打开文件 */
-        openFolder(e) {
+        /* 打开文件 */
+        openFile(e) {
             const {
                 item
             } = e.currentTarget.dataset;
             if (item.postfix == 'folder') return wx.navigateTo({
                 url: '/pages/tabbar/smartStore/folder?item=' + JSON.stringify(item),
             })
-
         },
-        changeChecked() {
-            this.setData({
-                checked: !this.data.checked
-            })
+        changeChecked(e) {
+            this.triggerEvent("changeId", e.target.dataset.item)
         }
     }
 })

+ 2 - 5
pages/tabbar/smartStore/modules/flies.scss

@@ -13,12 +13,9 @@
         align-items: center;
         height: 100%;
 
-        .iconfont {
-            display: flex;
+        .image {
             width: 58rpx;
             height: 58rpx;
-            line-height: 58rpx;
-            font-size: 54rpx;
         }
 
         .details {
@@ -51,4 +48,4 @@
         justify-content: center;
         padding-left: 20rpx;
     }
-}
+}

+ 4 - 4
pages/tabbar/smartStore/modules/flies.wxml

@@ -1,12 +1,12 @@
-<navigator class="my-card" url="#" wx:for="{{list}}" data-item="{{item}}" bindtap="openFolder">
+<navigator class="my-card" url="#" wx:for="{{list}}" data-item="{{item}}" bindtap="openFile">
     <view class="flie-left">
-        <view class="iconfont icon-a-yingxiaowuliaowenjianjia" style="color: #FFCA28;" />
+        <image class="image" src="/static/image/file/{{item.postfix}}.png" />
         <view class="details">
             <view class="name line-1">{{item.document}}</view>
             <view class="time">{{item.createdate}}</view>
         </view>
     </view>
-    <view class="flie-right" catchtap="changeChecked">
-        <van-checkbox value="{{ checked }}" icon-size="25rpx" />
+    <view class="flie-right" data-item="{{item}}" catchtap="changeChecked">
+        <van-checkbox value="{{ checkedId==item.attachmentid }}" data-item="{{item}}" icon-size="25rpx" />
     </view>
 </navigator>

+ 46 - 3
pages/tabbar/smartStore/modules/viewPage.js

@@ -7,6 +7,9 @@ Component({
     properties: {
 
     },
+    options: {
+        addGlobalClass: true
+    },
 
     lifetimes: {
         ready() {
@@ -23,11 +26,13 @@ Component({
      * 组件的初始数据
      */
     data: {
-        listHeight: 0,
-        tabActiveTitle: "列表",
+        listHeight: 0, //列表高度
+        tabActiveTitle: "列表", //列表类型
+        show: false, //显示底部弹出
+        fileSelected: {}, //选中文件详情
         content: { //请求搜索条件
             "pageNumber": 1,
-            "pageSize": 1,
+            "pageSize": 20,
             "parentid": 1,
             "pageTotal": 1,
             "where": {
@@ -108,5 +113,43 @@ Component({
                 ['content.parentid']: id
             })
         },
+        /* 修改选中ID */
+        changeId({
+            detail
+        }) {
+            console.log(detail)
+            this.setData({
+                fileSelected: detail,
+                show: true
+            })
+        },
+        /* 关闭修改 */
+        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: '收藏成功',
+                })
+            })
+        },
     }
 })

+ 44 - 0
pages/tabbar/smartStore/modules/viewPage.scss

@@ -9,4 +9,48 @@
     padding-right: 30rpx;
     justify-content: flex-end;
     background: #ffffff;
+}
+
+
+.sheet-header {
+    display: flex;
+    align-items: center;
+    width: 750rpx;
+    height: 120rpx;
+    padding: 0 30rpx;
+    box-sizing: border-box;
+
+    image {
+        width: 58rpx;
+        height: 58rpx;
+        margin-right: 20rpx;
+    }
+
+    .line-1 {
+        width: 100%;
+        font-size: 28rpx;
+        font-family: PingFang SC-Bold, PingFang SC;
+        font-weight: bold;
+        color: #333333;
+    }
+}
+
+.option {
+    display: flex;
+    align-items: center;
+    width: 750rpx;
+    height: 90rpx;
+    padding: 0 30rpx;
+    box-sizing: border-box;
+    color: #333333;
+
+    .icon {
+        font-size: 40rpx;
+        margin-right: 20rpx;
+        margin-top: -2rpx;
+    }
+
+    .star {
+        color: #FADB14;
+    }
 }

+ 22 - 2
pages/tabbar/smartStore/modules/viewPage.wxml

@@ -6,9 +6,29 @@
         <My_switch bindchange='changeSwitch' />
     </view>
 </van-tabs>
+
 <My_listBox id="ListBox" height='{{listHeight}}' bind:getlist='getList'>
     <view class="unread">总共{{inTotal}}个,有1个更新</view>
-    <My_files list="{{list}}" />
+    <My_files list="{{list}}" checkedId='{{fileSelected.attachmentid}}' bindchangeId='changeId' />
     <My_empty wx:if="{{list.length==0}}" />
     <view style="height: 200rpx;" />
-</My_listBox>
+</My_listBox>
+
+<van-action-sheet show="{{ show }}" bind:click-overlay='closeShow'>
+    <view class="sheet-header">
+        <image src="/static/image/file/{{fileSelected.postfix}}.png" />
+        <view class="line-1">{{fileSelected.document}}</view>
+    </view>
+    <navigator url='#' class="option" bindtap="addToFavorites">
+        <block>
+            <van-icon class="icon star-o" name="star-o" />收藏
+        </block>
+        <block>
+            <van-icon class="icon star" name="star" />取消收藏
+        </block>
+    </navigator>
+    <navigator wx:if="{{fileSelected.postfix!='folder'}}" url='#' class="option">
+        <text class="iconfont icon-a-tonggaoshujuxiazailiang icon" />下载
+    </navigator>
+    <view style="height: 115rpx;" />
+</van-action-sheet>

二进制
static/image/file/folder.png