yuminge-app/yun-min-program-plugin-master/packageC/Myshaky/lecturerDetail/lecturerDetail.js

259 lines
6.1 KiB
JavaScript

// packageC/Myshaky/lecturerDetail/lecturerDetail.js
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
detail: [
{
id: 0,
tit: '活动项目'
},
{
id: 1,
tit: '课程商品'
}
],
pageTwo: 1,
page: 1,
curr: "1",
member_id: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options.id);
this.setData({
member_id: options.id,
kid: options.eid
});
this.getList();
this.getShop();
},
tapStatus(e) {
console.log(e.target.id);
this.setData({
curr: e.target.id
});
},
goDingdan(e) {
console.log(e.currentTarget.id);
wx.navigateTo({
url: '/pages/detail_v2/detail_v2?id='+ e.currentTarget.id
});
},
goxq(e){
console.log(e.currentTarget.id);
wx.navigateTo({
url: '/packageC/Myshaky/enrollEnter/enrollEnter?id='+ e.currentTarget.id
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
console.log(this.data.current_page,this.data.last_page);
if (this.data.List_current_page >= this.data.List_last_page) {
wx.showToast({
title: '没有更多',
icon: 'none'
});
}else{
// wx.showLoading({
// title: '加载中'
// })
this.setData({
page: this.data.pageTwo + 1
});
this.nextgetShop();
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
getList() {
let urlStr = app.getNetAddresss("plugin.activity-apply.api.lecturer.getRelevance");
let that = this;
app._getNetWork({
url: urlStr,
data: {
member_id: that.data.member_id,
page: this.data.page
},
success: function (resdata) {
var res = resdata.data;
if (res.result == 1) {
console.log(res.data.lecturer);
console.log(!res.data.lecturer.introduce);
that.setData({
total: res.data.list.total,
lecturer: res.data.lecturer,
list: res.data.list.data,
List_current_page: res.data.list.current_page,
List_last_page: res.data.list.last_page
});
}
},
fail: function (res) {
console.log(res);
}
});
},
getShop() {
let urlStr = app.getNetAddresss("plugin.activity-apply.api.lecturer.getCourse");
let that = this;
app._getNetWork({
url: urlStr,
data: {
id: that.data.kid,
page: this.data.pageTwo
},
success: function (resdata) {
var res = resdata.data;
if (res.result == 1) {
console.log(res);
that.setData({
shopTotal: res.data.couser.total,
shopList: res.data.couser.data,
current_page: res.data.couser.current_page,
last_page: res.data.couser.last_page
});
}
},
fail: function (res) {
console.log(res);
}
});
},
nextgetList(){
let urlStr = app.getNetAddresss("plugin.activity-apply.api.lecturer.getRelevance");
let that = this;
app._getNetWork({
url: urlStr,
data: {
member_id: that.data.member_id,
page: this.data.page
},
success: function (resdata) {
var res = resdata.data;
if (res.result == 1) {
that.setData({
total: res.data.list.total,
list: that.data.list.concat(res.data.list.data),
List_current_page: res.data.list.current_page,
List_last_page: res.data.list.last_page
});
// if(res.data.list.current_page >= res.data.list.last_page){
// wx.hideLoading();
// wx.showToast({
// title: '没有更多',
// icon: 'none'
// });
// that.setData({
// List_current_page: res.data.list.current_page,
// List_last_page: res.data.list.last_page
// });
// return
// }else{
// wx.hideLoading();
// that.setData({
// total: res.data.list.total,
// list: that.data.list.concat(res.data.list.data),
// List_current_page: res.data.list.current_page,
// List_last_page: res.data.list.last_page
// })
// return
// }
}
},
fail: function (res) {
console.log(res);
}
});
},
nextgetShop() {
let urlStr = app.getNetAddresss("plugin.activity-apply.api.lecturer.getCourse");
let that = this;
app._getNetWork({
url: urlStr,
data: {
id: that.data.kid,
page: that.data.pageTwo
},
success: function (resdata) {
var res = resdata.data;
if (res.result == 1) {
console.log(res);
if (res.data.couser.current_page > res.data.couser.last_page) {
wx.hideLoading();
wx.showToast({
title: '没有更多',
icon: 'none'
});
that.setData({
current_page: res.data.couser.current_page,
last_page: res.data.couser.last_page
});
return;
} else {
wx.hideLoading();
that.setData({
current_page: res.data.couser.current_page,
last_page: res.data.couser.last_page,
shopList: that.data.shopList.concat(res.data.couser.data),
});
}
}
},
fail: function (res) {
console.log(res);
}
});
}
});