This commit is contained in:
parent
cd9edc2a32
commit
0f2f253b7f
|
|
@ -1,6 +1,10 @@
|
|||
<template>
|
||||
<view>
|
||||
<u-navbar leftIcon="" title="考试" :placeholder="true" />
|
||||
<u-navbar leftIcon="" title="考试" :placeholder="true">
|
||||
<view class="u-nav-slot" slot="right">
|
||||
<u-number-box v-model="fontSize" @change="changeFont" button-size="36"></u-number-box>
|
||||
</view>
|
||||
</u-navbar>
|
||||
<div class="content" @touchstart="touchStart" @touchmove="touchMove" @touchend="touchEnd">
|
||||
<div class="top-content">
|
||||
<div class="top-wrapper">
|
||||
|
|
@ -13,7 +17,27 @@
|
|||
:autoStart="false"
|
||||
:time="time"
|
||||
@change="changeCountDown"
|
||||
/>
|
||||
>
|
||||
<view class="time" style="color: #3c9cff">
|
||||
<view class="time__custom">
|
||||
<text class="time__custom__item">
|
||||
{{ timeData.hours > 10 ? timeData.hours : '0' + timeData.hours }}
|
||||
</text>
|
||||
</view>
|
||||
<text class="time__doc">:</text>
|
||||
<view class="time__custom">
|
||||
<text class="time__custom__item">
|
||||
{{ timeData.minutes > 10 ? timeData.minutes : '0' + timeData.minutes }}
|
||||
</text>
|
||||
</view>
|
||||
<text class="time__doc">:</text>
|
||||
<view class="time__custom">
|
||||
<text class="time__custom__item">
|
||||
{{ timeData.seconds > 10 ? timeData.seconds : '0' + timeData.seconds }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</u-count-down>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
|
|
@ -38,7 +62,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="unfold" @click="handleUnfold">
|
||||
{{ isRotating ? '收起' : '展开' }}
|
||||
<span style="font-size: 16px">{{ isRotating ? '收起' : '展开' }}</span>
|
||||
<u-icon v-if="!this.isRotating" name="arrow-down-fill" size="10" />
|
||||
<u-icon v-else name="arrow-up-fill" size="10" />
|
||||
</div>
|
||||
|
|
@ -91,13 +115,13 @@
|
|||
<!-- 底部按钮 -->
|
||||
<div class="bottom-btn">
|
||||
<div class="btn" v-show="currentIndex != 0">
|
||||
<u-button size="small" shape="circle" text="上一题" @click="currentIndex--" />
|
||||
<u-button shape="circle" text="上一题" @click="currentIndex--" />
|
||||
</div>
|
||||
<div class="btn" v-if="currentIndex !== questionList.length - 1">
|
||||
<u-button type="primary" size="small" shape="circle" text="下一题" @click="currentIndex++" />
|
||||
<u-button type="primary" shape="circle" text="下一题" @click="currentIndex++" />
|
||||
</div>
|
||||
<div class="btn">
|
||||
<u-button type="primary" size="small" shape="circle" text="交 卷" @click="openConfirmModal" />
|
||||
<u-button type="primary" shape="circle" text="交 卷" @click="openConfirmModal" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -174,7 +198,11 @@ export default {
|
|||
isHide: false,
|
||||
failCount: 3,
|
||||
startX: 0, // 起始触摸点X坐标
|
||||
endX: 0 // 结束触摸点X坐标
|
||||
startY: 0, // 起始触摸点Y坐标
|
||||
endX: 0, // 结束触摸点X坐标
|
||||
endY: 0, // 结束触摸点Y坐标
|
||||
fontSize: 20,
|
||||
timeData: {}
|
||||
}
|
||||
},
|
||||
onLoad(opt) {
|
||||
|
|
@ -219,6 +247,10 @@ export default {
|
|||
// this.handleConfirmSubmit()
|
||||
// },
|
||||
methods: {
|
||||
changeFont(e) {
|
||||
console.log('🚀 ~ changeFont ~ e:', e)
|
||||
this.fontSize = e.value
|
||||
},
|
||||
// 获取列表
|
||||
async getList() {
|
||||
try {
|
||||
|
|
@ -274,6 +306,7 @@ export default {
|
|||
}
|
||||
},
|
||||
changeCountDown(time) {
|
||||
this.timeData = time
|
||||
// console.log('🚀 ~ changeCountDown ~ time:', time)
|
||||
// 等时间赋值后再开始计时
|
||||
if (this.time == 0 && !this.isLoading) return
|
||||
|
|
@ -587,24 +620,31 @@ export default {
|
|||
touchStart(event) {
|
||||
this.startX = 0
|
||||
this.endX = 0
|
||||
this.startY = 0
|
||||
this.endY = 0
|
||||
console.log('🚀 ~ 开始 ~ event:', event)
|
||||
// 记录触摸开始的位置
|
||||
this.startX = event.touches[0].clientX
|
||||
this.startY = event.touches[0].clientY
|
||||
console.log('🚀 ~ touchStart ~ this.startX:', this.startX)
|
||||
},
|
||||
touchMove(event) {
|
||||
console.log('🚀 ~ 移动 ~ event:', event)
|
||||
// 在触摸过程中可以获取当前触摸点位置
|
||||
this.endX = event.touches[0].clientX
|
||||
this.endY = event.touches[0].clientY
|
||||
console.log('🚀 ~ touchMove ~ this.endX:', this.endX)
|
||||
},
|
||||
touchEnd() {
|
||||
// 判断滑动方向
|
||||
if (this.startX != 0 && this.endX != 0 && this.startX - this.endX > 10) {
|
||||
const deltaX = this.startX - this.endX
|
||||
const deltaY = this.startY - this.endY
|
||||
if (Math.abs(deltaY) < Math.abs(deltaX)) {
|
||||
if (this.startX != 0 && this.endX != 0 && deltaX > 10) {
|
||||
// 左滑
|
||||
console.log('向左滑动')
|
||||
this.currentIndex++
|
||||
} else if (this.startX != 0 && this.endX != 0 && this.endX - this.startX > 10) {
|
||||
} else if (this.startX != 0 && this.endX != 0 && deltaX < -10) {
|
||||
// 右滑
|
||||
console.log('向右滑动')
|
||||
this.currentIndex--
|
||||
|
|
@ -615,6 +655,7 @@ export default {
|
|||
this.currentIndex = this.questionList.length - 1
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onBackPress(options) {
|
||||
console.log(options)
|
||||
|
|
@ -718,7 +759,6 @@ export default {
|
|||
|
||||
.question {
|
||||
font-weight: 800;
|
||||
font-size: 15px;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,7 +166,9 @@ export default {
|
|||
unAnsweredList: [],
|
||||
list: [],
|
||||
startX: 0, // 起始触摸点X坐标
|
||||
endX: 0 // 结束触摸点X坐标
|
||||
startY: 0, // 起始触摸点Y坐标
|
||||
endX: 0, // 结束触摸点X坐标
|
||||
endY: 0 // 结束触摸点Y坐标
|
||||
}
|
||||
},
|
||||
onLoad(opt) {
|
||||
|
|
@ -334,24 +336,31 @@ export default {
|
|||
touchStart(event) {
|
||||
this.startX = 0
|
||||
this.endX = 0
|
||||
this.startY = 0
|
||||
this.endY = 0
|
||||
console.log('🚀 ~ 开始 ~ event:', event)
|
||||
// 记录触摸开始的位置
|
||||
this.startX = event.touches[0].clientX
|
||||
this.startY = event.touches[0].clientY
|
||||
console.log('🚀 ~ touchStart ~ this.startX:', this.startX)
|
||||
},
|
||||
touchMove(event) {
|
||||
console.log('🚀 ~ 移动 ~ event:', event)
|
||||
// 在触摸过程中可以获取当前触摸点位置
|
||||
this.endX = event.touches[0].clientX
|
||||
this.endY = event.touches[0].clientY
|
||||
console.log('🚀 ~ touchMove ~ this.endX:', this.endX)
|
||||
},
|
||||
touchEnd() {
|
||||
// 判断滑动方向
|
||||
if (this.startX != 0 && this.endX != 0 && this.startX - this.endX > 10) {
|
||||
const deltaX = this.startX - this.endX
|
||||
const deltaY = this.startY - this.endY
|
||||
if (Math.abs(deltaY) < Math.abs(deltaX)) {
|
||||
if (this.startX != 0 && this.endX != 0 && deltaX > 10) {
|
||||
// 左滑
|
||||
console.log('向左滑动')
|
||||
this.currentIndex++
|
||||
} else if (this.startX != 0 && this.endX != 0 && this.endX - this.startX > 10) {
|
||||
} else if (this.startX != 0 && this.endX != 0 && deltaX < -10) {
|
||||
// 右滑
|
||||
console.log('向右滑动')
|
||||
this.currentIndex--
|
||||
|
|
@ -363,6 +372,7 @@ export default {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,22 +1,34 @@
|
|||
<template>
|
||||
<view class="wrapper">
|
||||
<view class="wrapper" :style="{ fontSize: fontSize + 'px' }">
|
||||
<u-navbar leftIcon="" title="" :placeholder="true">
|
||||
<view class="u-nav-slot" slot="right">
|
||||
<u-number-box v-model="fontSize" @change="changeFont" button-size="36"></u-number-box>
|
||||
</view>
|
||||
</u-navbar>
|
||||
<div class="top-time">已用时间 {{ usedTime }}</div>
|
||||
<div class="num-wrapper">
|
||||
<div class="correct">
|
||||
<u-icon name="/static/images/true.png" size="18" />
|
||||
<u-icon name="/static/images/true.png" :size="fontSize" />
|
||||
<div class="num">{{ trueNum }}</div>
|
||||
</div>
|
||||
<div class="error">
|
||||
<u-icon name="/static/images/error.png" size="18" />
|
||||
<u-icon name="/static/images/error.png" :size="fontSize" />
|
||||
<div class="num">{{ falseNum }}</div>
|
||||
</div>
|
||||
<div class="total" @click="openSelect">
|
||||
<u-icon name="/static/images/quanbufenlei.png" size="18" />
|
||||
<u-icon name="/static/images/quanbufenlei.png" :size="fontSize" />
|
||||
<div class="num">{{ nowNum }}/{{ allNum }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="question-wrapper" v-for="(item, index) in questionList" :key="index" @touchstart="touchStart" @touchmove="touchMove" @touchend="touchEnd">
|
||||
<div
|
||||
class="question-wrapper"
|
||||
v-for="(item, index) in questionList"
|
||||
:key="index"
|
||||
@touchstart="touchStart"
|
||||
@touchmove="touchMove"
|
||||
@touchend="touchEnd"
|
||||
>
|
||||
<div v-if="item.examType != 2">
|
||||
<div class="title">{{ nowNum }}.{{ item.paperTopic }}{{ item.examType == 1 ? '(单选题)' : '(判断题)' }}</div>
|
||||
<u--image
|
||||
|
|
@ -111,7 +123,6 @@
|
|||
v-show="item.listOption.some(option => option.isCheck) && !item.isSelect"
|
||||
text="选好了"
|
||||
shape="circle"
|
||||
size="small"
|
||||
color="linear-gradient(to right, rgba(47, 195, 255, 1), rgba(5, 70, 173, 1))"
|
||||
@click="handleOk"
|
||||
/>
|
||||
|
|
@ -132,7 +143,6 @@
|
|||
<div class="btn">
|
||||
<u-button
|
||||
type="primary"
|
||||
size="small"
|
||||
shape="circle"
|
||||
text="提交"
|
||||
color="linear-gradient(to right, rgba(250, 223, 103, 1), rgba(207, 163, 14, 1)"
|
||||
|
|
@ -143,7 +153,6 @@
|
|||
<u-button
|
||||
v-show="nowNum > 1"
|
||||
type="primary"
|
||||
size="small"
|
||||
shape="circle"
|
||||
text="上一题"
|
||||
color="linear-gradient(to right, rgba(47, 195, 255, 1), rgba(5, 70, 173, 1))"
|
||||
|
|
@ -154,7 +163,6 @@
|
|||
<u-button
|
||||
v-show="nowNum < allNum"
|
||||
type="primary"
|
||||
size="small"
|
||||
shape="circle"
|
||||
text="下一题"
|
||||
color="linear-gradient(to right, rgba(47, 195, 255, 1), rgba(5, 70, 173, 1))"
|
||||
|
|
@ -212,6 +220,8 @@
|
|||
</div>
|
||||
</view>
|
||||
</u-modal>
|
||||
|
||||
<u-loading-page :loading="isLoading"></u-loading-page>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
@ -262,7 +272,12 @@ export default {
|
|||
studyId: '', // 学习id
|
||||
fileUrl: config.fileUrl,
|
||||
intervalId: '',
|
||||
isEnd: false
|
||||
isEnd: false,
|
||||
startX: 0, // 起始触摸点X坐标
|
||||
startY: 0, // 起始触摸点Y坐标
|
||||
endX: 0, // 结束触摸点X坐标
|
||||
endY: 0, // 结束触摸点Y坐标
|
||||
fontSize: 20
|
||||
}
|
||||
},
|
||||
onLoad(opt) {
|
||||
|
|
@ -286,6 +301,10 @@ export default {
|
|||
this.handleClose()
|
||||
},
|
||||
methods: {
|
||||
changeFont(e) {
|
||||
console.log('🚀 ~ changeFont ~ e:', e)
|
||||
this.fontSize = e.value
|
||||
},
|
||||
// 获取题目-上方数量
|
||||
getPracticeItData() {
|
||||
const params = {
|
||||
|
|
@ -598,12 +617,13 @@ export default {
|
|||
if (item.isSelect) {
|
||||
return
|
||||
}
|
||||
// 给当前点击的增加边框 再次点击取消
|
||||
if (!option.isCheck) {
|
||||
this.questionList[0].listOption[index].isCheck = !option.isCheck
|
||||
} else {
|
||||
this.questionList[0].listOption[index].isCheck = false
|
||||
}
|
||||
|
||||
// 使用 this.$set 确保 Vue 能够检测到数组的变化
|
||||
this.$set(this.questionList[0].listOption, index, {
|
||||
...option,
|
||||
isCheck: !option.isCheck
|
||||
})
|
||||
|
||||
// 将 isCheck: true 的选项的 value 放入 select 数组
|
||||
this.questionList[0].select = this.questionList[0].listOption
|
||||
.filter(item => item.isCheck)
|
||||
|
|
@ -804,7 +824,7 @@ export default {
|
|||
},
|
||||
// 打开题目选择弹框
|
||||
openSelect() {
|
||||
this.showModalSelect = true
|
||||
this.isLoading = true
|
||||
// const res = await this.getPracticeQuestionList()
|
||||
// console.log('🚀 ~ openSelect ~ res:', res)
|
||||
// this.questionListSelect = res.data
|
||||
|
|
@ -823,11 +843,13 @@ export default {
|
|||
Authorization: uni.getStorageSync('access_token')
|
||||
},
|
||||
success: res => {
|
||||
this.showModalSelect = true
|
||||
console.log('🚀 ~ getPracticeQuestionList ~ res:', res)
|
||||
res = res.data
|
||||
this.questionListSelect = res.data
|
||||
},
|
||||
fail: err => {
|
||||
this.isLoading = false
|
||||
console.log(err)
|
||||
}
|
||||
})
|
||||
|
|
@ -835,29 +857,37 @@ export default {
|
|||
touchStart(event) {
|
||||
this.startX = 0
|
||||
this.endX = 0
|
||||
this.startY = 0
|
||||
this.endY = 0
|
||||
console.log('🚀 ~ 开始 ~ event:', event)
|
||||
// 记录触摸开始的位置
|
||||
this.startX = event.touches[0].clientX
|
||||
this.startY = event.touches[0].clientY
|
||||
console.log('🚀 ~ touchStart ~ this.startX:', this.startX)
|
||||
},
|
||||
touchMove(event) {
|
||||
console.log('🚀 ~ 移动 ~ event:', event)
|
||||
// 在触摸过程中可以获取当前触摸点位置
|
||||
this.endX = event.touches[0].clientX
|
||||
this.endY = event.touches[0].clientY
|
||||
console.log('🚀 ~ touchMove ~ this.endX:', this.endX)
|
||||
},
|
||||
touchEnd() {
|
||||
// 判断滑动方向
|
||||
if (this.startX != 0 && this.endX != 0 && this.startX - this.endX > 10) {
|
||||
const deltaX = this.startX - this.endX
|
||||
const deltaY = this.startY - this.endY
|
||||
if (Math.abs(deltaY) < Math.abs(deltaX)) {
|
||||
if (this.startX != 0 && this.endX != 0 && deltaX > 10) {
|
||||
// 左滑
|
||||
console.log('向左滑动')
|
||||
this.handleJump('next')
|
||||
} else if (this.startX != 0 && this.endX != 0 && this.endX - this.startX > 10) {
|
||||
} else if (this.startX != 0 && this.endX != 0 && deltaX < -10) {
|
||||
// 右滑
|
||||
console.log('向右滑动')
|
||||
this.handleJump('prev')
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onBackPress(options) {
|
||||
console.log(options)
|
||||
|
|
@ -884,7 +914,6 @@ export default {
|
|||
.slot-content {
|
||||
width: 100%;
|
||||
.correctRate {
|
||||
font-size: 30px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
|
@ -904,7 +933,6 @@ export default {
|
|||
align-items: center;
|
||||
color: #9d9b9b;
|
||||
.num {
|
||||
font-size: 20px;
|
||||
color: #3185f0;
|
||||
}
|
||||
}
|
||||
|
|
@ -928,7 +956,6 @@ export default {
|
|||
align-items: center;
|
||||
margin: 10px;
|
||||
.topic {
|
||||
font-size: 11px;
|
||||
color: #409eff;
|
||||
}
|
||||
// 正确背景
|
||||
|
|
@ -975,21 +1002,19 @@ export default {
|
|||
}
|
||||
|
||||
.question-wrapper {
|
||||
height: 500px;
|
||||
height: 64vh;
|
||||
overflow: auto;
|
||||
padding: 30px;
|
||||
color: #08428d;
|
||||
|
||||
.title {
|
||||
font-weight: 500;
|
||||
font-size: 15px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
.option {
|
||||
margin-bottom: 5px;
|
||||
padding: 0 15px;
|
||||
min-height: 45px;
|
||||
max-height: 100px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
|
@ -997,7 +1022,6 @@ export default {
|
|||
border-radius: 8px;
|
||||
overflow: auto;
|
||||
.label-wrapper {
|
||||
max-height: 100px;
|
||||
overflow: auto;
|
||||
.label {
|
||||
display: flex;
|
||||
|
|
@ -1024,8 +1048,6 @@ export default {
|
|||
|
||||
.top-time {
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
/* color: #fff; */
|
||||
color: #333;
|
||||
padding-top: 60px;
|
||||
}
|
||||
|
|
@ -1040,7 +1062,6 @@ export default {
|
|||
.total {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 13px;
|
||||
margin: 0 6px;
|
||||
}
|
||||
.correct {
|
||||
|
|
|
|||
|
|
@ -34,47 +34,19 @@
|
|||
<div class="right-top">
|
||||
<div class="right-text">顺序练习</div>
|
||||
<div class="btn" v-if="!isNew">
|
||||
<u-button
|
||||
type="primary"
|
||||
plain
|
||||
shape="circle"
|
||||
text="继续上次练习"
|
||||
size="small"
|
||||
@click="handleExercises(1)"
|
||||
></u-button>
|
||||
<u-button type="primary" plain shape="circle" text="继续上次练习" @click="handleExercises(1)"></u-button>
|
||||
</div>
|
||||
<div class="btn">
|
||||
<u-button
|
||||
type="primary"
|
||||
plain
|
||||
shape="circle"
|
||||
text="开始新的练习"
|
||||
size="small"
|
||||
@click="handleExercises(2)"
|
||||
></u-button>
|
||||
<u-button type="primary" plain shape="circle" text="开始新的练习" @click="handleExercises(2)"></u-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right-bottom">
|
||||
<div class="right-text">随机练习</div>
|
||||
<div class="btn" v-if="!isNew">
|
||||
<u-button
|
||||
type="primary"
|
||||
plain
|
||||
shape="circle"
|
||||
text="继续上次练习"
|
||||
size="small"
|
||||
@click="handleExercises(3)"
|
||||
></u-button>
|
||||
<u-button type="primary" plain shape="circle" text="继续上次练习" @click="handleExercises(3)"></u-button>
|
||||
</div>
|
||||
<div class="btn">
|
||||
<u-button
|
||||
type="primary"
|
||||
plain
|
||||
shape="circle"
|
||||
text="开始新的练习"
|
||||
size="small"
|
||||
@click="handleExercises(4)"
|
||||
></u-button>
|
||||
<u-button type="primary" plain shape="circle" text="开始新的练习" @click="handleExercises(4)"></u-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -115,6 +87,7 @@ export default {
|
|||
onShow() {},
|
||||
onLoad(opt) {
|
||||
opt = JSON.parse(opt.params)
|
||||
console.log('🚀 ~ onLoad ~ opt:', opt)
|
||||
this.practiceId = opt.practiceId
|
||||
this.title = opt.title
|
||||
this.studyId = opt.studyId || '' // 学习id
|
||||
|
|
@ -137,6 +110,7 @@ export default {
|
|||
},
|
||||
success: res => {
|
||||
res = res.data
|
||||
console.log('🚀 ~ handleSubmit ~ res:', res)
|
||||
this.title = res.data.name
|
||||
this.userName = res.data.userName
|
||||
this.correctRate = res.data.trueRate || '0%'
|
||||
|
|
@ -223,7 +197,7 @@ export default {
|
|||
justify-content: space-between;
|
||||
.left {
|
||||
width: 52%;
|
||||
height: 209px;
|
||||
/* height: 209px; */
|
||||
background: #5185ed;
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
|
|
@ -259,17 +233,18 @@ export default {
|
|||
justify-content: space-between;
|
||||
|
||||
.btn {
|
||||
width: 60%;
|
||||
margin: 5px auto;
|
||||
width: 80%;
|
||||
margin: 10px auto;
|
||||
}
|
||||
|
||||
.right-top {
|
||||
height: 98px;
|
||||
// background: #e7ac67;
|
||||
background: url('../../../static/images/order-exercises.png') no-repeat;
|
||||
height: 158px;
|
||||
background: #e7ac67;
|
||||
/* background: url('../../../static/images/order-exercises.png') no-repeat; */
|
||||
background-size: 100% 98px;
|
||||
border-radius: 8px;
|
||||
position: relative;
|
||||
margin-bottom: 10px;
|
||||
// top-icon - 在当前位置的右下角
|
||||
.top-icon {
|
||||
position: absolute;
|
||||
|
|
@ -278,7 +253,7 @@ export default {
|
|||
}
|
||||
}
|
||||
.right-bottom {
|
||||
height: 98px;
|
||||
height: 158px;
|
||||
background: #73c2f7;
|
||||
border-radius: 8px 8px 8px 8px;
|
||||
position: relative;
|
||||
|
|
@ -294,7 +269,7 @@ export default {
|
|||
font-weight: 500;
|
||||
font-size: 15px;
|
||||
color: #fff;
|
||||
margin: 5px 0 0 10px;
|
||||
margin: 5px 0 15px 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue