Commit 7aafba9f by YangChengYuan

修改了页面的数据

parent d1e19931
......@@ -75,11 +75,11 @@ Page({
},
// 美行攻略
gotoGuides: function(event) {
wx.navigateTo({
url: '/pages/guide/index',
})
},
// gotoGuides: function(event) {
// wx.navigateTo({
// url: '/pages/guide/index',
// })
// },
// 商家合作
gotoShopJoin: function(event) {
......
......@@ -33,7 +33,7 @@
</i-grid-icon>
<i-grid-label i-class="nav-label">线下活动</i-grid-label>
</i-grid-item>
<i-grid-item i-class="nav-grid-item" catchtap='gotoGuides'>
<i-grid-item i-class="nav-grid-item" catchtap='catalogClick' data-name='转让专区'>
<i-grid-icon i-class="nav-icon">
<image src="/images/navs/icon_nav_6.png" />
</i-grid-icon>
......
// pages/makeOver/index.js
import api from '../../../utils/Api.js'
import Wx from '../../../utils/Wx.js'
import Schedule from '../../../utils/Schedule.js'
const {
$Toast
} = require('../../../iview/base/index');
Page({
/**
* 页面的初始数据
*/
data: {
projects: [],
currentPage: 1,
is_transfer: '1',
loading: true,
hasMore: true,
title: '',
tags: [],
catalog: '0'
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let _title = options.title
let _tags = options.tags
let _catalog = options.catalog
if (_tags != null && _tags.length > 0) {
this.setData({
tags: JSON.parse(_tags)
})
}
if (_title != null && _title.length > 0) {
this.setData({
title: _title
})
}
if (_catalog != null && _catalog.length > 0) {
this.setData({
catalog: _catalog
})
}
// 页面title
let _ptitle = options.ptitle
if (_ptitle != null && _ptitle.length > 0) {
wx.setNavigationBarTitle({
title: _ptitle
})
}
this.catalogClick()
},
/**
* 加载
*/
catalogClick: function (callback) {
const p = this.data.currentPage
let params = {
p: p
}
if (this.data.tags.length > 0) {
params['tags'] = JSON.stringify(this.data.tags)
}
if (parseInt(this.data.catalog) > 0) {
params['catalog_id'] = this.data.catalog
}
if (this.data.title.length > 0) {
params['title'] = this.data.title
}
if (parseInt(this.data.is_transfer) > 0) {
params['is_transfer'] = this.data.is_transfer
}
// 请求数据接口
api.search.index(params).then(res => {
if (res.code) {
this.setData({
hasMore: false,
loading: false,
currentPage: 2
})
} else {
let _projects = this.data.projects
this.setData({
projects: _projects.concat(res.data),
loading: false,
hasMore: res.data && res.data.length > 0 ? true : false,
currentPage: res.data && res.data.length > 0 ? p : (p - 1)
})
typeof callback == "function" && callback()
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
this.setData({
projects: [],
loading: true,
hasMore: true,
currentPage: 1
})
wx.showNavigationBarLoading()
wx.showLoading({
title: '加载中...',
})
new Schedule().task(this.getListData).delay(1600).task(() => {
wx.hideNavigationBarLoading()
wx.stopPullDownRefresh()
wx.hideLoading()
})
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
let that = this
if (that.data.loading || !that.data.hasMore) {
return;
} else {
let page = that.data.currentPage + 1
new Schedule().task(() => {
that.setData({
loading: true,
currentPage: page
})
}).delay(1000).task(that.getListData)
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"navigationBarTitleText": "转让专区",
"enablePullDownRefresh": true,
"usingComponents": {
"project-item": "/components/project-item/index",
"more": "/components/more/index",
"i-toast": "/iview/toast/index"
}
}
\ No newline at end of file
<!--pages/makeOver/index.wxml-->
<view class="page-wrapper">
<view class="projects-wrapper">
<project-item wx:for="{{projects}}" wx:for-index="idx" wx:for-item="item" wx:key="item.id" project-item="{{item}}" />
</view>
<i-toast id="toast" />
</view>
<more hasMore="{{hasMore}}" loading="{{loading}}" page="{{currentPage}}" />
/* pages/makeOver/index.wxss */
.page-wrapper{
background: white;
}
\ No newline at end of file
......@@ -15,7 +15,7 @@ Page({
currentPage: 1,
loading: true,
hasMore: true,
is_transfer:0,
title: '',
tags: [],
catalog: '0',
......@@ -47,6 +47,11 @@ Page({
this.setData({
catalog: _catalog
})
if (_catalog === "undefined") {
this.setData({
is_transfer: 1
});
}
}
// 页面title
let _ptitle = options.ptitle
......@@ -63,8 +68,10 @@ Page({
*/
getListData: function(callback) {
const p = this.data.currentPage
const is_transfer = this.data.is_transfer
let params = {
p: p
p: p,
is_transfer: is_transfer
}
if (this.data.tags.length > 0) {
params['tags'] = JSON.stringify(this.data.tags)
......@@ -187,7 +194,7 @@ Page({
/**
* 用户进行了筛选操作
*/
filterChange: function (event) {
filterChange: function(event) {
let _filters = event.detail.filters
this.setData({
filters: _filters
......
......@@ -15,7 +15,7 @@
"compileType": "miniprogram",
"libVersion": "2.3.2",
"appid": "wx1b834552a7d49bb3",
"projectname": "%E7%BE%8E%E8%A1%8C%E8%80%85%E4%BA%B2%E5%AD%90%E6%B8%B8(git)",
"projectname": "%E7%BE%8E%E8%A1%8C%E8%80%85%E4%BA%B2%E5%AD%90%E6%B8%B8(git13)",
"debugOptions": {
"hidedInDevtools": []
},
......@@ -38,7 +38,7 @@
"list": []
},
"miniprogram": {
"current": 14,
"current": 15,
"list": [
{
"id": 0,
......@@ -130,6 +130,11 @@
"name": "预约下次",
"pathName": "pages/detail/appoint/index",
"query": "id=173"
},
{
"id": -1,
"name": "转让专区",
"pathName": "pages/search/list/list"
}
]
}
......
......@@ -5,7 +5,7 @@
// }
export const Config = {
apiPath: "https://meixzz.usa1.utools.club/api/",
apiPath: "https://meixzz.utools.club/api/",
mobPath: "https://mavaler.jqhulian.com/mob/",
shopJoinPath: "https://mavaler.jqhulian.com/mob/Index/shopjoin"
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment