zhaoxiaohai 3 years ago
parent
commit
2957dcf56c

+ 2 - 0
README.md

@@ -70,6 +70,8 @@
 
 ​	My_showModel -- 自定义模态框
 
+​	My_paging -- 分页
+
 # 缓存
 
 ​	userData -- 用户基本数据 -- 保存数据:index-用户列表下标,token,fisadministrator--是否主账号,tagentsid,tenterpriseid,userid

+ 2 - 1
app.json

@@ -79,7 +79,8 @@
         "van-popup": "@vant/weapp/popup/index",
         "My_MultipleChoice": "/components/My_MultipleChoice/index",
         "My_SupplyAndDemandItemBox": "/components/My_SupplyAndDemandItemBox/index",
-        "My_CenterTheTitle": "/components/My_CenterTheTitle/index"
+        "My_CenterTheTitle": "/components/My_CenterTheTitle/index",
+        "My_paging": "/components/My_paging/index"
     },
     "window": {
         "backgroundTextStyle": "light",

+ 39 - 0
components/My_paging/index.js

@@ -0,0 +1,39 @@
+// components/My_paging/index.js
+Component({
+    /**
+     * 组件的属性列表
+     */
+    properties: {
+        show: {
+            type: Boolean
+        },
+        count: {
+            type: Number
+        },
+        rightClick: {
+            type: Function
+        },
+        lifeClick: {
+            type: Function
+        }
+    },
+
+    /**
+     * 组件的初始数据
+     */
+    data: {
+
+    },
+
+    /**
+     * 组件的方法列表
+     */
+    methods: {
+        buttonRightClick() {
+            this.triggerEvent('rightClick')
+        },
+        buttonLifeClick() {
+            this.triggerEvent('lifeClick')
+        }
+    }
+})

+ 4 - 0
components/My_paging/index.json

@@ -0,0 +1,4 @@
+{
+    "component": true,
+    "usingComponents": {}
+}

+ 15 - 0
components/My_paging/index.wxml

@@ -0,0 +1,15 @@
+<view wx:if="{{show}}" class="paging-button">
+    <view>
+        <van-button custom-class="paging-button-class" catchtap="buttonRightClick"></van-button>
+        <view class="paging-button-icon icon-right">
+            <van-icon name="arrow" />
+        </view>
+    </view>
+    <text>{{count}}</text>
+    <view>
+        <van-button custom-class="paging-button-class" catchtap="buttonLifeClick"></van-button>
+        <view class="paging-button-icon icon-left">
+            <van-icon name="arrow-left" />
+        </view>
+    </view>
+</view>

+ 56 - 0
components/My_paging/index.wxss

@@ -0,0 +1,56 @@
+/* 分页按钮 */
+.paging-button {
+    float: right;
+    width: 100%;
+    height: 30rpx;
+    margin-top: 30rpx;
+    margin-bottom: 20rpx;
+}
+
+.paging-button>view {
+    position: relative;
+    float: right;
+    width: 30rpx !important;
+    height: 30rpx !important;
+    margin-right: 10rpx;
+    overflow: hidden;
+}
+
+.paging-button-icon {
+    position: absolute;
+    font-size: 20rpx;
+    color: rgba(0, 0, 0, 0.5);
+    top: 2rpx;
+    pointer-events: none;
+}
+
+.icon-left {
+    left: 4rpx;
+}
+
+.icon-right {
+    left: 6rpx;
+}
+
+.paging-button>text {
+    float: right;
+    display: block;
+    height: 30rpx;
+    line-height: 30rpx;
+    background: #4DC2D4;
+    border-radius: 4rpx;
+    font-size: 20rpx;
+    font-weight: 550;
+    color: #FFFFFF;
+    padding: 0 10rpx;
+    margin-right: 10rpx;
+}
+
+/* 分页按钮外部样式表 */
+.paging-button-class {
+    width: 100%;
+    height: 100%;
+    background: #F6F7F8 !important;
+    border-radius: 4rpx !important;
+    border: 0 !important;
+}

+ 50 - 16
pages/annunciate/glanceover.js

@@ -2,6 +2,7 @@ import {
     ApiModel
 } from "../../utils/api";
 const _Http = new ApiModel();
+const processingData = require('../../utils/processingData');
 Page({
 
     /**
@@ -19,25 +20,35 @@ Page({
      */
     onLoad: function (options) {
         if (options.id) {
-            _Http.basic({
-                "accesstoken": wx.getStorageSync('userData').token,
-                "classname": "customer.noticemag.noticemag",
-                "method": "havereaduserlist",
-                "content": {
-                    "tnoticeid": options.id
-                }
-            }).then(res => {
-
-                if (res.msg != '成功') return wx.showToast({
-                    title: res.data,
-                    icon: "none"
-                });
-                this.setData({
-                    history: res.data
-                })
+            this.setData({
+                tnoticeid: options.id
             })
+            this.getList()
         }
     },
+    getList() {
+        _Http.basic({
+            "accesstoken": wx.getStorageSync('userData').token,
+            "classname": "customer.noticemag.noticemag",
+            "method": "havereaduserlist",
+            "content": {
+                "tnoticeid": this.data.tnoticeid
+            }
+        }).then(res => {
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            });
+            let data = res.data;
+            for (let i = 0; i < data.length; i++) {
+                let ffirstreadtime = data[i].ffirstreadtime;
+                if (ffirstreadtime != null && ffirstreadtime != undefined) data[i].ffirstreadtime = ffirstreadtime.slice(0, ffirstreadtime.lastIndexOf('.'));
+            }
+            this.setData({
+                history: data
+            })
+        })
+    },
     viewRow(e) {
         const {
             index
@@ -46,6 +57,29 @@ Page({
             viewRowIndex: index
         })
     },
+    /* 下一页 */
+    buttonRightClick() {
+        if (this.data.pageNumber == this.data.pageTotal) return wx.showToast({
+            title: '已经到达最后一页',
+            icon: "none"
+        });
+        this.setData({
+            pageNumber: this.data.pageNumber + 1
+        })
+        this.getList()
+
+    },
+    /* 上一页 */
+    buttonLifeClick() {
+        if (this.data.pageNumber == 1) return wx.showToast({
+            title: '已经在第一页了哦',
+            icon: "none"
+        });
+        this.setData({
+            pageNumber: this.data.pageNumber - 1
+        })
+        this.getList()
+    },
     /**
      * 生命周期函数--监听页面初次渲染完成
      */

+ 4 - 1
pages/annunciate/glanceover.wxml

@@ -1,5 +1,5 @@
 <My_liveAccountMsg title="浏览数据">
-    <view slot='con' class="form-box clearfix">
+    <view wx:if="{{history.length>=1}}" slot='con' class="form-box clearfix">
         <view class="header">
             <view class="u-line-1" style="width: 155rpx;padding-left: 14rpx;">浏览用户</view>
             <view class="u-line-1" style="width: 135rpx;">浏览次数</view>
@@ -12,6 +12,9 @@
             <view class="u-line-1" style="width: 135rpx;">{{item.freadtimes}}小时</view>
             <view class="u-line-1" style="width: 225rpx;">{{item.ffirstreadtime}}</view>
         </view>
+        <My_paging show="{{history.length>=1}}" count='{{pageNumber}}' bind:lifeClick='buttonLifeClick' bind:rightClick='buttonRightClick'></My_paging>
+    </view>
+    <view wx:else slot='con'>
         <My_pageReachBottom dummyStatus="{{history.length>=1}}" loadMore="{{pageNumber>=pageTotal}}"></My_pageReachBottom>
     </view>
 </My_liveAccountMsg>

+ 1 - 15
pages/liveStreaming/index.wxml

@@ -160,21 +160,7 @@
             </view>
         </scroll-view>
     </view>
-    <view wx:if="{{liveSessionList.length>=1}}" class="paging-button">
-        <view>
-            <van-button custom-class="paging-button-class" catchtap="buttonRightClick"></van-button>
-            <view class="paging-button-icon icon-right">
-                <van-icon name="arrow" />
-            </view>
-        </view>
-        <text>{{dataTypes==0?pageNumber:userPageNumber}}</text>
-        <view>
-            <van-button custom-class="paging-button-class" catchtap="buttonLifeClick"></van-button>
-            <view class="paging-button-icon icon-left">
-                <van-icon name="arrow-left" />
-            </view>
-        </view>
-    </view>
+    <My_paging show="{{liveSessionList.length>=1}}" count='{{dataTypes==0?pageNumber:userPageNumber}}' bind:lifeClick='buttonLifeClick' bind:rightClick='buttonRightClick'></My_paging>
 </view>
 <!-- 自定义model -->
 <My_showModel isShow='{{myShowModel}}' content="直播地址:+{{accountMsg.fliveurl_web}}" confirm='一键复制' cancel='知道了' bindcallBack='showModelCallBack' />

+ 0 - 57
pages/liveStreaming/index.wxss

@@ -107,63 +107,6 @@
     min-width: 1800rpx !important;
 }
 
-/* 分页按钮 */
-.paging-button {
-    float: right;
-    width: 100%;
-    height: 30rpx;
-    margin-top: 30rpx;
-    margin-bottom: 20rpx;
-}
-
-.paging-button>view {
-    position: relative;
-    float: right;
-    width: 30rpx !important;
-    height: 30rpx !important;
-    margin-right: 10rpx;
-    overflow: hidden;
-}
-
-.paging-button-icon {
-    position: absolute;
-    font-size: 20rpx;
-    color: rgba(0, 0, 0, 0.5);
-    top: 2rpx;
-    pointer-events: none;
-}
-
-.icon-left {
-    left: 4rpx;
-}
-
-.icon-right {
-    left: 6rpx;
-}
-
-.paging-button>text {
-    float: right;
-    display: block;
-    height: 30rpx;
-    line-height: 30rpx;
-    background: #4DC2D4;
-    border-radius: 4rpx;
-    font-size: 20rpx;
-    font-weight: 550;
-    color: #FFFFFF;
-    padding: 0 10rpx;
-    margin-right: 10rpx;
-}
-
-/* 分页按钮外部样式表 */
-.paging-button-class {
-    width: 100%;
-    height: 100%;
-    background: #F6F7F8 !important;
-    border-radius: 4rpx !important;
-    border: 0 !important;
-}
-
 /* 一键开播按钮 */
 .custom-class-msgBox-but {
     width: 116rpx !important;