// pages/result/index.js Page({ /** * 页面的初始数据 */ data: { detail: {}, scrollheight: 0 }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { if (!options.data) return wx.redirectTo({ url: '/pages/problemPage/index', }) const detail = JSON.parse(options.data); const sys = wx.getSystemInfoSync(); const query = wx.createSelectorQuery(); query.selectAll('.getHeight').boundingClientRect(rect => { let heightAll = 0; rect.map((currentValue, index, arr) => { heightAll += currentValue.height }) this.setData({ scrollheight: sys.windowHeight - heightAll }) }).exec(); detail.durationText = ""; let h = Math.floor(detail.duration / 3600000); if (h) detail.durationText += h + "时"; let min = Math.floor(detail.duration % 3600000 / 60000); if (min) detail.durationText += min + "分"; let s = Math.floor(detail.duration % 60000 / 1000); if (s) detail.durationText += s + "秒"; this.setData({ detail }) }, reset() { wx.reLaunch({ url: '/pages/answer/index?reset=1' }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })