From 8fbd6b8d09e70494d920cc0b77812e9643be3196 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期二, 23 八月 2022 17:37:31 +0800
Subject: [PATCH] 2022.8.23

---
 pages/promise/promise.js |   34 ++++++++++++++++++++++++----------
 1 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/pages/promise/promise.js b/pages/promise/promise.js
index 3563360..cbc5ea7 100644
--- a/pages/promise/promise.js
+++ b/pages/promise/promise.js
@@ -16,7 +16,7 @@
     promise: [{
       period: '鎵胯鍛ㄦ湡锛�2021骞�1鏈垀2021骞�12鏈�',
       time: '2021骞�1鏈�6鏃ュ畬鎴�',
-      picPath: '',
+      picPath: [],
       pdfPath: ''
     }],
     deadline: "鎵胯鎴鏃堕棿锛�----骞�--鏈�--鏃�",
@@ -29,14 +29,15 @@
    */
   onLoad: function (options) {
     this._initPlanYear()
-    this.getCommitment()
+    // this.getCommitment()
   },
 
   /**
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず
    */
   onShow: function () {
-
+    console.log("promise: onshow");
+    this.getCommitment()
   },
 
   /**
@@ -59,15 +60,28 @@
   checkStatus() {
     if (this.promiseHistory.length > 0) {
       var first = this.promiseHistory[0]
-      var firstYear = moment(first.cmCreateTime).year()
-      if (firstYear >= this.data.year) {
-        var deadline = moment().add(1, 'years').endOf('year').format("YYYY骞碝M鏈圖D鏃�")
+      var cTime = moment(first.cmCreateTime)
+      let leftDays = cTime.add(1, 'years').diff(moment(), 'days')
+      // that.setData({
+      //   promsieInfo: {
+      //     leftDays: leftDays
+      //   }
+      // })
+      if (leftDays > 0) {
+        var deadline = cTime.format("YYYY-MM-DD")
         this.setData({
-          text1: "寰堟!鏈鎵胯宸插畬鎴�",
+          text1: "鏈鎵胯宸插畬鎴�",
           text3: "鏌ョ湅鎵胯",
           status: 1,
-          deadline: `涓嬫鎵胯鏃堕棿锛�${deadline}`
+          deadline: `鎵胯鏈夋晥鏃堕棿锛氬墿浣�${leftDays}澶ー
         })
+      } else {
+        this.setData({
+          text1: "璇峰強鏃跺畬鎴愭壙璇�",
+          text3: "鍘绘壙璇�",
+          status: 0,
+        })
+        this._initPlanYear()
       }
     }
   },
@@ -107,7 +121,7 @@
     if (status == 0) {
       wx.navigateTo({
         url: '/pages/promiseinfo/promiseinfo'
-      }) 
+      })
     } else {
       this.gotoResult(0)
     }
@@ -121,7 +135,7 @@
     this.gotoResult(i)
   },
 
-  gotoResult (i) {
+  gotoResult(i) {
     var p = this.data.promise[i]
     wx.navigateTo({
       url: '/pages/promiseresult/promiseresult',

--
Gitblit v1.9.3