zhaoxiaohai 3 anos atrás
pai
commit
93f1ec6058

+ 70 - 0
pages/tabbar/smartStore/folder.js

@@ -0,0 +1,70 @@
+// pages/tabbar/smartStore/folder.js
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad(options) {
+        let obj = JSON.parse(options.item);
+        this.selectComponent("#viewPage").changeParentid(obj.attachmentid);
+        wx.setNavigationBarTitle({
+            title: obj.document
+        });
+    },
+
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload() {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh() {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom() {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage() {
+
+    }
+})

+ 5 - 0
pages/tabbar/smartStore/folder.json

@@ -0,0 +1,5 @@
+{
+    "usingComponents": {
+        "viewPage": "./modules/viewPage"
+    }
+}

+ 1 - 0
pages/tabbar/smartStore/folder.scss

@@ -0,0 +1 @@
+/* pages/tabbar/smartStore/folder.wxss */

+ 1 - 0
pages/tabbar/smartStore/folder.wxml

@@ -0,0 +1 @@
+<viewPage id='viewPage' />

+ 4 - 4
pages/tabbar/smartStore/index.js

@@ -1,24 +1,24 @@
-// custom-tab-bar/smartStore/index.js
+
 Page({
 
     /**
      * 页面的初始数据
      */
     data: {
+
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad(options) {
-
     },
-
+    
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
     onReady() {
-
+        
     },
 
     /**

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

@@ -1,8 +1,6 @@
 {
     "navigationBarTitleText": "营销物料",
     "usingComponents": {
-        "van-dropdown-menu": "@vant/weapp/dropdown-menu/index",
-        "van-dropdown-item": "@vant/weapp/dropdown-item/index",
-        "My_files": "./modules/flies"
+        "viewPage": "./modules/viewPage"
     }
 }

+ 2 - 11
pages/tabbar/smartStore/index.scss

@@ -1,12 +1,3 @@
-@import '../../../static/unread.wxss';
-
-.switch {
-    display: flex;
-    align-items: center;
-    height: 90rpx;
-    width: 650rpx;
-    box-sizing: border-box;
-    padding-right: 30rpx;
-    justify-content: flex-end;
-    background: #ffffff;
+page{
+    padding: 0 !important;
 }

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

@@ -1,12 +1 @@
-<van-search value="{{ value }}" shape="round" background="var(--bgColor)" placeholder="搜索文件" />
-
-<van-tabs color='var(--assist)' title-active-color='var(--assist)' sticky>
-    <van-tab title="列表" />
-    <van-tab title="收藏夹" />
-    <view slot='nav-right' class="switch">
-        <My_switch></My_switch>
-    </view>
-</van-tabs>
-<view class="unread">总共20个,有1个更新</view>
-<My_files></My_files>
-<view style="height: 140rpx;" />
+<viewPage />

+ 14 - 1
pages/tabbar/smartStore/modules/flies.js

@@ -4,7 +4,10 @@ Component({
      * 组件的属性列表
      */
     properties: {
-
+        list: {
+            type: Array,
+            value: []
+        }
     },
     options: {
         addGlobalClass: true
@@ -21,6 +24,16 @@ Component({
      * 组件的方法列表
      */
     methods: {
+        /* 打开文件夹 */
+        openFolder(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

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

@@ -1,9 +1,9 @@
-<navigator class="my-card" url="#" wx:for="{{5}}">
+<navigator class="my-card" url="#" wx:for="{{list}}" data-item="{{item}}" bindtap="openFolder">
     <view class="flie-left">
         <view class="iconfont icon-a-yingxiaowuliaowenjianjia" style="color: #FFCA28;" />
         <view class="details">
-            <view class="name line-1">文件分类文件分类文件分类文件分类文件分类文件分类</view>
-            <view class="time">2022-01-12 15:30</view>
+            <view class="name line-1">{{item.document}}</view>
+            <view class="time">{{item.createdate}}</view>
         </view>
     </view>
     <view class="flie-right" catchtap="changeChecked">

+ 112 - 0
pages/tabbar/smartStore/modules/viewPage.js

@@ -0,0 +1,112 @@
+const getHeight = require("../../../../utils/getRheRemainingHeight");
+const _Http = getApp().globalData.http;
+Component({
+    /**
+     * 组件的属性列表
+     */
+    properties: {
+
+    },
+
+    lifetimes: {
+        ready() {
+            this.getList();
+            getHeight.getHeight('.tabs', this).then(res => {
+                this.setData({
+                    listHeight: res
+                })
+            });
+        }
+    },
+
+    /**
+     * 组件的初始数据
+     */
+    data: {
+        listHeight: 0,
+        tabActiveTitle: "列表",
+        content: { //请求搜索条件
+            "pageNumber": 1,
+            "pageSize": 1,
+            "parentid": 1,
+            "pageTotal": 1,
+            "where": {
+                "condition": "", //搜索内容
+                "sorttype": 2 //1:热门,2:最新,不传默认最新
+            }
+        },
+        list: [], //文件列表
+        inTotal: 0, //总计
+    },
+
+    /**
+     * 组件的方法列表
+     */
+    methods: {
+        /* 获得列表 */
+        getList(init = false) {
+            if (init.detail != undefined) init = init.detail;
+            if (init) this.setData({
+                ['content.pageNumber']: 1
+            })
+            if (this.data.content.pageNumber > this.data.content.pageTotal) return;
+            _Http.basic({
+                "classname": "saletool.salematerial.salematerial",
+                "method": (this.data.tabActiveTitle == '列表') ? "selectList" : "selectMyList",
+                "content": this.data.content
+            }).then(res => {
+                this.selectComponent('#ListBox').RefreshToComplete();
+                if (res.msg != '成功') return wx.showToast({
+                    title: res.data,
+                    icon: "none"
+                })
+                this.setData({
+                    list: (res.pageNumber == 1) ? res.data : this.data.list.concat(res.data),
+                    ['content.pageNumber']: res.pageNumber + 1,
+                    ['content.pageTotal']: res.pageTotal,
+                    inTotal: res.total
+                })
+                // console.log((this.data.tabActiveTitle == '列表') ? "列表" : '营销物料', this.data.list)
+            })
+        },
+        /* 搜索框输入 */
+        searchInput({
+            detail
+        }) {
+            this.setData({
+                ['content.where.condition']: detail.trim()
+            })
+            this.getList(true)
+        },
+        /* 清除搜索输入 */
+        searchClear() {
+            this.setData({
+                ['content.where.condition']: ""
+            })
+        },
+        /* tab切换 */
+        tabsChange({
+            detail
+        }) {
+            this.setData({
+                tabActiveTitle: detail.title
+            })
+            this.getList(true);
+        },
+        /* 开关切换 */
+        changeSwitch({
+            detail
+        }) {
+            this.setData({
+                ["content.where.sorttype"]: detail == '最新' ? 2 : 1
+            })
+            this.getList(true);
+        },
+        /* 修改ID */
+        changeParentid(id) {
+            this.setData({
+                ['content.parentid']: id
+            })
+        },
+    }
+})

+ 8 - 0
pages/tabbar/smartStore/modules/viewPage.json

@@ -0,0 +1,8 @@
+{
+    "component": true,
+    "usingComponents": {
+        "van-dropdown-menu": "@vant/weapp/dropdown-menu/index",
+        "van-dropdown-item": "@vant/weapp/dropdown-item/index",
+        "My_files": "./flies"
+    }
+}

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

@@ -0,0 +1,12 @@
+@import '../../../../static/unread.wxss';
+
+.switch {
+    display: flex;
+    align-items: center;
+    height: 90rpx;
+    width: 650rpx;
+    box-sizing: border-box;
+    padding-right: 30rpx;
+    justify-content: flex-end;
+    background: #ffffff;
+}

+ 14 - 0
pages/tabbar/smartStore/modules/viewPage.wxml

@@ -0,0 +1,14 @@
+<van-search value="{{ content.where.condition }}" bind:change='searchInput' bind:clear='searchClear' shape="round" background="var(--bgColor)" placeholder="搜索文件" />
+<van-tabs class="tabs" color='var(--assist)' bind:change='tabsChange' title-active-color='var(--assist)' sticky>
+    <van-tab title="列表" />
+    <van-tab title="收藏夹" />
+    <view slot='nav-right' class="switch">
+        <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_empty wx:if="{{list.length==0}}" />
+    <view style="height: 200rpx;" />
+</My_listBox>