const baseUrl = getApp(); const api = require('../../config/api.js'); const util = require('../../config/util.js'); Page({ /** * 页面的初始数据---练习题查看交卷 */ data: { title:'练习完成', coursetypefour_id:1, grouppaper_id:1, listdata:[], list:[] }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { console.log(options.coursetypefour_id); this.setData({ coursetypefour_id:options.coursetypefour_id }); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, getexamobjectactiovename: function (id) { //得到试卷名称 const that = this; let url = baseUrl.globalData.baseUrl + '/examobjectactive/getexamobjectactiovename'; var param = { id: id, }; //此处为使用封装的post请求 util.post(url, param).then((res) => { wx.setNavigationBarTitle({ title: res.data["name"], }) }).catch((errMsg) => { console.log(errMsg); }); }, /** * 生命周期函数--监听页面显示 */ onShow: function () { this.getexamright(); this.getexamobjectactiovename(this.data.coursetypefour_id); }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, getexamright:function() { //得到练习题目 const that = this; let url = baseUrl.globalData.baseUrl + '/examobjectactive/examuseranswer'; 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.itemdata, listdata:res.data }); }).catch((errMsg) => { console.log(errMsg); }); }, 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, }) } })