index.js 891 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. let app = getApp()
  2. Page({
  3. data: {
  4. groupId: 0,
  5. tableData: [],
  6. types:{
  7. 1:'判断题',
  8. 2:'单选题',
  9. 3:'多选题',
  10. 4:'案例题'
  11. }
  12. },
  13. onLoad: function(options) {
  14. let groupId = +options.groupId||1;
  15. this.setData({ groupId });
  16. },
  17. onShow: function () {
  18. app.checkLogin( userInfo =>{
  19. this.setData({userInfo, from:0})
  20. this.loadData()
  21. })
  22. },
  23. gotoAnswer(e){
  24. let item = e.currentTarget.dataset.item;
  25. let groupId = this.data.groupId
  26. console.log( item )
  27. wx.navigateTo({
  28. url: `/pages/exam/orderTest/answer?groupId=${groupId}&type=${item.type}&count=${item.count}`
  29. })
  30. },
  31. loadData: function(){
  32. let param= {groupId: this.data.groupId}
  33. app.formPost('Exam.InitGroupAnswerV1', param ).then(res => {
  34. if( res.code == 200){
  35. this.setData({tableData: res.data})
  36. }
  37. })
  38. }
  39. })