123 lines
2.2 KiB
JavaScript
123 lines
2.2 KiB
JavaScript
const baseUrl = getApp();
|
|
const api = require('../../config/api.js');
|
|
const util = require('../../config/util.js');
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
messagelist:[],
|
|
baseurl:baseUrl.globalData.baseimgurl,
|
|
indexclassid:1
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
console.log(options.id);
|
|
this.setData({
|
|
indexclassid:options.id
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
this.msglist(this.data.indexclassid);
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
},
|
|
messageinfo:function(e){
|
|
console.log("fan----------------");
|
|
console.log(e);
|
|
let id=e.currentTarget.id;
|
|
this.msgadd(id);
|
|
|
|
wx.navigateTo({
|
|
url: '/pages/indexobjectivework/indexobjectivework?id='+id,
|
|
})
|
|
},
|
|
msgadd:function (params) {
|
|
|
|
|
|
const that = this;
|
|
let url = baseUrl.globalData.baseUrl + '/examobjectactive/examaddobjectactive';
|
|
var param = {
|
|
user_id: wx.getStorageSync('wxuserid'),
|
|
examobjectactive_id:params
|
|
};
|
|
//此处为使用封装的post请求
|
|
util.post(url, param).then((res) => {
|
|
|
|
console.log(param);
|
|
console.log(res);
|
|
|
|
|
|
}).catch((errMsg) => {
|
|
console.log(errMsg);
|
|
});
|
|
|
|
|
|
},
|
|
msglist:function(params){
|
|
|
|
const that = this;
|
|
let url = baseUrl.globalData.baseUrl + '/examobjectactive/examobjectactivelist';
|
|
var param = {
|
|
id: params
|
|
};
|
|
//此处为使用封装的post请求
|
|
util.get(url, param).then((res) => {
|
|
console.log(res);
|
|
that.setData({
|
|
messagelist: res.data
|
|
});
|
|
|
|
}).catch((errMsg) => {
|
|
console.log(errMsg);
|
|
});
|
|
}
|
|
}) |