From c9b0f3fa490afc0aeed1df11a723006aba27316b Mon Sep 17 00:00:00 2001
From: liuwh <hugeinfo123>
Date: Wed, 27 May 2020 10:02:57 +0800
Subject: [PATCH] 指纹仪

---
 SunshineLnsMinApp/app.js |  101 +++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 79 insertions(+), 22 deletions(-)

diff --git a/SunshineLnsMinApp/app.js b/SunshineLnsMinApp/app.js
index 9653496..a03a6e4 100644
--- a/SunshineLnsMinApp/app.js
+++ b/SunshineLnsMinApp/app.js
@@ -1,7 +1,7 @@
 var qcloud = require('./lib/index');
 //app.js
 App({
-  onLaunch: function () {
+  onLaunch: function() {
     // 展示本地存储能力
     var logs = wx.getStorageSync('logs') || []
     logs.unshift(Date.now())
@@ -10,17 +10,17 @@
   globalData: {
     userInfo: null,
     pageData: {},
-    // url: 'https://nsjcy.hugeinfo.com.cn/nsjc-charge',
+     url: 'https://nsjcy.hugeinfo.com.cn/nsjc-charge',
     // url: 'http://1p885086k1.iok.la/nsjc-charge',
-    // url: 'http://192.168.0.31:8085/nsjc-charge',
+    //url: 'http://localhost:6060/nsjc-charge',
     imgUrl: 'https://nsjcy.hugeinfo.com.cn/nsjc-charge',
-    url: 'http://nsjc.vaiwan.com/nsjc-charge',
+    // url: 'http://nsjc.vaiwan.com/nsjc-charge',
     // imgUrl: 'http://nsjc.vaiwan.com/nsjc-charge'
   },
   // 过滤数组
   where: (collection, source) => {
     var sourceKeys = Object.keys(source);
-    return collection.filter(function (obj) {
+    return collection.filter(function(obj) {
       for (var i = 0; i < sourceKeys.length; i++) {
         if (!obj.hasOwnProperty(sourceKeys[i]) || obj[sourceKeys[i]] !== source[sourceKeys[i]]) {
           return false;
@@ -31,7 +31,7 @@
   },
 
   //控制是否能够编辑
-  judgeDisable: function (status) {
+  judgeDisable: function(status) {
     if (status == null || status == 0 || status == 4) {
       return false; //可以
     } else {
@@ -40,14 +40,14 @@
   },
 
   //提示弹窗
-  showModal: function (warn) {
+  showModal: function(warn) {
     wx.showModal({
       title: '提示',
       content: warn
     })
   },
   //添加图片
-  joinPicture: function (e, these, associateTypeId, attId) {
+  joinPicture: function(e, these, associateTypeId, attId) {
     var th = this;
     var index = e.currentTarget.dataset.index;
     var associateTypeId = e.currentTarget.dataset.associatetypeid || associateTypeId;
@@ -75,7 +75,7 @@
   },
 
   // 上传视频
-  joinVideo: function (e, these, associateTypeId, attId) {
+  joinVideo: function(e, these, associateTypeId, attId) {
     var th = this;
     var index = e.currentTarget.dataset.index;
     var associateTypeId = e.currentTarget.dataset.associatetypeid || associateTypeId;
@@ -92,7 +92,7 @@
     })
   },
   //上传文件
-  upload: function (these, path, associateTypeId, way, id) {
+  upload: function(these, path, associateTypeId, way, id) {
     console.log(these)
     console.log(path)
     console.log(associateTypeId)
@@ -122,7 +122,7 @@
         associateTypeId: associateTypeId,
         batch
       },
-      success: function (res) {
+      success: function(res) {
         console.log(res)
         var evalList = these.data.evalList;
         var evalListType = 'evalList' + associateTypeId;
@@ -141,7 +141,7 @@
           },
         })
       },
-      complete: function () {
+      complete: function() {
         wx.hideToast(); //隐藏Toast
       }
     })
@@ -149,7 +149,7 @@
   },
 
   //删除图片
-  clearImg: function (e, these) {
+  clearImg: function(e, these) {
     var id = e.currentTarget.id;
     var index = e.currentTarget.dataset.index;
     var associateTypeId = e.currentTarget.dataset.associatetypeid;
@@ -162,12 +162,12 @@
       }),
       wx.request({
         url: this.globalData.url + '/api/v1/attachment/delete/' + id,
-        success: function (res) {
+        success: function(res) {
           if (res.data.code == 0) {
             console.log('删除成功!')
           }
         },
-        complete: function () {
+        complete: function() {
           wx.hideToast(); //隐藏Toast
         }
       })
@@ -181,7 +181,7 @@
   },
 
   // 预览图片
-  previewImage: function (e) {
+  previewImage: function(e) {
     wx.previewImage({
       current: e.currentTarget.dataset.src, // 当前显示图片的http链接
       urls: [e.currentTarget.dataset.src] // 需要预览的图片http链接列表
@@ -189,7 +189,7 @@
   },
 
   //转换时间戳
-  formatDate: function (ts) {
+  formatDate: function(ts) {
     var now = new Date(ts);
     var year = now.getFullYear();
     var month = now.getMonth() + 1;
@@ -201,7 +201,7 @@
   },
 
   //转换时间戳
-  formatDateday: function (ts) {
+  formatDateday: function(ts) {
     var now = new Date(ts);
     var year = now.getFullYear();
     var month = now.getMonth() + 1;
@@ -213,14 +213,14 @@
   },
 
   // 页面正在开发中
-  developIng: function () {
+  developIng: function() {
     wx.navigateTo({
       url: '../developIng/developIng',
     })
   },
 
   // 判断时间段
-  period: function () {
+  period: function() {
     var now = new Date(),
       hour = now.getHours(),
       word = '';;
@@ -245,7 +245,7 @@
   },
 
   // 根据身份证获取生日,性别,年龄
-  IdCard: function (UUserCard, num) {
+  IdCard: function(UUserCard, num) {
     if (num == 1) {
       //获取出生日期
       var birth = UUserCard.substring(6, 10) + "-" + UUserCard.substring(10, 12) + "-" + UUserCard.substring(12, 14);
@@ -272,6 +272,63 @@
       }
       return age;
     }
+  },
+  getPermission: function(url) {
+    wx.getLocation({
+      success: function(res) {
+        wx.navigateTo({
+          url,
+        })
+      },
+      fail: function() {
+        wx.getSetting({
+          success: function(res) {
+            var statu = res.authSetting;
+            if (!statu['scope.userLocation']) {
+              wx.showModal({
+                title: '是否授权当前位置',
+                content: '需要获取您的地理位置,请确认授权,否则地图功能将无法使用',
+                success: function(tip) {
+                  if (tip.confirm) {
+                    wx.openSetting({
+                      success: function(data) {
+                        if (data.authSetting["scope.userLocation"] === true) {
+                          wx.showToast({
+                            title: '授权成功',
+                            icon: 'success',
+                            duration: 1000
+                          })
+                          //授权成功之后,再调用chooseLocation选择地方
+                          wx.getLocation({
+                            success: function(res) {
+                              wx.navigateTo({
+                                url,
+                              })
+                            },
+                          })
+                        } else {
+                          wx.showToast({
+                            title: '授权失败',
+                            icon: 'success',
+                            duration: 1000
+                          })
+                        }
+                      }
+                    })
+                  }
+                }
+              })
+            }
+          },
+          fail: function(res) {
+            wx.showToast({
+              title: '调用授权窗口失败',
+              icon: 'success',
+              duration: 1000
+            })
+          }
+        })
+      }
+    })
   }
-
 })
\ No newline at end of file

--
Gitblit v1.8.0