瀏覽代碼

通告列表

zhaoxiaohai 3 年之前
父節點
當前提交
7ecad9d1c4
共有 3 個文件被更改,包括 75 次插入26 次删除
  1. 42 3
      pages/annunciate/index.js
  2. 7 1
      pages/annunciate/index.scss
  3. 26 22
      pages/annunciate/index.wxml

+ 42 - 3
pages/annunciate/index.js

@@ -1,25 +1,64 @@
-// pages/annunciate/index.js
+const getHeight = require("../../utils/getRheRemainingHeight");
+const _Http = getApp().globalData.http;
+
 Page({
 
     /**
      * 页面的初始数据
      */
     data: {
-
+        scrollHeight: 0,
+        "content": {
+            "pageNumber": 1,
+            "pageSize": 20,
+            pageTotal: 1,
+            "where": {
+                "condition": ""
+            }
+        }
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad(options) {
+        this.getList()
+    },
 
+    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.notice.notice",
+            "method": "queryNoticeList",
+            content: this.data.content
+        }).then(res => {
+            console.log("列表", 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
+            })
+        })
     },
 
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
     onReady() {
-
+        getHeight.getHeight('.top', this).then(res => {
+            this.setData({
+                scrollHeight: res
+            })
+        })
     },
 
     /**

+ 7 - 1
pages/annunciate/index.scss

@@ -2,8 +2,13 @@
 @import "../../components/My_card/index.scss";
 @import "./incidental.scss";
 
+page {
+    padding-bottom: 0;
+}
+
 .list {
     padding: 30rpx;
+
     .content {
         display: flex;
         width: 100%;
@@ -35,7 +40,8 @@
             }
         }
     }
-    .incidental{
+
+    .incidental {
         margin-top: 18rpx;
     }
 }

+ 26 - 22
pages/annunciate/index.wxml

@@ -1,26 +1,30 @@
-<view class="unread">总共50条,未读25条</view>
-<navigator class="my-card list" url="./details" wx:for="{{20}}">
-    <view class="content">
-        <image class="cover" src="/static/image/a-cover.png" />
-        <view class="main">
-            <view class="title line-1">标题显示最多40个字符,超出部分省略标题显示最多40个字符,超出部分省略</view>
-            <view class="explain line-1">标题显示最多40个字符,超出部分省略标题显示最多40个字符,超出部分省略</view>
-        </view>
-    </view>
-    <view class="incidental">
-        <view class="incidental_l">
-            <van-tag custom-class='tag' color="#FF3B30" plain>政策公告</van-tag>
-            <view class="time">发布于:2022-10-12</view>
+<view class="top" />
+<My_listBox id='ListBox' height='{{scrollHeight}}' bind:getlist='getList'>
+    <view class="unread">总共50条,未读25条</view>
+    <navigator class="my-card list" url="./details" wx:for="{{20}}">
+        <view class="content">
+            <image class="cover" src="/static/image/a-cover.png" />
+            <view class="main">
+                <view class="title line-1">标题显示最多40个字符,超出部分省略标题显示最多40个字符,超出部分省略</view>
+                <view class="explain line-1">标题显示最多40个字符,超出部分省略标题显示最多40个字符,超出部分省略</view>
+            </view>
         </view>
-        <view class="incidental_r">
-            <view class="incidental_r_item">
-                <text class="iconfont icon-a-tonggaofujian" />
-                附件:1
+        <view class="incidental">
+            <view class="incidental_l">
+                <van-tag custom-class='tag' color="#FF3B30" plain>政策公告</van-tag>
+                <view class="time">发布于:2022-10-12</view>
             </view>
-            <view class="incidental_r_item">
-                <text class="iconfont icon-a-tonggaoliulanliang" />
-                200
+            <view class="incidental_r">
+                <view class="incidental_r_item">
+                    <text class="iconfont icon-a-tonggaofujian" />
+                    附件:1
+                </view>
+                <view class="incidental_r_item">
+                    <text class="iconfont icon-a-tonggaoliulanliang" />
+                    200
+                </view>
             </view>
         </view>
-    </view>
-</navigator>
+    </navigator>
+    <view style="height: 40px;" />
+</My_listBox>