|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- // pages/pageSerchDetail/pageSerchDetail.js
-
- const utils = require('../../utils/serve')
-
-
- Page({
-
- /**
- * 页面的初始数据
- */
- data: {
- searchData: [],
- paginate: null,
- p: 1,
- total: 0,
- },
- skipSearch: function () {
- wx.navigateTo({
- url: '/pages/pageSearch/pageSearch',
- })
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.data.finData = (JSON.parse(options.param))
- this.init()
- wx.setNavigationBarTitle({
- title: JSON.parse(options.param).name
- })
- },
-
- init: function () {
-
- utils.http({
- url: '/manicureApi/Index/finishedProduct',
- method: 'GET',
- data: {
- color_id: this.data.finData.id,
- p: this.data.p,
- limit: 40,
- }
- }).then(res => {
-
- 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
- })
- }
-
- })
- },
-
-
- 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?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)
- // }
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
-
- },
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
-
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- if (this.data.searchData.length < this.data.total ) {
- this.data.p ++
- this.init()
- } else {
- wx.showToast({
- title: '已经到底了~',
- duration: 2000,
- icon: 'none',
- })
- }
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
-
- }
- })
|