Silent 6 年之前
父节点
当前提交
d09003c707
共有 2 个文件被更改,包括 28 次插入2 次删除
  1. 1 1
      app/Http/Controllers/WeChat/ApiController.php
  2. 27 1
      wechat/pages/index/index.js

+ 1 - 1
app/Http/Controllers/WeChat/ApiController.php

xqd
@@ -363,7 +363,7 @@ class ApiController extends Controller
                 $day = Carbon::createFromTimestamp(strtotime($item->end_date_time))->day;
                 $tmp = $checkCardList->where('day', $day);
                 if($tmp->count() == 0) {
-                    $checkCardList->push(collect(['month' => 'current', 'day' => $day, 'color' => '#77b9b9']));
+                    $checkCardList->push(collect(['month' => 'current', 'day' => $day, 'background' => '#fb534b', 'color' => '#ffffff']));
                 }
             }
         }

+ 27 - 1
wechat/pages/index/index.js

xqd xqd
@@ -91,7 +91,7 @@ Page({
             if (res.data.status == 'success' && res.data.result == 'ok') {
               let validLocation = api.isTest ? true : false;
               this.setData({
-                is_btn_disabled: validLocation
+                is_btn_disabled: !validLocation
               })
             }
           },
@@ -123,6 +123,32 @@ Page({
     return res;
   },
   handleBtnClick() {
+    wx.getLocation({
+      success: (res) => {
+        // let validLocation = this.validLocation(res.latitude, res.longitude)
+        wx.request({
+          url: api.checkPositionUrl,
+          method: 'GET',
+          data: {
+            latitude: res.latitude,
+            longitude: res.longitude
+          },
+          success: res => {
+            let validLocation = false;
+            if (res.data.status == 'success' && res.data.result == 'ok') {
+              validLocation = api.isTest ? true : false;
+            }
+            validLocation = api.isTest ? true : false;
+            this.setData({
+              is_btn_disabled: !validLocation
+            })
+            this.checkCard()
+          },
+        });
+      }
+    })
+  },
+  checkCard: function() {
     let isLearning = this.data.isLearning
     let is_btn_disabled = this.data.is_btn_disabled
     let that = this;