|
|
@@ -49,16 +49,10 @@
|
|
|
<view style="height: 160rpx;"></view>
|
|
|
</scroll-view>
|
|
|
|
|
|
- <!-- 阅读完成浮动按钮 -->
|
|
|
+ <!-- 阅读完成 -->
|
|
|
<view v-if="!showQuiz && !showResult" class="detail-footer">
|
|
|
- <view class="reading-timer">
|
|
|
- <text class="timer-icon">⏱</text>
|
|
|
- <text class="timer-text">{{ formatTime(readingSeconds) }}</text>
|
|
|
- </view>
|
|
|
<button
|
|
|
class="read-btn"
|
|
|
- :class="{ 'read-btn-ready': readingSeconds >= 10 }"
|
|
|
- :disabled="readingSeconds < 10"
|
|
|
@click="onReadComplete"
|
|
|
>阅读完成</button>
|
|
|
</view>
|
|
|
@@ -114,7 +108,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getArticleDetail, getAiQuestions, submitAnswers, recordArticleRead } from '@/utils/api.js'
|
|
|
+import { getArticleDetail, getAiQuestions, submitAnswers } from '@/utils/api.js'
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
@@ -124,8 +118,7 @@ export default {
|
|
|
loading: true,
|
|
|
error: false,
|
|
|
errorMsg: '',
|
|
|
- readingSeconds: 0,
|
|
|
- readingTimer: null,
|
|
|
+ // timer removed
|
|
|
showQuiz: false,
|
|
|
quizLoading: false,
|
|
|
quizError: false,
|
|
|
@@ -152,7 +145,6 @@ export default {
|
|
|
if (options && options.id) {
|
|
|
this.articleId = options.id
|
|
|
this.loadDetail(options.id)
|
|
|
- this.startTimer()
|
|
|
} else {
|
|
|
this.error = true
|
|
|
this.errorMsg = '参数错误'
|
|
|
@@ -160,7 +152,6 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
onUnload() {
|
|
|
- this.stopTimer()
|
|
|
},
|
|
|
methods: {
|
|
|
async loadDetail(id) {
|
|
|
@@ -181,23 +172,7 @@ export default {
|
|
|
this.loading = false
|
|
|
}
|
|
|
},
|
|
|
- startTimer() {
|
|
|
- var self = this
|
|
|
- this.readingTimer = setInterval(function() {
|
|
|
- self.readingSeconds++
|
|
|
- }, 1000)
|
|
|
- },
|
|
|
- stopTimer() {
|
|
|
- if (this.readingTimer) {
|
|
|
- clearInterval(this.readingTimer)
|
|
|
- this.readingTimer = null
|
|
|
- }
|
|
|
- },
|
|
|
- formatTime(seconds) {
|
|
|
- var m = Math.floor(seconds / 60)
|
|
|
- var s = seconds % 60
|
|
|
- return (m < 10 ? '0' + m : m) + ':' + (s < 10 ? '0' + s : s)
|
|
|
- },
|
|
|
+ // timer methods removed
|
|
|
formatDate(dateStr) {
|
|
|
if (!dateStr) return ''
|
|
|
return dateStr.slice(0, 10)
|
|
|
@@ -231,17 +206,7 @@ export default {
|
|
|
// 滚动到底部
|
|
|
},
|
|
|
async onReadComplete() {
|
|
|
- this.stopTimer()
|
|
|
- try {
|
|
|
- var childId = uni.getStorageSync('currentChildId')
|
|
|
- await recordArticleRead({
|
|
|
- id: this.article.id,
|
|
|
- durationSeconds: this.readingSeconds,
|
|
|
- childId: childId || undefined
|
|
|
- })
|
|
|
- } catch (e) {
|
|
|
- // 阅读记录失败不影响出题
|
|
|
- }
|
|
|
+ // 计时器已移除,直接进入答题
|
|
|
this.showQuiz = true
|
|
|
this.loadQuiz()
|
|
|
},
|
|
|
@@ -333,12 +298,7 @@ export default {
|
|
|
.detail-body rich-text { word-break: break-word; }
|
|
|
/* 底部按钮 */
|
|
|
.detail-footer { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; padding: 20rpx 30rpx; display: flex; align-items: center; box-shadow: 0 -2rpx 10rpx rgba(0,0,0,0.06); z-index: 10; }
|
|
|
-.reading-timer { display: flex; align-items: center; margin-right: 20rpx; }
|
|
|
-.timer-icon { font-size: 32rpx; margin-right: 6rpx; }
|
|
|
-.timer-text { font-size: 28rpx; font-weight: bold; color: #333; }
|
|
|
-.read-btn { flex: 1; height: 80rpx; line-height: 80rpx; background: #ddd; color: #fff; font-size: 30rpx; font-weight: bold; border-radius: 40rpx; text-align: center; border: none; }
|
|
|
-.read-btn-ready { background: linear-gradient(135deg, #5B9BD5, #3A7CC4); }
|
|
|
-.read-btn[disabled] { opacity: 0.5; }
|
|
|
+.read-btn { flex: 1; height: 80rpx; line-height: 80rpx; background: linear-gradient(135deg, #5B9BD5, #3A7CC4); color: #fff; font-size: 30rpx; font-weight: bold; border-radius: 40rpx; text-align: center; border: none; }
|
|
|
.read-btn::after { border: none; }
|
|
|
/* 答题区 */
|
|
|
.quiz-container { padding: 30rpx; }
|