207 lines
4.7 KiB
JavaScript
207 lines
4.7 KiB
JavaScript
// pages/mechanism/mechanism.js
|
|
//获取应用实例
|
|
const app = getApp()
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
navHeight: '',
|
|
menuButtonInfo: {},
|
|
searchMarginTop: 0, // 搜索框上边距
|
|
searchWidth: 0, // 搜索框宽度
|
|
searchHeight: 0, // 搜索框高度
|
|
page:1,
|
|
search: ''
|
|
},
|
|
/**
|
|
* 监听搜索内容
|
|
*/
|
|
changeSearch: function(e) {
|
|
let that = this;
|
|
var inputSearch = e.detail.value;
|
|
that.setData({
|
|
search: inputSearch
|
|
})
|
|
app.console(inputSearch+"================="+'22dddddddddddddddddddddd2')
|
|
// this.dataRefresh()
|
|
this.getMechanismList();
|
|
},
|
|
back(){
|
|
wx.navigateBack()
|
|
},
|
|
//机构详情跳转
|
|
mechanism(e){
|
|
app.console("================="+'dddddddddddddddd')
|
|
wx.navigateTo({
|
|
url: "/pages/institutions/institutions?id=" + e.currentTarget.dataset.id,
|
|
})
|
|
},
|
|
Seemore(){
|
|
console.log('点击了查看更多');
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
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) ),
|
|
searchMarginTop: statusBarHeight + margin, // 状态栏 + 胶囊按钮边距
|
|
searchHeight: height, // 与胶囊按钮同高
|
|
searchWidth: right - width // 胶囊按钮右边坐标 - 胶囊按钮宽度 = 按钮左边可使用宽度
|
|
})
|
|
},
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
this.getMechanismList();
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
},
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
//this.getOrderList();
|
|
var that = this;
|
|
wx.request({
|
|
url: app.buildUrl("/app/Goddesswechat/getOrderList"),
|
|
header: app.getRequestHeader(),
|
|
method:'POST',
|
|
data: {
|
|
version_number: app.globalData.version_number,
|
|
uid:wx.getStorageSync('uid'),
|
|
token:wx.getStorageSync('token'),
|
|
page:1,
|
|
page_size:10,
|
|
style: that.data.status[ that.data.currentType ]
|
|
|
|
},
|
|
success: (res)=> {
|
|
var resp = res.data;
|
|
|
|
if(resp.erro==0){
|
|
that.setData({
|
|
page:1,
|
|
order_list:resp.order,
|
|
});
|
|
wx.stopPullDownRefresh({
|
|
success: (res) => {},
|
|
})
|
|
}
|
|
}
|
|
});
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
this.getMechanismList();
|
|
},
|
|
|
|
//机构列表
|
|
getMechanismList: function () {
|
|
var that = this;
|
|
wx.request({
|
|
url: app.buildUrl("/app/Goddesswechat/getMechanismList"),
|
|
header: app.getRequestHeader(),
|
|
method:'POST',
|
|
data: {
|
|
version_number: app.globalData.version_number,
|
|
uid:wx.getStorageSync('uid'),
|
|
token:wx.getStorageSync('token'),
|
|
page:'1',
|
|
page_size:500,
|
|
city:'',
|
|
style_id:'',
|
|
serach_name:this.data.search,
|
|
px_type:'',
|
|
lng:'',
|
|
lat:'',
|
|
},
|
|
success: function (res) {
|
|
var resp = res.data;
|
|
if(resp.erro==0){
|
|
that.setData({
|
|
lists:resp.lists
|
|
|
|
});
|
|
|
|
|
|
|
|
// if(that.data.page==1){
|
|
// that.setData({
|
|
// lists:resp.lists,
|
|
// page:that.data.page+1
|
|
// });
|
|
|
|
// }else{
|
|
// that.setData({
|
|
// lists:that.data.lists.concat(resp.lists),
|
|
// page:that.data.page+1
|
|
// });
|
|
// }
|
|
}
|
|
}
|
|
});
|
|
},
|
|
|
|
}) |