From 03d5631ace0bbdf47acdcfd2c03df5c0924aaf31 Mon Sep 17 00:00:00 2001 From: meo <18801474720@163.com> Date: Thu, 23 May 2019 19:57:23 +0800 Subject: [PATCH] =?UTF-8?q?[=E7=89=B9=E4=BA=AB=E7=A4=BC=E9=81=87][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]:[=E7=89=B9=E4=BA=AB=E7=A4=BC=E9=81=87?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 18 +-- config/config.js | 6 +- pages/index/searchbar/detail/index.wxss | 1 - pages/passCar/passCar.js | 20 +-- pages/specialcourtesy/specialcourtesy.wxml | 6 +- pages/specialcourtesy/specialcourtesy.wxss | 145 +++++++++++++-------- pages/user/index.js | 123 ++++++++++------- 7 files changed, 187 insertions(+), 132 deletions(-) diff --git a/app.js b/app.js index d53c374..8712f83 100644 --- a/app.js +++ b/app.js @@ -5,7 +5,6 @@ App({ data: {}, onLaunch: function (options) { var that = this; - console.log("onLuanch") that.globalData.sceneAddress = options.scene; /** * 用户登录 @@ -99,21 +98,6 @@ App({ } }) }, - /** - * 获取地址位置信息 - */ - getLocation: function () { - var that = this; - wx.getLocation({ - type: "wgs84", - success: function (res) { - that.globalData.locationInfo = res; - }, - fail: error => { - console.log(error); - } - }); - }, globalData: { // token token: null, @@ -134,7 +118,7 @@ App({ carLogin: false, // 当前商场信息 market: { - name: "陕西大悦城" + name: "" }, // websocket socketClient: null, diff --git a/config/config.js b/config/config.js index e5f8699..545d644 100755 --- a/config/config.js +++ b/config/config.js @@ -281,7 +281,11 @@ var config = { /** * 会员积分记录 */ - integralList:'/credit/list' + integralList:'/credit/list', + /** + * 用户更新位置信息 + */ + updateLBS:"/user/updateLBS" }, weapp: { AppId: weappId diff --git a/pages/index/searchbar/detail/index.wxss b/pages/index/searchbar/detail/index.wxss index 65c41a2..94ea8c8 100644 --- a/pages/index/searchbar/detail/index.wxss +++ b/pages/index/searchbar/detail/index.wxss @@ -45,7 +45,6 @@ .merchant-detail { width: 100%; - padding: 30rpx 0 0; background: #fff; border-top-left-radius: 20rpx; border-top-right-radius: 20rpx; diff --git a/pages/passCar/passCar.js b/pages/passCar/passCar.js index 278c88c..8fd9d13 100644 --- a/pages/passCar/passCar.js +++ b/pages/passCar/passCar.js @@ -145,23 +145,23 @@ Page({ appId: config.weapp.AppId, } }) - .then(res => { - let weapNote = JSON.parse(res.data.weapNote); - that.setData({ - desc: weapNote.carpage.desc, - title: weapNote.carpage.title - }) - }) - .catch(err => { - console.log(err); + .then(res => { + let weapNote = JSON.parse(res.data.weapNote); + that.setData({ + desc: weapNote.carpage.desc, + title: weapNote.carpage.title }) + }) + .catch(err => { + console.log(err); + }) // 登录 var scene = decodeURIComponent(options.scene); that.setData({ scene: scene }); if (app.globalData.token) { } else { - app.getLocation(); + // app.getLocation(); that.userLogin() } }, diff --git a/pages/specialcourtesy/specialcourtesy.wxml b/pages/specialcourtesy/specialcourtesy.wxml index 373fe71..878cba6 100644 --- a/pages/specialcourtesy/specialcourtesy.wxml +++ b/pages/specialcourtesy/specialcourtesy.wxml @@ -19,7 +19,11 @@ {{item.discount/10}}{{item.merchantName}} - {{item.buildingName}}{{item.floorName}} + + + {{list.buildingName}}{{list.floorName}} + + diff --git a/pages/specialcourtesy/specialcourtesy.wxss b/pages/specialcourtesy/specialcourtesy.wxss index ba2cb27..9e99ad1 100644 --- a/pages/specialcourtesy/specialcourtesy.wxss +++ b/pages/specialcourtesy/specialcourtesy.wxss @@ -1,125 +1,151 @@ @import "../../app.wxss"; -Page{ + +Page { background: #fc5b24; } -.none{ + +.none { font-size: 28rpx; text-align: center; margin-top: 30rpx; - color: #fff; - float:none!important; + color: #fff; + float: none !important; } -.headerbg image{ + +.headerbg image { display: block; width: 100%; } -.fl{ + +.fl { float: left; } -.fr{ + +.fr { float: right; } -.title{ + +.title { padding: 20rpx 40rpx 30rpx; color: #fff; text-align: center; - font-size:26rpx; + font-size: 26rpx; } -.card{ + +.card { position: relative; width: 335rpx; margin: 0 auto 18rpx; - border-radius:16rpx; + border-radius: 16rpx; overflow: hidden; padding-bottom: 20rpx; - background: #fff; + background: #fff; height: 185rpx; } -.txt01 text{ + +.txt01 text { display: block; text-align: center; } -.cards{ + +.cards { padding: 0 33rpx; } -.cards>view:nth-of-type(2n){ + +.cards>view:nth-of-type(2n) { float: right; } -.cards>view:nth-of-type(2n+1){ + +.cards>view:nth-of-type(2n+1) { float: left; } -.tit{ - font-size:36rpx; - color:rgba(51,51,51,1); + +.tit { + font-size: 36rpx; + color: rgba(51, 51, 51, 1); margin: -40rpx auto 0; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; - width:280rpx; + width: 280rpx; text-align: center; } -.cardtype{ + +.cardtype { position: absolute; right: 28rpx; top: 20rpx; - font-size: 24rpx; - color:rgba(99,188,230,1); + font-size: 24rpx; + color: rgba(99, 188, 230, 1); } -.footer{ + +.footer { margin-top: 26rpx; - font-size:26rpx; - font-weight:500; - color:rgba(153,153,153,1); + font-size: 26rpx; + font-weight: 500; + color: rgba(153, 153, 153, 1); } -.footer text{ + +.footer text { text-indent: 33rpx; } -.footer image{ + +.footer image { width: 24rpx; margin-right: 33rpx; -} - .triangle { - width: 0px; - height: 0px; - border-color: transparent #DAB055; - border-width: 0 0 110rpx 110rpx; - border-style: solid; -} -.discount{ + position: absolute; + right: 0rpx; + bottom: 20rpx; +} + +.triangle { + width: 0px; + height: 0px; + border-color: transparent #dab055; + border-width: 0 0 110rpx 110rpx; + border-style: solid; +} + +.discount { position: absolute; color: #fff; width: 110rpx; height: 100rpx; font-size: 20rpx; - left:13rpx; - top:-11rpx; + left: 13rpx; + top: -11rpx; z-index: 10; - transform:rotate(315deg); + transform: rotate(315deg); } -.discount text{ + +.discount text { font-size: 28rpx; } -.level{ + +.level { color: yellow; } -#mycanvas2{ + +#mycanvas2 { height: 300rpx; width: 300rpx; margin: 40rpx auto 20rpx; } -.goback{ + +.goback { position: fixed; right: 50rpx; bottom: 60rpx; - width:100rpx!important; - height:100rpx; + width: 100rpx !important; + height: 100rpx; z-index: 100; - background:rgba(255,255,255,1); + background: rgba(255, 255, 255, 1); line-height: 95rpx; - border:1rpx solid rgba(227,227,227,1); - border-radius:50%; + border: 1rpx solid rgba(227, 227, 227, 1); + border-radius: 50%; } -.goback image{ + +.goback image { position: absolute; width: 60rpx; left: 0; @@ -128,26 +154,33 @@ Page{ bottom: 0; margin: auto; } -.code{ + +.code { width: 684rpx; background: #fff; margin: 0 auto; - border-radius:10rpx; + border-radius: 10rpx; padding: 20rpx 0 40rpx; } -.code text{ + +.code text { color: #666; display: block; text-align: center; font-size: 28rpx; } -#barcode{ + +#barcode { width: 600rpx; height: 150rpx; margin: 0 auto 10rpx; } -.code image{ + +.code image { display: block; width: 500rpx; margin: 0 auto; +} +.building{ + display: inline-block; } \ No newline at end of file diff --git a/pages/user/index.js b/pages/user/index.js index be4ae2a..828d423 100644 --- a/pages/user/index.js +++ b/pages/user/index.js @@ -24,24 +24,24 @@ Page({ wmspellgroup: imgurl.wmspellgroup.url, canIUse: wx.canIUse('official-account'), flag: 'hidden', - score:'0', - name:"", - birthdate:"", - sex:"", - showEdit:false, - ismember:false, - showQrcode:false, + score: '0', + name: "", + birthdate: "", + sex: "", + showEdit: false, + ismember: false, + showQrcode: false, canvasHidden: false, maskHidden: true, imagePath: '', - appVersion:"", + appVersion: "", showmemberqrcode: false, placeholder: '' }, /** * 跳转到成长值的页面 */ - gotograde:function(){ + gotograde: function() { wx.navigateTo({ url: '/pages/czdetail/czdetail', }) @@ -57,16 +57,45 @@ Page({ */ let that = this; if (that.data.flag == 'hidden') { - that.setData({ + that.setData({ flag: 'show' }); } }, - gotoedit:function(){ + gotoedit: function() { wx.navigateTo({ url: '/pages/edit/edit', }) }, + onLoad() { + this.getLocation(); + }, + /** + * 获得经纬度 + */ + getLocation() { + let that = this; + wx.getLocation({ + type: "wgs84", + success: function(res) { + console.log(res) + if (res && res.longitude && res.latitude) { + Http.post({ + url: config.api.updateLBS, + data: { + latitude: res.latitude, + longitude: res.longitude + } + }).then(res => { + console.log(res) + }) + } + }, + fail: error => { + console.log(error); + } + }) + }, /** * 生命周期函数--监听页面显示 */ @@ -79,7 +108,7 @@ Page({ * couponNum * couponNum2 */ - let num = wx.getStorageSync('couponNum'); + let num = wx.getStorageSync('couponNum'); let num1 = wx.getStorageSync('couponNum2'); wx.hideTabBarRedDot({ index: 3 @@ -115,46 +144,48 @@ Page({ }; Http.get({ - url: config.api.getScore, - data: {} - }).then(res=>{ - if (res.data.address && res.data.name && res.data.sex && res.data.birthdate){ + url: config.api.getScore, + data: {} + }).then(res => { + if (res.data.address && res.data.name && res.data.sex && res.data.birthdate) { + that.setData({ + showEdit: true + }) + } that.setData({ - showEdit:true + score: res.data.score, + levelName: res.data.levelName, }) - } - that.setData({ - score: res.data.score, - levelName: res.data.levelName, + if (res.data.nickName) { + that.setData({ + ismember: true, + memberId: res.data.id + }) + var size = this.setCanvasSize(); + var initUrl = JSON.stringify({ + flagid: res.data.id + }); + that.createQrCode(initUrl, "mycanvas1", size.w, size.h); + } }) - if (res.data.nickName){ - that.setData({ - ismember:true, - memberId: res.data.id + .catch(err => { + wx.showModal({ + title: '提示', + content: err.errMsg, + showCancel: false }) - var size = this.setCanvasSize(); - var initUrl = JSON.stringify({flagid:res.data.id}); - that.createQrCode(initUrl, "mycanvas1", size.w, size.h); - } - }) - .catch(err => { - wx.showModal({ - title: '提示', - content: err.errMsg, - showCancel:false }) - }) //暂时注释 // that.getrun(); }, - hideQrcode:function(){ + hideQrcode: function() { let that = this; that.setData({ showQrcode: false }) }, //适配不同屏幕大小的canvas - setCanvasSize: function () { + setCanvasSize: function() { var size = {}; try { var res = wx.getSystemInfoSync(); @@ -171,26 +202,26 @@ Page({ } return size; }, - createQrCode: function (url, canvasId, cavW, cavH) { + createQrCode: function(url, canvasId, cavW, cavH) { //调用插件中的draw方法,绘制二维码图片 QR.api.draw(url, canvasId, cavW, cavH); }, - qrcode: function (e) { + qrcode: function(e) { var that = this; that.setData({ - showQrcode:true + showQrcode: true }) wx.showToast({ title: '生成中...', icon: 'loading', duration: 2000 }); - var st = setTimeout(function () { + var st = setTimeout(function() { wx.hideToast() var size = that.setCanvasSize(); var url = JSON.stringify({ - END:"C", - TYPE:"memberCode", + END: "C", + TYPE: "memberCode", ID: that.data.memberId, }) that.createQrCode(url, "mycanvas1", size.w, size.h); @@ -201,9 +232,9 @@ Page({ }, 1000) }, - close: function () { + close: function() { this.setData({ showmemberqrcode: false, }) } -}); \ No newline at end of file +}); \ No newline at end of file