Kaynağa Gözat

签到日历组件更新

liuyao 1 yıl önce
ebeveyn
işleme
e19887ffa7

+ 36 - 1
components/dkbase/dk-timeclock-calendar/dk-timeclock-calendar.js

@@ -40,6 +40,8 @@ Component({
     dateList: [], //日历主体渲染数组
     selectDay: {}, //选中时间
     // open: false,
+    slipFlag: false, // 滑动事件开关
+    startPoint: undefined, // 滑动坐标数据
   },
 
   /**
@@ -261,7 +263,40 @@ Component({
         })
         this.triggerEvent("change", this.data.selectDay)
       }
-    }
+    },
+    // 滑动事件监听开始事件
+    myTouchStart(e){
+      // ---------------------记录滑动事件信息---------------------
+      //开启滑动事件
+      const slipFlag = true
+      //记录触摸点的坐标信息
+      const startPoint = e.touches[0]
+      //---------------------记录滑动事件信息end---------------------
+      this.setData({
+        slipFlag: slipFlag,
+        startPoint: startPoint
+      })
+    },
+    // 滑动事件监听结束事件
+    myTouchMove(e) {
+      const startPoint = this.data.startPoint
+      const slipFlag = this.data.slipFlag
+      // ----------------监听手势左右滑事件----------------
+      if (((startPoint.clientX - e.touches[e.touches.length - 1].clientX) > 80) && slipFlag) {
+          this.nextMonth()
+          this.setData({
+            slipFlag: false
+          })
+          return
+      } else if (((startPoint.clientX - e.touches[e.touches.length - 1].clientX) < -80) && slipFlag) {
+          this.lastMonth()
+          this.setData({
+            slipFlag: false
+          })
+          return
+      }
+      // ----------------监听手势左右滑事件end----------------
+    },
   },
   lifetimes: {
     attached() {

+ 1 - 1
components/dkbase/dk-timeclock-calendar/dk-timeclock-calendar.wxml

@@ -26,7 +26,7 @@
 	</view>
 
 	<!-- 日历主体 -->
-	<view class="flex-start flex-wrap calendar-main" style="height:{{dateList.length/7*89}}rpx;  ">
+	<view class="flex-start flex-wrap calendar-main" bind:touchstart="myTouchStart" bind:touchmove="myTouchMove" style="height:{{dateList.length/7*110}}rpx;">
 		<view wx:for="{{dateList}}" wx:key="dateList" class="day">
 			<view class="bg {{(item.year === selectDay.year && item.month === selectDay.month) ? (item.day === selectDay.day?'select':''): 'other-month'}}" data-day="{{item.day}}" data-year="{{item.year}}" data-month="{{item.month}}" data-date-string="{{item.dateString}}">
 				{{item.day}}

+ 3 - 2
components/dkbase/dk-timeclock-calendar/dk-timeclock-calendar.wxss

@@ -142,7 +142,8 @@
 	width: 14.2%;
 	color: #666;
 	text-align: center; 
-	height: 89rpx; 
+  height: 89rpx; 
+  margin-top: 15rpx;
   }
   
   .calendar .calendar-main .day .bg {
@@ -172,5 +173,5 @@
 	display: flex; 
 	align-items: center;
 	justify-content: center;
-	margin-top: -5rpx;
+	margin-top: 10rpx;
   }

+ 20 - 0
package-basic-data/pages/sign/sign.js

@@ -45,6 +45,8 @@ Page({
     // this.getIntegralTactic()
     // // 积分
     // this.getIntegral()
+    // 获取优惠劵
+    this.getCouponNumber()
     // 头像
     this.getUser()
   },
@@ -59,6 +61,24 @@ Page({
     })
   },
 
+    /**
+  * @desc : 优惠劵数量获取
+  * @author : 刘尧
+  * @date : 2024/7/29 15:54
+  */
+  getCouponNumber() {
+    let params = {
+      couponStatus: Constants.couponStatus.unused,
+      flgValid: true
+    }
+    let service = app.globalData['couponUseService']
+    this.excute(service, service.countByCond, params).then(res => {
+      this.setData({
+        couponCount: res.data.data
+      })
+    });
+  },
+
   /**
   * 日期
   * @param {*} e