From 2694df4b25c6a729c2f5cb01fc51cc1894898933 Mon Sep 17 00:00:00 2001 From: Eddie <102564160@qq.com> Date: Mon, 19 Apr 2021 09:41:15 +0800 Subject: [PATCH] =?UTF-8?q?=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 | 37 ++++++++++++------------ pages/pageSearch/pageSearch.js | 12 ++++++-- pages/pageSerchDetail/pageSerchDetail.js | 23 ++++++++++----- project.config.json | 4 +-- utils/serve.js | 3 +- 5 files changed, 47 insertions(+), 32 deletions(-) diff --git a/pages/detailContent/detailContent.js b/pages/detailContent/detailContent.js index 7f43665..85d4386 100644 --- a/pages/detailContent/detailContent.js +++ b/pages/detailContent/detailContent.js @@ -21,7 +21,10 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - this.initOn() + + let obj = JSON.parse(options.obj) + + this.initOn(obj) }, skipSearch: function () { wx.navigateTo({ @@ -140,54 +143,49 @@ Page({ initOn: function (params) { - const eventChannel = this.getOpenerEventChannel() - eventChannel.on('acceptDataFromOpenerPage', (data, list, paginate, finData) => { + // const eventChannel = this.getOpenerEventChannel() + console.log(params ,'params') + // eventChannel.on('acceptDataFromOpenerPage', (data, list, paginate, finData) => { let isItem = 0; - for (let i = 0; i < list.length; i++) { - if (list[i].id === data.id) { + for (let i = 0; i < params.searchData.length; i++) { + if ( params.searchData[i].id === params.param.id) { isItem = i break } } - if (isItem <= 1) { utils.http({ url: '/manicureApi/Index/finishedProduct', method: 'GET', data: { - id: list[0].id, + id: params.searchData[0].id, type: 'left' } }).then(res => { - if (res.data.lists.length >= 1 && res.data.lists.length === 20) { this.data.leftStatus = true } else { this.data.leftStatus = false } - - - - this.setData({ - searchData: res.data.lists.concat(list), + searchData: res.data.lists.concat( params.searchData ), isItem: isItem + res.data.lists.length }, () => { - this.data.paginate = paginate - this.data.finData = finData + this.data.paginate = params.paginate + this.data.finData = params.finData }) }) } else { this.setData({ - searchData: list, + searchData: params.searchData, isItem: isItem }, () => { - this.data.paginate = paginate - this.data.finData = finData + this.data.paginate = params.paginate + this.data.finData = params.finData }) } - }) + // }) }, setSearchColor: function (ev) { @@ -199,6 +197,7 @@ Page({ skipInquire: function () { + console.log(this.data.searchData) utils.http({ url: '/manicureApi/Index/productDetail', method: 'GET', diff --git a/pages/pageSearch/pageSearch.js b/pages/pageSearch/pageSearch.js index 667e019..c44bf62 100644 --- a/pages/pageSearch/pageSearch.js +++ b/pages/pageSearch/pageSearch.js @@ -13,11 +13,19 @@ Page({ }, skipDetail: function (ev) { let param = ev.currentTarget.dataset.param + let obj = { + param: param, + searchData: this.data.searchData, + paginate: this.data.paginate, + finData: this.data.finData + } + + wx.redirectTo({ - url: '/pages/detailContent/detailContent', + url: '/pages/detailContent/detailContent?obj=' + JSON.stringify(obj), success: res=> { // 通过eventChannel向被打开页面传送数据 - res.eventChannel.emit('acceptDataFromOpenerPage', param , this.data.searchData , this.data.paginate , this.data.finData) + // res.eventChannel.emit('acceptDataFromOpenerPage', param , this.data.searchData , this.data.paginate , this.data.finData) } }) }, diff --git a/pages/pageSerchDetail/pageSerchDetail.js b/pages/pageSerchDetail/pageSerchDetail.js index 9ce4d61..0de37ef 100644 --- a/pages/pageSerchDetail/pageSerchDetail.js +++ b/pages/pageSerchDetail/pageSerchDetail.js @@ -12,7 +12,7 @@ Page({ searchData: [], paginate: null, }, - skipSearch: function(){ + skipSearch: function () { wx.navigateTo({ url: '/pages/pageSearch/pageSearch', }) @@ -38,7 +38,7 @@ Page({ }).then(res => { this.setData({ searchData: res.data.lists, - },()=>{ + }, () => { this.data.paginate = res.data.paginate this.data.finData = params }) @@ -49,12 +49,21 @@ Page({ skipDetail: function (ev) { let param = ev.currentTarget.dataset.param + let obj = { + param: param, + searchData: this.data.searchData, + paginate: this.data.paginate, + finData: this.data.finData + } + + wx.navigateTo({ - url: '/pages/detailContent/detailContent', - success: res=> { - // 通过eventChannel向被打开页面传送数据 - res.eventChannel.emit('acceptDataFromOpenerPage', param , this.data.searchData , this.data.paginate , this.data.finData) - } + url: '/pages/detailContent/detailContent?obj=' + JSON.stringify(obj), + // success: res => { + // // console.log(res, 123) + // // // 通过eventChannel向被打开页面传送数据 + // // res.eventChannel.emit('acceptDataFromOpenerPage', param, this.data.searchData, this.data.paginate, this.data.finData) + // } }) }, /** diff --git a/project.config.json b/project.config.json index 3971b43..ce99e72 100644 --- a/project.config.json +++ b/project.config.json @@ -23,7 +23,7 @@ "compileHotReLoad": false, "useMultiFrameRuntime": true, "useApiHook": true, - "useApiHostProcess": false, + "useApiHostProcess": true, "babelSetting": { "ignore": [], "disablePlugins": [], @@ -41,7 +41,7 @@ }, "compileType": "miniprogram", "libVersion": "2.15.0", - "appid": "wx518e1f26bfa0e1d3", + "appid": "wxf77625888d34a50a", "projectname": "manicureLet", "debugOptions": { "hidedInDevtools": [] diff --git a/utils/serve.js b/utils/serve.js index 7c007c6..d4c14ad 100644 --- a/utils/serve.js +++ b/utils/serve.js @@ -1,5 +1,5 @@ -const HTTPS = 'http://manicure.cn' +const HTTPS = 'https://mjcms.fnuo123.net' export const http = function (param) { let { url, data, method } = param @@ -20,7 +20,6 @@ export const http = function (param) { icon: 'none', }) } - }, fail: (res) => { }, complete: (res) => {