From 5a887acf1924950715086633d329db045223b5c4 Mon Sep 17 00:00:00 2001 From: liuwh <hugeinfo123> Date: Tue, 09 Jun 2020 14:47:27 +0800 Subject: [PATCH] test --- SunshineLnsMinApp/app.js | 86 ++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 80 insertions(+), 6 deletions(-) diff --git a/SunshineLnsMinApp/app.js b/SunshineLnsMinApp/app.js index b434732..a03a6e4 100644 --- a/SunshineLnsMinApp/app.js +++ b/SunshineLnsMinApp/app.js @@ -10,11 +10,12 @@ globalData: { userInfo: null, pageData: {}, - // url: 'https://nsjcy.hugeinfo.com.cn/nsjc-charge', - //url: 'http://192.168.0.31:8085/nsjc-charge', - // imgUrl: 'https://nsjcy.hugeinfo.com.cn/nsjc-charge', - url: 'http://nsjc.vaiwan.com/nsjc-charge', - imgUrl: 'http://nsjc.vaiwan.com/nsjc-charge' + url: 'https://nsjcy.hugeinfo.com.cn/nsjc-charge', + // url: 'http://1p885086k1.iok.la/nsjc-charge', + //url: 'http://localhost:6060/nsjc-charge', + imgUrl: 'https://nsjcy.hugeinfo.com.cn/nsjc-charge', + // url: 'http://nsjc.vaiwan.com/nsjc-charge', + // imgUrl: 'http://nsjc.vaiwan.com/nsjc-charge' }, // 过滤数组 where: (collection, source) => { @@ -126,6 +127,10 @@ var evalList = these.data.evalList; var evalListType = 'evalList' + associateTypeId; var data = JSON.parse(res.data) + console.log(data) + console.log('path', path) + console.log('evalList', evalList) + console.log('associateTypeId', associateTypeId) these.setData({ evalList: { ...evalList, @@ -195,6 +200,18 @@ return year + "-" + month + "-" + date + " " + hour + ":" + minute; }, + //转换时间戳 + formatDateday: function(ts) { + var now = new Date(ts); + var year = now.getFullYear(); + var month = now.getMonth() + 1; + var date = now.getDate(); + var hour = now.getHours() < 10 ? '0' + now.getHours() : now.getHours(); + var minute = now.getMinutes() < 10 ? '0' + now.getMinutes() : now.getMinutes(); + var second = now.getSeconds(); + return year + "-" + month + "-" + date; + }, + // 页面正在开发中 developIng: function() { wx.navigateTo({ @@ -255,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