@@ -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', | |||
@@ -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) | |||
} | |||
}) | |||
}, | |||
@@ -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) | |||
// } | |||
}) | |||
}, | |||
/** | |||
@@ -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": [] | |||
@@ -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) => { | |||