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 = {
// // baseUrl:'/prod-api',
// // 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',
// // baseUrl:'http://192.168.0.14:2900',
// baseUrl: 'http://192.168.0.14:19999',

View File

@ -1,6 +1,10 @@
<template>
<view>
<u-navbar leftIcon="" title="考试" :placeholder="true" />
<view :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="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) {
@ -218,6 +246,10 @@ export default {
// this.handleConfirmSubmit()
// },
methods: {
changeFont(e) {
console.log('🚀 ~ changeFont ~ e:', e)
this.fontSize = e.value
},
//
async getList() {
try {
@ -271,6 +303,7 @@ export default {
}
},
changeCountDown(time) {
this.timeData = time
// console.log('🚀 ~ changeCountDown ~ time:', time)
//
if (this.time == 0 && !this.isLoading) return
@ -585,32 +618,42 @@ 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)
console.log('🚀 ~ touchStart ~ this.startY:', this.startY)
},
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)
console.log('🚀 ~ touchMove ~ this.endY:', this.endY)
},
touchEnd() {
//
if (this.startX != 0 && this.endX != 0 && this.startX - this.endX > 10) {
//
console.log('向左滑动')
this.currentIndex++
} else if (this.startX != 0 && this.endX != 0 && this.endX - this.startX > 10) {
//
console.log('向右滑动')
this.currentIndex--
}
if (this.currentIndex < 0) {
this.currentIndex = 0
} else if (this.currentIndex > this.questionList.length - 1) {
this.currentIndex = this.questionList.length - 1
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 && deltaX < -10) {
//
console.log('向右滑动')
this.currentIndex--
}
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 {
font-weight: 800;
font-size: 15px;
color: #333333;
}
}
@ -761,6 +803,7 @@ export default {
width: 100%;
background-color: #fff;
padding: 15px 0;
padding-bottom: 18px;
display: flex;
justify-content: flex-end;
align-items: center;

View File

@ -165,7 +165,9 @@ export default {
unAnsweredList: [],
list: [],
startX: 0, // X
endX: 0 // X
startY: 0, // Y
endX: 0, // X
endY: 0 // Y
}
},
onLoad(opt) {
@ -333,32 +335,41 @@ 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) {
//
console.log('向左滑动')
this.currentIndex++
} else if (this.startX != 0 && this.endX != 0 && this.endX - this.startX > 10) {
//
console.log('向右滑动')
this.currentIndex--
}
if (this.currentIndex < 0) {
this.currentIndex = 0
} else if (this.currentIndex > this.questionList.length - 1) {
this.currentIndex = this.questionList.length - 1
//
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 && deltaX < -10) {
//
console.log('向右滑动')
this.currentIndex--
}
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>
<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>
@ -264,7 +274,10 @@ export default {
intervalId: '',
isEnd: false,
startX: 0, // X
endX: 0 // X
startY: 0, // Y
endX: 0, // X
endY: 0, // Y
fontSize: 20
}
},
onLoad(opt) {
@ -288,6 +301,10 @@ export default {
this.handleClose()
},
methods: {
changeFont(e) {
console.log('🚀 ~ changeFont ~ e:', e)
this.fontSize = e.value
},
// -
getPracticeItData() {
const params = {
@ -608,12 +625,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)
@ -814,7 +832,8 @@ export default {
},
//
openSelect() {
this.showModalSelect = true
this.isLoading = true
// this.showModalSelect = true
// const res = await this.getPracticeQuestionList()
// console.log('🚀 ~ openSelect ~ res:', res)
// this.questionListSelect = res.data
@ -833,39 +852,50 @@ export default {
Authorization: uni.getStorageSync('access_token')
},
success: res => {
this.showModalSelect = true
console.log('🚀 ~ getPracticeQuestionList ~ res:', res)
res = res.data
this.questionListSelect = res.data
this.isLoading = false
},
fail: err => {
console.log(err)
this.isLoading = false
}
})
},
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) {
//
console.log('向左滑动')
this.handleJump('next')
} else if (this.startX != 0 && this.endX != 0 && this.endX - this.startX > 10) {
//
console.log('向右滑动')
this.handleJump('prev')
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 && deltaX < -10) {
//
console.log('向右滑动')
this.handleJump('prev')
}
}
}
},
@ -894,7 +924,6 @@ export default {
.slot-content {
width: 100%;
.correctRate {
font-size: 30px;
text-align: center;
}
@ -914,7 +943,6 @@ export default {
align-items: center;
color: #9d9b9b;
.num {
font-size: 20px;
color: #3185f0;
}
}
@ -938,7 +966,6 @@ export default {
align-items: center;
margin: 10px;
.topic {
font-size: 11px;
color: #409eff;
}
//
@ -985,21 +1012,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;
@ -1007,7 +1032,6 @@ export default {
border-radius: 8px;
overflow: auto;
.label-wrapper {
max-height: 100px;
overflow: auto;
.label {
display: flex;
@ -1034,9 +1058,7 @@ export default {
.top-time {
text-align: center;
font-size: 13px;
color: #fff;
padding-top: 60px;
color: #333;
}
.num-wrapper {
@ -1049,7 +1071,6 @@ export default {
.total {
display: flex;
align-items: center;
font-size: 13px;
margin: 0 6px;
}
.correct {

View File

@ -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>
@ -112,8 +84,7 @@ export default {
isNew: true //
}
},
onShow() {
},
onShow() {},
onLoad(opt) {
opt = JSON.parse(opt.params)
console.log('🚀 ~ onLoad ~ opt:', opt)
@ -226,7 +197,7 @@ export default {
justify-content: space-between;
.left {
width: 52%;
height: 209px;
/* height: 209px; */
background: #5185ed;
border-radius: 8px;
display: flex;
@ -262,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;
@ -281,7 +253,7 @@ export default {
}
}
.right-bottom {
height: 98px;
height: 158px;
background: #73c2f7;
border-radius: 8px 8px 8px 8px;
position: relative;
@ -297,7 +269,7 @@ export default {
font-weight: 500;
font-size: 15px;
color: #fff;
margin: 5px 0 0 10px;
margin: 5px 0 15px 10px;
}
}
}