-
报告首页
首页考试列表数据就在list里,首页展示的列表在rest里。
更新后把词汇和阅读一起获取到list里 -
报告首页点击
点击list是通过那一项里有没有subject_id来判断的,有就是普通考试,无就是联考(在union.js里) -
报告首页图表判断
通过联考无subject数据,普通考试有subject判断,在exam-rank-card卡片里
4. 小技巧
- 在plugins里给vue的原型定义一个属性$query,在全局用这个属性随时取到当前页面的query
Object.defineProperty(Vue.prototype, '$query', {
get () {
return this.$route.query
},
})
- 改mint-ui样式时,没有scoped的css需要加个/deep/
<style>
.mt-progress /deep/ .mt-progress-progress
background-color white
</style>
- 巧用map!
我的垃圾代码
let read = this.recent.knowledge[0].avg_score / this.recent.knowledge[0].total_score
let obj = {}
obj.cn_name = '阅读'
obj.value = read
obj.key = 0
rank.push(obj)
let listening = this.recent.knowledge[1].avg_score / this.recent.knowledge[1].total_score
obj.cn_name = '听力'
obj.value = listening
obj.key = 1
rank.push(obj)
let grammar = this.recent.knowledge[0].avg_score / this.recent.knowledge[0].total_score
obj.cn_name = '语法'
obj.value = grammar
obj.key = 2
rank.push(obj)
风鸣改的
let rank = ['阅读', '听力', '语法'].map((title, key) => {
return {
title,
value: this.recent.knowledge[key].avg_score / this.recent.knowledge[key].total_score,
key,
}
})
- 巧用map
风鸣写的,echart的配置
series: [
{
name: '班级',
type: 'bar',
barMaxWidth: 30,
label: {
normal: { show: true, position: 'top', color: '#444' } },
color: ['#4db5f8'],
data: classData.map(d => ({
value: d || 0,
label: { normal: { show: d > 0 } },
})),
},
{
name: '学生',
type: 'bar',
barMaxWidth: 30,
label: {
normal: { show: true, position: 'top', color: '#444' } },
color: ['#f5aa41'],
data: studentData.map(d => ({
value: d || 0,
label: { normal: { show: d > 0 } },
})),
},
],
- 组织router-link的点击事件
<router-link :to="getDownloadRoute(item)" @click.native="$event.stopPropagation()">
<mt-button type="primary" size="normal">下载</mt-button>
</router-link>
网友评论