answermsg.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. const app=getApp(),utils=require("../../../utils/http");
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. answerobj:[],
  8. pid:'',
  9. type:0,//0全部,1正确,2错误
  10. datashow:false,
  11. },
  12. /**
  13. * 生命周期函数--监听页面加载
  14. */
  15. onLoad: function (options) {
  16. this.setData({
  17. pid:options.pid
  18. })
  19. this.answermsg();
  20. },
  21. answermsg:function(){
  22. const that=this;
  23. utils.$post({
  24. url: app.globalData.webUrl + 'api/exam/get_questions',
  25. header: {
  26. 'Authorization':'bearer '+app.globalData.token
  27. },
  28. data:{
  29. paperid:that.data.pid,
  30. type:that.data.type,
  31. employee_id:app.globalData.personMsg.binded.id,
  32. },
  33. success: function (res) {
  34. if (res.data.code == "0"){
  35. that.setData({
  36. answerobj:res.data.data,
  37. datashow:false,
  38. })
  39. }
  40. setTimeout(function(){
  41. wx.hideLoading()
  42. },500)
  43. },
  44. fail(){
  45. wx.hideLoading()
  46. }
  47. })
  48. },
  49. setypetap(e){
  50. if(this.data.type!=e.currentTarget.dataset.type){
  51. this.setData({
  52. type:e.currentTarget.dataset.type
  53. })
  54. this.answermsg();
  55. }
  56. },
  57. /**
  58. * 生命周期函数--监听页面初次渲染完成
  59. */
  60. onReady: function () {
  61. },
  62. /**
  63. * 生命周期函数--监听页面显示
  64. */
  65. onShow: function () {
  66. },
  67. /**
  68. * 生命周期函数--监听页面隐藏
  69. */
  70. onHide: function () {
  71. },
  72. /**
  73. * 生命周期函数--监听页面卸载
  74. */
  75. onUnload: function () {
  76. },
  77. /**
  78. * 页面相关事件处理函数--监听用户下拉动作
  79. */
  80. onPullDownRefresh: function () {
  81. this.answermsg();
  82. setTimeout(res=>{wx.stopPullDownRefresh()},500)
  83. },
  84. /**
  85. * 页面上拉触底事件的处理函数
  86. */
  87. onReachBottom: function () {
  88. },
  89. /**
  90. * 用户点击右上角分享
  91. */
  92. })