115 lines
2.1 KiB
JavaScript
115 lines
2.1 KiB
JavaScript
const Apps = getApp();
|
|
const api = require('../../config/api.js');
|
|
const util = require('../../config/util.js');
|
|
import Toast from '../../miniprogram_npm/@vant/weapp/toast/toast';
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
listdata:[],
|
|
baseurl:Apps.globalData.baseimgurl,
|
|
viplist:[]
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
|
|
Apps.islogin();
|
|
this.getvipsmonth();
|
|
this.vipkechengdays();
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
},
|
|
getvipsmonth:function(params) {
|
|
const that = this;
|
|
let url = Apps.globalData.baseUrl + '/vip/getvipmonthlist';
|
|
var param = {
|
|
id: params
|
|
};
|
|
//此处为使用封装的post请求
|
|
util.get(url, param).then((res) => {
|
|
console.log(res);
|
|
that.setData({
|
|
listdata: res.data
|
|
});
|
|
|
|
}).catch((errMsg) => {
|
|
console.log(errMsg);
|
|
});
|
|
},
|
|
vipmonthclick:function(params) {
|
|
console.log(params);
|
|
wx.navigateTo({
|
|
url: '/pages/vipmonth/vipmonth?id='+params.currentTarget.id,
|
|
})
|
|
},
|
|
vipkechengdays:function() {
|
|
//得到用户VIP课程天数
|
|
const that = this;
|
|
let url = Apps.globalData.baseUrl + '/vip/displayvipdata';
|
|
var param = {
|
|
user_id: wx.getStorageSync('wxuserid')
|
|
};
|
|
//此处为使用封装的post请求
|
|
util.post(url, param).then((res) => {
|
|
console.log(res);
|
|
that.setData({
|
|
viplist: res.data
|
|
});
|
|
|
|
}).catch((errMsg) => {
|
|
console.log(errMsg);
|
|
});
|
|
}
|
|
}) |