update:运动馆
This commit is contained in:
parent
afab9b0a53
commit
29d3ba66f8
@ -100,12 +100,26 @@ Page({
|
|||||||
const res = await getPhysicalFitnessReport()
|
const res = await getPhysicalFitnessReport()
|
||||||
const rawList = (res.data && res.data.categoryScoreList) || []
|
const rawList = (res.data && res.data.categoryScoreList) || []
|
||||||
const list = rawList.filter(item => !(item.name && item.name.includes('米') && item.name.includes('跑')))
|
const list = rawList.filter(item => !(item.name && item.name.includes('米') && item.name.includes('跑')))
|
||||||
|
|
||||||
|
// 雷达图根据 gradeId 过滤不适用的项目
|
||||||
|
const gradeId = list.length > 0 ? list[0].gradeId : null
|
||||||
|
let radarList = list
|
||||||
|
if (gradeId !== null && gradeId !== undefined) {
|
||||||
|
if (gradeId <= 2) {
|
||||||
|
radarList = list.filter(item => item.name !== '一分钟仰卧起坐' && item.name !== '立定跳远')
|
||||||
|
} else if (gradeId > 2 && gradeId <= 6) {
|
||||||
|
radarList = list.filter(item => item.name !== '立定跳远')
|
||||||
|
} else if (gradeId > 6) {
|
||||||
|
radarList = list.filter(item => item.name !== '一分钟跳绳')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const fitnessItems = list.map(item => ({
|
const fitnessItems = list.map(item => ({
|
||||||
...item,
|
...item,
|
||||||
unit: UNIT_MAP[item.name] || '',
|
unit: UNIT_MAP[item.name] || '',
|
||||||
}))
|
}))
|
||||||
this.setData({
|
this.setData({
|
||||||
fitnessReport: list,
|
fitnessReport: radarList,
|
||||||
fitnessItems,
|
fitnessItems,
|
||||||
})
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -156,7 +170,7 @@ Page({
|
|||||||
tapLegend:true,
|
tapLegend:true,
|
||||||
background: 'rgba(0,0,0,0)',
|
background: 'rgba(0,0,0,0)',
|
||||||
color: ['#4A90E2', '#E74C3C'],
|
color: ['#4A90E2', '#E74C3C'],
|
||||||
padding: [0, 0, 0, 10],
|
padding: [0, 0, 0, 15],
|
||||||
legend: {
|
legend: {
|
||||||
show: true,
|
show: true,
|
||||||
position: 'bottom',
|
position: 'bottom',
|
||||||
@ -168,7 +182,7 @@ Page({
|
|||||||
},
|
},
|
||||||
extra: {
|
extra: {
|
||||||
radar: {
|
radar: {
|
||||||
gridType: this.data.fitnessItems.length == 4 ? 'circle' : 'radar',
|
gridType: this.data.fitnessReport.length == 4 ? 'circle' : 'radar',
|
||||||
gridColor: '#CCCCCC',
|
gridColor: '#CCCCCC',
|
||||||
gridCount: 4,
|
gridCount: 4,
|
||||||
opacity: 0.15,
|
opacity: 0.15,
|
||||||
|
|||||||
@ -17,7 +17,14 @@ Page({
|
|||||||
onLoad() {
|
onLoad() {
|
||||||
const item = wx.getStorageSync('fitnessDetailItem') || null
|
const item = wx.getStorageSync('fitnessDetailItem') || null
|
||||||
if (item) {
|
if (item) {
|
||||||
this.setData({ item, name: item.name, unit: item.unit || '' })
|
const fmt = v => (v != null && !isNaN(v)) ? Number(v).toFixed(1) : v
|
||||||
|
const formattedItem = {
|
||||||
|
...item,
|
||||||
|
lastScore: fmt(item.lastScore),
|
||||||
|
classAvgScore: fmt(item.classAvgScore),
|
||||||
|
schoolAvgScore: fmt(item.schoolAvgScore),
|
||||||
|
}
|
||||||
|
this.setData({ item: formattedItem, name: item.name, unit: item.unit || '' })
|
||||||
wx.setNavigationBarTitle({ title: item.name + '详情' })
|
wx.setNavigationBarTitle({ title: item.name + '详情' })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user