let app = getApp() Page({ data: { groupId: 0, tableData: [], types:{ 1:'判断题', 2:'单选题', 3:'多选题', 4:'案例题' } }, onLoad: function(options) { let groupId = +options.groupId||1; this.setData({ groupId }); }, onShow: function () { app.checkLogin( userInfo =>{ this.setData({userInfo, from:0}) this.loadData() }) }, gotoAnswer(e){ let item = e.currentTarget.dataset.item; let groupId = this.data.groupId console.log( item ) wx.navigateTo({ url: `/pages/exam/orderTest/answer?groupId=${groupId}&type=${item.type}&count=${item.count}` }) }, loadData: function(){ let param= {groupId: this.data.groupId} app.formPost('Exam.InitGroupAnswerV1', param ).then(res => { if( res.code == 200){ this.setData({tableData: res.data}) } }) } })