// pages/test/detail.js const api = require("../../utils/request.js"); Page({ /** * 页面的初始数据 */ data: { tm_index:0, results:[], tm_current:null, domain:getApp().globalData.mediahost, }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { var that = this var query = {'examtest':options.id} wx.showLoading({ title: '加载中...', mask:true }) api.request('/examtest/answerdetail/', 'GET', query).then(res => { wx.hideLoading() for (var i = 0; i < res.data.length; i++) { if(res.data[i].img){ res.data[i].img = getApp().globalData.mediahost + res.data[i].img } } that.data.results= res.data that.showTm(0) that.setData({ tmtotal:res.data.length }) }).catch(e=>{wx.hideLoading()}) try { const res = wx.getSystemInfoSync() that.setData({ scrollHeight: res.windowHeight - 78 }) } catch (e) { } }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, showTm: function (index) { var that = this if(index