const { getTaskResult } = require("../../../utils/serve/team") const { getUserInfo } = require("../../../utils/serve/user") Page({ /** * 页面的初始数据 */ data: { threeList:[], otherList:[], id:0, user:{}, currentRanking:0, no:0, complete:0, percent:0, left: '-80rpx', status:1 }, /** * 生命周期函数--监听页面加载 */ async onLoad(options) { const user = await getUserInfo() this.setData({ id:options.taskId, user:user.data, status:options.status },async()=>{ await this.getList() }) }, async getList (){ const res = await getTaskResult(this.data.id) if(!res.data) return const {taskResults,contribute,teamGoal,complete} = res.data let no = teamGoal - complete let percent = (complete / teamGoal)*100 percent = percent >100 ? 100 : percent <0 ? 1 : percent let left = ((6.50 * percent) - 100) + 'rpx' percent += '%' no = no <0 ?0 :no this.setData({ no, contribute, left, complete, percent, threeList: taskResults != null ? taskResults.slice(0,3) : [], otherList: taskResults != null ? taskResults.slice(0,taskResults.length) : [] }) }, goSport(){ wx.navigateTo({ url: '/subpackage/train/check-type/check-page?theme=team&taskId='+this.data.id, }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ async onShow() { await this.getList() }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })