Kaynağa Gözat

feat: debug my file api

wangyuan 2 yıl önce
ebeveyn
işleme
dccaf9c7c8

+ 0 - 4
api/app.js

@@ -1,4 +0,0 @@
-
-// 应用公共 api 接口
-import { wxRequest } from './request'
-

+ 7 - 0
api/document.js

@@ -0,0 +1,7 @@
+
+// 档案 api 接口
+import { wxRequest } from './request'
+
+const documentListURL = '/get/document/list'
+
+export const documentList =  (data) => wxRequest(documentListURL, data)

+ 29 - 20
pages/myFile/myFile.js

@@ -1,4 +1,4 @@
-
+import { documentList } from "../../api/document";
 Page({
 
   /**
@@ -7,33 +7,42 @@ Page({
   data: {
     vanoverlayshow: false,
     qrcodeDialog: false,
-    fileList: [
-      {
-        name: '测试用户',
-        date: '1995/12'
-      }
-    ]
+    currentPage: 1,
+    hasNext: false,
+    fileList: []
   },
 
   /**
-   * 生命周期函数--监听页面加载
+   * 生命周期函数--监听页面显示
    */
-  onLoad(options) {
-
+  onShow() {
+    this.getDocumentList()
   },
 
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady() {
-
+  // 获取档案列表
+  getDocumentList () {
+    var data = {
+      currentPage: this.data.currentPage
+    }
+    documentList(data).then(res => {
+      console.log(res, 'documentList');
+      var response = res.data.vos
+      response.map(item => {
+        item.birthDay = item.birthday.split(' ')[0]
+      })
+      this.setData({
+        hasNext: res.data.hasNext,
+        fileList: response
+      })
+    })
   },
 
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow() {
-
+  onReachBottom () {
+    var _currentPag = this.data.currentPage + 1
+    this.setData({
+      currentPage: _currentPag
+    })
+    this.getDocumentList()
   },
 
   /**

+ 2 - 1
pages/myFile/myFile.json

@@ -1,3 +1,4 @@
 {
-  "navigationBarTitleText": "我的档案"
+  "navigationBarTitleText": "我的档案",
+  "onReachBottomDistance": 50
 }

+ 6 - 4
pages/myFile/myFile.wxml

@@ -3,15 +3,17 @@
   <view class="main-content">
     <view class="file-item ittflex-jcb" wx:for="{{fileList}}" wx:key="index">
       <view class="f-left ittflex-jcs">
-        <view class="f-avatar"></view>
+        <view class="f-avatar">
+          <image class="head-img" src="{{item.headImg}}"></image>
+        </view>
         <view class="f-user">
           <view class="fu-top ittflex-jcs">
-            <text class="fu-name">{{item.name}}</text>
+            <text class="fu-name">{{item.realName}}</text>
             <view class="suer-sex ittflex">
-              <image class="img" src="../../imaes/nan@2x.png"></image>
+              <image class="img" src="{{item.sex ? '../../imaes/nan@2x.png' : '../../imaes/nv@2x.png'}}"></image>
             </view>
           </view>
-          <view class="fu-bottom fu-date">{{item.date}}</view>
+          <view class="fu-bottom fu-date">{{item.birthDay}}</view>
         </view>
         <view class="f-qrcode ittflex" bindtap="handleShowQRCode">
           <image class="qrcode-item" src="../../imaes/erweima@2x.png"></image>

+ 5 - 1
pages/myFile/myFile.wxss

@@ -26,9 +26,13 @@
   width: 80rpx;
   height: 80rpx;
   border-radius: 50%;
-  background-color: var(--maincolor);
   margin: 0 14rpx 0 20rpx;
 }
+.head-img {
+  width: 80rpx;
+  height: 80rpx;
+  border-radius: 50%;
+}
 .f-right {
   width: 30%
 }