107 lines
2.1 KiB
JavaScript
107 lines
2.1 KiB
JavaScript
const baseUrl = getApp();
|
|
const api = require('../../config/api.js');
|
|
const util = require('../../config/util.js');
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
|
|
list:[],
|
|
coursetypefour_id:1,
|
|
grouppaper_id:1,
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
|
|
console.log(options);
|
|
this.setData({
|
|
coursetypefour_id:options.id,
|
|
grouppaper_id:options.grouppaper_id
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
this.getexamright();
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
},
|
|
viewallexplain:function(params) {
|
|
console.log(params);
|
|
console.log(this.data.coursetypefour_id);
|
|
let typeid=params.currentTarget.id;
|
|
let coursetypefour_id=this.data.coursetypefour_id;
|
|
let grouppaper_id=this.data.grouppaper_id;
|
|
wx.navigateTo({
|
|
url: '/pages/examanalysis/examanalysis?id='+typeid+'&coursetypefour_id='+coursetypefour_id+'&grouppaper_id='+grouppaper_id,
|
|
})
|
|
},
|
|
getexamright:function() {
|
|
//得到练习题目
|
|
const that = this;
|
|
let url = baseUrl.globalData.baseUrl + '/exam/examuseranswerpaper';
|
|
let user_id=wx.getStorageSync('wxuserid')==''?3:wx.getStorageSync('wxuserid');
|
|
var param = {
|
|
coursetypefour_id: that.data.coursetypefour_id,
|
|
user_id:user_id
|
|
};
|
|
//此处为使用封装的post请求
|
|
util.post(url, param).then((res) => {
|
|
console.log(res.data);
|
|
that.setData({
|
|
list:res.data,
|
|
listdata:res.data
|
|
});
|
|
|
|
}).catch((errMsg) => {
|
|
console.log(errMsg);
|
|
});
|
|
}
|
|
}) |