index.js 785 B

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