const app=getApp(),utils=require("../../../utils/http"); Page({ /** * 页面的初始数据 */ data: { answerobj:[], pid:'', type:0,//0全部,1正确,2错误 datashow:false, }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.setData({ pid:options.pid }) this.answermsg(); }, answermsg:function(){ const that=this; utils.$post({ url: app.globalData.webUrl + 'api/exam/get_questions', header: { 'Authorization':'bearer '+app.globalData.token }, data:{ paperid:that.data.pid, type:that.data.type, employee_id:app.globalData.personMsg.binded.id, }, success: function (res) { if (res.data.code == "0"){ that.setData({ answerobj:res.data.data, datashow:false, }) } setTimeout(function(){ wx.hideLoading() },500) }, fail(){ wx.hideLoading() } }) }, setypetap(e){ if(this.data.type!=e.currentTarget.dataset.type){ this.setData({ type:e.currentTarget.dataset.type }) this.answermsg(); } }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { this.answermsg(); setTimeout(res=>{wx.stopPullDownRefresh()},500) }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ })