initial commit: giftlaw ni xue fa wo you li - natural resources session
This commit is contained in:
@@ -0,0 +1,306 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<image src="https://aliyunoss.hn12301.net/learnlaw/gift_zt_bj.jpg" mode="widthFix" style="width:750rpx;position:absolute;top:0;left:0;z-index:0;"></image>
|
||||
<view class="page-body">
|
||||
<view class="stat-grid">
|
||||
<view class="stat-row">
|
||||
<view class="stat-item">
|
||||
<view class="stat-icon icon-correct">
|
||||
<text class="iconfont">✓</text>
|
||||
</view>
|
||||
<text class="stat-num">{{ correctCount }}</text>
|
||||
<text class="stat-label">答对题数</text>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<view class="stat-icon icon-accuracy">
|
||||
<text class="iconfont">%</text>
|
||||
</view>
|
||||
<text class="stat-num">{{ accuracy }}%</text>
|
||||
<text class="stat-label">正确率</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="stat-row">
|
||||
<view class="stat-item">
|
||||
<view class="stat-icon icon-time">
|
||||
<text class="iconfont">⏱</text>
|
||||
</view>
|
||||
<text class="stat-num">{{ useTime }}s</text>
|
||||
<text class="stat-label">用时</text>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<view class="stat-icon icon-wrong">
|
||||
<text class="iconfont">✗</text>
|
||||
</view>
|
||||
<text class="stat-num">{{ wrongCount }}</text>
|
||||
<text class="stat-label">错题数</text>
|
||||
</view>
|
||||
</view>
|
||||
</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,
|
||||
accuracy: 0,
|
||||
useTime: 0,
|
||||
detailList: []
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
try {
|
||||
const data = uni.getStorageSync('resultDataGift') || {}
|
||||
this.useTime = data.use_time || 0
|
||||
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
|
||||
this.accuracy = Math.round(this.correctCount / data.resultDetailList.length * 100)
|
||||
}
|
||||
} catch(e) {
|
||||
console.error('解析结果数据失败', e)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
goBack() {
|
||||
uni.switchTab({ url: '/pages/index/index' })
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #7CC6EB;
|
||||
}
|
||||
|
||||
.content {
|
||||
position: relative;
|
||||
height: 100vh;
|
||||
height: 100dvh;
|
||||
|
||||
}
|
||||
|
||||
.page-body {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
height: 100%;
|
||||
padding: 40rpx 30rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.stat-grid {
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.stat-row {
|
||||
display: flex;
|
||||
gap: 14rpx;
|
||||
margin-bottom: 14rpx;
|
||||
}
|
||||
|
||||
.stat-row:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
flex: 1;
|
||||
background: rgba(255,255,255,0.95);
|
||||
border-radius: 16rpx;
|
||||
padding: 20rpx 12rpx 18rpx;
|
||||
text-align: center;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
|
||||
}
|
||||
|
||||
.stat-icon {
|
||||
width: 44rpx;
|
||||
height: 44rpx;
|
||||
border-radius: 50%;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.stat-icon .iconfont {
|
||||
font-size: 22rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.icon-correct { background: #f6ffed; }
|
||||
.icon-correct .iconfont { color: #52c41a; }
|
||||
.icon-accuracy { background: #fff7e6; }
|
||||
.icon-accuracy .iconfont { color: #fa8c16; }
|
||||
.icon-time { background: #e6f7ff; }
|
||||
.icon-time .iconfont { color: #1890ff; }
|
||||
.icon-wrong { background: #fff1f0; }
|
||||
.icon-wrong .iconfont { color: #f5222d; }
|
||||
|
||||
.stat-num {
|
||||
display: block;
|
||||
font-size: 34rpx;
|
||||
font-weight: 700;
|
||||
color: #333;
|
||||
margin-bottom: 4rpx;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.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>
|
||||
Reference in New Issue
Block a user