myPaper.vue
1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<template>
<view>
<view class="item" v-for="l in list" :key="l.id">
<image v-if="l.images" :src="config.baseUrl_api+l.images"></image>
<view class="info">
<view class="name">{{l.paperName}}</view>
<button class="btn btnKx" v-if="l.status=='0'" @click="goTest(l)">继续测评</button>
<button class="btn btnKx2" v-if="l.status=='1'" @click="goResult(l)">查看结果</button>
</view>
</view>
<view class="nodata" v-if="list.length==0">
<image mode="aspectFit" src="/static/nodata.png"></image>
</view>
</view>
</template>
<script setup>
import * as api from '@/common/api.js';
import config from '@/config.js';
import { ref } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
const list = ref([])
onShow(()=>{
init()
})
function init(){
api.getUserAnswerList().then(res=>{
list.value = res.data
})
}
function goTest(item){
let path = `/exam/subject?id=${item.paperId}&flag=1`;
uni.navigateTo({
url: path
});
}
function goResult(item){
let path = `/exam/result?id=${item.paperId}`;
uni.navigateTo({
url: path
});
}
</script>
<style scoped lang="scss">
.item{display: flex;background: #fff;border-radius: 15rpx;width: 700rpx;margin: 30rpx auto 0;
padding: 30rpx;
image{width: 225rpx;height: 120rpx;margin-right: 20rpx;border-radius: 10rpx; flex: 0 0 auto;}
.info{ flex: 1 1 auto;
.name{margin-bottom: 20rpx;}
.btn{margin: 0;float: right;
width: auto;
font-size: 28rpx;
padding: 10rpx 30rpx;
height: auto;
line-height: 1;}
}
}
</style>