yuminge-app/yun-min-program-plugin-master/packageD/auction/auction-mine/auction_collect/auction_collect.js

179 lines
3.7 KiB
JavaScript

// packageD/auction/auction-mine/auction_collect/auction_collect.js
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
page: 1
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getdata();
},
tapGO(e) {
console.log(e);
let id = e.currentTarget.dataset.item.auctioneer_id;
wx.navigateTo({
url: "/packageD/auction/auctioneer-shop/auctioneer_shop/auctioneer_shop?id="+id,
});
},
//收藏
toCollect(e) {
// console.log(e.currentTarget.dataset.id)
let id = e.currentTarget.dataset.id;
let json = {
art: 'collectionShop',
auctioneer_id: id
};
var that = this;
let urlStr = app.getNetAddresss('plugin.auction.api.index.getAuctionData');
app._getNetWork({
url: urlStr,
data: json,
success: function (resdata) {
var res = resdata.data;
if (res.result == 1) {
that.getdata();
} else {
wx.showToast({
title: res.msg,
icon: "none",
duration: 1000
});
}
},
fail: function (res) {
console.log(res);
}
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
if (this.data.current_page >= this.data.last_page) {
wx.showToast({
title: '暂无更多',
duration: 1000,
icon: 'none'
});
} else {
let pages = this.data.page + 1;
this.setData({
page: pages
});
this.getNextdata();
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
getdata() {
let that = this;
let json = {
art: 'collectionList',
page: that.data.page
};
let urlStr = app.getNetAddresss('plugin.auction.api.index.getAuctionData');
app._postNetWork({
url: urlStr,
data: json,
success: function (resdata) {
var res = resdata.data;
if (res.result == 1) {
console.log(res);
that.setData({
datas: res.data.collectionList.data,
current_page: res.data.collectionList.current_page,
last_page: res.data.collectionList.last_page
});
} else {
wx.showToast({
title: res.msg,
icon: "none",
duration: 1000
});
}
},
fail: function (res) {
console.log(res);
}
});
},
getNextdata() {
let that = this;
let json = {
art: 'collectionList',
page: that.data.page
};
let urlStr = app.getNetAddresss('plugin.auction.api.index.getAuctionData');
app._postNetWork({
url: urlStr,
data: json,
success: function (resdata) {
var res = resdata.data;
if (res.result == 1) {
console.log(res);
that.setData({
datas: that.data.datas.concat(res.data.collectionList.data),
current_page: res.data.collectionList.current_page,
last_page: res.data.collectionList.last_page
});
} else {
wx.showToast({
title: res.msg,
icon: "none",
duration: 1000
});
}
},
fail: function (res) {
console.log(res);
}
});
}
});