From 59e2e04b5cc178e1f01922d2e651202912e679d9 Mon Sep 17 00:00:00 2001 From: Eddie <102564160@qq.com> Date: Mon, 26 Apr 2021 10:46:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E6=8C=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/detailContent/detailContent.js | 12 +++++-- pages/detailContent/detailContent.wxml | 2 +- pages/pageSerchDetail/pageSerchDetail.js | 45 ++++++++++++++++++------ 3 files changed, 46 insertions(+), 13 deletions(-) diff --git a/pages/detailContent/detailContent.js b/pages/detailContent/detailContent.js index 85d4386..b1edebc 100644 --- a/pages/detailContent/detailContent.js +++ b/pages/detailContent/detailContent.js @@ -33,6 +33,15 @@ Page({ }, + getImg( ev){ + + wx.previewImage({ + current: '', + urls: [ev.currentTarget.dataset.img] + }) + }, + + // 右滑翻页 onbolwerRight: function () { console.log(this.data.searchData[this.data.searchData.length - 1]) @@ -143,8 +152,7 @@ Page({ initOn: function (params) { - // const eventChannel = this.getOpenerEventChannel() - console.log(params ,'params') + // eventChannel.on('acceptDataFromOpenerPage', (data, list, paginate, finData) => { let isItem = 0; diff --git a/pages/detailContent/detailContent.wxml b/pages/detailContent/detailContent.wxml index 89468f7..d7676c6 100644 --- a/pages/detailContent/detailContent.wxml +++ b/pages/detailContent/detailContent.wxml @@ -14,7 +14,7 @@ - + 色号:{{item.name}} diff --git a/pages/pageSerchDetail/pageSerchDetail.js b/pages/pageSerchDetail/pageSerchDetail.js index 0de37ef..5d1a981 100644 --- a/pages/pageSerchDetail/pageSerchDetail.js +++ b/pages/pageSerchDetail/pageSerchDetail.js @@ -11,6 +11,8 @@ Page({ data: { searchData: [], paginate: null, + p: 1, + total: 0, }, skipSearch: function () { wx.navigateTo({ @@ -22,26 +24,40 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - this.init(JSON.parse(options.param)) + this.data.finData = (JSON.parse(options.param)) + this.init() wx.setNavigationBarTitle({ title: JSON.parse(options.param).name }) }, - init: function (params) { + init: function () { + utils.http({ url: '/manicureApi/Index/finishedProduct', method: 'GET', data: { - color_id: params.id, + color_id: this.data.finData.id, + p: this.data.p, + limit: 40, } }).then(res => { - this.setData({ - searchData: res.data.lists, - }, () => { - this.data.paginate = res.data.paginate - this.data.finData = params - }) + + if (this.data.p >= 2) { + this.setData({ + searchData: this.data.searchData.concat(res.data.lists), + }, () => { + this.data.paginate = res.data.paginate + }) + } else { + this.setData({ + searchData: res.data.lists, + total: res.data.paginate.total + }, () => { + this.data.paginate = res.data.paginate + }) + } + }) }, @@ -105,7 +121,16 @@ Page({ * 页面上拉触底事件的处理函数 */ onReachBottom: function () { - + if (this.data.searchData.length < this.data.total ) { + this.data.p ++ + this.init() + } else { + wx.showToast({ + title: '已经到底了~', + duration: 2000, + icon: 'none', + }) + } }, /**