// pages/lianxi/index.js const api = require("../../utils/request.js"); var util = require('../../utils/util.js') Page({ /** * 页面的初始数据 */ data: { isTest:true, results: [], types:['自助模考','押卷模考','正式考试'], query:{ type:"自助模考",//“自助模考”,“正式考试”,"押卷模考" page:1, limit:10 } }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { // var that = this // if(options.type=1){ // that.data.query.type='正式考试' // that.data.query.workscope=getApp().globalData.userinfo.workscope // } // that.getList(that.data.query) }, /** * 生命周期函数--监听页面显示 */ onShow: function () { this.getList(); }, changeActive(e){ this.setData({ ['query.page']:1, ['query.type']:e.target.dataset.type }) this.getList(); }, getList: function () { var that = this; api.request('/examtest/examtest/self/', 'GET', that.data.query).then(res => { for(var i=0;i