@@ -21,7 +21,10 @@ Page({ | |||||
* 生命周期函数--监听页面加载 | * 生命周期函数--监听页面加载 | ||||
*/ | */ | ||||
onLoad: function (options) { | onLoad: function (options) { | ||||
this.initOn() | |||||
let obj = JSON.parse(options.obj) | |||||
this.initOn(obj) | |||||
}, | }, | ||||
skipSearch: function () { | skipSearch: function () { | ||||
wx.navigateTo({ | wx.navigateTo({ | ||||
@@ -140,54 +143,49 @@ Page({ | |||||
initOn: function (params) { | 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; | 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 | isItem = i | ||||
break | break | ||||
} | } | ||||
} | } | ||||
if (isItem <= 1) { | if (isItem <= 1) { | ||||
utils.http({ | utils.http({ | ||||
url: '/manicureApi/Index/finishedProduct', | url: '/manicureApi/Index/finishedProduct', | ||||
method: 'GET', | method: 'GET', | ||||
data: { | data: { | ||||
id: list[0].id, | |||||
id: params.searchData[0].id, | |||||
type: 'left' | type: 'left' | ||||
} | } | ||||
}).then(res => { | }).then(res => { | ||||
if (res.data.lists.length >= 1 && res.data.lists.length === 20) { | if (res.data.lists.length >= 1 && res.data.lists.length === 20) { | ||||
this.data.leftStatus = true | this.data.leftStatus = true | ||||
} else { | } else { | ||||
this.data.leftStatus = false | this.data.leftStatus = false | ||||
} | } | ||||
this.setData({ | this.setData({ | ||||
searchData: res.data.lists.concat(list), | |||||
searchData: res.data.lists.concat( params.searchData ), | |||||
isItem: isItem + res.data.lists.length | 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 { | } else { | ||||
this.setData({ | this.setData({ | ||||
searchData: list, | |||||
searchData: params.searchData, | |||||
isItem: isItem | isItem: isItem | ||||
}, () => { | }, () => { | ||||
this.data.paginate = paginate | |||||
this.data.finData = finData | |||||
this.data.paginate = params.paginate | |||||
this.data.finData = params.finData | |||||
}) | }) | ||||
} | } | ||||
}) | |||||
// }) | |||||
}, | }, | ||||
setSearchColor: function (ev) { | setSearchColor: function (ev) { | ||||
@@ -199,6 +197,7 @@ Page({ | |||||
skipInquire: function () { | skipInquire: function () { | ||||
console.log(this.data.searchData) | |||||
utils.http({ | utils.http({ | ||||
url: '/manicureApi/Index/productDetail', | url: '/manicureApi/Index/productDetail', | ||||
method: 'GET', | method: 'GET', | ||||
@@ -13,11 +13,19 @@ Page({ | |||||
}, | }, | ||||
skipDetail: function (ev) { | skipDetail: function (ev) { | ||||
let param = ev.currentTarget.dataset.param | let param = ev.currentTarget.dataset.param | ||||
let obj = { | |||||
param: param, | |||||
searchData: this.data.searchData, | |||||
paginate: this.data.paginate, | |||||
finData: this.data.finData | |||||
} | |||||
wx.redirectTo({ | wx.redirectTo({ | ||||
url: '/pages/detailContent/detailContent', | |||||
url: '/pages/detailContent/detailContent?obj=' + JSON.stringify(obj), | |||||
success: res=> { | success: res=> { | ||||
// 通过eventChannel向被打开页面传送数据 | // 通过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) | |||||
} | } | ||||
}) | }) | ||||
}, | }, | ||||
@@ -12,7 +12,7 @@ Page({ | |||||
searchData: [], | searchData: [], | ||||
paginate: null, | paginate: null, | ||||
}, | }, | ||||
skipSearch: function(){ | |||||
skipSearch: function () { | |||||
wx.navigateTo({ | wx.navigateTo({ | ||||
url: '/pages/pageSearch/pageSearch', | url: '/pages/pageSearch/pageSearch', | ||||
}) | }) | ||||
@@ -38,7 +38,7 @@ Page({ | |||||
}).then(res => { | }).then(res => { | ||||
this.setData({ | this.setData({ | ||||
searchData: res.data.lists, | searchData: res.data.lists, | ||||
},()=>{ | |||||
}, () => { | |||||
this.data.paginate = res.data.paginate | this.data.paginate = res.data.paginate | ||||
this.data.finData = params | this.data.finData = params | ||||
}) | }) | ||||
@@ -49,12 +49,21 @@ Page({ | |||||
skipDetail: function (ev) { | skipDetail: function (ev) { | ||||
let param = ev.currentTarget.dataset.param | let param = ev.currentTarget.dataset.param | ||||
let obj = { | |||||
param: param, | |||||
searchData: this.data.searchData, | |||||
paginate: this.data.paginate, | |||||
finData: this.data.finData | |||||
} | |||||
wx.navigateTo({ | 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) | |||||
// } | |||||
}) | }) | ||||
}, | }, | ||||
/** | /** | ||||
@@ -23,7 +23,7 @@ | |||||
"compileHotReLoad": false, | "compileHotReLoad": false, | ||||
"useMultiFrameRuntime": true, | "useMultiFrameRuntime": true, | ||||
"useApiHook": true, | "useApiHook": true, | ||||
"useApiHostProcess": false, | |||||
"useApiHostProcess": true, | |||||
"babelSetting": { | "babelSetting": { | ||||
"ignore": [], | "ignore": [], | ||||
"disablePlugins": [], | "disablePlugins": [], | ||||
@@ -41,7 +41,7 @@ | |||||
}, | }, | ||||
"compileType": "miniprogram", | "compileType": "miniprogram", | ||||
"libVersion": "2.15.0", | "libVersion": "2.15.0", | ||||
"appid": "wx518e1f26bfa0e1d3", | |||||
"appid": "wxf77625888d34a50a", | |||||
"projectname": "manicureLet", | "projectname": "manicureLet", | ||||
"debugOptions": { | "debugOptions": { | ||||
"hidedInDevtools": [] | "hidedInDevtools": [] | ||||
@@ -1,5 +1,5 @@ | |||||
const HTTPS = 'http://manicure.cn' | |||||
const HTTPS = 'https://mjcms.fnuo123.net' | |||||
export const http = function (param) { | export const http = function (param) { | ||||
let { url, data, method } = param | let { url, data, method } = param | ||||
@@ -20,7 +20,6 @@ export const http = function (param) { | |||||
icon: 'none', | icon: 'none', | ||||
}) | }) | ||||
} | } | ||||
}, | }, | ||||
fail: (res) => { }, | fail: (res) => { }, | ||||
complete: (res) => { | complete: (res) => { | ||||