存档
This commit is contained in:
@@ -2,3 +2,12 @@
|
|||||||
2. 务必保证代码可维护性,做好模块划分
|
2. 务必保证代码可维护性,做好模块划分
|
||||||
3. 不要过度理解需求,尽量保持需求的简单性
|
3. 不要过度理解需求,尽量保持需求的简单性
|
||||||
4. 保持最小修改,不要大刀阔斧的改动代码
|
4. 保持最小修改,不要大刀阔斧的改动代码
|
||||||
|
5. 接口的返回格式统一为
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"code": 0,
|
||||||
|
"msg": "success",
|
||||||
|
"data": {}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
我给你描述的返回值均是指data字段
|
||||||
@@ -8,7 +8,9 @@ const config = {
|
|||||||
getCategoryQuestion: '/qgdzs/open/category/question',
|
getCategoryQuestion: '/qgdzs/open/category/question',
|
||||||
answerCategoryQuestion: '/qgdzs/open/category/answer',
|
answerCategoryQuestion: '/qgdzs/open/category/answer',
|
||||||
getQuicklyQuestion: '/qgdzs/open/quickly/question',
|
getQuicklyQuestion: '/qgdzs/open/quickly/question',
|
||||||
answerQuicklyQuestion: '/qgdzs/open/quickly/answer'
|
answerQuicklyQuestion: '/qgdzs/open/quickly/answer',
|
||||||
|
getPointInfo: '/qgdzs/auth/point/info',
|
||||||
|
getPointRecord: '/qgdzs/auth/point/record'
|
||||||
},
|
},
|
||||||
timeout: 30000
|
timeout: 30000
|
||||||
}
|
}
|
||||||
|
|||||||
12
pages.json
12
pages.json
@@ -43,11 +43,23 @@
|
|||||||
"navigationBarTitleText": "类目题目"
|
"navigationBarTitleText": "类目题目"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/records/records",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "答题记录"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/quick/quick",
|
"path": "pages/quick/quick",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "快速答题"
|
"navigationBarTitleText": "快速答题"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/point-record/point-record",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "学识分记录"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
|
|||||||
@@ -1,98 +1,58 @@
|
|||||||
<template>
|
<template>
|
||||||
<scroll-view
|
<view class="container">
|
||||||
class="container"
|
|
||||||
scroll-y
|
|
||||||
show-scrollbar="false"
|
|
||||||
@scrolltolower="loadMore"
|
|
||||||
>
|
|
||||||
<view class="header">
|
<view class="header">
|
||||||
<view class="welcome">
|
<view class="welcome">
|
||||||
<text class="welcome-title">答题记录</text>
|
<text class="welcome-title">趣味答题</text>
|
||||||
<text class="welcome-subtitle">查看你的答题历史</text>
|
<text class="welcome-subtitle">海量题库,轻松学习</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<view v-if="!isNotLoggedIn" class="point-card">
|
||||||
|
<view class="point-info">
|
||||||
<view class="record-section">
|
<text class="point-label">学识分</text>
|
||||||
<view v-if="isNotLoggedIn" class="empty-record">
|
<text class="point-value">{{ point }}</text>
|
||||||
<text class="empty-icon">🔐</text>
|
|
||||||
<text class="empty-text">需要登录</text>
|
|
||||||
<text class="empty-hint">登录后才会记录答题记录</text>
|
|
||||||
</view>
|
|
||||||
<view v-else-if="recordList.length > 0" class="record-list">
|
|
||||||
<view v-for="(record, index) in recordList" :key="index" class="record-item" @click="handleRecordClick(record)">
|
|
||||||
<view class="record-header">
|
|
||||||
<view class="record-category">{{ record.category }}</view>
|
|
||||||
<view class="record-difficulty" :class="getDifficultyClass(record.difficulty)">
|
|
||||||
<text class="difficulty-text">{{ getDifficultyText(record.difficulty) }}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="record-question">{{ record.question }}</view>
|
|
||||||
<view class="record-footer">
|
|
||||||
<view class="record-result" :class="record.is_correct ? 'correct' : 'wrong'">
|
|
||||||
<text class="result-icon">{{ record.is_correct ? '✓' : '✗' }}</text>
|
|
||||||
<text class="result-text">{{ record.is_correct ? '回答正确' : '回答错误' }}</text>
|
|
||||||
</view>
|
|
||||||
<text class="record-time">{{ formatTime(record.create_time) }}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<view class="point-level">
|
||||||
<view v-else class="empty-record">
|
<text class="level-text">{{ pointLevel }}</text>
|
||||||
<text class="empty-icon">📝</text>
|
|
||||||
<text class="empty-text">暂无答题记录</text>
|
|
||||||
<text class="empty-hint">快去答题吧!</text>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view v-if="isLoading" class="loading-more">
|
|
||||||
<text class="loading-text">加载中...</text>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view v-if="!hasMore && recordList.length > 0" class="no-more">
|
|
||||||
<text class="no-more-text">没有更多了</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view v-if="showDetail" class="detail-modal" @click="closeDetail">
|
|
||||||
<view class="detail-content" @click.stop>
|
|
||||||
<view class="detail-header">
|
|
||||||
<text class="detail-title">题目详情</text>
|
|
||||||
<text class="detail-close" @click="closeDetail">✕</text>
|
|
||||||
</view>
|
|
||||||
<view v-if="detailLoading" class="detail-loading">
|
|
||||||
<text class="loading-text">加载中...</text>
|
|
||||||
</view>
|
|
||||||
<view v-else-if="detailQuestion" class="detail-body">
|
|
||||||
<view class="detail-meta">
|
|
||||||
<view class="meta-tag category-tag">
|
|
||||||
<text class="meta-text">{{ detailQuestion.category }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="meta-tag difficulty-tag" :class="getDifficultyClass(detailQuestion.difficulty)">
|
|
||||||
<text class="meta-text">{{ getDifficultyText(detailQuestion.difficulty) }}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="detail-question">
|
|
||||||
<text class="question-text">{{ detailQuestion.question }}</text>
|
|
||||||
</view>
|
|
||||||
<view v-if="detailQuestion.options" class="detail-options">
|
|
||||||
<view
|
|
||||||
v-for="(option, index) in detailQuestion.options"
|
|
||||||
:key="index"
|
|
||||||
class="detail-option"
|
|
||||||
:class="{
|
|
||||||
'correct': getOptionLabel(option) === getCorrectAnswer(),
|
|
||||||
'wrong': getOptionLabel(option) === detailQuestion.user_answer && getOptionLabel(option) !== getCorrectAnswer()
|
|
||||||
}"
|
|
||||||
>
|
|
||||||
<text class="option-text">{{ option }}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view v-if="detailQuestion.explanation" class="detail-analysis">
|
|
||||||
<text class="analysis-label">解析:</text>
|
|
||||||
<text class="analysis-text">{{ detailQuestion.explanation }}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
|
||||||
|
<view class="action-section">
|
||||||
|
<view class="action-card" @click="handleStartQuiz">
|
||||||
|
<view class="action-icon">🎯</view>
|
||||||
|
<text class="action-title">开始答题</text>
|
||||||
|
<text class="action-desc">选择一种答题模式</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="feature-section">
|
||||||
|
<view class="feature-card" @click="handleRandomQuiz">
|
||||||
|
<view class="feature-icon">🎲</view>
|
||||||
|
<text class="feature-title">随机答题</text>
|
||||||
|
<text class="feature-desc">随机抽取题目</text>
|
||||||
|
</view>
|
||||||
|
<view class="feature-card" @click="handleCategoryQuiz">
|
||||||
|
<view class="feature-icon">📚</view>
|
||||||
|
<text class="feature-title">类目答题</text>
|
||||||
|
<text class="feature-desc">按分类答题</text>
|
||||||
|
</view>
|
||||||
|
<view class="feature-card" @click="handleQuickQuiz">
|
||||||
|
<view class="feature-icon">⚡</view>
|
||||||
|
<text class="feature-title">快速答题</text>
|
||||||
|
<text class="feature-desc">限时挑战</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="tips-section">
|
||||||
|
<view class="tip-item">
|
||||||
|
<text class="tip-icon">💡</text>
|
||||||
|
<text class="tip-text">每日答题,提升学识分</text>
|
||||||
|
</view>
|
||||||
|
<view class="tip-item">
|
||||||
|
<text class="tip-icon">🏆</text>
|
||||||
|
<text class="tip-text">解锁更高等级,展示你的知识水平</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -101,162 +61,73 @@ import api from '../../utils/api.js'
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
recordList: [],
|
isNotLoggedIn: false,
|
||||||
currentPage: 1,
|
point: 0,
|
||||||
pageSize: 10,
|
pointLevel: '',
|
||||||
totalCount: 0,
|
pointLoading: false
|
||||||
hasMore: true,
|
|
||||||
isLoading: false,
|
|
||||||
isFirstLoad: true,
|
|
||||||
showDetail: false,
|
|
||||||
detailQuestion: null,
|
|
||||||
detailLoading: false,
|
|
||||||
isNotLoggedIn: false
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.loadRecord()
|
this.loadPointInfo()
|
||||||
},
|
},
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
if (!this.isFirstLoad) {
|
this.loadPointInfo()
|
||||||
this.loadRecord()
|
|
||||||
}
|
|
||||||
this.isFirstLoad = false
|
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
async handleRecordClick(record) {
|
async loadPointInfo() {
|
||||||
this.showDetail = true
|
this.pointLoading = true
|
||||||
this.detailLoading = true
|
|
||||||
this.detailQuestion = null
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await api.getQuestionInfo(record.question_sn)
|
const res = await api.getPointInfo()
|
||||||
if (res.data) {
|
if (res.data && res.data.point) {
|
||||||
this.detailQuestion = {
|
this.point = parseInt(res.data.point) || 0
|
||||||
...res.data,
|
this.pointLevel = this.getPointLevel(this.point)
|
||||||
is_correct: record.is_correct,
|
|
||||||
user_answer: record.answer,
|
|
||||||
correct_answer: record.question_answer
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取题目详情失败:', error)
|
console.error('获取学识分失败:', error)
|
||||||
uni.showToast({
|
|
||||||
title: '获取失败',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
} finally {
|
|
||||||
this.detailLoading = false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
closeDetail() {
|
|
||||||
this.showDetail = false
|
|
||||||
this.detailQuestion = null
|
|
||||||
},
|
|
||||||
|
|
||||||
getCorrectAnswer() {
|
|
||||||
if (!this.detailQuestion) return ''
|
|
||||||
return String(this.detailQuestion.correct_answer || '').toUpperCase()
|
|
||||||
},
|
|
||||||
|
|
||||||
getOptionLabel(option) {
|
|
||||||
if (!option) return ''
|
|
||||||
const match = option.match(/^([A-D])\./)
|
|
||||||
return match ? match[1] : ''
|
|
||||||
},
|
|
||||||
|
|
||||||
async loadRecord(isLoadMore = false) {
|
|
||||||
if (this.isLoading) return
|
|
||||||
if (!isLoadMore) {
|
|
||||||
this.currentPage = 1
|
|
||||||
this.hasMore = true
|
|
||||||
this.isNotLoggedIn = false
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.hasMore) return
|
|
||||||
|
|
||||||
this.isLoading = true
|
|
||||||
|
|
||||||
try {
|
|
||||||
const res = await api.getRecord(this.currentPage, this.pageSize)
|
|
||||||
if (res.data) {
|
|
||||||
const newRecords = (res.data.records || []).map(record => ({
|
|
||||||
...record,
|
|
||||||
is_correct: String(record.answer || '').toUpperCase() === String(record.question_answer || '').toUpperCase()
|
|
||||||
}))
|
|
||||||
|
|
||||||
if (isLoadMore) {
|
|
||||||
this.recordList = [...this.recordList, ...newRecords]
|
|
||||||
} else {
|
|
||||||
this.recordList = newRecords
|
|
||||||
}
|
|
||||||
|
|
||||||
this.totalCount = res.data.count || 0
|
|
||||||
|
|
||||||
if (this.recordList.length >= this.totalCount) {
|
|
||||||
this.hasMore = false
|
|
||||||
} else {
|
|
||||||
this.currentPage++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('获取答题记录失败:', error)
|
|
||||||
// 检查是否是401错误
|
// 检查是否是401错误
|
||||||
if (error.message && error.message.includes('401')) {
|
if (error.message && error.message.includes('401')) {
|
||||||
this.isNotLoggedIn = true
|
this.isNotLoggedIn = true
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
this.isLoading = false
|
this.pointLoading = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
loadMore() {
|
getPointLevel(point) {
|
||||||
this.loadRecord(true)
|
if (point < 100) return '幼儿园'
|
||||||
|
if (point < 300) return '小学生'
|
||||||
|
if (point < 600) return '初中生'
|
||||||
|
if (point < 1000) return '高中生'
|
||||||
|
if (point < 1500) return '大学生'
|
||||||
|
if (point < 2000) return '硕士'
|
||||||
|
return '博士'
|
||||||
},
|
},
|
||||||
|
|
||||||
getDifficultyText(difficulty) {
|
handleStartQuiz() {
|
||||||
if (!difficulty && difficulty !== 0) return '简单'
|
uni.navigateTo({
|
||||||
if (difficulty <= 30) return '简单'
|
url: '/pages/gameplay/gameplay'
|
||||||
if (difficulty <= 60) return '中等'
|
})
|
||||||
if (difficulty <= 80) return '困难'
|
|
||||||
return '极难'
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getDifficultyClass(difficulty) {
|
handleRandomQuiz() {
|
||||||
if (!difficulty && difficulty !== 0) return 'difficulty-easy'
|
uni.navigateTo({
|
||||||
if (difficulty <= 30) return 'difficulty-easy'
|
url: '/pages/random/random'
|
||||||
if (difficulty <= 60) return 'difficulty-medium'
|
})
|
||||||
if (difficulty <= 80) return 'difficulty-hard'
|
|
||||||
return 'difficulty-extreme'
|
|
||||||
},
|
},
|
||||||
|
|
||||||
formatTime(timestamp) {
|
handleCategoryQuiz() {
|
||||||
if (!timestamp) return ''
|
uni.navigateTo({
|
||||||
const date = new Date(timestamp * 1000)
|
url: '/pages/category/category'
|
||||||
const now = new Date()
|
})
|
||||||
const diff = now - date
|
},
|
||||||
|
|
||||||
const minute = 60 * 1000
|
handleQuickQuiz() {
|
||||||
const hour = 60 * minute
|
uni.navigateTo({
|
||||||
const day = 24 * hour
|
url: '/pages/quick/quick'
|
||||||
|
})
|
||||||
if (diff < minute) {
|
|
||||||
return '刚刚'
|
|
||||||
} else if (diff < hour) {
|
|
||||||
return Math.floor(diff / minute) + '分钟前'
|
|
||||||
} else if (diff < day) {
|
|
||||||
return Math.floor(diff / hour) + '小时前'
|
|
||||||
} else if (diff < 7 * day) {
|
|
||||||
return Math.floor(diff / day) + '天前'
|
|
||||||
} else {
|
|
||||||
const month = date.getMonth() + 1
|
|
||||||
const dayOfMonth = date.getDate()
|
|
||||||
return `${month}月${dayOfMonth}日`
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -264,33 +135,20 @@ export default {
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.container {
|
.container {
|
||||||
height: 100vh;
|
min-height: 100vh;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||||
padding: 40rpx;
|
padding: 40rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container::-webkit-scrollbar {
|
|
||||||
display: none;
|
|
||||||
width: 0;
|
|
||||||
height: 0;
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/deep/ ::-webkit-scrollbar {
|
|
||||||
display: none;
|
|
||||||
width: 0;
|
|
||||||
height: 0;
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
margin-bottom: 60rpx;
|
margin-bottom: 60rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.welcome {
|
.welcome {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
margin-bottom: 40rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.welcome-title {
|
.welcome-title {
|
||||||
@@ -307,352 +165,160 @@ export default {
|
|||||||
color: rgba(255, 255, 255, 0.9);
|
color: rgba(255, 255, 255, 0.9);
|
||||||
}
|
}
|
||||||
|
|
||||||
.record-section {
|
.point-card {
|
||||||
|
background: rgba(255, 255, 255, 0.2);
|
||||||
|
border-radius: 20rpx;
|
||||||
|
padding: 30rpx;
|
||||||
|
margin: 0 auto;
|
||||||
|
width: 90%;
|
||||||
|
max-width: 400rpx;
|
||||||
|
backdrop-filter: blur(10rpx);
|
||||||
|
border: 2rpx solid rgba(255, 255, 255, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.point-info {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.point-label {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.9);
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.point-value {
|
||||||
|
font-size: 48rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #ffffff;
|
||||||
|
text-shadow: 0 4rpx 10rpx rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.point-level {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.level-text {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #ffffff;
|
||||||
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||||
|
padding: 10rpx 40rpx;
|
||||||
|
border-radius: 30rpx;
|
||||||
|
box-shadow: 0 4rpx 15rpx rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-section {
|
||||||
margin-bottom: 60rpx;
|
margin-bottom: 60rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.record-list {
|
.action-card {
|
||||||
display: flex;
|
background: rgba(255, 255, 255, 0.2);
|
||||||
flex-direction: column;
|
|
||||||
gap: 20rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.record-item {
|
|
||||||
background: #ffffff;
|
|
||||||
border-radius: 20rpx;
|
|
||||||
padding: 30rpx;
|
|
||||||
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.1);
|
|
||||||
width: 100%;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.record-header {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 20rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.record-category {
|
|
||||||
font-size: 26rpx;
|
|
||||||
color: #666;
|
|
||||||
background: #f0f0f0;
|
|
||||||
padding: 6rpx 16rpx;
|
|
||||||
border-radius: 12rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.record-difficulty {
|
|
||||||
padding: 6rpx 16rpx;
|
|
||||||
border-radius: 12rpx;
|
|
||||||
font-size: 24rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.difficulty-easy {
|
|
||||||
background: #d4edda;
|
|
||||||
color: #155724;
|
|
||||||
}
|
|
||||||
|
|
||||||
.difficulty-medium {
|
|
||||||
background: #fff3cd;
|
|
||||||
color: #856404;
|
|
||||||
}
|
|
||||||
|
|
||||||
.difficulty-hard {
|
|
||||||
background: #fd7e14;
|
|
||||||
color: #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.difficulty-extreme {
|
|
||||||
background: #dc3545;
|
|
||||||
color: #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.difficulty-tag.difficulty-easy {
|
|
||||||
background: #d4edda;
|
|
||||||
color: #155724;
|
|
||||||
}
|
|
||||||
|
|
||||||
.difficulty-tag.difficulty-medium {
|
|
||||||
background: #fff3cd;
|
|
||||||
color: #856404;
|
|
||||||
}
|
|
||||||
|
|
||||||
.difficulty-tag.difficulty-hard {
|
|
||||||
background: #fd7e14;
|
|
||||||
color: #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.difficulty-tag.difficulty-extreme {
|
|
||||||
background: #dc3545;
|
|
||||||
color: #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.difficulty-text {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.record-question {
|
|
||||||
font-size: 30rpx;
|
|
||||||
color: #333;
|
|
||||||
line-height: 1.6;
|
|
||||||
margin-bottom: 20rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.record-footer {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
padding-top: 20rpx;
|
|
||||||
border-top: 2rpx solid #f0f0f0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.record-result {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 10rpx;
|
|
||||||
font-size: 26rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.record-result.correct {
|
|
||||||
color: #28a745;
|
|
||||||
}
|
|
||||||
|
|
||||||
.record-result.wrong {
|
|
||||||
color: #dc3545;
|
|
||||||
}
|
|
||||||
|
|
||||||
.result-icon {
|
|
||||||
font-size: 32rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.result-text {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.record-time {
|
|
||||||
font-size: 24rpx;
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
|
|
||||||
.empty-record {
|
|
||||||
background: rgba(255, 255, 255, 0.15);
|
|
||||||
border-radius: 20rpx;
|
|
||||||
padding: 100rpx 40rpx;
|
|
||||||
text-align: center;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
gap: 20rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.empty-icon {
|
|
||||||
font-size: 80rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.empty-text {
|
|
||||||
font-size: 32rpx;
|
|
||||||
color: rgba(255, 255, 255, 0.9);
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.empty-hint {
|
|
||||||
font-size: 26rpx;
|
|
||||||
color: rgba(255, 255, 255, 0.7);
|
|
||||||
}
|
|
||||||
|
|
||||||
.loading-more {
|
|
||||||
text-align: center;
|
|
||||||
padding: 40rpx 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.loading-text {
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: rgba(255, 255, 255, 0.9);
|
|
||||||
}
|
|
||||||
|
|
||||||
.no-more {
|
|
||||||
text-align: center;
|
|
||||||
padding: 40rpx 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.no-more-text {
|
|
||||||
font-size: 26rpx;
|
|
||||||
color: rgba(255, 255, 255, 0.6);
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-modal {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
background: rgba(0, 0, 0, 0.5);
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
z-index: 999;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-content {
|
|
||||||
background: #ffffff;
|
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
|
padding: 50rpx;
|
||||||
|
margin: 0 auto 40rpx;
|
||||||
width: 90%;
|
width: 90%;
|
||||||
max-height: 80vh;
|
max-width: 500rpx;
|
||||||
|
backdrop-filter: blur(10rpx);
|
||||||
|
border: 2rpx solid rgba(255, 255, 255, 0.3);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
|
||||||
|
|
||||||
.detail-header {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 30rpx;
|
|
||||||
border-bottom: 2rpx solid #f0f0f0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-title {
|
|
||||||
font-size: 36rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-close {
|
|
||||||
font-size: 48rpx;
|
|
||||||
color: #999;
|
|
||||||
line-height: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-loading {
|
|
||||||
padding: 80rpx 40rpx;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-body {
|
|
||||||
padding: 30rpx;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-meta {
|
|
||||||
display: flex;
|
|
||||||
gap: 20rpx;
|
gap: 20rpx;
|
||||||
margin-bottom: 30rpx;
|
transition: all 0.3s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.meta-tag {
|
.action-card:active {
|
||||||
padding: 8rpx 20rpx;
|
transform: scale(0.98);
|
||||||
|
background: rgba(255, 255, 255, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-icon {
|
||||||
|
font-size: 80rpx;
|
||||||
|
margin-bottom: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-title {
|
||||||
|
font-size: 40rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #ffffff;
|
||||||
|
text-shadow: 0 4rpx 10rpx rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-desc {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.9);
|
||||||
|
}
|
||||||
|
|
||||||
|
.feature-section {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 20rpx;
|
||||||
|
margin-top: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feature-card {
|
||||||
|
background: rgba(255, 255, 255, 0.15);
|
||||||
border-radius: 16rpx;
|
border-radius: 16rpx;
|
||||||
font-size: 24rpx;
|
padding: 30rpx;
|
||||||
}
|
backdrop-filter: blur(10rpx);
|
||||||
|
border: 2rpx solid rgba(255, 255, 255, 0.2);
|
||||||
.category-tag {
|
|
||||||
background: #e3f2fd;
|
|
||||||
color: #0d47a1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.difficulty-tag {
|
|
||||||
background: #f8f9fa;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-question {
|
|
||||||
margin-bottom: 30rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.question-text {
|
|
||||||
font-size: 32rpx;
|
|
||||||
color: #333;
|
|
||||||
line-height: 1.8;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-analysis {
|
|
||||||
background: #f0f9ff;
|
|
||||||
padding: 24rpx;
|
|
||||||
border-radius: 12rpx;
|
|
||||||
margin-bottom: 30rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.analysis-label {
|
|
||||||
font-size: 26rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #0d47a1;
|
|
||||||
margin-right: 10rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.analysis-text {
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: #666;
|
|
||||||
line-height: 1.6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-options {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 20rpx;
|
|
||||||
margin-bottom: 30rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-option {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 24rpx 30rpx;
|
gap: 30rpx;
|
||||||
background: #f8f9fa;
|
transition: all 0.3s;
|
||||||
border-radius: 12rpx;
|
|
||||||
gap: 16rpx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail-option.correct {
|
.feature-card:active {
|
||||||
background: #d4edda;
|
transform: scale(0.98);
|
||||||
border: 2rpx solid #28a745;
|
background: rgba(255, 255, 255, 0.25);
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail-option.wrong {
|
.feature-icon {
|
||||||
background: #f8d7da;
|
font-size: 50rpx;
|
||||||
border: 2rpx solid #dc3545;
|
min-width: 60rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.option-label {
|
.feature-title {
|
||||||
font-size: 28rpx;
|
font-size: 32rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #666;
|
color: #ffffff;
|
||||||
min-width: 40rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.option-text {
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: #333;
|
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail-footer {
|
.feature-desc {
|
||||||
display: flex;
|
font-size: 24rpx;
|
||||||
justify-content: space-between;
|
color: rgba(255, 255, 255, 0.8);
|
||||||
align-items: center;
|
|
||||||
padding-top: 20rpx;
|
|
||||||
border-top: 2rpx solid #f0f0f0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail-result {
|
.tips-section {
|
||||||
|
margin-top: 60rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tip-item {
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
|
border-radius: 16rpx;
|
||||||
|
padding: 24rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 10rpx;
|
gap: 20rpx;
|
||||||
font-size: 28rpx;
|
backdrop-filter: blur(10rpx);
|
||||||
|
border: 2rpx solid rgba(255, 255, 255, 0.15);
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail-result.correct {
|
.tip-icon {
|
||||||
color: #28a745;
|
font-size: 36rpx;
|
||||||
|
min-width: 40rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail-result.wrong {
|
.tip-text {
|
||||||
color: #dc3545;
|
font-size: 26rpx;
|
||||||
}
|
color: rgba(255, 255, 255, 0.9);
|
||||||
|
flex: 1;
|
||||||
.detail-answer {
|
line-height: 1.6;
|
||||||
font-size: 28rpx;
|
|
||||||
color: #666;
|
|
||||||
}
|
|
||||||
|
|
||||||
.answer-text {
|
|
||||||
font-weight: bold;
|
|
||||||
color: #333;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -12,9 +12,17 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="menu-list">
|
<view class="menu-list">
|
||||||
|
<view class="menu-item" @click="handleRecordClick">
|
||||||
|
<text class="menu-text">答题记录</text>
|
||||||
|
<text class="arrow">›</text>
|
||||||
|
</view>
|
||||||
|
<view class="menu-item" @click="handlePointRecordClick">
|
||||||
|
<text class="menu-text">学识分记录</text>
|
||||||
|
<text class="arrow">›</text>
|
||||||
|
</view>
|
||||||
<view class="menu-item">
|
<view class="menu-item">
|
||||||
<text class="menu-text">关于我们</text>
|
<text class="menu-text">关于我们</text>
|
||||||
<text class="arrow">></text>
|
<text class="arrow">›</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -60,28 +68,44 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
handleLogout() {
|
handleRecordClick() {
|
||||||
uni.showModal({
|
uni.navigateTo({
|
||||||
title: '提示',
|
url: '/pages/records/records'
|
||||||
content: '确定要退出登录吗?',
|
})
|
||||||
success: (res) => {
|
},
|
||||||
if (res.confirm) {
|
|
||||||
storage.removeToken()
|
|
||||||
storage.removeRefreshToken()
|
|
||||||
storage.removeUserInfo()
|
|
||||||
storage.removeQuestion()
|
|
||||||
storage.clearAnsweredQuestions()
|
|
||||||
|
|
||||||
this.userInfo = {}
|
handlePointRecordClick() {
|
||||||
|
try {
|
||||||
uni.showToast({
|
uni.navigateTo({
|
||||||
title: '已退出登录',
|
url: '/pages/point-record/point-record'
|
||||||
icon: 'success'
|
})
|
||||||
})
|
} catch (error) {
|
||||||
}
|
console.error('跳转失败:', error)
|
||||||
}
|
}
|
||||||
})
|
},
|
||||||
}
|
|
||||||
|
handleLogout() {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '确定要退出登录吗?',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
storage.removeToken()
|
||||||
|
storage.removeRefreshToken()
|
||||||
|
storage.removeUserInfo()
|
||||||
|
storage.removeQuestion()
|
||||||
|
storage.clearAnsweredQuestions()
|
||||||
|
|
||||||
|
this.userInfo = {}
|
||||||
|
|
||||||
|
uni.showToast({
|
||||||
|
title: '已退出登录',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
357
pages/point-record/point-record.vue
Normal file
357
pages/point-record/point-record.vue
Normal file
@@ -0,0 +1,357 @@
|
|||||||
|
<template>
|
||||||
|
<scroll-view
|
||||||
|
class="container"
|
||||||
|
scroll-y
|
||||||
|
show-scrollbar="false"
|
||||||
|
@scrolltolower="loadMore"
|
||||||
|
>
|
||||||
|
<view class="header">
|
||||||
|
<view class="welcome">
|
||||||
|
<text class="welcome-title">学识分记录</text>
|
||||||
|
<text class="welcome-subtitle">查看你的学识分获取历史</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="record-section">
|
||||||
|
<view v-if="isNotLoggedIn" class="empty-record">
|
||||||
|
<text class="empty-icon">🔐</text>
|
||||||
|
<text class="empty-text">需要登录</text>
|
||||||
|
<text class="empty-hint">登录后才会记录学识分获取记录</text>
|
||||||
|
</view>
|
||||||
|
<view v-else-if="recordList.length > 0" class="record-list">
|
||||||
|
<view v-for="(record, index) in recordList" :key="index" class="record-item">
|
||||||
|
<view class="record-header">
|
||||||
|
<view class="record-source" :class="getSourceClass(record.source)">
|
||||||
|
<text class="source-text">{{ getSourceText(record.source) }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="record-point" :class="record.point > 0 ? 'point-positive' : 'point-negative'">
|
||||||
|
<text class="point-text">{{ record.point > 0 ? '+' : '' }}{{ record.point }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="record-footer">
|
||||||
|
<text class="record-time">{{ formatTime(record.create_time) }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view v-else class="empty-record">
|
||||||
|
<text class="empty-icon">📊</text>
|
||||||
|
<text class="empty-text">暂无学识分记录</text>
|
||||||
|
<text class="empty-hint">参与答题获取学识分</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view v-if="isLoading" class="loading-more">
|
||||||
|
<text class="loading-text">加载中...</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view v-if="!hasMore && recordList.length > 0" class="no-more">
|
||||||
|
<text class="no-more-text">没有更多了</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import api from '../../utils/api.js'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
recordList: [],
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
totalCount: 0,
|
||||||
|
hasMore: true,
|
||||||
|
isLoading: false,
|
||||||
|
isFirstLoad: true,
|
||||||
|
isNotLoggedIn: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onLoad() {
|
||||||
|
this.loadRecord()
|
||||||
|
},
|
||||||
|
|
||||||
|
onShow() {
|
||||||
|
if (!this.isFirstLoad) {
|
||||||
|
this.loadRecord()
|
||||||
|
}
|
||||||
|
this.isFirstLoad = false
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
async loadRecord(isLoadMore = false) {
|
||||||
|
if (this.isLoading) return
|
||||||
|
if (!isLoadMore) {
|
||||||
|
this.currentPage = 1
|
||||||
|
this.hasMore = true
|
||||||
|
this.isNotLoggedIn = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.hasMore) return
|
||||||
|
|
||||||
|
this.isLoading = true
|
||||||
|
|
||||||
|
try {
|
||||||
|
const res = await api.getPointRecord(this.currentPage, this.pageSize)
|
||||||
|
if (res.data) {
|
||||||
|
const newRecords = res.data.records || []
|
||||||
|
|
||||||
|
if (isLoadMore) {
|
||||||
|
this.recordList = [...this.recordList, ...newRecords]
|
||||||
|
} else {
|
||||||
|
this.recordList = newRecords
|
||||||
|
}
|
||||||
|
|
||||||
|
this.totalCount = res.data.count || 0
|
||||||
|
|
||||||
|
if (this.recordList.length >= this.totalCount) {
|
||||||
|
this.hasMore = false
|
||||||
|
} else {
|
||||||
|
this.currentPage++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取学识分记录失败:', error)
|
||||||
|
// 检查是否是401错误
|
||||||
|
if (error.message && error.message.includes('401')) {
|
||||||
|
this.isNotLoggedIn = true
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
this.isLoading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
loadMore() {
|
||||||
|
this.loadRecord(true)
|
||||||
|
},
|
||||||
|
|
||||||
|
getSourceText(source) {
|
||||||
|
// 根据source值返回对应的文本
|
||||||
|
const sourceMap = {
|
||||||
|
0: '未知',
|
||||||
|
1: '随机答题',
|
||||||
|
2: '类目答题',
|
||||||
|
3: '限时答题'
|
||||||
|
}
|
||||||
|
return sourceMap[source] || '其他'
|
||||||
|
},
|
||||||
|
|
||||||
|
getSourceClass(source) {
|
||||||
|
// 根据source值返回对应的样式类
|
||||||
|
const classMap = {
|
||||||
|
0: 'source-unknown',
|
||||||
|
1: 'source-random',
|
||||||
|
2: 'source-category',
|
||||||
|
3: 'source-quick'
|
||||||
|
}
|
||||||
|
return classMap[source] || 'source-other'
|
||||||
|
},
|
||||||
|
|
||||||
|
formatTime(timestamp) {
|
||||||
|
if (!timestamp) return ''
|
||||||
|
const date = new Date(timestamp * 1000)
|
||||||
|
const now = new Date()
|
||||||
|
const diff = now - date
|
||||||
|
|
||||||
|
const minute = 60 * 1000
|
||||||
|
const hour = 60 * minute
|
||||||
|
const day = 24 * hour
|
||||||
|
|
||||||
|
if (diff < minute) {
|
||||||
|
return '刚刚'
|
||||||
|
} else if (diff < hour) {
|
||||||
|
return Math.floor(diff / minute) + '分钟前'
|
||||||
|
} else if (diff < day) {
|
||||||
|
return Math.floor(diff / hour) + '小时前'
|
||||||
|
} else if (diff < 7 * day) {
|
||||||
|
return Math.floor(diff / day) + '天前'
|
||||||
|
} else {
|
||||||
|
const month = date.getMonth() + 1
|
||||||
|
const dayOfMonth = date.getDate()
|
||||||
|
return `${month}月${dayOfMonth}日`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.container {
|
||||||
|
height: 100vh;
|
||||||
|
width: 100%;
|
||||||
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||||
|
padding: 40rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/deep/ ::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
margin-bottom: 60rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.welcome {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.welcome-title {
|
||||||
|
display: block;
|
||||||
|
font-size: 48rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #ffffff;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.welcome-subtitle {
|
||||||
|
display: block;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.9);
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-section {
|
||||||
|
margin-bottom: 60rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-item {
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
padding: 30rpx;
|
||||||
|
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.1);
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-source {
|
||||||
|
padding: 8rpx 20rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.source-unknown {
|
||||||
|
background: #f5f5f5;
|
||||||
|
color: #666666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.source-random {
|
||||||
|
background: #e3f2fd;
|
||||||
|
color: #0d47a1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.source-category {
|
||||||
|
background: #d4edda;
|
||||||
|
color: #155724;
|
||||||
|
}
|
||||||
|
|
||||||
|
.source-quick {
|
||||||
|
background: #fff3cd;
|
||||||
|
color: #856404;
|
||||||
|
}
|
||||||
|
|
||||||
|
.source-other {
|
||||||
|
background: #f5f5f5;
|
||||||
|
color: #666666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.source-text {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-point {
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.point-positive {
|
||||||
|
color: #28a745;
|
||||||
|
}
|
||||||
|
|
||||||
|
.point-negative {
|
||||||
|
color: #dc3545;
|
||||||
|
}
|
||||||
|
|
||||||
|
.point-text {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-footer {
|
||||||
|
padding-top: 20rpx;
|
||||||
|
border-top: 2rpx solid #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-time {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-record {
|
||||||
|
background: rgba(255, 255, 255, 0.15);
|
||||||
|
border-radius: 20rpx;
|
||||||
|
padding: 100rpx 40rpx;
|
||||||
|
text-align: center;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-icon {
|
||||||
|
font-size: 80rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-text {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.9);
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-hint {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.7);
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-more {
|
||||||
|
text-align: center;
|
||||||
|
padding: 40rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-text {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.9);
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-more {
|
||||||
|
text-align: center;
|
||||||
|
padding: 40rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-more-text {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.6);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
658
pages/records/records.vue
Normal file
658
pages/records/records.vue
Normal file
@@ -0,0 +1,658 @@
|
|||||||
|
<template>
|
||||||
|
<scroll-view
|
||||||
|
class="container"
|
||||||
|
scroll-y
|
||||||
|
show-scrollbar="false"
|
||||||
|
@scrolltolower="loadMore"
|
||||||
|
>
|
||||||
|
<view class="header">
|
||||||
|
<view class="welcome">
|
||||||
|
<text class="welcome-title">答题记录</text>
|
||||||
|
<text class="welcome-subtitle">查看你的答题历史</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="record-section">
|
||||||
|
<view v-if="isNotLoggedIn" class="empty-record">
|
||||||
|
<text class="empty-icon">🔐</text>
|
||||||
|
<text class="empty-text">需要登录</text>
|
||||||
|
<text class="empty-hint">登录后才会记录答题记录</text>
|
||||||
|
</view>
|
||||||
|
<view v-else-if="recordList.length > 0" class="record-list">
|
||||||
|
<view v-for="(record, index) in recordList" :key="index" class="record-item" @click="handleRecordClick(record)">
|
||||||
|
<view class="record-header">
|
||||||
|
<view class="record-category">{{ record.category }}</view>
|
||||||
|
<view class="record-difficulty" :class="getDifficultyClass(record.difficulty)">
|
||||||
|
<text class="difficulty-text">{{ getDifficultyText(record.difficulty) }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="record-question">{{ record.question }}</view>
|
||||||
|
<view class="record-footer">
|
||||||
|
<view class="record-result" :class="record.is_correct ? 'correct' : 'wrong'">
|
||||||
|
<text class="result-icon">{{ record.is_correct ? '✓' : '✗' }}</text>
|
||||||
|
<text class="result-text">{{ record.is_correct ? '回答正确' : '回答错误' }}</text>
|
||||||
|
</view>
|
||||||
|
<text class="record-time">{{ formatTime(record.create_time) }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view v-else class="empty-record">
|
||||||
|
<text class="empty-icon">📝</text>
|
||||||
|
<text class="empty-text">暂无答题记录</text>
|
||||||
|
<text class="empty-hint">快去答题吧!</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view v-if="isLoading" class="loading-more">
|
||||||
|
<text class="loading-text">加载中...</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view v-if="!hasMore && recordList.length > 0" class="no-more">
|
||||||
|
<text class="no-more-text">没有更多了</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view v-if="showDetail" class="detail-modal" @click="closeDetail">
|
||||||
|
<view class="detail-content" @click.stop>
|
||||||
|
<view class="detail-header">
|
||||||
|
<text class="detail-title">题目详情</text>
|
||||||
|
<text class="detail-close" @click="closeDetail">✕</text>
|
||||||
|
</view>
|
||||||
|
<view v-if="detailLoading" class="detail-loading">
|
||||||
|
<text class="loading-text">加载中...</text>
|
||||||
|
</view>
|
||||||
|
<view v-else-if="detailQuestion" class="detail-body">
|
||||||
|
<view class="detail-meta">
|
||||||
|
<view class="meta-tag category-tag">
|
||||||
|
<text class="meta-text">{{ detailQuestion.category }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="meta-tag difficulty-tag" :class="getDifficultyClass(detailQuestion.difficulty)">
|
||||||
|
<text class="meta-text">{{ getDifficultyText(detailQuestion.difficulty) }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="detail-question">
|
||||||
|
<text class="question-text">{{ detailQuestion.question }}</text>
|
||||||
|
</view>
|
||||||
|
<view v-if="detailQuestion.options" class="detail-options">
|
||||||
|
<view
|
||||||
|
v-for="(option, index) in detailQuestion.options"
|
||||||
|
:key="index"
|
||||||
|
class="detail-option"
|
||||||
|
:class="{
|
||||||
|
'correct': getOptionLabel(option) === getCorrectAnswer(),
|
||||||
|
'wrong': getOptionLabel(option) === detailQuestion.user_answer && getOptionLabel(option) !== getCorrectAnswer()
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<text class="option-text">{{ option }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="detailQuestion.explanation" class="detail-analysis">
|
||||||
|
<text class="analysis-label">解析:</text>
|
||||||
|
<text class="analysis-text">{{ detailQuestion.explanation }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import api from '../../utils/api.js'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
recordList: [],
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
totalCount: 0,
|
||||||
|
hasMore: true,
|
||||||
|
isLoading: false,
|
||||||
|
isFirstLoad: true,
|
||||||
|
showDetail: false,
|
||||||
|
detailQuestion: null,
|
||||||
|
detailLoading: false,
|
||||||
|
isNotLoggedIn: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onLoad() {
|
||||||
|
this.loadRecord()
|
||||||
|
},
|
||||||
|
|
||||||
|
onShow() {
|
||||||
|
if (!this.isFirstLoad) {
|
||||||
|
this.loadRecord()
|
||||||
|
}
|
||||||
|
this.isFirstLoad = false
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
async handleRecordClick(record) {
|
||||||
|
this.showDetail = true
|
||||||
|
this.detailLoading = true
|
||||||
|
this.detailQuestion = null
|
||||||
|
|
||||||
|
try {
|
||||||
|
const res = await api.getQuestionInfo(record.question_sn)
|
||||||
|
if (res.data) {
|
||||||
|
this.detailQuestion = {
|
||||||
|
...res.data,
|
||||||
|
is_correct: record.is_correct,
|
||||||
|
user_answer: record.answer,
|
||||||
|
correct_answer: record.question_answer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取题目详情失败:', error)
|
||||||
|
uni.showToast({
|
||||||
|
title: '获取失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
} finally {
|
||||||
|
this.detailLoading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
closeDetail() {
|
||||||
|
this.showDetail = false
|
||||||
|
this.detailQuestion = null
|
||||||
|
},
|
||||||
|
|
||||||
|
getCorrectAnswer() {
|
||||||
|
if (!this.detailQuestion) return ''
|
||||||
|
return String(this.detailQuestion.correct_answer || '').toUpperCase()
|
||||||
|
},
|
||||||
|
|
||||||
|
getOptionLabel(option) {
|
||||||
|
if (!option) return ''
|
||||||
|
const match = option.match(/^([A-D])\./)
|
||||||
|
return match ? match[1] : ''
|
||||||
|
},
|
||||||
|
|
||||||
|
async loadRecord(isLoadMore = false) {
|
||||||
|
if (this.isLoading) return
|
||||||
|
if (!isLoadMore) {
|
||||||
|
this.currentPage = 1
|
||||||
|
this.hasMore = true
|
||||||
|
this.isNotLoggedIn = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.hasMore) return
|
||||||
|
|
||||||
|
this.isLoading = true
|
||||||
|
|
||||||
|
try {
|
||||||
|
const res = await api.getRecord(this.currentPage, this.pageSize)
|
||||||
|
if (res.data) {
|
||||||
|
const newRecords = (res.data.records || []).map(record => ({
|
||||||
|
...record,
|
||||||
|
is_correct: String(record.answer || '').toUpperCase() === String(record.question_answer || '').toUpperCase()
|
||||||
|
}))
|
||||||
|
|
||||||
|
if (isLoadMore) {
|
||||||
|
this.recordList = [...this.recordList, ...newRecords]
|
||||||
|
} else {
|
||||||
|
this.recordList = newRecords
|
||||||
|
}
|
||||||
|
|
||||||
|
this.totalCount = res.data.count || 0
|
||||||
|
|
||||||
|
if (this.recordList.length >= this.totalCount) {
|
||||||
|
this.hasMore = false
|
||||||
|
} else {
|
||||||
|
this.currentPage++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取答题记录失败:', error)
|
||||||
|
// 检查是否是401错误
|
||||||
|
if (error.message && error.message.includes('401')) {
|
||||||
|
this.isNotLoggedIn = true
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
this.isLoading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
loadMore() {
|
||||||
|
this.loadRecord(true)
|
||||||
|
},
|
||||||
|
|
||||||
|
getDifficultyText(difficulty) {
|
||||||
|
if (!difficulty && difficulty !== 0) return '简单'
|
||||||
|
if (difficulty <= 30) return '简单'
|
||||||
|
if (difficulty <= 60) return '中等'
|
||||||
|
if (difficulty <= 80) return '困难'
|
||||||
|
return '极难'
|
||||||
|
},
|
||||||
|
|
||||||
|
getDifficultyClass(difficulty) {
|
||||||
|
if (!difficulty && difficulty !== 0) return 'difficulty-easy'
|
||||||
|
if (difficulty <= 30) return 'difficulty-easy'
|
||||||
|
if (difficulty <= 60) return 'difficulty-medium'
|
||||||
|
if (difficulty <= 80) return 'difficulty-hard'
|
||||||
|
return 'difficulty-extreme'
|
||||||
|
},
|
||||||
|
|
||||||
|
formatTime(timestamp) {
|
||||||
|
if (!timestamp) return ''
|
||||||
|
const date = new Date(timestamp * 1000)
|
||||||
|
const now = new Date()
|
||||||
|
const diff = now - date
|
||||||
|
|
||||||
|
const minute = 60 * 1000
|
||||||
|
const hour = 60 * minute
|
||||||
|
const day = 24 * hour
|
||||||
|
|
||||||
|
if (diff < minute) {
|
||||||
|
return '刚刚'
|
||||||
|
} else if (diff < hour) {
|
||||||
|
return Math.floor(diff / minute) + '分钟前'
|
||||||
|
} else if (diff < day) {
|
||||||
|
return Math.floor(diff / hour) + '小时前'
|
||||||
|
} else if (diff < 7 * day) {
|
||||||
|
return Math.floor(diff / day) + '天前'
|
||||||
|
} else {
|
||||||
|
const month = date.getMonth() + 1
|
||||||
|
const dayOfMonth = date.getDate()
|
||||||
|
return `${month}月${dayOfMonth}日`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.container {
|
||||||
|
height: 100vh;
|
||||||
|
width: 100%;
|
||||||
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||||
|
padding: 40rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/deep/ ::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
margin-bottom: 60rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.welcome {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.welcome-title {
|
||||||
|
display: block;
|
||||||
|
font-size: 48rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #ffffff;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.welcome-subtitle {
|
||||||
|
display: block;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.9);
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-section {
|
||||||
|
margin-bottom: 60rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-item {
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
padding: 30rpx;
|
||||||
|
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.1);
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-category {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #666;
|
||||||
|
background: #f0f0f0;
|
||||||
|
padding: 6rpx 16rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-difficulty {
|
||||||
|
padding: 6rpx 16rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.difficulty-easy {
|
||||||
|
background: #d4edda;
|
||||||
|
color: #155724;
|
||||||
|
}
|
||||||
|
|
||||||
|
.difficulty-medium {
|
||||||
|
background: #fff3cd;
|
||||||
|
color: #856404;
|
||||||
|
}
|
||||||
|
|
||||||
|
.difficulty-hard {
|
||||||
|
background: #fd7e14;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.difficulty-extreme {
|
||||||
|
background: #dc3545;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.difficulty-tag.difficulty-easy {
|
||||||
|
background: #d4edda;
|
||||||
|
color: #155724;
|
||||||
|
}
|
||||||
|
|
||||||
|
.difficulty-tag.difficulty-medium {
|
||||||
|
background: #fff3cd;
|
||||||
|
color: #856404;
|
||||||
|
}
|
||||||
|
|
||||||
|
.difficulty-tag.difficulty-hard {
|
||||||
|
background: #fd7e14;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.difficulty-tag.difficulty-extreme {
|
||||||
|
background: #dc3545;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.difficulty-text {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-question {
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: #333;
|
||||||
|
line-height: 1.6;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-footer {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding-top: 20rpx;
|
||||||
|
border-top: 2rpx solid #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-result {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-result.correct {
|
||||||
|
color: #28a745;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-result.wrong {
|
||||||
|
color: #dc3545;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-icon {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-text {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-time {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-record {
|
||||||
|
background: rgba(255, 255, 255, 0.15);
|
||||||
|
border-radius: 20rpx;
|
||||||
|
padding: 100rpx 40rpx;
|
||||||
|
text-align: center;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-icon {
|
||||||
|
font-size: 80rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-text {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.9);
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-hint {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.7);
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-more {
|
||||||
|
text-align: center;
|
||||||
|
padding: 40rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-text {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.9);
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-more {
|
||||||
|
text-align: center;
|
||||||
|
padding: 40rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-more-text {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-modal {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background: rgba(0, 0, 0, 0.5);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
z-index: 999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-content {
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
width: 90%;
|
||||||
|
max-height: 80vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding: 30rpx;
|
||||||
|
border-bottom: 2rpx solid #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-title {
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-close {
|
||||||
|
font-size: 48rpx;
|
||||||
|
color: #999;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-loading {
|
||||||
|
padding: 80rpx 40rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-body {
|
||||||
|
padding: 30rpx;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-meta {
|
||||||
|
display: flex;
|
||||||
|
gap: 20rpx;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.meta-tag {
|
||||||
|
padding: 8rpx 20rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.category-tag {
|
||||||
|
background: #e3f2fd;
|
||||||
|
color: #0d47a1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.difficulty-tag {
|
||||||
|
background: #f8f9fa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-question {
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.question-text {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #333;
|
||||||
|
line-height: 1.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-analysis {
|
||||||
|
background: #f0f9ff;
|
||||||
|
padding: 24rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.analysis-label {
|
||||||
|
font-size: 26rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #0d47a1;
|
||||||
|
margin-right: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.analysis-text {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #666;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-options {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 20rpx;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-option {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 24rpx 30rpx;
|
||||||
|
background: #f8f9fa;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
gap: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-option.correct {
|
||||||
|
background: #d4edda;
|
||||||
|
border: 2rpx solid #28a745;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-option.wrong {
|
||||||
|
background: #f8d7da;
|
||||||
|
border: 2rpx solid #dc3545;
|
||||||
|
}
|
||||||
|
|
||||||
|
.option-label {
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #666;
|
||||||
|
min-width: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.option-text {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-footer {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding-top: 20rpx;
|
||||||
|
border-top: 2rpx solid #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-result {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-result.correct {
|
||||||
|
color: #28a745;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-result.wrong {
|
||||||
|
color: #dc3545;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-answer {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.answer-text {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
20
utils/api.js
20
utils/api.js
@@ -254,6 +254,26 @@ const api = {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getPointInfo() {
|
||||||
|
return request({
|
||||||
|
url: config.api.getPointInfo,
|
||||||
|
method: 'POST',
|
||||||
|
noAuthModal: true
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
getPointRecord(page = 1, pageSize = 10) {
|
||||||
|
return request({
|
||||||
|
url: config.api.getPointRecord,
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
page,
|
||||||
|
page_size: pageSize
|
||||||
|
},
|
||||||
|
noAuthModal: true
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
getAllCategory() {
|
getAllCategory() {
|
||||||
return request({
|
return request({
|
||||||
url: config.api.getAllCategory,
|
url: config.api.getAllCategory,
|
||||||
|
|||||||
Reference in New Issue
Block a user