第一次提交
This commit is contained in:
158
pages/activity/activity.js
Normal file
158
pages/activity/activity.js
Normal file
@@ -0,0 +1,158 @@
|
||||
//获取应用实例
|
||||
var app = getApp();
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
order_list:[],
|
||||
navHeight: '',
|
||||
menuButtonInfo: {},
|
||||
searchMarginTop: 0, // 搜索框上边距
|
||||
searchWidth: 0, // 搜索框宽度
|
||||
searchHeight: 0, // 搜索框高度
|
||||
style_id:'',
|
||||
search:''
|
||||
},
|
||||
/**
|
||||
* 监听搜索内容
|
||||
*/
|
||||
changeSearch: function(e) {
|
||||
let that = this;
|
||||
var inputSearch = e.detail.value;
|
||||
that.setData({
|
||||
search: inputSearch
|
||||
})
|
||||
app.console(inputSearch+"================="+'22dddddddddddddddddddddd2')
|
||||
this.getGoodsList();
|
||||
},
|
||||
back(){
|
||||
wx.navigateBack()
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
app.console('sssssss'+"================="+options.id),
|
||||
this.setData({
|
||||
style_id:options.id
|
||||
|
||||
});
|
||||
this.getGoodsList();
|
||||
this.setData({
|
||||
menuButtonInfo: wx.getMenuButtonBoundingClientRect()
|
||||
})
|
||||
console.log(this.data.menuButtonInfo)
|
||||
const { top, width, height, right } = this.data.menuButtonInfo
|
||||
wx.getSystemInfo({
|
||||
success: (res) => {
|
||||
const { statusBarHeight } = res
|
||||
const margin = top - statusBarHeight
|
||||
this.setData({
|
||||
navHeight: (height + statusBarHeight + (margin * 2) + 15),
|
||||
searchMarginTop: statusBarHeight + margin, // 状态栏 + 胶囊按钮边距
|
||||
searchHeight: height, // 与胶囊按钮同高
|
||||
searchWidth: right - width // 胶囊按钮右边坐标 - 胶囊按钮宽度 = 按钮左边可使用宽度
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
},
|
||||
// 跳转详情
|
||||
activity(e){
|
||||
|
||||
if (e.currentTarget.dataset.id != 0) {
|
||||
console.log("你选择的课程id是"+e.currentTarget.dataset.id);
|
||||
wx.navigateTo({
|
||||
url: "/shopping/pages/goddess/goddess?id=" + e.currentTarget.dataset.id,
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
//商品列表
|
||||
getGoodsList: function () {
|
||||
var that = this;
|
||||
wx.request({
|
||||
url: app.buildUrl("/app/Goddesswechat/getGoodsList"),
|
||||
header: app.getRequestHeader(),
|
||||
method:'POST',
|
||||
data: {
|
||||
version_number: this.data.version_number,
|
||||
uid:wx.getStorageSync('uid'),
|
||||
token:wx.getStorageSync('token'),
|
||||
page:'1',
|
||||
page_size:10,
|
||||
city:'',
|
||||
style_id:this.data.style_id,
|
||||
mechanism_id:'',
|
||||
serach_name:this.data.search,
|
||||
px_type:'',
|
||||
lng:'',
|
||||
lat:''
|
||||
},
|
||||
success: function (res) {
|
||||
var resp = res.data;
|
||||
console.log(resp+"=================dddddddddddddddddddddddddddddddddddddddddddd")
|
||||
console.log(resp.erro+"=================dddddddddddddddddddddddddddddddddddddddddddd")
|
||||
if(resp.erro==0){
|
||||
that.setData({
|
||||
order_list:resp.lists
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
})
|
||||
Reference in New Issue
Block a user