237 lines
5.1 KiB
Vue
237 lines
5.1 KiB
Vue
<template>
|
||
<view class="content">
|
||
<image src="https://aliyunoss.hn12301.net/learnlaw/learn_dtbj.jpg" mode="widthFix" style="width:750rpx;position:absolute;top:0;left:0;z-index:0;"></image>
|
||
<view class="page-body">
|
||
<view class="correct-card">
|
||
<text class="correct-label">答对题数</text>
|
||
<text class="correct-num">{{ correctCount }} <text class="correct-total">/ {{ detailList.length }}</text></text>
|
||
</view>
|
||
|
||
<view class="detail-section">
|
||
<view class="section-header">
|
||
<text class="section-title">答题详情</text>
|
||
<text class="section-subtitle">共 {{ detailList.length }} 题,{{ correctCount }} 对 {{ wrongCount }} 错</text>
|
||
</view>
|
||
<view class="detail-item" v-for="(item, i) in detailList" :key="i">
|
||
<view class="detail-index" :class="item.is_correct || item.status === 1 ? 'correct' : 'wrong'">
|
||
<text class="detail-index-text">{{ i + 1 }}</text>
|
||
</view>
|
||
<view class="detail-body">
|
||
<text class="detail-q">{{ item.tiku_question_content || '题目' + (i+1) }}</text>
|
||
<view class="detail-answer-row">
|
||
<text class="detail-label">你的答案:</text>
|
||
<text class="detail-value" :class="item.is_correct || item.status === 1 ? 'text-correct' : 'text-wrong'">{{ item.user_answer || '未作答' }}</text>
|
||
</view>
|
||
<view class="detail-answer-row" v-if="!(item.is_correct || item.status === 1)">
|
||
<text class="detail-label">正确答案:</text>
|
||
<text class="detail-value text-correct-answer">{{ item.tiku_correct_answer || '-' }}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<button class="back-btn" @tap="goBack">返回首页</button>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
correctCount: 0,
|
||
wrongCount: 0,
|
||
detailList: []
|
||
}
|
||
},
|
||
onLoad() {
|
||
try {
|
||
const data = uni.getStorageSync('resultData') || {}
|
||
if (data.resultDetailList && data.resultDetailList.length) {
|
||
this.detailList = data.resultDetailList
|
||
this.correctCount = data.resultDetailList.filter(r => r.is_correct === true || r.is_correct === 1 || r.status === 1).length
|
||
this.wrongCount = data.resultDetailList.length - this.correctCount
|
||
}
|
||
} catch(e) {
|
||
console.error('解析结果数据失败', e)
|
||
}
|
||
},
|
||
methods: {
|
||
goBack() {
|
||
uni.reLaunch({ url: '/pages/index/index' })
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
page {
|
||
background-color: #B3E9F3;
|
||
}
|
||
|
||
.content {
|
||
position: relative;
|
||
height: 100vh;
|
||
height: 100dvh;
|
||
}
|
||
|
||
.page-body {
|
||
position: relative;
|
||
z-index: 1;
|
||
height: 100%;
|
||
padding: 40rpx 30rpx;
|
||
box-sizing: border-box;
|
||
overflow-y: auto;
|
||
}
|
||
|
||
.correct-card {
|
||
background: linear-gradient(135deg, #FD5401, #FF7A3D);
|
||
border-radius: 20rpx;
|
||
padding: 28rpx 24rpx;
|
||
text-align: center;
|
||
margin-bottom: 20rpx;
|
||
box-shadow: 0 4rpx 20rpx rgba(253, 84, 1, 0.2);
|
||
}
|
||
|
||
.correct-label {
|
||
font-size: 24rpx;
|
||
color: rgba(255,255,255,0.85);
|
||
display: block;
|
||
}
|
||
|
||
.correct-num {
|
||
font-size: 72rpx;
|
||
font-weight: 800;
|
||
color: #FFF;
|
||
display: block;
|
||
line-height: 1.2;
|
||
margin-top: 6rpx;
|
||
}
|
||
|
||
.correct-total {
|
||
font-size: 32rpx;
|
||
font-weight: 500;
|
||
color: rgba(255,255,255,0.8);
|
||
}
|
||
|
||
.detail-section {
|
||
background: rgba(255,255,255,0.95);
|
||
border-radius: 20rpx;
|
||
padding: 28rpx;
|
||
margin-bottom: 30rpx;
|
||
box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.04);
|
||
}
|
||
|
||
.section-header {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: baseline;
|
||
margin-bottom: 20rpx;
|
||
padding-bottom: 16rpx;
|
||
border-bottom: 2rpx solid #f5f5f5;
|
||
}
|
||
|
||
.section-title {
|
||
font-size: 30rpx;
|
||
font-weight: 700;
|
||
color: #333;
|
||
}
|
||
|
||
.section-subtitle {
|
||
font-size: 24rpx;
|
||
color: #bbb;
|
||
}
|
||
|
||
.detail-item {
|
||
padding: 20rpx 0;
|
||
border-bottom: 1rpx solid #f0f0f0;
|
||
display: flex;
|
||
}
|
||
|
||
.detail-item:last-child {
|
||
border-bottom: none;
|
||
}
|
||
|
||
.detail-index {
|
||
width: 44rpx;
|
||
height: 44rpx;
|
||
border-radius: 50%;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
flex-shrink: 0;
|
||
margin-right: 16rpx;
|
||
margin-top: 2rpx;
|
||
}
|
||
|
||
.detail-index.correct {
|
||
background: linear-gradient(135deg, #52c41a, #73d13d);
|
||
box-shadow: 0 2rpx 8rpx rgba(82,196,26,0.3);
|
||
}
|
||
|
||
.detail-index.wrong {
|
||
background: linear-gradient(135deg, #f5222d, #ff4d4f);
|
||
box-shadow: 0 2rpx 8rpx rgba(245,34,45,0.3);
|
||
}
|
||
|
||
.detail-index-text {
|
||
font-size: 20rpx;
|
||
font-weight: 700;
|
||
color: #fff;
|
||
}
|
||
|
||
.detail-body {
|
||
flex: 1;
|
||
min-width: 0;
|
||
}
|
||
|
||
.detail-q {
|
||
font-size: 26rpx;
|
||
color: #333;
|
||
line-height: 1.5;
|
||
display: block;
|
||
margin-bottom: 10rpx;
|
||
}
|
||
|
||
.detail-answer-row {
|
||
display: flex;
|
||
align-items: baseline;
|
||
margin-top: 4rpx;
|
||
}
|
||
|
||
.detail-label {
|
||
font-size: 22rpx;
|
||
color: #999;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.detail-value {
|
||
font-size: 24rpx;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.text-correct {
|
||
color: #52c41a;
|
||
}
|
||
|
||
.text-wrong {
|
||
color: #f5222d;
|
||
}
|
||
|
||
.text-correct-answer {
|
||
color: #52c41a;
|
||
}
|
||
|
||
.back-btn {
|
||
width: 690rpx;
|
||
height: 88rpx;
|
||
line-height: 88rpx;
|
||
background: linear-gradient(135deg, #FD5401, #FF7A3D);
|
||
color: #fff;
|
||
font-size: 32rpx;
|
||
font-weight: 600;
|
||
border: none;
|
||
border-radius: 44rpx;
|
||
box-shadow: 0 4rpx 16rpx rgba(253,84,1,0.3);
|
||
}
|
||
</style> |