|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- //index.js
- //获取应用实例
- const app = getApp()
- Page({
- data: {
- imgUrl: app.globalData.urlStatic,//图片路径
- phoneInputShow:false,//是否显示电话输入框
- siteSelect: false,//是否显示位置选择框
- provinceArr:['广东','上海','河南','河北'],//省
- provinceValue: 0,//选中的省下标
- storeArr:['百联超市','全家','喜士多'],//店铺
- storeValue:0,//选中的店铺下标
- swiperCurrent:1,//swiper选中的元素下标
- },
- onLoad: function () {
- this.getUserLocation();//获取用户当前位置
- },
- provinceChane: function (e) {//选中省
- this.setData({
- provinceValue: e.detail.value,
- })
- },
- storeChane: function (e) {//选中店铺
- this.setData({
- storeValue: e.detail.value,
- })
- },
- getUserPhone:function(e){//获取用户手机号
- console.log(e);
- this.setData({
- phoneInputShow: true,
- })
- if (e.detail.errMsg=='getPhoneNumber:ok'){
- console.log('获取到了手机号');
- }
- },
- getUserLocation:function(e){
- wx.getLocation({
- type: 'gcj02', //wgs84
- success(res) {
- if (res) {
- console.log(res);
- // this.setData({
- // siteSelect: true,
- // })
- }
- }
- })
- },
- prevImg(){//上一张图片
- if (this.data.swiperCurrent>0) {
- this.setData({
- swiperCurrent: this.data.swiperCurrent-=1,
- })
- }
- },
- nextImg() {//下一张图片
- if (this.data.swiperCurrent < 3) {
- this.setData({
- swiperCurrent: this.data.swiperCurrent+=1,
- })
- }
- },
- swiperChange(e){//通过鼠标滑动改变swiper时
- if (e.detail.source == "touch"){
- this.setData({
- swiperCurrent: e.detail.current,
- })
- }
- }
- })
|