heikabujianai 5 سال پیش
والد
کامیت
6c04113306

BIN
images/clock-video.zip


+ 2 - 2
pages/clock/clock-success/clock-success.js

@@ -25,10 +25,10 @@ Page({
   onLoad: function (options) {
     if (options.clockType) {
       this.setData({
-        clockType: options.clockType,
+        clockType: Number(options.clockType),
         sumMoney: options.sumMoney,
         duration: options.duration,
-todayMoney: options.todayMoney,
+        todayMoney: options.todayMoney,
       })
     }
     const date = new Date()

+ 5 - 5
pages/clock/clock-success/clock-success.wxml

@@ -2,23 +2,23 @@
 <wxs src="../clock.wxs" module="clock"></wxs>
 <view class="container" wx:if="{{clockType}}">
   <view class="clock-success">
-    <text wx:if="{{clockType === '1'}}">上班打卡成功</text>
-    <text wx:if="{{clockType === '2'}}">下班打卡成功</text>
+    <text wx:if="{{clockType === 1}}">上班打卡成功</text>
+    <text wx:if="{{clockType === 2}}">下班打卡成功</text>
   </view>
   <view class="time">
     打卡时间 {{time}}
   </view>
   <image src="{{imgServerUrl}}/images/clock/clock-success.png"></image>
-  <view class="money">
+  <view class="money" wx:if="{{clockType === 2}}">
     <text>累计预支</text>
     <text class="number">{{clock.toFixed(sumMoney)}}</text>
     <text>元</text>
   </view>
-  <view class="end" wx:if="{{clockType === '1'}}">
+  <view class="end" wx:if="{{clockType === 1}}">
     <view>新的一天开始啦!</view>
     <view>今天的你也要光芒万丈!记得下班也要打卡哦!</view>
   </view>
-  <view class="end" wx:if="{{clockType === '2'}}">
+  <view class="end" wx:if="{{clockType === 2}}">
     <view>
       <text>今日打卡已完成,打卡时长</text> <text class="number">{{duration}}</text>
       <text>小时,</text>

+ 2 - 2
pages/clock/clock-tongji/calendar/calendar.wxss

@@ -75,12 +75,12 @@
   border-radius: 100%;
 }
 
-.all {
+.shortage {
   background-color: #FD7235;
   border: 2rpx solid #FFFFFF;
 }
 
-.shortage {
+.all {
   background-color: #BCBCBC;
   border: 2rpx solid #FFFFFF;
 }

+ 11 - 10
pages/clock/clock-tongji/index.js

@@ -38,17 +38,20 @@ Page({
   },
   getCurrent() {
     currentSettlement().then(data => {
+      const month = Number(data.data.currentSettlement.date.split('-')[1])
       this.setData({
-        currentSettlement: data.data.currentSettlement
+        currentSettlement: data.data.currentSettlement,
+        text: month,
+        mouth: month,
       })
     })
   },
   next() {
-    if (this.data.text < this.data.mouth) {
+    if (this.data.text !== this.data.mouth) {
       this.selectComponent('.calendar').next()
       this.getList(1)
       this.setData({
-        text: new Date().getMonth() + 1,
+        text: this.data.mouth,
         next: `${imgServerUrl}/images/clock/clock-arrow-righr-disabled.png`,
         last: `${imgServerUrl}/images/clock/clock-arrow-left.png`,
       }, _ => {
@@ -65,12 +68,12 @@ Page({
     if (this.data.text === this.data.mouth) {
       this.selectComponent('.calendar').last()
       this.getList(2)
-      if (new Date().getMonth() - 1 < 0) {
+      if (this.data.mouth - 1 <= 0) {
         this.setData({
           text: 12
         }, _ => {
-          let { year, month } = this.data
-          const search_date = [year, month, 1].map(val => {
+          let { year, text } = this.data
+          const search_date = [year - 1, text, 1].map(val => {
             const number = val.toString()
             return number[1] ? number : '0' + number
           }).join('-')
@@ -79,7 +82,7 @@ Page({
         })
       } else {
         this.setData({
-          text: new Date().getMonth()
+          text: this.data.mouth - 1
         }, _ => {
           let { year, text } = this.data
           const search_date = [year, text, 1].map(val => {
@@ -116,7 +119,7 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-  
+
   },
 
   /**
@@ -142,8 +145,6 @@ Page({
     this.getCurrent()
     this.getDay(search_date)
     this.setData({
-      text: month,
-      mouth: month,
       year
     })
   },

+ 3 - 3
pages/clock/clock-tongji/index.wxml

@@ -1,8 +1,8 @@
 <!--pages/clock/clock-tongji/index.wxml-->
 <wxs src="../clock.wxs" module="clock"></wxs>
 <view class="container">
-  <view class="header">
-    <view class="header-title" bindtap="toList">
+  <view class="header" bindtap="toList">
+    <view class="header-title">
       <text>{{mouth}}月汇总</text>
       <image src="{{imgServerUrl}}/images/clock/clock-arrow-righr-disabled.png"></image>
     </view>
@@ -69,7 +69,7 @@
             <view class="clock-type">下班<text class="shortage">缺卡</text></view>
             <view class="address">
               <image src="{{imgServerUrl}}/images/clock/clock-position.png" class="position"></image>
-              <text>获取定位失败</text>
+              <text>{{item.companyName}}</text>
             </view>
           </view>
         </view>

+ 8 - 1
pages/clock/clock-tongji/index.wxss

@@ -78,6 +78,7 @@ page {
 }
 
 .calendar-content-choose {
+  height: 100%;
   font-size: 28rpx;
   font-family: PingFangSC-Regular, PingFang SC;
   font-weight: 400;
@@ -89,9 +90,15 @@ page {
 .last,
 .next {
   height: 100%;
-  width: 60rpx;
+  width: 75rpx;
   display: flex;
   align-items: center;
+  /* justify-content: center; */
+}
+
+.last {
+  width: 120rpx;
+  justify-content: center;
 }
 
 .next {

+ 11 - 2
pages/clock/clock-tongji/list.wxss

@@ -60,11 +60,12 @@ page {
 }
 
 .title {
+  height: 138rpx;
   font-size: 34rpx;
   font-family: PingFangSC-Semibold, PingFang SC;
   font-weight: 600;
   color: #000000;
-  padding: 30rpx;
+  padding: 0 30rpx;
   display: flex;
   align-items: center;
   justify-content: space-between;
@@ -92,7 +93,9 @@ page {
 .label {
   color: #666666;
 }
+
 .calendar-content-choose {
+  height: 100%;
   font-size: 28rpx;
   font-family: PingFangSC-Regular, PingFang SC;
   font-weight: 400;
@@ -107,6 +110,12 @@ page {
   width: 60rpx;
   display: flex;
   align-items: center;
+  /* justify-content: center; */
+}
+
+.last {
+  width: 120rpx;
+  justify-content: center;
 }
 
 .next {
@@ -116,4 +125,4 @@ page {
 .calendar-content-choose image {
   height: 29rpx;
   width: 17rpx;
-}
+}

+ 3 - 3
pages/clock/clock.wxml

@@ -36,7 +36,7 @@
         前往认证
       </navigator>
     </view>
-    <image  bindtap="toRule" src="{{imgServerUrl}}/images/clock/clock-video.png" class="video"></image>
+    <image bindtap="toRule" src="{{imgServerUrl}}/images/clock/clock-video.png" class="video"></image>
   </view>
   <view class="pass" wx:else>
     <view class="pass-header">
@@ -66,7 +66,7 @@
         </view>
       </view>
     </view>
-    <view class="pass-content {{clockType === 4 ?'height':''}}">
+    <view class="pass-content">
       <view class="status">
         <view class="clock-in">
           <text>上班打卡</text>
@@ -104,7 +104,7 @@
         <image src="{{imgServerUrl}}/images/clock/refresh.png"></image>
         <text>重新定位</text>
       </view>
-      <view class="prepayable">
+      <view class="prepayable" wx:if="{{clockType === 4}}">
         <text>当日可预支工资:</text>
         <view>
           <text class="prepayable-number">{{clock.toFixed(todayMoney)}}</text>

+ 5 - 6
pages/clock/clock.wxss

@@ -182,12 +182,13 @@ page {
 
 .pass-content {
   width: 690rpx;
-  height: 748rpx;
+  min-height: 748rpx;
   background: #fff;
   /* box-shadow: 0px 10rpx 10rpx 0rpx rgba(0, 0, 0, 0.06); */
   border-radius: 16rpx;
   margin-top: 20rpx;
   padding: 30rpx 27rpx;
+  padding-bottom: 0;
   box-sizing: border-box;
 }
 
@@ -280,6 +281,7 @@ page {
   font-weight: 600;
   color: #007AFF;
   padding-top: 40rpx;
+  padding-bottom: 70rpx;
   display: flex;
   justify-content: center;
   align-items: center;
@@ -300,7 +302,8 @@ page {
   display: flex;
   align-items: center;
   justify-content: space-between;
-  margin-top: 164rpx;
+  margin-top: 151rpx;
+  padding-bottom: 40rpx;
 }
 
 .prepayable-number {
@@ -315,10 +318,6 @@ page {
   margin-left: 8rpx;
 }
 
-.height {
-  height: 894rpx;
-}
-
 .cover {
   position: fixed;
   left: 0;

+ 1 - 1
project.config.json

@@ -390,7 +390,7 @@
           "id": 44,
           "name": "打卡成功",
           "pathName": "pages/clock/clock-success/clock-success",
-          "query": "status=4",
+          "query": "clockType=1",
           "scene": null
         },
         {

+ 20 - 3
utils/http.js

@@ -37,10 +37,27 @@ const getData = (data) => {
   }
   return _data;
 }
+// 获取网络状态
+function networkType() {
+  return new Promise(resolve => {
+    wx.getNetworkType({
+      success(res) {
+        resolve(res.networkType === 'none')
+      }
+    })
+  })
+}
 /**
  * 封装http 请求方法
  */
-const http = (params) => {
+const http = async (params) => {
+  if (await networkType()) {
+    wx.showToast({
+      icon: 'none',
+      title: '请检查网络连接',
+    })
+    return Promise.reject('网络未连接')
+  }
   _loading.showLoading({
     mask: true,
     title: '加载中...',
@@ -170,9 +187,9 @@ const http = (params) => {
             return reject(res.data);
           } else if (errorCode === 2101) {
             return reject(res.data);
-          }else if (errorCode === 2102) {
+          } else if (errorCode === 2102) {
             return reject(res.data);
-          }else if (errorCode === 2103) {
+          } else if (errorCode === 2103) {
             return reject(res.data);
           }
           params.data.task_id !== 10 && showToast(res.data.errmsg);