kk.shi vor 3 Jahren
Ursprung
Commit
37278fcfa5
3 geänderte Dateien mit 43 neuen und 6 gelöschten Zeilen
  1. 34 5
      pages/signIn/record/record.js
  2. 2 1
      pages/signIn/record/record.wxml
  3. 7 0
      pages/signIn/record/record.wxss

+ 34 - 5
pages/signIn/record/record.js

@@ -1,6 +1,7 @@
 // pages/signIn/record/record.js
 import SignIn from '../../../api/signIn'
 import { parseTime } from '../../../utils/util'
+import {getMobileCache, getPhoneNumber as getPhoneNumberSync} from '../../../utils/user'
 Page({
 
     /**
@@ -27,7 +28,17 @@ Page({
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
-        this.getUserAwardCouponList();
+        this.setData({
+            isLogin: getMobileCache() != ''
+        })
+        if(this.data.isLogin){
+            this.setData({
+                hidden1: false,
+                hidden2: true,
+            })
+            this.getUserAwardCouponList();
+        }
+        
     },
 
     getUserAwardCouponList: function() {
@@ -52,12 +63,12 @@ Page({
             console.log("优惠券数据为空");
             if (this.data.page == 1) {
                 this.setData({
-                    // mobileTop:getMobileCache(),
+                    mobileTop:getMobileCache(),
                     noResult: true
                 })
             } else {
                 this.setData({
-                    // mobileTop:getMobileCache(),
+                    mobileTop:getMobileCache(),
                     noMore: true
                 })
             }
@@ -72,11 +83,24 @@ Page({
 
         this.data.couponList = this.data.couponList.concat(...data)
         this.setData({
-            // mobileTop:getMobileCache(),
+            mobileTop:getMobileCache(),
             couponList: this.data.couponList
         })
     },
 
+    // 授权手机号
+    getPhoneNumber(e) {
+        getPhoneNumberSync(e, _ => {
+            this.setData({
+                isLogin: true,
+                mobileTop: getMobileCache(),
+                hidden1: false,
+                hidden2: true,
+            })
+            this.getUserAwardCouponList()
+        })
+    },
+
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
@@ -116,7 +140,12 @@ Page({
      * 页面上拉触底事件的处理函数
      */
     onReachBottom: function () {
-
+        if (this.data.lock || this.data.noMore) {
+            return
+        }
+        this.data.lock = true
+        this.data.page++
+        this.getUserAwardCouponList()
     },
 
     /**

+ 2 - 1
pages/signIn/record/record.wxml

@@ -3,7 +3,8 @@
   <!-- 首部信息 -->
   <view class="head flex-column">
     <view class="head_num">4</view>
-    <view class="head_text">请在优惠券有效期内尽快使用</view>
+    <view class="head_text" wx:if="{{isLogin}}">请在优惠券有效期内尽快使用</view>
+    <button class="sigin-isLogin" wx:if="{{!isLogin}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber" >登录</button>
   </view>
   <!-- 中部说明 -->
   <view class="explain flex-row">

+ 7 - 0
pages/signIn/record/record.wxss

@@ -44,6 +44,13 @@
   color: #FEFEFE;
 }
 
+.sigin-isLogin{
+  color: #FEFEFE;
+  font-weight: 400;
+  background-color: transparent;
+  border-style: none;
+}
+
 .explain{
   width: 750rpx;
   height: 120rpx;