From 335e18645a0eeaaf673a8f7799cf9dff664018de Mon Sep 17 00:00:00 2001 From: lfs3 Date: Thu, 19 Jul 2018 20:44:33 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E9=A1=B5=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/loding/loding.js | 141 +++++++++++++++------------------------ pages/loding/loding.wxml | 2 +- project.config.json | 4 ++ 3 files changed, 57 insertions(+), 90 deletions(-) diff --git a/pages/loding/loding.js b/pages/loding/loding.js index 24ed458..8e8ad96 100644 --- a/pages/loding/loding.js +++ b/pages/loding/loding.js @@ -10,13 +10,9 @@ Page({ hiddenLoading: false, resData: [] }, - onLoad: function (options) { + onShow: 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) { @@ -39,89 +35,56 @@ Page({ }); }, queryCartList: function () { - wx.getSetting({ - success: function (res) { - if (res.authSetting["scope.userInfo"]) { - //授权了 - wx.navigateTo({ - url: "../at_present/at_present" - }); - } else { - //未授权 - wx.switchTab({ - url: "../city/city" - }); - } + wx.getLocation({ + type: 'wgs84', + success: function(res) { + //授权了 + wx.navigateTo({ + url: "../at_present/at_present" + }); + }, + fail:function(error){ + console.log(error); + wx.navigateTo({ + url: '../city/city', + }) } - }); - } -}); - -// // 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', -// }) -// } -// } - -// }); + }) + }, + handler: function (e) { + var that = this; + if (!e.detail.authSetting['scope.userLocation']) { + that.setData({ + ldata: false + }) + } else { + that.setData({ + ldata: true, + }) + wx.getLocation({ + type: 'gcj02', + success: function (res) { + var latitude = res.latitude + var longitude = res.longitude -// } -// }) -// // }); \ No newline at end of file + that.setData({ + latitude: latitude, + longitude: longitude + }) + wx.openLocation({ + latitude: latitude, + longitude: longitude, + scale: 28 + }) + } + }) + } + }, + btnTap(e) { + wx.openLocation({ + latitude: this.data.latitude, + longitude: this.data.longitude, + scale: 28 + }) + }, +}); diff --git a/pages/loding/loding.wxml b/pages/loding/loding.wxml index 0277891..24ef887 100644 --- a/pages/loding/loding.wxml +++ b/pages/loding/loding.wxml @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/project.config.json b/project.config.json index e0dfff3..1797105 100644 --- a/project.config.json +++ b/project.config.json @@ -20,6 +20,10 @@ "current": -1, "list": [] }, + "plugin": { + "current": -1, + "list": [] + }, "game": { "currentL": -1, "list": [] From 559461d34a3b6095f79257d6714450e822b675d9 Mon Sep 17 00:00:00 2001 From: lfs3 Date: Thu, 19 Jul 2018 21:01:07 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.js | 79 ++++++++++++++++++++++-------------------- pages/loding/loding.js | 70 ++++++++++++++++++------------------- 2 files changed, 76 insertions(+), 73 deletions(-) diff --git a/pages/index/index.js b/pages/index/index.js index 6afb29d..b00f73a 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -45,7 +45,7 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - let that = this; + var that = this; //获取本地数据 // 获取地址 wx.getStorage({ @@ -62,54 +62,57 @@ Page({ success: function (res) { that.setData({ merchantNo: res.data + }), + that.getActivityList(res.data); + wx.request({ + url: app.gw.hostUrl + '/mall/wxa/activity/banner', + method: 'get', + data: { + merchantNo: res.data + }, + header: { + 'Content-Type': 'application/x-www-form-urlencoded' + }, + success: function (res) { + var data = res.data; + var status = data.code; + if (status == 0) { + var data = res.data; + var status = data.code; + // console.log(res); + that.setData({ + imgUrls: data.response + }) + } else { + wx.showToast({ + title: data.msg, + icon: 'none', + duration: 3000 + }); + return; + } + }, + fail: function (res) { + wx.showToast({ + title: '加载数据失败', + }); + }, }) } }); - wx.request({ - url: app.gw.hostUrl + '/mall/wxa/activity/banner', - method: 'get', - data: { - merchantNo: that.merchantNo - }, - header: { - 'Content-Type': 'application/x-www-form-urlencoded' - }, - success: function (res) { - var data = res.data; - var status = data.code; - if (status == 0) { - var data = res.data; - var status = data.code; - // console.log(res); - that.setData({ - imgUrls: data.response - }) - } else { - wx.showToast({ - title: data.msg, - icon: 'none', - duration: 3000 - }); - return; - } - }, - fail: function (res) { - wx.showToast({ - title: '加载数据失败', - }); - }, - }), - this.getActivityList(); + + + }, - getActivityList: function () { + getActivityList: function ( merchantNo) { let that = this; wx.showNavigationBarLoading() //在标题栏中显示加载 wx.request({ url: app.gw.hostUrl + '/mall/wxa/activity/list', method: 'get', data: { - merchantNo: that.merchantNo, + merchantNo: merchantNo, // selectedCityId: that.data.addrArray.id[that.data.addrIndex] == undefined ? 0 : that.data.addrArray.id[that.data.addrIndex], pageNum: that.data.pageNum, pageSize: that.data.pageSize diff --git a/pages/loding/loding.js b/pages/loding/loding.js index 8e8ad96..d04b0b4 100644 --- a/pages/loding/loding.js +++ b/pages/loding/loding.js @@ -51,40 +51,40 @@ Page({ } }) }, - handler: function (e) { - var that = this; - if (!e.detail.authSetting['scope.userLocation']) { - that.setData({ - ldata: false - }) - } else { - that.setData({ - ldata: true, - }) - wx.getLocation({ - type: 'gcj02', - success: function (res) { - var latitude = res.latitude - var longitude = res.longitude + // handler: function (e) { + // var that = this; + // if (!e.detail.authSetting['scope.userLocation']) { + // that.setData({ + // ldata: false + // }) + // } else { + // that.setData({ + // ldata: true, + // }) + // wx.getLocation({ + // type: 'gcj02', + // success: function (res) { + // var latitude = res.latitude + // var longitude = res.longitude - that.setData({ - latitude: latitude, - longitude: longitude - }) - wx.openLocation({ - latitude: latitude, - longitude: longitude, - scale: 28 - }) - } - }) - } - }, - btnTap(e) { - wx.openLocation({ - latitude: this.data.latitude, - longitude: this.data.longitude, - scale: 28 - }) - }, + // that.setData({ + // latitude: latitude, + // longitude: longitude + // }) + // wx.openLocation({ + // latitude: latitude, + // longitude: longitude, + // scale: 28 + // }) + // } + // }) + // } + // }, + // btnTap(e) { + // wx.openLocation({ + // latitude: this.data.latitude, + // longitude: this.data.longitude, + // scale: 28 + // }) + // }, });