57 lines
1.2 KiB
Vue
57 lines
1.2 KiB
Vue
<template>
|
||
<view>
|
||
<uni-list>
|
||
<!-- 垂直排列,无略缩图,主标题+副标题显示 -->
|
||
<uni-list-item direction="column" :key="item.id" v-for="(item, index) in examList">
|
||
<template v-slot:header>
|
||
<view class="uni-title">{{item.name}}</view>
|
||
</template>
|
||
<template v-slot:footer>
|
||
<view class="uni-footer">
|
||
<u-button size="mini" type="primary" @click="attendTest(item)">开始练习</u-button>
|
||
</view>
|
||
</template>
|
||
</uni-list-item>
|
||
</uni-list>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
query:{
|
||
page: 1
|
||
},
|
||
examList: []
|
||
}
|
||
},
|
||
onLoad() {
|
||
this.getExamList();
|
||
},
|
||
methods: {
|
||
getExamList(){
|
||
this.$u.api.getExamList(this.query).then(res=>{
|
||
this.examList = res.data.results
|
||
})
|
||
},
|
||
attendTest(val){
|
||
console.log(val)
|
||
let currentExam = val;
|
||
this.$u.api.paperDetail(val.paper_.id).then(res=>{
|
||
currentExam = res.data;
|
||
uni.setStorageSync('currentExam', currentExam)
|
||
uni.navigateTo({
|
||
url:"/pages/exam/testDetail"
|
||
})
|
||
})
|
||
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style>
|
||
|
||
</style>
|