This commit is contained in:
binbin_pan 2024-12-19 18:45:49 +08:00
parent 6e20aa837c
commit d899df8226
5 changed files with 162 additions and 116 deletions

View File

@ -41,8 +41,7 @@ module.exports = {
// module.exports = { // module.exports = {
// // baseUrl:'/prod-api', // // baseUrl:'/prod-api',
// // http://192.168.0.14:19999 // // http://192.168.0.14:19999
// loginBaseUrl: 'http://112.29.103.165:1616', // loginBaseUrl: 'http://192.168.0.14:27018',
// // loginBaseUrl: 'http://192.168.0.14:27018',
// // loginBaseUrl:'http://192.168.0.14:19999', // // loginBaseUrl:'http://192.168.0.14:19999',
// // baseUrl:'http://192.168.0.14:2900', // // baseUrl:'http://192.168.0.14:2900',
// baseUrl: 'http://192.168.0.14:19999', // baseUrl: 'http://192.168.0.14:19999',

View File

@ -1,6 +1,10 @@
<template> <template>
<view> <view :style="{ fontSize: fontSize + 'px' }">
<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="content" @touchstart="touchStart" @touchmove="touchMove" @touchend="touchEnd">
<div class="top-content"> <div class="top-content">
<div class="top-wrapper"> <div class="top-wrapper">
@ -13,7 +17,27 @@
:autoStart="false" :autoStart="false"
:time="time" :time="time"
@change="changeCountDown" @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> </div>
<div> <div>
@ -38,7 +62,7 @@
</div> </div>
</div> </div>
<div class="unfold" @click="handleUnfold"> <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-if="!this.isRotating" name="arrow-down-fill" size="10" />
<u-icon v-else name="arrow-up-fill" size="10" /> <u-icon v-else name="arrow-up-fill" size="10" />
</div> </div>
@ -91,13 +115,13 @@
<!-- 底部按钮 --> <!-- 底部按钮 -->
<div class="bottom-btn"> <div class="bottom-btn">
<div class="btn" v-show="currentIndex != 0"> <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>
<div class="btn" v-if="currentIndex !== questionList.length - 1"> <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>
<div class="btn"> <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> </div>
</div> </div>
@ -174,7 +198,11 @@ export default {
isHide: false, isHide: false,
failCount: 3, failCount: 3,
startX: 0, // X startX: 0, // X
endX: 0 // X startY: 0, // Y
endX: 0, // X
endY: 0, // Y
fontSize: 20,
timeData: {}
} }
}, },
onLoad(opt) { onLoad(opt) {
@ -218,6 +246,10 @@ export default {
// this.handleConfirmSubmit() // this.handleConfirmSubmit()
// }, // },
methods: { methods: {
changeFont(e) {
console.log('🚀 ~ changeFont ~ e:', e)
this.fontSize = e.value
},
// //
async getList() { async getList() {
try { try {
@ -271,6 +303,7 @@ export default {
} }
}, },
changeCountDown(time) { changeCountDown(time) {
this.timeData = time
// console.log('🚀 ~ changeCountDown ~ time:', time) // console.log('🚀 ~ changeCountDown ~ time:', time)
// //
if (this.time == 0 && !this.isLoading) return if (this.time == 0 && !this.isLoading) return
@ -585,32 +618,42 @@ export default {
touchStart(event) { touchStart(event) {
this.startX = 0 this.startX = 0
this.endX = 0 this.endX = 0
this.startY = 0
this.endY = 0
console.log('🚀 ~ 开始 ~ event:', event) console.log('🚀 ~ 开始 ~ event:', event)
// //
this.startX = event.touches[0].clientX this.startX = event.touches[0].clientX
this.startY = event.touches[0].clientY
console.log('🚀 ~ touchStart ~ this.startX:', this.startX) console.log('🚀 ~ touchStart ~ this.startX:', this.startX)
console.log('🚀 ~ touchStart ~ this.startY:', this.startY)
}, },
touchMove(event) { touchMove(event) {
console.log('🚀 ~ 移动 ~ event:', event) console.log('🚀 ~ 移动 ~ event:', event)
// //
this.endX = event.touches[0].clientX this.endX = event.touches[0].clientX
this.endY = event.touches[0].clientY
console.log('🚀 ~ touchMove ~ this.endX:', this.endX) console.log('🚀 ~ touchMove ~ this.endX:', this.endX)
console.log('🚀 ~ touchMove ~ this.endY:', this.endY)
}, },
touchEnd() { 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
console.log('向左滑动') if (Math.abs(deltaY) < Math.abs(deltaX)) {
this.currentIndex++ if (this.startX != 0 && this.endX != 0 && deltaX > 10) {
} else if (this.startX != 0 && this.endX != 0 && this.endX - this.startX > 10) { //
// console.log('向左滑动')
console.log('向右滑动') this.currentIndex++
this.currentIndex-- } else if (this.startX != 0 && this.endX != 0 && deltaX < -10) {
} //
if (this.currentIndex < 0) { console.log('向右滑动')
this.currentIndex = 0 this.currentIndex--
} else if (this.currentIndex > this.questionList.length - 1) { }
this.currentIndex = this.questionList.length - 1 if (this.currentIndex < 0) {
this.currentIndex = 0
} else if (this.currentIndex > this.questionList.length - 1) {
this.currentIndex = this.questionList.length - 1
}
} }
} }
}, },
@ -716,7 +759,6 @@ export default {
.question { .question {
font-weight: 800; font-weight: 800;
font-size: 15px;
color: #333333; color: #333333;
} }
} }
@ -761,6 +803,7 @@ export default {
width: 100%; width: 100%;
background-color: #fff; background-color: #fff;
padding: 15px 0; padding: 15px 0;
padding-bottom: 18px;
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
align-items: center; align-items: center;

View File

@ -165,7 +165,9 @@ export default {
unAnsweredList: [], unAnsweredList: [],
list: [], list: [],
startX: 0, // X startX: 0, // X
endX: 0 // X startY: 0, // Y
endX: 0, // X
endY: 0 // Y
} }
}, },
onLoad(opt) { onLoad(opt) {
@ -333,32 +335,41 @@ export default {
touchStart(event) { touchStart(event) {
this.startX = 0 this.startX = 0
this.endX = 0 this.endX = 0
this.startY = 0
this.endY = 0
console.log('🚀 ~ 开始 ~ event:', event) console.log('🚀 ~ 开始 ~ event:', event)
// //
this.startX = event.touches[0].clientX this.startX = event.touches[0].clientX
this.startY = event.touches[0].clientY
console.log('🚀 ~ touchStart ~ this.startX:', this.startX) console.log('🚀 ~ touchStart ~ this.startX:', this.startX)
}, },
touchMove(event) { touchMove(event) {
console.log('🚀 ~ 移动 ~ event:', event) console.log('🚀 ~ 移动 ~ event:', event)
// //
this.endX = event.touches[0].clientX this.endX = event.touches[0].clientX
this.endY = event.touches[0].clientY
console.log('🚀 ~ touchMove ~ this.endX:', this.endX) console.log('🚀 ~ touchMove ~ this.endX:', this.endX)
}, },
touchEnd() { touchEnd() {
// //
if (this.startX != 0 && this.endX != 0 && this.startX - this.endX > 10) { //
// const deltaX = this.startX - this.endX
console.log('向左滑动') const deltaY = this.startY - this.endY
this.currentIndex++ if (Math.abs(deltaY) < Math.abs(deltaX)) {
} else if (this.startX != 0 && this.endX != 0 && this.endX - this.startX > 10) { if (this.startX != 0 && this.endX != 0 && deltaX > 10) {
// //
console.log('向右滑动') console.log('向左滑动')
this.currentIndex-- this.currentIndex++
} } else if (this.startX != 0 && this.endX != 0 && deltaX < -10) {
if (this.currentIndex < 0) { //
this.currentIndex = 0 console.log('向右滑动')
} else if (this.currentIndex > this.questionList.length - 1) { this.currentIndex--
this.currentIndex = this.questionList.length - 1 }
if (this.currentIndex < 0) {
this.currentIndex = 0
} else if (this.currentIndex > this.questionList.length - 1) {
this.currentIndex = this.questionList.length - 1
}
} }
} }
} }

View File

@ -1,22 +1,34 @@
<template> <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="top-time">已用时间 {{ usedTime }}</div>
<div class="num-wrapper"> <div class="num-wrapper">
<div class="correct"> <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 class="num">{{ trueNum }}</div>
</div> </div>
<div class="error"> <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 class="num">{{ falseNum }}</div>
</div> </div>
<div class="total" @click="openSelect"> <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 class="num">{{ nowNum }}/{{ allNum }}</div>
</div> </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 v-if="item.examType != 2">
<div class="title">{{ nowNum }}.{{ item.paperTopic }}{{ item.examType == 1 ? '(单选题)' : '(判断题)' }}</div> <div class="title">{{ nowNum }}.{{ item.paperTopic }}{{ item.examType == 1 ? '(单选题)' : '(判断题)' }}</div>
<u--image <u--image
@ -111,7 +123,6 @@
v-show="item.listOption.some(option => option.isCheck) && !item.isSelect" v-show="item.listOption.some(option => option.isCheck) && !item.isSelect"
text="选好了" text="选好了"
shape="circle" shape="circle"
size="small"
color="linear-gradient(to right, rgba(47, 195, 255, 1), rgba(5, 70, 173, 1))" color="linear-gradient(to right, rgba(47, 195, 255, 1), rgba(5, 70, 173, 1))"
@click="handleOk" @click="handleOk"
/> />
@ -132,7 +143,6 @@
<div class="btn"> <div class="btn">
<u-button <u-button
type="primary" type="primary"
size="small"
shape="circle" shape="circle"
text="提交" text="提交"
color="linear-gradient(to right, rgba(250, 223, 103, 1), rgba(207, 163, 14, 1)" color="linear-gradient(to right, rgba(250, 223, 103, 1), rgba(207, 163, 14, 1)"
@ -143,7 +153,6 @@
<u-button <u-button
v-show="nowNum > 1" v-show="nowNum > 1"
type="primary" type="primary"
size="small"
shape="circle" shape="circle"
text="上一题" text="上一题"
color="linear-gradient(to right, rgba(47, 195, 255, 1), rgba(5, 70, 173, 1))" color="linear-gradient(to right, rgba(47, 195, 255, 1), rgba(5, 70, 173, 1))"
@ -154,7 +163,6 @@
<u-button <u-button
v-show="nowNum < allNum" v-show="nowNum < allNum"
type="primary" type="primary"
size="small"
shape="circle" shape="circle"
text="下一题" text="下一题"
color="linear-gradient(to right, rgba(47, 195, 255, 1), rgba(5, 70, 173, 1))" color="linear-gradient(to right, rgba(47, 195, 255, 1), rgba(5, 70, 173, 1))"
@ -212,6 +220,8 @@
</div> </div>
</view> </view>
</u-modal> </u-modal>
<u-loading-page :loading="isLoading"></u-loading-page>
</view> </view>
</template> </template>
@ -264,7 +274,10 @@ export default {
intervalId: '', intervalId: '',
isEnd: false, isEnd: false,
startX: 0, // X startX: 0, // X
endX: 0 // X startY: 0, // Y
endX: 0, // X
endY: 0, // Y
fontSize: 20
} }
}, },
onLoad(opt) { onLoad(opt) {
@ -288,6 +301,10 @@ export default {
this.handleClose() this.handleClose()
}, },
methods: { methods: {
changeFont(e) {
console.log('🚀 ~ changeFont ~ e:', e)
this.fontSize = e.value
},
// - // -
getPracticeItData() { getPracticeItData() {
const params = { const params = {
@ -608,12 +625,13 @@ export default {
if (item.isSelect) { if (item.isSelect) {
return return
} }
//
if (!option.isCheck) { // 使 this.$set Vue
this.questionList[0].listOption[index].isCheck = !option.isCheck this.$set(this.questionList[0].listOption, index, {
} else { ...option,
this.questionList[0].listOption[index].isCheck = false isCheck: !option.isCheck
} })
// isCheck: true value select // isCheck: true value select
this.questionList[0].select = this.questionList[0].listOption this.questionList[0].select = this.questionList[0].listOption
.filter(item => item.isCheck) .filter(item => item.isCheck)
@ -814,7 +832,8 @@ export default {
}, },
// //
openSelect() { openSelect() {
this.showModalSelect = true this.isLoading = true
// this.showModalSelect = true
// const res = await this.getPracticeQuestionList() // const res = await this.getPracticeQuestionList()
// console.log('🚀 ~ openSelect ~ res:', res) // console.log('🚀 ~ openSelect ~ res:', res)
// this.questionListSelect = res.data // this.questionListSelect = res.data
@ -833,39 +852,50 @@ export default {
Authorization: uni.getStorageSync('access_token') Authorization: uni.getStorageSync('access_token')
}, },
success: res => { success: res => {
this.showModalSelect = true
console.log('🚀 ~ getPracticeQuestionList ~ res:', res) console.log('🚀 ~ getPracticeQuestionList ~ res:', res)
res = res.data res = res.data
this.questionListSelect = res.data this.questionListSelect = res.data
this.isLoading = false
}, },
fail: err => { fail: err => {
console.log(err) console.log(err)
this.isLoading = false
} }
}) })
}, },
touchStart(event) { touchStart(event) {
this.startX = 0 this.startX = 0
this.endX = 0 this.endX = 0
this.startY = 0
this.endY = 0
console.log('🚀 ~ 开始 ~ event:', event) console.log('🚀 ~ 开始 ~ event:', event)
// //
this.startX = event.touches[0].clientX this.startX = event.touches[0].clientX
this.startY = event.touches[0].clientY
console.log('🚀 ~ touchStart ~ this.startX:', this.startX) console.log('🚀 ~ touchStart ~ this.startX:', this.startX)
}, },
touchMove(event) { touchMove(event) {
console.log('🚀 ~ 移动 ~ event:', event) console.log('🚀 ~ 移动 ~ event:', event)
// //
this.endX = event.touches[0].clientX this.endX = event.touches[0].clientX
this.endY = event.touches[0].clientY
console.log('🚀 ~ touchMove ~ this.endX:', this.endX) console.log('🚀 ~ touchMove ~ this.endX:', this.endX)
}, },
touchEnd() { 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
console.log('向左滑动') if (Math.abs(deltaY) < Math.abs(deltaX)) {
this.handleJump('next') if (this.startX != 0 && this.endX != 0 && deltaX > 10) {
} else if (this.startX != 0 && this.endX != 0 && this.endX - this.startX > 10) { //
// console.log('向左滑动')
console.log('向右滑动') this.handleJump('next')
this.handleJump('prev') } else if (this.startX != 0 && this.endX != 0 && deltaX < -10) {
//
console.log('向右滑动')
this.handleJump('prev')
}
} }
} }
}, },
@ -894,7 +924,6 @@ export default {
.slot-content { .slot-content {
width: 100%; width: 100%;
.correctRate { .correctRate {
font-size: 30px;
text-align: center; text-align: center;
} }
@ -914,7 +943,6 @@ export default {
align-items: center; align-items: center;
color: #9d9b9b; color: #9d9b9b;
.num { .num {
font-size: 20px;
color: #3185f0; color: #3185f0;
} }
} }
@ -938,7 +966,6 @@ export default {
align-items: center; align-items: center;
margin: 10px; margin: 10px;
.topic { .topic {
font-size: 11px;
color: #409eff; color: #409eff;
} }
// //
@ -985,21 +1012,19 @@ export default {
} }
.question-wrapper { .question-wrapper {
height: 500px; height: 64vh;
overflow: auto; overflow: auto;
padding: 30px; padding: 30px;
color: #08428d; color: #08428d;
.title { .title {
font-weight: 500; font-weight: 500;
font-size: 15px;
margin-bottom: 30px; margin-bottom: 30px;
} }
.option { .option {
margin-bottom: 5px; margin-bottom: 5px;
padding: 0 15px; padding: 0 15px;
min-height: 45px; min-height: 45px;
max-height: 100px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
@ -1007,7 +1032,6 @@ export default {
border-radius: 8px; border-radius: 8px;
overflow: auto; overflow: auto;
.label-wrapper { .label-wrapper {
max-height: 100px;
overflow: auto; overflow: auto;
.label { .label {
display: flex; display: flex;
@ -1034,9 +1058,7 @@ export default {
.top-time { .top-time {
text-align: center; text-align: center;
font-size: 13px; color: #333;
color: #fff;
padding-top: 60px;
} }
.num-wrapper { .num-wrapper {
@ -1049,7 +1071,6 @@ export default {
.total { .total {
display: flex; display: flex;
align-items: center; align-items: center;
font-size: 13px;
margin: 0 6px; margin: 0 6px;
} }
.correct { .correct {

View File

@ -34,47 +34,19 @@
<div class="right-top"> <div class="right-top">
<div class="right-text">顺序练习</div> <div class="right-text">顺序练习</div>
<div class="btn" v-if="!isNew"> <div class="btn" v-if="!isNew">
<u-button <u-button type="primary" plain shape="circle" text="继续上次练习" @click="handleExercises(1)"></u-button>
type="primary"
plain
shape="circle"
text="继续上次练习"
size="small"
@click="handleExercises(1)"
></u-button>
</div> </div>
<div class="btn"> <div class="btn">
<u-button <u-button type="primary" plain shape="circle" text="开始新的练习" @click="handleExercises(2)"></u-button>
type="primary"
plain
shape="circle"
text="开始新的练习"
size="small"
@click="handleExercises(2)"
></u-button>
</div> </div>
</div> </div>
<div class="right-bottom"> <div class="right-bottom">
<div class="right-text">随机练习</div> <div class="right-text">随机练习</div>
<div class="btn" v-if="!isNew"> <div class="btn" v-if="!isNew">
<u-button <u-button type="primary" plain shape="circle" text="继续上次练习" @click="handleExercises(3)"></u-button>
type="primary"
plain
shape="circle"
text="继续上次练习"
size="small"
@click="handleExercises(3)"
></u-button>
</div> </div>
<div class="btn"> <div class="btn">
<u-button <u-button type="primary" plain shape="circle" text="开始新的练习" @click="handleExercises(4)"></u-button>
type="primary"
plain
shape="circle"
text="开始新的练习"
size="small"
@click="handleExercises(4)"
></u-button>
</div> </div>
</div> </div>
</div> </div>
@ -112,8 +84,7 @@ export default {
isNew: true // isNew: true //
} }
}, },
onShow() { onShow() {},
},
onLoad(opt) { onLoad(opt) {
opt = JSON.parse(opt.params) opt = JSON.parse(opt.params)
console.log('🚀 ~ onLoad ~ opt:', opt) console.log('🚀 ~ onLoad ~ opt:', opt)
@ -226,7 +197,7 @@ export default {
justify-content: space-between; justify-content: space-between;
.left { .left {
width: 52%; width: 52%;
height: 209px; /* height: 209px; */
background: #5185ed; background: #5185ed;
border-radius: 8px; border-radius: 8px;
display: flex; display: flex;
@ -262,17 +233,18 @@ export default {
justify-content: space-between; justify-content: space-between;
.btn { .btn {
width: 60%; width: 80%;
margin: 5px auto; margin: 10px auto;
} }
.right-top { .right-top {
height: 98px; height: 158px;
// background: #e7ac67; background: #e7ac67;
background: url('/static/images/order-exercises.png') no-repeat; /* background: url('/static/images/order-exercises.png') no-repeat; */
background-size: 100% 98px; background-size: 100% 98px;
border-radius: 8px; border-radius: 8px;
position: relative; position: relative;
margin-bottom: 10px;
// top-icon - // top-icon -
.top-icon { .top-icon {
position: absolute; position: absolute;
@ -281,7 +253,7 @@ export default {
} }
} }
.right-bottom { .right-bottom {
height: 98px; height: 158px;
background: #73c2f7; background: #73c2f7;
border-radius: 8px 8px 8px 8px; border-radius: 8px 8px 8px 8px;
position: relative; position: relative;
@ -297,7 +269,7 @@ export default {
font-weight: 500; font-weight: 500;
font-size: 15px; font-size: 15px;
color: #fff; color: #fff;
margin: 5px 0 0 10px; margin: 5px 0 15px 10px;
} }
} }
} }