Browse Source

修改弹框

feature/v1.1.0
shuiqing 7 years ago
parent
commit
d4582c1bed
5 changed files with 99 additions and 86 deletions
  1. 2
      pages/at_present/at_present.js
  2. 8
      pages/city/city.js
  3. 28
      pages/district/district.js
  4. 82
      pages/index/index.js
  5. 65
      pages/loding/loding.js

2
pages/at_present/at_present.js

@ -125,7 +125,7 @@ Page({
// } // }
// }); // });
wx.switchTab({ wx.switchTab({
// url: '../index/index'
url: '../index/index'
}) })
}, },
}) })

8
pages/city/city.js

@ -3,9 +3,9 @@
const app = getApp() const app = getApp()
Page({ Page({
onLoad: function (options) { onLoad: function (options) {
// this.setData({
// title: options.title
// });
this.setData({
title: options.title
});
var that = this var that = this
wx.request({ wx.request({
url: app.gw.hostUrl + '/mall/wxa/index/opencitylist', url: app.gw.hostUrl + '/mall/wxa/index/opencitylist',
@ -28,7 +28,7 @@ Page({
}) })
}, },
openGroup: function (e) { openGroup: function (e) {
// console.log(e.currentTarget.dataset.item)
console.log(e.currentTarget.dataset.item)
wx.setStorage({ wx.setStorage({
key: 'cityId', key: 'cityId',
data: e.currentTarget.dataset.item, data: e.currentTarget.dataset.item,

28
pages/district/district.js

@ -2,17 +2,31 @@
const app = getApp() const app = getApp()
var cityId var cityId
Page({ Page({
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
let that = this;
wx.getStorage({
key: 'merchantNo',
success: function (res) {
that.setData({
merchantNo: res.data
})
console.log(222);
}
});
wx.getStorage({
key: 'districtName',
success: function (res) {
that.setData({
districtName: res.data
})
}
});
cityId = options.cityId; cityId = options.cityId;
// console.log(cityId);
// let str = e.currentTarget.dataset.item;
let that = this;
console.log(cityId); console.log(cityId);
wx.request({ wx.request({
url: app.gw.hostUrl + '/mall/wxa/index/opendistictlist', url: app.gw.hostUrl + '/mall/wxa/index/opendistictlist',
@ -24,7 +38,6 @@ Page({
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/x-www-form-urlencoded'
}, },
success: function (res) { success: function (res) {
var districts = res.data; var districts = res.data;
console.log(districts) console.log(districts)
that.setData({ that.setData({
@ -63,6 +76,5 @@ Page({
url: '../index/index' url: '../index/index'
}) })
}, },
onShow: function () { }
}) })

82
pages/index/index.js

@ -11,10 +11,10 @@ Page({
interval: 5000, interval: 5000,
duration: 1000, duration: 1000,
imgUrls: [], imgUrls: [],
merchantNo:'',
merchantNo: '',
// bannerImage: '/images/activity_banner.png', // bannerImage: '/images/activity_banner.png',
menu_list:[
{ name: '拼团', disabled:false, className:'green_button'},
menu_list: [
{ name: '拼团', disabled: false, className: 'green_button' },
{ name: '秒杀', disabled: true, className: 'gray_button' }, { name: '秒杀', disabled: true, className: 'gray_button' },
{ name: '夺宝', disabled: true, className: 'gray_button' }, { name: '夺宝', disabled: true, className: 'gray_button' },
{ name: '砍价', disabled: true, className: 'gray_button' } { name: '砍价', disabled: true, className: 'gray_button' }
@ -29,7 +29,7 @@ Page({
// typeNum: 10, // typeNum: 10,
// addrArray: { id: [440100000, 430426000], name: ['长沙', '深圳', '上海', '长沙', '武汉', '杭州', '北京'] }, // addrArray: { id: [440100000, 430426000], name: ['长沙', '深圳', '上海', '长沙', '武汉', '杭州', '北京'] },
addrIndex: 0, addrIndex: 0,
districtName:'',
districtName: '',
}, },
/** /**
* 城市选择 * 城市选择
@ -46,33 +46,33 @@ Page({
*/ */
onLoad: function (options) { onLoad: function (options) {
let that = this; let that = this;
// //获取本地数据
// // 获取地址
// wx.getStorage({
// key: 'districtName',
// success: function (res) {
// console.log(111111111111111111)
// console.log(res.data)
// that.setData({
// districtName: res.data
// })
// console.log(222222222222222222)
//获取本地数据
// 获取地址
wx.getStorage({
key: 'districtName',
success: function (res) {
console.log(111111111111111111)
console.log(res.data)
that.setData({
districtName: res.data
})
console.log(222222222222222222)
// // that.setData({ userName: res.data });
// }
// });
// // 商家编号
// wx.getStorage({
// key: 'merchantNo',
// success: function (res) {
// console.log(6666666666666666666666)
// console.log(res.data)
// that.setData({
// merchantNo: res.data
// })
// console.log(888888888888888888888888)
// }
// });
// that.setData({ userName: res.data });
}
});
// 商家编号
wx.getStorage({
key: 'merchantNo',
success: function (res) {
console.log(6666666666666666666666)
console.log(res.data)
that.setData({
merchantNo: res.data
})
console.log(888888888888888888888888)
}
});
wx.request({ wx.request({
url: app.gw.hostUrl + '/mall/wxa/activity/banner', url: app.gw.hostUrl + '/mall/wxa/activity/banner',
method: 'get', method: 'get',
@ -82,7 +82,7 @@ Page({
header: { header: {
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/x-www-form-urlencoded'
}, },
success: function (res){
success: function (res) {
var data = res.data; var data = res.data;
var status = data.code; var status = data.code;
if (status == 0) { if (status == 0) {
@ -107,16 +107,16 @@ Page({
}); });
}, },
}), }),
this.getActivityList();
this.getActivityList();
}, },
getActivityList: function(){
getActivityList: function () {
let that = this; let that = this;
wx.showNavigationBarLoading() //在标题栏中显示加载 wx.showNavigationBarLoading() //在标题栏中显示加载
wx.request({ wx.request({
url: app.gw.hostUrl + '/mall/wxa/activity/list', url: app.gw.hostUrl + '/mall/wxa/activity/list',
method: 'get', method: 'get',
data: {
data: {
merchantNo: that.merchantNo, merchantNo: that.merchantNo,
// selectedCityId: that.data.addrArray.id[that.data.addrIndex] == undefined ? 0 : that.data.addrArray.id[that.data.addrIndex], // selectedCityId: that.data.addrArray.id[that.data.addrIndex] == undefined ? 0 : that.data.addrArray.id[that.data.addrIndex],
pageNum: that.data.pageNum, pageNum: that.data.pageNum,
@ -158,7 +158,7 @@ Page({
return; return;
} }
}, },
fail:function(res) {
fail: function (res) {
wx.showToast({ wx.showToast({
title: '加载数据失败', title: '加载数据失败',
}); });
@ -174,7 +174,7 @@ Page({
/** /**
* 点击去开团 * 点击去开团
*/ */
openGroup:function(e){
openGroup: function (e) {
console.log('activityNo:' + e.currentTarget.dataset.item); console.log('activityNo:' + e.currentTarget.dataset.item);
wx.navigateTo({ wx.navigateTo({
url: '../activity_detail/activity_detail?activityNo=' + e.currentTarget.dataset.item, url: '../activity_detail/activity_detail?activityNo=' + e.currentTarget.dataset.item,
@ -184,7 +184,7 @@ Page({
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady: function () { onReady: function () {
}, },
/** /**
@ -218,14 +218,14 @@ Page({
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide: function () { onHide: function () {
}, },
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload: function () { onUnload: function () {
}, },
/** /**
@ -253,7 +253,7 @@ Page({
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage: function () { onShareAppMessage: function () {
}, },
getUserInfo: function (e) { getUserInfo: function (e) {
console.log(e) console.log(e)

65
pages/loding/loding.js

@ -13,42 +13,18 @@ Page({
resData: [] resData: []
}, },
onLoad: function (options) {   // 实例化腾讯地图API核心类 onLoad: function (options) {   // 实例化腾讯地图API核心类
let that = this; 
let that = this;
qqmapsdk = new QQMapWX({ qqmapsdk = new QQMapWX({
// 二号家政
key: 'C5KBZ-RISKD-INW4P-PWYQJ-QC6C7-BQBGC' key: 'C5KBZ-RISKD-INW4P-PWYQJ-QC6C7-BQBGC'
//微信正式用 key:'JN7BZ-MJBK5-52SIH-QOKGH-FJE5F-IWFGG'
}); });
wx.getStorage({
wx.getStorage({
key: 'merchantNo', key: 'merchantNo',
success: function (res) { success: function (res) {
console.log(res.data) console.log(res.data)
if (res.data == '') { if (res.data == '') {
// 页面渲染完成
var tt = this;
setTimeout(function () {
tt.setData({
hiddenLoading: true
});
tt.update();
}, 2000);
wx.getSetting({
success: function (res) {
if (res.authSetting['scope.userInfo']) {
//授权了
wx.navigateTo({
url: '../at_present/at_present',
})
} else {
//未授权
wx.navigateTo({
url: '../city/city/',
})
}
}
});
} else { } else {
console.log(6666);
wx.switchTab({ wx.switchTab({
url: '../index/index' url: '../index/index'
}) })
@ -56,11 +32,36 @@ Page({
that.setData({ that.setData({
merchantNo: res.data merchantNo: res.data
}) })
console.log(222);
// that.setData({ userName: res.data });
} }
}); });
}, },
onReady: function () { onReady: function () {
},
})
// 页面渲染完成
var tt = this;
setTimeout(function () {
tt.setData({
hiddenLoading: true
});
tt.update();
}, 2000);
wx.getSetting({
success: function (res) {
if (res.authSetting['scope.userInfo']) {
//授权了
wx.navigateTo({
url: '../at_present/at_present',
})
} else {
//未授权
wx.switchTab({
url: '../city/city/',
})
}
}
});
}
})
// });
Loading…
Cancel
Save