myPaper.vue 1.49 KB
<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>