From 60e8bd4303790d6ddc4f95f8b88aa3eccc16e6b5 Mon Sep 17 00:00:00 2001 From: shuiqing Date: Thu, 19 Jul 2018 19:12:31 +0800 Subject: [PATCH] ... --- pages/at_present/at_present.js | 33 ++++++++-- pages/loding/loding.js | 112 ++++++++++++++++++++++++++------- 2 files changed, 118 insertions(+), 27 deletions(-) diff --git a/pages/at_present/at_present.js b/pages/at_present/at_present.js index e804763..63a9b76 100644 --- a/pages/at_present/at_present.js +++ b/pages/at_present/at_present.js @@ -21,17 +21,36 @@ Page({ merchantNo: '', }, onLoad: function(options) { - let that = this;  + // let that = this;  qqmapsdk = new QQMapWX({ key: 'C5KBZ-RISKD-INW4P-PWYQJ-QC6C7-BQBGC' }); }, + //  onShow: function () { + //   var that = this; + //   // 腾讯地图调用接口 + //   qqmapsdk.search({ + //    success: function (res) { + //     + //    }, + //    fail: function (res) { + //     console.log(res); + //    }, + //    complete: function (res) { + //     console.log(res); + //    } + //   }) + //  }, + + + onReady: function() { var that = this; wx.getLocation({ - type: 'wgs84', + type: 'wgs84', success: function(res) { - qqmapsdk.reverseGeocoder({ + // qqmapsdk.reverseGeocoder({ + qqmapsdk.search({ success: function(res) { let district = res.result.address_component.district; let city = res.result.address_component.city; @@ -48,7 +67,7 @@ Page({ }, header: { 'Content-Type': 'application/x-www-form-urlencoded' - }, + }, success: function(res) { // 打印对应想得到的数据 console.log(res) @@ -83,6 +102,7 @@ Page({ }); } }); + }, fail: function(res) { showorHide: false, @@ -92,7 +112,10 @@ Page({ }, }); } - }) + }), + wx.getSetting({ + + }) }, groupTaps: function(e) { var that = this; diff --git a/pages/loding/loding.js b/pages/loding/loding.js index 65eda0b..24ed458 100644 --- a/pages/loding/loding.js +++ b/pages/loding/loding.js @@ -1,8 +1,6 @@ // pages/demo/demo.js -var QQMapWX = require('../../libs/qqmap-wx-jssdk.js'); - +var QQMapWX = require("../../libs/qqmap-wx-jssdk.js"); var util = require("../../utils/util.js"); - var qqmapsdk; /** * 页面的初始数据 @@ -12,29 +10,30 @@ Page({ hiddenLoading: false, resData: [] }, - onLoad: function (options) {   // 实例化腾讯地图API核心类 - let that = this; - qqmapsdk = new QQMapWX({ - key: 'C5KBZ-RISKD-INW4P-PWYQJ-QC6C7-BQBGC' - //正式版 key: ' JN7BZ-MJBK5-52SIH-QOKGH-FJE5F-IWFGG' - }); + onLoad: function (options) { + // 实例化腾讯地图API核心类 + let that = this; + // qqmapsdk = new QQMapWX({ + // key: "C5KBZ-RISKD-INW4P-PWYQJ-QC6C7-BQBGC" + // //正式版 key: ' JN7BZ-MJBK5-52SIH-QOKGH-FJE5F-IWFGG' + // }); wx.getStorage({ - key: 'merchantNo', + key: "merchantNo", success: function (res) { - console.log(res.data) - if (res.data == '') { + console.log(res.data); + if (res.data == "") { that.queryCartList(); } else { wx.switchTab({ - url: '../index/index' - }) + url: "../index/index" + }); } that.setData({ merchantNo: res.data - }) + }); }, fail: function (res) { - console.log(res) + console.log(res); that.queryCartList(); } }); @@ -42,18 +41,87 @@ Page({ queryCartList: function () { wx.getSetting({ success: function (res) { - if (res.authSetting['scope.userInfo']) { + if (res.authSetting["scope.userInfo"]) { //授权了 wx.navigateTo({ - url: '../at_present/at_present', - }) + url: "../at_present/at_present" + }); } else { //未授权 wx.switchTab({ - url: '../city/city', - }) + url: "../city/city" + }); } } }); } -}) \ No newline at end of file +}); + +// // pages/demo/demo.js +// var QQMapWX = require('../../libs/qqmap-wx-jssdk.js'); + +// var util = require("../../utils/util.js"); + +// var qqmapsdk; +// /** +// * 页面的初始数据 +// */ +// Page({ +// data: { +// hiddenLoading: false, +// resData: [] +// }, +// onLoad: function (options) {   // 实例化腾讯地图API核心类 +// let that = this; +// qqmapsdk = new QQMapWX({ +// key: 'C5KBZ-RISKD-INW4P-PWYQJ-QC6C7-BQBGC' +// //正式版 key: ' JN7BZ-MJBK5-52SIH-QOKGH-FJE5F-IWFGG' +// }); +// // wx.getStorage({ +// // key: 'merchantNo', +// // success: function (res) { +// // console.log(res.data) +// // if (res.data == '') { +// // console.log('第一次进来的时候') +// // } else { +// // wx.switchTab({ +// // url: '../index/index' +// // }) +// // } +// // that.setData({ +// // merchantNo: res.data +// // }) +// // // that.setData({ userName: res.data }); +// // } +// // }); +// }, +// onReady: function () { +// // 页面渲染完成 +// var t = this; +// setTimeout(function () { +// t.setData({ +// hiddenLoading: true +// }); +// t.update(); +// }, 3000); +// wx.getSetting({ +// success: function (res) { +// if (res.authSetting['scope.userInfo']) { +// //授权了 +// wx.navigateTo({ +// url: '../at_present/at_present', +// }) +// } else { +// //未授权 + +// wx.navigateTo({ +// url: '../city/city', +// }) +// } +// } + +// }); + +// } +// }) +// // }); \ No newline at end of file