考试-接口联调

This commit is contained in:
binbin_pan 2024-08-23 16:00:43 +08:00
parent 09e63f4bfa
commit 191ec2e84c
12 changed files with 1031 additions and 773 deletions

View File

@ -1,10 +1,83 @@
import request from "@/utils/request";
import request from '@/utils/request'
// 我的消息
export function getNoticeAnnoByUserId(data) {
return request({
'url': '/app/index/getNoticeAnnoByUserId',
'method': 'post',
'data': data
})
return request({
url: '/app/index/getNoticeAnnoByUserId',
method: 'post',
data: data
})
}
// 考试-列表 /personalCenter/getStudentExamList
export function getStudentExamList(params) {
return request({
url: '/personalCenter/getStudentExamList',
method: 'post',
data: params
})
}
// 考试-题目 /studentExam/getExamQuestionList
export function getExamQuestionList(params) {
return request({
url: '/studentExam/getExamQuestionList',
method: 'post',
data: params
})
}
// 考试-做题 /studentExam/insertQuestionAnswerById
export function insertQuestionAnswerById(params) {
return request({
url: '/studentExam/insertQuestionAnswerById',
method: 'post',
data: params
})
}
// 考试-交卷+结果 /studentExam/commitExamByRecordId
export function commitExamByRecordId(params) {
return request({
url: '/studentExam/commitExamByRecordId',
method: 'post',
data: params
})
}
// 考试-查询结果列表 /studentExam/getExamRecordById
export function getExamRecordById(params) {
return request({
url: '/studentExam/getExamRecordById',
method: 'get',
data: params
})
}
// 考试-结果详情 studentExam/getExamRecordAnswer
export function getExamRecordAnswer(params) {
return request({
url: '/studentExam/getExamRecordAnswer',
method: 'post',
data: params
})
}
// 考试-排名 studentExam/getExamRankById
export function getExamRankById(params) {
return request({
url: '/studentExam/getExamRankById',
method: 'post',
data: params
})
}
// 练习-列表 /personalCenter/getStudentPracticeList
export function getStudentPracticeList(params) {
return request({
url: '/personalCenter/getStudentPracticeList',
method: 'post',
data: params
})
}

View File

@ -1,7 +1,11 @@
// 应用全局配置
module.exports = {
// baseUrl:'/prod-api',
baseUrl:'http://112.29.103.165:1616/ynuw',
// baseUrl:'http://112.29.103.165:1616/ynuw',
baseUrl:'http://192.168.0.32:2900/exam-student',
// 上传文件地址
uploadUrl: 'http://192.168.0.137:2909/exam-file/file/uploadBase64',
bmwUrl: 'http://192.168.0.137:2911/exam-bmw',
// 应用信息
appInfo: {
// 应用名称

View File

@ -154,7 +154,10 @@
"path" : "pages/YNEduApp/exam/examination",
"style" :
{
"navigationStyle" : "custom"
"navigationStyle" : "custom",
"app-plus": {
"popGesture": "none"
}
}
},
{

View File

@ -49,26 +49,46 @@ export default {
return {
showModal: false,
//
title: '2023年送配电线路架设工模拟考试',
title: '',
//
subtitle: '不限期',
subtitle: '',
//
duration: '120',
duration: '',
//
count: '不限次',
//
switchCount: '不限次',
content: '是否确认进入考试?'
switchCount: '',
content: '是否确认进入考试?',
examId: '',
examNum: 0, //
examCount: 1, // 1: 2: 3:
examCustom: 0, //
}
},
onLoad(opt) {
opt = JSON.parse(opt.params)
console.log('🚀 ~ onLoad ~ opt:', opt)
this.examId = opt.id
this.title = opt.name
this.subtitle = opt.validityDate
this.duration = opt.responseTime
this.switchCount = opt.cutNum.includes('null') || opt.cutNum.includes('undefined') ? '不限次' : opt.cutNum
},
methods: {
openModal() {
this.showModal = true
},
//
handleEnterExam() {
const params = {
examId: this.examId, // id
switchCount: this.switchCount, //
examNum: this.examNum,
examCount: this.examCount,
examCustom: this.examCustom
}
uni.navigateTo({
url: '/pages/YNEduApp/exam/examination'
url: `/pages/YNEduApp/exam/examination?params=${JSON.stringify(params)}`
})
}
}

View File

@ -11,22 +11,26 @@
</div>
<div class="content">
<div v-for="(item, index) in list" :key="index" class="item-wrapper">
<div class="title">{{ item.title }}</div>
<div class="title">{{ item.name }}</div>
<div class="name-status">
<div class="name">
{{ item.name }}
{{ item.userName }}
<div class="name-sub">指派</div>
</div>
<div class="status">{{ item.status }}</div>
<div class="status">{{ item.status == 2 ? '已考试' : '未考试' }}</div>
</div>
<div class="time">{{ item.time }}</div>
<div class="time">{{ item.validityDate }}</div>
<div class="count-total">
<div class="count">考试{{ item.count }}</div>
<div class="total">总分{{ item.total }}</div>
<div class="count">考试{{ item.examNum }}</div>
<div class="total">总分{{ item.passScore }}</div>
</div>
<div class="bt-wrapper">
<div class="score">得分{{ item.score }}</div>
<div class="btn" @click="handleExamination">开始考试</div>
<div class="score">得分{{ item.examScore }}</div>
<div v-if="item.examNum == 0" class="btn" @click="handleExamination(item)">开始考试</div>
<div v-else class="btn-wrapper">
<div class="btn" @click="handleExamDataList(item)">考试数据</div>
<div class="btn" @click="handleExamination(item)">重新考试</div>
</div>
</div>
</div>
@ -40,6 +44,8 @@
</template>
<script>
import { getStudentExamList } from '@/api/eduApp/index'
export default {
data() {
return {
@ -47,42 +53,7 @@ export default {
activeIndex: 0,
list: [],
//
allList: [
{
id: 1,
//
title: '送配电线路架设(初级)',
//
name: '张三',
//
status: '待考试',
//
time: '2020-12-12 12:00',
//
count: 1,
//
total: '--',
//
score: '暂无'
},
{
id: 2,
//
title: '送配电线路架设(初级)',
//
name: '张三',
//
status: '待考试',
//
time: '2020-12-12 12:00',
//
count: 1,
//
total: '--',
//
score: '暂无'
}
],
allList: [],
//
waitList: [],
//
@ -92,9 +63,21 @@ export default {
}
},
mounted() {
this.list = this.allList
this.getList()
},
methods: {
async getList() {
const params = {
userId: 31,
source: 1
}
const res = await getStudentExamList(params)
// status
this.list = this.allList
this.allList = this.list = res.data
this.waitList = res.data.filter(item => item.status === 1)
this.alreadyList = res.data.filter(item => item.status === 2)
},
handleTab(item, index) {
this.activeIndex = index
if (index === 0) {
@ -108,9 +91,33 @@ export default {
}
},
//
handleExamination() {
handleExamination(item) {
// examCount 1: 2: 3:
if (item.examCount == 2 && item.results == 1) {
uni.showToast({
title: '此考试及格终止, 考试以及格, 无需再次考试',
icon: 'none'
})
return
} else if (item.examCount == 3 && item.examNum >= item.examCustom) {
uni.showToast({
title: '此考试有次数限制, 考试次数已达上限, 无法再考试了',
icon: 'none'
})
return
}
const params = {
id: item.id, // id
name: item.name, //
validityDate: item.validityDate, //
cutNum: item.cutNum, //
responseTime: item.responseTime, //
examNum: item.examNum, //
examCount: item.examCount, //
examCustom: item.examCustom //
}
uni.navigateTo({
url: '/pages/YNEduApp/exam/beforeExam'
url: `/pages/YNEduApp/exam/beforeExam?params=${JSON.stringify(params)}`
})
uni.removeStorageSync('from')
uni.setStorageSync('from', '/pages/YNEduApp/exam/exam')
@ -119,6 +126,16 @@ export default {
uni.navigateTo({
url: '/pages/YNEduApp/index/index'
})
},
//
handleExamDataList(item) {
console.log('🚀 ~ handleExamDataList ~ item:', item)
const params = {
examId: item.id,
}
uni.navigateTo({
url: `/pages/YNEduApp/exam/examinationList?params=${JSON.stringify(params)}`
})
}
}
}
@ -194,7 +211,11 @@ export default {
.score {
color: #999;
}
.btn-wrapper {
display: flex;
}
.btn {
margin-left: 5px;
padding: 5px 10px;
background: #409eff;
color: #fff;

View File

@ -32,7 +32,9 @@
v-show="item.isShow"
@click="handleQuestionNumber(item, index)"
>
<div class="answer-item" :class="{ isActive: item.isActive }">{{ index + 1 }}</div>
<div class="answer-item" :class="{ isActive: item.isActive, currentActive: currentIndex == index }">
{{ index + 1 }}
</div>
</div>
</div>
<div class="unfold" @click="handleUnfold">
@ -48,23 +50,23 @@
<div class="question-type-wrapper">
<div class="line" />
<div class="question-type">
<div v-if="item.type == 1">单选题{{ item.score }}</div>
<div v-if="item.type == 2">多选题{{ item.score }}</div>
<div v-if="item.type == 3">判断题{{ item.score }}</div>
<div v-if="item.examType == 1">单选题{{ item.questionScore }}</div>
<div v-if="item.examType == 2">多选题{{ item.questionScore }}</div>
<div v-if="item.examType == 3">判断题{{ item.questionScore }}</div>
</div>
</div>
<div class="question">{{ currentIndex + 1 }}. {{ item.question }}</div>
<div class="question">{{ currentIndex + 1 }}. {{ item.examTopic }}</div>
<div class="options">
<div
class="option"
v-for="(option, optionIndex) in item.options"
v-for="(option, optionIndex) in item.listOption"
:key="optionIndex"
:class="{ isActive: option.isActive }"
@click="handleSelectOption(item, index, option, optionIndex)"
>
<div class="option-item">{{ option.value }}.</div>
<div class="option-content">{{ option.label }}</div>
<div class="option-item">{{ option.optionIdent }}.</div>
<div class="option-content">{{ option.optionContent }}</div>
</div>
</div>
</div>
@ -107,14 +109,24 @@
<script>
import face from '@/uni_modules/mcc-face/index.js'
import { getExamQuestionList, insertQuestionAnswerById, commitExamByRecordId, getFaceRecognition } from '@/api/eduApp'
import config from 'config'
export default {
data() {
return {
// id
examId: '',
// id
recordId: '',
//
screenCount: 0,
//
switchCount: 0,
showConfirmModal: false,
time: 30 * 60 * 1000,
//
time: 0,
examTime: 0,
random1: 0,
random2: 0,
hasScanned: false,
@ -127,164 +139,94 @@ export default {
isEnd: false,
//
unDoCount: 0,
//
answerCard: [],
examNum: 0, //
examCount: 1, // 1: 2: 3:
examCustom: 0, //
results: 0, //
//
questionList: [
{
id: 1,
//
type: 1, // 1: , 2: , 3:
//
score: 2,
//
question: '送配电线路架设工的主要工作是?',
//
options: [
{ label: '电力设备的安装、调试、维护和检修', value: 'A' },
{ label: '电力设备的安装、调试、维护和检修', value: 'B' },
{ label: '电力设备的安装、调试、维护和检修', value: 'C' },
{ label: '电力设备的安装、调试、维护和检修', value: 'D' }
]
},
{
id: 2,
type: 2,
score: 2,
question: '送配电线路架设工的主要工作是?',
options: [
{ label: '电力设备的安装、调试、维护和检修', value: 'A' },
{ label: '电力设备的安装、调试、维护和检修', value: 'B' },
{ label: '电力设备的安装、调试、维护和检修', value: 'C' },
{ label: '电力设备的安装、调试、维护和检修', value: 'D' }
]
},
{
id: 3,
type: 3,
score: 2,
question: '送配电线路架设工的主要工作是: 好好工作?',
options: [
{ label: '对', value: 'A' },
{ label: '错', value: 'B' }
]
},
{
id: 11,
//
type: 1, // 1: , 2: , 3:
//
score: 2,
//
question: '送配电线路架设工的主要工作是?',
//
options: [
{ label: '电力设备的安装、调试、维护和检修', value: 'A' },
{ label: '电力设备的安装、调试、维护和检修', value: 'B' },
{ label: '电力设备的安装、调试、维护和检修', value: 'C' },
{ label: '电力设备的安装、调试、维护和检修', value: 'D' }
]
},
{
id: 21,
type: 2,
score: 2,
question: '送配电线路架设工的主要工作是?',
options: [
{ label: '电力设备的安装、调试、维护和检修', value: 'A' },
{ label: '电力设备的安装、调试、维护和检修', value: 'B' },
{ label: '电力设备的安装、调试、维护和检修', value: 'C' },
{ label: '电力设备的安装、调试、维护和检修', value: 'D' }
]
},
{
id: 31,
type: 3,
score: 2,
question: '送配电线路架设工的主要工作是: 好好工作?',
options: [
{ label: '对', value: 'A' },
{ label: '错', value: 'B' }
]
},
{
id: 12,
//
type: 1, // 1: , 2: , 3:
//
score: 2,
//
question: '送配电线路架设工的主要工作是?',
//
options: [
{ label: '电力设备的安装、调试、维护和检修', value: 'A' },
{ label: '电力设备的安装、调试、维护和检修', value: 'B' },
{ label: '电力设备的安装、调试、维护和检修', value: 'C' },
{ label: '电力设备的安装、调试、维护和检修', value: 'D' }
]
},
{
id: 22,
type: 2,
score: 2,
question: '送配电线路架设工的主要工作是?',
options: [
{ label: '电力设备的安装、调试、维护和检修', value: 'A' },
{ label: '电力设备的安装、调试、维护和检修', value: 'B' },
{ label: '电力设备的安装、调试、维护和检修', value: 'C' },
{ label: '电力设备的安装、调试、维护和检修', value: 'D' }
]
},
{
id: 32,
type: 3,
score: 2,
question: '送配电线路架设工的主要工作是: 好好工作?',
options: [
{ label: '对', value: 'A' },
{ label: '错', value: 'B' }
]
questionList: []
}
},
onLoad(opt) {
console.log('🚀 ~ onLoad ~ opt考试中--:', opt)
opt = JSON.parse(opt.params)
this.examId = opt.examId
this.switchCount = Number(opt.switchCount)
this.examNum = opt.examNum
this.examCount = opt.examCount
this.examCustom = opt.examCustom
},
onShow() {
setTimeout(() => {
if (this.screenCount > 0) {
//
this.$refs.uToast.show({
message: '切屏次数: ' + this.screenCount,
duration: 1000
})
// ,
if (this.screenCount > this.switchCount) {
this.$refs.uToast.show({
message: '切屏次数已达上限, 系统将自动提交',
duration: 1000
})
// this.handleConfirmSubmit()
setTimeout(() => {
this.isEnd = true
}, 1000)
}
]
}
}
}, 1000)
},
onShow: function () {
if (this.screenCount > 0) {
//
this.$refs.uToast.show({
message: '切屏次数: ' + this.screenCount,
duration: 1000
})
}
},
onHide: function () {
onHide() {
this.screenCount++
},
mounted() {
this.getList()
this.random1 = Math.floor(Math.random() * 100000) + 420000 // random1 7-13
// this.random1 = Math.floor(Math.random() * 100000) + 420000 // random1 7-13
this.random1 = 10000
this.random2 = Math.floor(Math.random() * 100000) + 900000 // random2 15-19
console.log('🚀 ~ mounted ~ this.random1:', this.random1, this.random2)
},
methods: {
//
getList() {
if (this.questionList.length > 0) {
this.questionList.forEach((item, index) => {
this.$set(item, 'isShow', index < 7)
this.$set(item, 'isActive', false)
if (item.options) {
item.options.forEach(option => {
this.$set(option, 'isActive', false)
})
}
})
console.log('🚀 ~ this.questionList.forEach ~ this.questionList:', this.questionList)
this.$refs.countDown.start()
async getList() {
try {
const params = {
examId: this.examId
}
const res = await getExamQuestionList(params)
const data = res.data
this.questionList = data.examPaperData
this.recordId = data.recordId
this.examTime = data.answerTime
this.time = Number(data.answerTime) * 60 * 1000
console.log('🚀 ~ getList ~ this.time:', this.time)
console.log('🚀 ~ getList ~ res考试题:', res)
if (this.questionList.length > 0) {
this.questionList.forEach((item, index) => {
this.$set(item, 'isShow', index < 7)
this.$set(item, 'isActive', false)
if (item.listOption) {
item.listOption.forEach(option => {
this.$set(option, 'isActive', false)
})
}
})
console.log('🚀 ~ this.questionList.forEach ~ this.questionList:', this.questionList)
setTimeout(() => {
this.$refs.countDown.start()
}, 100)
}
} catch (error) {
console.log('🚀 ~ getList ~ error:', error)
}
},
changeCountDown(time) {
// console.log('🚀 ~ changeCountDown ~ time:', time)
//
if (this.time == 0) return
this.answerTime =
this.time - (time.days * 24 * 60 * 60 + time.hours * 60 * 60 + time.minutes * 60 + time.seconds) * 1000
// console.log('🚀 ~ changeCountDown ~ this.answerTime:', this.answerTime)
@ -323,109 +265,116 @@ export default {
console.log('🚀 ~ this.questionList.forEach ~ this.isRotating:', this.isRotating)
},
handleSelectOption(item, index, option, optionIndex) {
console.log('🚀 ~ handleSelectOption ~ option:', option, optionIndex)
let selectAnswer = ''
console.log('🚀 ~ handleSelectOption ~ option:', item, option, optionIndex)
item.isActive = true
//
if (item.type == 1 || item.type == 3) {
if (item.examType == 1 || item.examType == 3) {
this.$set(option, 'isActive', true)
item.options.forEach((option, optIndex) => {
item.listOption.forEach((option, optIndex) => {
//
if (optIndex != optionIndex) {
this.$set(option, 'isActive', false)
}
})
selectAnswer = option.optionIdent
} else {
this.$set(option, 'isActive', !option.isActive)
// ,
let isActive = item.options.some(option => option.isActive)
let isActive = item.listOption.some(option => option.isActive)
item.isActive = isActive
// optionIdent 'ABC'
item.listOption.forEach(option => {
if (option.isActive) {
selectAnswer += option.optionIdent
}
})
}
const params = {
recordId: this.recordId,
questionId: item.id,
selectAnswer
}
console.log('🚀 ~ handleSelectOption ~ params:', params)
insertQuestionAnswerById(params)
},
openConfirmModal() {
this.unDoCount = this.questionList.filter(item => !item.isActive).length
this.showConfirmModal = true
},
//
handleAnswerCard() {
// questionList.options.isActive
this.questionList.forEach((item, index) => {
if (item.type == 1 || item.type == 3) {
item.options.forEach(option => {
if (option.isActive) {
this.answerCard.push({
id: item.id,
answer: option.value
})
}
})
} else {
let answer = []
item.options.forEach(option => {
if (option.isActive) {
answer.push(option.value)
}
})
this.answerCard.push({
id: item.id,
answer
})
}
})
},
//
handleConfirmSubmit() {
this.handleAnswerCard()
async handleConfirmSubmit() {
//
this.$refs.countDown.pause()
console.log('🚀 ~ handleConfirmSubmit ~ this.answerCard:', this.answerCard, this.answerTime)
const params = {
recordId: this.recordId,
examId: this.examId,
// ,
answerTime: Math.ceil(this.answerTime / 60000)
}
const res = await commitExamByRecordId(params)
console.log('🚀 ~ handleConfirmSubmit ~ params:', params, res)
this.showConfirmModal = false
const params2 = {
examId: this.examId,
examGrade: res.examGrade,
examResult: res.examResult,
gradeAverage: res.gradeAverage,
answerTime: Math.ceil(this.answerTime / 60000),
examTime: this.examTime,
questionCount: this.questionList.length,
switchCount: this.switchCount,
examNum: this.examNum,
examCount: this.examCount,
examCustom: this.examCustom,
results: res.examResult
}
uni.navigateTo({
url: '/pages/YNEduApp/exam/examinationDetails'
url: `/pages/YNEduApp/exam/examinationDetails?params=${JSON.stringify(params2)}`
})
},
//
openFaceScan() {
async openFaceScan() {
face.open(['a', 'c'], e => {
console.log('🚀 ~ e-人脸识别:', e)
face.close()
uni.showToast({
title: '人脸识别成功',
icon: 'none'
let params = {
userId: 31,
img: e
}
params = JSON.stringify(params)
uni.request({
url: config.baseUrl + '/personalCenter/getFaceRecognition',
method: 'POST',
header: {
'content-type': 'application/json',
Authorization: 'Bearer ' + uni.getStorageSync('App-Token')
},
data: params,
success: res => {
console.log('🚀 ~ openFaceScan ~ res-人脸识别:', res)
res = JSON.parse(res.data)
if (res.data.code == 200) {
this.$refs.uToast.show({
message: '人脸识别成功',
duration: 1000
})
} else {
this.$refs.uToast.show({
message: '人脸识别失败, 即将结束考试',
duration: 1000
})
setTimeout(() => {
this.handleConfirmSubmit()
}, 1000)
}
},
fail(err) {
console.log('🚀 ~ openFaceScan ~ 人脸识别失败', err)
}
})
// uni.request({
// url: publicPath + '/backstage/app/uploadPersonPhoto',
// method: 'POST',
// header: {
// 'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
// Authorization: 'Bearer ' + uni.getStorageSync('token')
// },
// data: {
// base: e,
// idCard: uni.getStorageSync('idCard'),
// type: 1
// },
// success: res => {
// console.log(JSON.stringify(res))
// if (res.data.resMsg == '') {
// uni.showToast({
// icon: 'none',
// title: ''
// })
// } else if (res.data.resMsg == '') {
// uni.showToast({
// icon: 'none',
// title: ',!'
// })
// } else {
// uni.showToast({
// icon: 'none',
// title: ',!'
// })
// }
// },
// fail() {}
// })
})
}
}
@ -489,6 +438,9 @@ export default {
&.isActive {
background: #1989fa;
}
&.currentActive {
background: #f4c14a;
}
}
}
}

View File

@ -12,18 +12,14 @@
<div class="top-wrapper">
<div class="item">
<div>{{ scoreRate }}</div>
<div class="tip">得分</div>
<div class="tip">得分</div>
</div>
<div class="item">
<div>{{ rightCount }}</div>
<div class="tip">答对题目</div>
</div>
<div class="item">
<div>{{ rightRate }}</div>
<div>{{ rightRate }}%</div>
<div class="tip">正确率</div>
</div>
<div class="item">
<div>{{ answerTime }}</div>
<div>{{ answerTime }}分钟</div>
<div class="tip">作答用时</div>
</div>
</div>
@ -47,17 +43,17 @@
<div v-for="(item, index) in rankList" :key="index" class="rank-list">
<div class="icon">
<u-icon :name="iconLit[index]" size="30" />
<u-avatar :src="item.url" size="40" />
<u-avatar src="/static/images/user.png" size="40" />
</div>
<div>{{ item.name }}</div>
<div>{{ item.score }}</div>
<div>{{ item.scoreRate }}</div>
<div>{{ `${item.userName}/${item.orgName}` }}</div>
<div>{{ item.examGrade }}</div>
<div>{{ item.gradeAverage }}</div>
</div>
</div>
<!-- 底部按钮 -->
<div class="bottom-btn">
<div class="btn">
<!-- <div class="btn">
<u-button
size="small"
shape="circle"
@ -65,75 +61,114 @@
style="color: #1989fa; border-color: #1989fa"
@click="handleExamination"
/>
</div>
</div> -->
<div class="btn">
<u-button type="primary" size="small" shape="circle" text="重新考试" />
<u-button type="primary" size="small" shape="circle" text="重新考试" @click="handleResetExamination" />
</div>
</div>
</view>
</template>
<script>
import { getExamRankById } from '@/api/eduApp'
export default {
data() {
return {
examId: '',
result: '不及格',
//
scoreRate: '60%',
//
rightCount: 15,
//
scoreRate: '',
//
rightRate: '60%',
//
answerTime: '30分钟',
answerTime: '',
//
totalScore: 100,
//
passScore: 60,
//
duration: 120,
duration: 0,
//
questionCount: 100,
questionCount: 0,
//
examNum: 0,
examCount: 1, // 1: 2: 3:
examCustom: 0, //
results: 0, //
iconLit: ['/static/images/top-one.png', '/static/images/top-two.png', '/static/images/top-three.png'],
// -
rankList: [
{
id: 1,
name: '张三',
url: 'https://cdn.uviewui.com/uview/album/1.jpg',
score: 80,
scoreRate: '80%'
},
{
id: 2,
name: '李四',
url: 'https://cdn.uviewui.com/uview/album/1.jpg',
score: 70,
scoreRate: '70%'
},
{
id: 3,
name: '王五',
url: 'https://cdn.uviewui.com/uview/album/1.jpg',
score: 60,
scoreRate: '60%'
}
]
rankList: []
}
},
onLoad(opt) {
opt = JSON.parse(opt.params)
console.log('🚀 ~ onLoad ~ opt:', opt)
this.examId = opt.examId
this.result = opt.examResult == 1 ? '及格' : '不及格'
this.scoreRate = opt.examGrade
this.rightRate = opt.gradeAverage
this.answerTime = opt.answerTime
this.duration = opt.examTime
this.questionCount = opt.questionCount
this.examNum = opt.examNum
this.examCount = opt.examCount
this.examCustom = opt.examCustom
this.results = opt.results
},
mounted() {
this.getExamRankById()
},
methods: {
handleExamination() {
// handleExamination() {
// uni.navigateTo({
// url: '/pages/YNEduApp/exam/examinationList'
// })
// },
//
handleResetExamination() {
if (this.examNum > 10) {
uni.showToast({
title: '已达到最大考试次数',
icon: 'none'
})
return
}
// examCount 1: 2: 3:
if (this.examCount == 2 && this.results == 1) {
uni.showToast({
title: '此考试及格终止, 考试以及格, 无需再次考试',
icon: 'none'
})
return
} else if (this.examCount == 3 && this.examNum >= this.examCustom) {
uni.showToast({
title: '此考试有次数限制, 考试次数已达上限, 无法再考试了',
icon: 'none'
})
return
}
const params = {
examId: this.examId,
switchCount: this.switchCount
}
uni.navigateTo({
url: '/pages/YNEduApp/exam/examinationList'
url: `/pages/YNEduApp/exam/examination?params=${JSON.stringify(params)}`
})
},
//
handleResetExamination() {},
handleArrow() {
const from = uni.getStorageSync('from')
uni.navigateTo({
url: from
})
},
//
async getExamRankById() {
const params = {
examId: this.examId
}
const res = await getExamRankById(params)
this.rankList = res.data
}
}
}
@ -287,7 +322,7 @@ export default {
background-color: #fff;
padding: 10px 0;
display: flex;
justify-content: space-around;
justify-content: flex-end;
align-items: center;
.btn {

View File

@ -4,10 +4,11 @@
<div class="tip">*随机抽题下每道分数根据管理员的设置可能不同最高分以得分率计算得分率=得分/总分*100%</div>
<div class="list-item" v-for="(item, index) in list" :key="index" @click="handleExamList(item)">
<div class="title">{{ item.name }}</div>
<div class="item-title">
<div class="title">{{ item.time }}</div>
<div class="item-time">{{ item.endTime }}</div>
<div class="item-tip" v-if="index == 0">最新</div>
<div class="pass">{{ item.pass ? '' : '不及格' }}</div>
<div class="pass" :class="{ 'un-pass': item.isPass == '不通过' }">{{ item.isPass }}</div>
</div>
<div class="item-content">
@ -17,30 +18,33 @@
</div>
<div class="item">
得分/总分
<span class="item-info">{{ item.score }}/{{ item.totalScore }}</span>
<span class="item-info">{{ item.score }}/{{ item.examGrade }}</span>
</div>
<div class="item">
得分率
<span class="item-info">{{ item.scoreRate }}</span>
<span class="item-info">{{ item.gradeAverage }}</span>
</div>
</div>
</div>
<div class="all">已显示全部</div>
<!-- 底部按钮 -->
<div class="bottom-btn">
<!-- <div class="bottom-btn">
<div class="btn">
<u-button type="primary" size="small" shape="circle" text="重新考试" />
</div>
</div>
</div> -->
</div>
</view>
</template>
<script>
import { getExamRecordById } from '@/api/eduApp'
export default {
data() {
return {
examId: '', // id
list: [
{
id: 1,
@ -75,13 +79,35 @@ export default {
]
}
},
onLoad(opt) {
opt = JSON.parse(opt.params)
this.examId = opt.examId
this.getList()
},
methods: {
handleExamList(item) {
uni.navigateTo({
url: '/pages/YNEduApp/exam/examinationResultDetails'
})
}
}
//
async getList() {
const params = {
examId: this.examId,
userId: 31,
page: 1,
limit: 999
}
const res = await getExamRecordById(params)
console.log('🚀 ~ getList ~ res:', res)
this.list = res.data
},
//
handleExamList(item) {
const params = {
examId: this.examId,
recordId: item.id
}
uni.navigateTo({
url: '/pages/YNEduApp/exam/examinationResultDetails?params=' + JSON.stringify(params)
})
}
}
}
</script>
@ -104,14 +130,19 @@ export default {
margin-bottom: 10px;
padding: 10px;
.title {
font-size: 16px;
font-weight: bold;
}
.item-title {
margin-top: 10px;
display: flex;
justify-content: space-between;
align-items: center;
.title {
font-size: 16px;
font-weight: bold;
.item-time {
font-size: 14px;
}
.item-tip {
width: 40px;
@ -126,7 +157,10 @@ export default {
}
.pass {
font-size: 12px;
color: #f0514c;
color: #67c23a;
&.un-pass {
color: #f0514c;
}
}
}
@ -149,8 +183,8 @@ export default {
}
.all {
margin: 30px auto;
text-align: center;
margin: 40px auto;
text-align: center;
font-size: 13px;
color: #8a8a8a;
}

View File

@ -44,23 +44,23 @@
<div class="question-type-wrapper">
<div class="line" />
<div class="question-type">
<div v-if="item.type == 1">单选题{{ item.score }}</div>
<div v-if="item.type == 2">多选题{{ item.score }}</div>
<div v-if="item.type == 3">判断题{{ item.score }}</div>
<div v-if="item.examType == 1">单选题{{ item.questionScore }}</div>
<div v-if="item.examType == 2">多选题{{ item.questionScore }}</div>
<div v-if="item.examType == 3">判断题{{ item.questionScore }}</div>
</div>
</div>
<div class="question">{{ currentIndex + 1 }}. {{ item.question }}</div>
<div class="question">{{ currentIndex + 1 }}. {{ item.examTopic }}</div>
<div class="options">
<div
class="option"
v-for="(option, optionIndex) in item.options"
v-for="(option, optionIndex) in item.listOption"
:key="optionIndex"
:class="{ isRight: option.isRight, isError: option.isError }"
>
<div class="option-item">{{ option.value }}.</div>
<div class="option-item">{{ option.optionIdent }}.</div>
<div class="option-content">
<div>{{ option.label }}</div>
<div>{{ option.optionContent }}</div>
<u-icon v-if="option.isRight" name="/static/images/correct.png" />
<u-icon v-if="option.isError" name="/static/images/error.png" />
</div>
@ -76,29 +76,61 @@
<div class="select-wrapper">
<div class="select-item">
<div>正确选择</div>
<div v-if="item.type == 1 || item.type == 3" style="color: #48d66b">{{ item.rightAnswer }}</div>
<div v-else style="color: #48d66b">{{ item.rightAnswer.join(', ') }}</div>
<div v-if="item.examType == 1 || item.examType == 3" style="color: #48d66b">
{{ item.correctGrade || '' }}
</div>
<div v-else style="color: #48d66b" class="grade">
<div v-for="(grade, gradeIndex) in item.correctGrade.split('')" :key="gradeIndex">
{{ grade }}{{ gradeIndex + 1 == item.correctGrade.split('').length ? '' : ',&nbsp;' }}
</div>
</div>
</div>
<div class="select-item" v-show="!item.isUnAnswered">
<div>你的选择</div>
<div v-if="item.type == 1 || item.type == 3" :style="{ color: item.isRight ? '#48d66b' : '#fa4f19' }">
{{ item.userAnswer }}
<div
v-if="item.examType == 1 || item.examType == 3"
:style="{ color: item.isRight ? '#48d66b' : '#fa4f19' }"
>
{{ item.selectAnswer || '' }}
</div>
<div v-else :style="{ color: item.isRight ? '#48d66b' : '#fa4f19' }" class="grade">
<div v-if="item.selectAnswer">
<div v-for="(grade, gradeIndex) in item.selectAnswer.split('')" :key="gradeIndex">
{{ grade }}{{ gradeIndex + 1 == item.selectAnswer.split('').length ? '' : ',&nbsp;' }}
</div>
</div>
</div>
<div v-else :style="{ color: item.isRight ? '#48d66b' : '#fa4f19' }">{{ item.userAnswer.join(', ') }}</div>
</div>
</div>
<div class="analysis"><u-icon name="/static/images/解析.png" style="margin-right: 5px;" />解析</div>
<div class="analysis-item">{{ item.analysis }}</div>
<div class="analysis">
<u-icon name="/static/images/解析.png" style="margin-right: 5px" />
解析
</div>
<div class="analysis-item">{{ item.examAnaly }}</div>
</div>
<!-- 底部按钮 -->
<div class="bottom-btn">
<div class="btn" v-show="currentIndex != 0">
<u-button size="small" 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++" />
</div>
</div>
</div>
</view>
</template>
<script>
import { getExamRecordAnswer } from '@/api/eduApp'
export default {
data() {
return {
examId: '', // id
recordId: '', // id
isActive: 1,
isRotating: false,
currentIndex: 0,
@ -109,318 +141,319 @@ export default {
//
unAnsweredCount: 0,
//
questionList: [
{
type: 1,
question: '送配电线路架设工模拟考试',
options: [
{
label: '正常工作电压作用下的电气设备',
value: 'A'
},
{
label: '电气设备的绝缘电阻',
value: 'B'
},
{
label: '电气设备的绝缘电阻',
value: 'C'
},
{
label: '电气设备的绝缘电阻',
value: 'D'
}
],
rightAnswer: 'A',
userAnswer: 'B',
analysis: '解析'
},
{
type: 2,
question: '送配电线路架设工模拟考试',
options: [
{
label: '正常工作电压作用下的电气设备',
value: 'A'
},
{
label: '电气设备的绝缘电阻',
value: 'B'
},
{
label: '电气设备的绝缘电阻',
value: 'C'
},
{
label: '电气设备的绝缘电阻',
value: 'D'
}
],
rightAnswer: ['B', 'D'],
userAnswer: ['B', 'C'],
analysis: '解析'
},
{
type: 3,
question: '送配电线路架设工模拟考试',
options: [
{
label: '对',
value: 'A'
},
{
label: '错',
value: 'B'
}
],
rightAnswer: 'A',
userAnswer: 'A',
analysis: '解析'
},
{
type: 1,
question: '送配电线路架设工模拟考试',
options: [
{
label: '正常工作电压作用下的电气设备',
value: 'A'
},
{
label: '电气设备的绝缘电阻',
value: 'B'
},
{
label: '电气设备的绝缘电阻',
value: 'C'
},
{
label: '电气设备的绝缘电阻',
value: 'D'
}
],
rightAnswer: 'A',
userAnswer: 'A',
analysis: '解析'
},
{
type: 2,
question: '送配电线路架设工模拟考试',
options: [
{
label: '正常工作电压作用下的电气设备',
value: 'A'
},
{
label: '电气设备的绝缘电阻',
value: 'B'
},
{
label: '电气设备的绝缘电阻',
value: 'C'
},
{
label: '电气设备的绝缘电阻',
value: 'D'
}
],
rightAnswer: ['B', 'D'],
userAnswer: ['B', 'C'],
analysis: '解析'
},
{
type: 2,
question: '送配电线路架设工模拟考试',
options: [
{
label: '正常工作电压作用下的电气设备',
value: 'A'
},
{
label: '电气设备的绝缘电阻',
value: 'B'
},
{
label: '电气设备的绝缘电阻',
value: 'C'
},
{
label: '电气设备的绝缘电阻',
value: 'D'
}
],
rightAnswer: ['B', 'D'],
userAnswer: ['B', 'D'],
analysis: '解析'
},
{
type: 3,
question: '送配电线路架设工模拟考试',
options: [
{
label: '对',
value: 'A'
},
{
label: '错',
value: 'B'
}
],
rightAnswer: 'A',
userAnswer: 'A',
analysis: '解析'
},
{
type: 1,
question: '送配电线路架设工模拟考试',
options: [
{
label: '正常工作电压作用下的电气设备',
value: 'A'
},
{
label: '电气设备的绝缘电阻',
value: 'B'
},
{
label: '电气设备的绝缘电阻',
value: 'C'
},
{
label: '电气设备的绝缘电阻',
value: 'D'
}
],
rightAnswer: 'A',
userAnswer: 'B',
analysis: '解析'
},
{
type: 2,
question: '送配电线路架设工模拟考试',
options: [
{
label: '正常工作电压作用下的电气设备',
value: 'A'
},
{
label: '电气设备的绝缘电阻',
value: 'B'
},
{
label: '电气设备的绝缘电阻',
value: 'C'
},
{
label: '电气设备的绝缘电阻',
value: 'D'
}
],
rightAnswer: ['B', 'D'],
userAnswer: ['B', 'C'],
analysis: '解析'
},
{
type: 3,
question: '送配电线路架设工模拟考试',
options: [
{
label: '对',
value: 'A'
},
{
label: '错',
value: 'B'
}
],
rightAnswer: 'A',
userAnswer: 'A',
analysis: '解析'
},
{
type: 1,
question: '送配电线路架设工模拟考试',
options: [
{
label: '正常工作电压作用下的电气设备',
value: 'A'
},
{
label: '电气设备的绝缘电阻',
value: 'B'
},
{
label: '电气设备的绝缘电阻',
value: 'C'
},
{
label: '电气设备的绝缘电阻',
value: 'D'
}
],
rightAnswer: 'A',
userAnswer: 'B',
analysis: '解析'
},
{
type: 2,
question: '送配电线路架设工模拟考试',
options: [
{
label: '正常工作电压作用下的电气设备',
value: 'A'
},
{
label: '电气设备的绝缘电阻',
value: 'B'
},
{
label: '电气设备的绝缘电阻',
value: 'C'
},
{
label: '电气设备的绝缘电阻',
value: 'D'
}
],
rightAnswer: ['B', 'D'],
userAnswer: ['B', 'C'],
analysis: '解析'
},
{
type: 3,
question: '送配电线路架设工模拟考试',
options: [
{
label: '对',
value: 'A'
},
{
label: '错',
value: 'B'
}
],
rightAnswer: 'A',
userAnswer: 'A',
analysis: '解析'
},
{
type: 3,
question: '送配电线路架设工模拟考试',
options: [
{
label: '对',
value: 'A'
},
{
label: '错',
value: 'B'
}
],
rightAnswer: 'A',
userAnswer: '',
analysis: '解析'
}
],
questionList: [],
// questionList: [
// {
// type: 1,
// question: '线',
// options: [
// {
// label: '',
// value: 'A'
// },
// {
// label: '',
// value: 'B'
// },
// {
// label: '',
// value: 'C'
// },
// {
// label: '',
// value: 'D'
// }
// ],
// correctGrade: 'A',
// selectAnswer: 'B',
// analysis: ''
// },
// {
// type: 2,
// question: '线',
// options: [
// {
// label: '',
// value: 'A'
// },
// {
// label: '',
// value: 'B'
// },
// {
// label: '',
// value: 'C'
// },
// {
// label: '',
// value: 'D'
// }
// ],
// correctGrade: ['B', 'D'],
// selectAnswer: ['B', 'C'],
// analysis: ''
// },
// {
// type: 3,
// question: '线',
// options: [
// {
// label: '',
// value: 'A'
// },
// {
// label: '',
// value: 'B'
// }
// ],
// correctGrade: 'A',
// selectAnswer: 'A',
// analysis: ''
// },
// {
// type: 1,
// question: '线',
// options: [
// {
// label: '',
// value: 'A'
// },
// {
// label: '',
// value: 'B'
// },
// {
// label: '',
// value: 'C'
// },
// {
// label: '',
// value: 'D'
// }
// ],
// correctGrade: 'A',
// userAnswer: 'A',
// analysis: ''
// },
// {
// type: 2,
// question: '线',
// options: [
// {
// label: '',
// value: 'A'
// },
// {
// label: '',
// value: 'B'
// },
// {
// label: '',
// value: 'C'
// },
// {
// label: '',
// value: 'D'
// }
// ],
// correctGrade: ['B', 'D'],
// userAnswer: ['B', 'C'],
// analysis: ''
// },
// {
// type: 2,
// question: '线',
// options: [
// {
// label: '',
// value: 'A'
// },
// {
// label: '',
// value: 'B'
// },
// {
// label: '',
// value: 'C'
// },
// {
// label: '',
// value: 'D'
// }
// ],
// correctGrade: ['B', 'D'],
// userAnswer: ['B', 'D'],
// analysis: ''
// },
// {
// type: 3,
// question: '线',
// options: [
// {
// label: '',
// value: 'A'
// },
// {
// label: '',
// value: 'B'
// }
// ],
// correctGrade: 'A',
// userAnswer: 'A',
// analysis: ''
// },
// {
// type: 1,
// question: '线',
// options: [
// {
// label: '',
// value: 'A'
// },
// {
// label: '',
// value: 'B'
// },
// {
// label: '',
// value: 'C'
// },
// {
// label: '',
// value: 'D'
// }
// ],
// rightAnswer: 'A',
// userAnswer: 'B',
// analysis: ''
// },
// {
// type: 2,
// question: '线',
// options: [
// {
// label: '',
// value: 'A'
// },
// {
// label: '',
// value: 'B'
// },
// {
// label: '',
// value: 'C'
// },
// {
// label: '',
// value: 'D'
// }
// ],
// rightAnswer: ['B', 'D'],
// userAnswer: ['B', 'C'],
// analysis: ''
// },
// {
// type: 3,
// question: '线',
// options: [
// {
// label: '',
// value: 'A'
// },
// {
// label: '',
// value: 'B'
// }
// ],
// rightAnswer: 'A',
// userAnswer: 'A',
// analysis: ''
// },
// {
// type: 1,
// question: '线',
// options: [
// {
// label: '',
// value: 'A'
// },
// {
// label: '',
// value: 'B'
// },
// {
// label: '',
// value: 'C'
// },
// {
// label: '',
// value: 'D'
// }
// ],
// rightAnswer: 'A',
// userAnswer: 'B',
// analysis: ''
// },
// {
// type: 2,
// question: '线',
// options: [
// {
// label: '',
// value: 'A'
// },
// {
// label: '',
// value: 'B'
// },
// {
// label: '',
// value: 'C'
// },
// {
// label: '',
// value: 'D'
// }
// ],
// rightAnswer: ['B', 'D'],
// userAnswer: ['B', 'C'],
// analysis: ''
// },
// {
// type: 3,
// question: '线',
// options: [
// {
// label: '',
// value: 'A'
// },
// {
// label: '',
// value: 'B'
// }
// ],
// rightAnswer: 'A',
// userAnswer: 'A',
// analysis: ''
// },
// {
// type: 3,
// question: '线',
// options: [
// {
// label: '',
// value: 'A'
// },
// {
// label: '',
// value: 'B'
// }
// ],
// correctGrade: 'A',
// userAnswer: '',
// analysis: ''
// }
// ],
//
rightList: [],
//
@ -430,58 +463,71 @@ export default {
list: []
}
},
onLoad(opt) {
opt = JSON.parse(opt.params)
console.log('🚀 ~ onLoad ~ opt-结果详情:', opt)
this.examId = opt.examId
this.recordId = opt.recordId
},
mounted() {
this.getList()
this.list = this.questionList
this.list.forEach((item, index) => {
if (index < 7) {
item.isShow = true
} else {
item.isShow = false
}
})
},
methods: {
getList() {
async getList() {
const params = {
examId: this.examId,
recordId: this.recordId
}
const res = await getExamRecordAnswer(params)
this.questionList = res.data.examPaperData
this.list = this.questionList
this.list.forEach((item, index) => {
if (index < 7) {
item.isShow = true
} else {
item.isShow = false
}
})
console.log('🚀 ~ getList ~ res:', res)
this.questionList.forEach((item, index) => {
if (item.type === 1 || item.type === 3) {
if (!item.userAnswer) {
if (item.examType === 1 || item.examType === 3) {
if (!item.selectAnswer) {
this.unAnsweredCount++
item.isUnAnswered = true
//
item.options.forEach(option => {
option.isRight = option.value === item.rightAnswer
item.listOption.forEach(option => {
option.isRight = option.optionIdent === item.correctGrade
})
} else {
if (item.rightAnswer === item.userAnswer) {
if (item.correctGrade === item.selectAnswer) {
this.rightCount++
//
item.isRight = true
item.options.forEach(option => {
option.isRight = option.value === item.rightAnswer
item.listOption.forEach(option => {
option.isRight = option.optionIdent === item.correctGrade
})
} else {
this.wrongCount++
//
item.isWrong = true
item.options.forEach(option => {
option.isError = option.value === item.userAnswer
if (option.value === item.rightAnswer) {
item.listOption.forEach(option => {
option.isError = option.optionIdent === item.selectAnswer
if (option.optionIdent === item.correctGrade) {
option.isRight = true
}
})
}
}
} else {
if (!item.userAnswer) {
if (!item.selectAnswer) {
this.unAnsweredCount++
item.isUnAnswered = true
//
item.options.forEach(option => {
option.isRight = item.rightAnswer.includes(option.value)
item.listOption.forEach(option => {
option.isRight = item.correctGrade.includes(option.optionIdent)
})
} else {
if (item.rightAnswer.toString() === item.userAnswer.toString()) {
if (item.correctGrade.toString() === item.selectAnswer.toString()) {
this.rightCount++
//
item.isRight = true
@ -490,19 +536,18 @@ export default {
//
item.isWrong = true
}
item.listOption.forEach(option => {
if (item.correctGrade.includes(option.optionIdent)) {
option.isRight = true
}
if (item.selectAnswer.includes(option.optionIdent)) {
option.isError = true
}
if (option.isRight && option.isError) {
option.isError = false
}
})
}
// ,, , ,
item.options.forEach(option => {
if (item.rightAnswer.includes(option.value)) {
option.isRight = true
}
if (item.userAnswer.includes(option.value)) {
option.isError = true
}
if (option.isRight && option.isError) {
option.isError = false
}
})
}
})
this.rightList = this.questionList.filter(item => item.isRight)
@ -512,7 +557,7 @@ export default {
handleTab(index) {
console.log('🚀 ~ handleTab ~ index:', index)
this.isActive = index
this.currentIndex = 0
this.currentIndex = 0
if (index === 1) {
this.list = this.questionList
} else if (index === 2) {
@ -707,6 +752,14 @@ export default {
color: #646464;
background: #edf2f7;
border-radius: 5px;
.grade {
display: flex;
justify-content: center;
align-items: center;
flex-wrap: nowrap;
margin-right: 3px;
}
}
}
@ -719,12 +772,31 @@ export default {
justify-content: flex-start;
}
.analysis-item {
height: 100px;
margin-bottom: 100px;
height: 80px;
background: #edf2f7;
border-radius: 5px;
padding: 10px;
font-size: 12px;
color: #656565;
overflow: auto;
}
.bottom-btn {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
background-color: #fff;
padding: 15px 0;
display: flex;
justify-content: flex-end;
align-items: center;
.btn {
width: 100px;
margin-right: 10px;
}
}
}
</style>

View File

@ -11,22 +11,20 @@
</div>
<div class="content">
<div v-for="(item, index) in list" :key="index" class="item-wrapper">
<div class="title">{{ item.title }}</div>
<div class="title">{{ item.name }}</div>
<div class="name-status">
<div class="name">
{{ item.name }}
<div class="name-sub">指派</div>
</div>
<div class="status">{{ item.status }}</div>
<div class="status">{{ item.alreadyNum > 0 ? '已练习' : '未练习' }}</div>
</div>
<div class="time">{{ item.time }}</div>
<div class="time">练习时长 {{ item.practiceDuration }}</div>
<div class="count-total">
<div class="count">练习{{ item.count }}</div>
<div class="total">总分{{ item.total }}</div>
<div class="count">{{ item.allQuestionNum || 0 }}, 已练习{{ item.alreadyNum || 0 }}</div>
</div>
<div class="bt-wrapper">
<div class="score">得分{{ item.score }}</div>
<div class="btn" @click="handleExercise(item.id)">开始练习</div>
<div class="score">完成率{{ item.completionRate }}</div>
<div class="btn-wrapper">
<div class="btn" @click="handleExercise(item.id)">开始练习</div>
<div class="btn" @click="handleError(item)">错题消除({{ item.missNum }})</div>
</div>
</div>
</div>
@ -40,6 +38,8 @@
</template>
<script>
import { getStudentPracticeList } from '@/api/eduApp'
export default {
data() {
return {
@ -47,42 +47,7 @@ export default {
activeIndex: 0,
list: [],
//
allList: [
{
id: 1,
//
title: '送配电线路架设(初级)',
//
name: '张三',
//
status: '待练习',
//
time: '2020-12-12 12:00',
//
count: 1,
//
total: '--',
//
score: '暂无'
},
{
id: 2,
//
title: '送配电线路架设(初级)',
//
name: '张三',
//
status: '待练习',
//
time: '2020-12-12 12:00',
//
count: 1,
//
total: '--',
//
score: '暂无'
}
],
allList: [],
//
waitList: [],
//
@ -90,9 +55,21 @@ export default {
}
},
mounted() {
this.list = this.allList
this.getList()
},
methods: {
async getList() {
const params = {
userId: 31,
source: 1
}
const res = await getStudentPracticeList(params)
this.list = this.allList = res.data
// alreadyNum
this.waitList = res.data.filter(item => item.alreadyNum === 0)
this.alreadyList = res.data.filter(item => item.alreadyNum > 0)
console.log('🚀 ~ getList ~ res:', res)
},
handleTab(item, index) {
this.activeIndex = index
if (index === 0) {
@ -115,6 +92,12 @@ export default {
uni.navigateTo({
url: '/pages/YNEduApp/index/index'
})
},
//
handleError(item) {
uni.navigateTo({
url: '/pages/YNEduApp/prac/exercises?id=' + item.id
})
}
}
}
@ -190,7 +173,11 @@ export default {
.score {
color: #999;
}
.btn-wrapper {
display: flex;
}
.btn {
margin-left: 5px;
padding: 5px 10px;
background: #409eff;
color: #fff;

View File

@ -41,14 +41,20 @@
<script>
import face from '@/uni_modules/mcc-face/index.js'
import config from 'config.js'
export default {
data() {
return {
isShow: true,
url: ''
url: '',
facePath: '',
optMode: 'add'
}
},
mounted() {
console.log('🚀 ~ mounted', config)
},
methods: {
//
openFaceScan() {
@ -58,15 +64,66 @@ export default {
this.url = e
this.isShow = false
face.close()
uni.showToast({
title: '人脸识别成功',
icon: 'none'
})
})
if (!this.url) this.isShow = true
},
//
handleSubmit() {}
handleSubmit() {
console.log('🚀 ~ 确定录入:')
//
uni.uploadFile({
url: config.uploadUrl,
filePath: this.url,
name: 'data',
formData: {
photoType: 'face',
file: this.url
},
header: {
Authorization: uni.getStorageSync('App-Token')
},
success: res => {
console.log('🚀 ~ res:', res)
res = JSON.parse(res.data)
this.facePath = res.data.url
console.log('🚀 ~ handleSubmit ~ this.facePath:', this.facePath)
let params = {
userId: 31,
facePath: this.facePath,
optMode: this.optMode,
img: this.url
}
params = JSON.stringify(params)
uni.request({
url: config.baseUrl + '/personalCenter/getFaceRecognition',
method: 'POST',
data: params,
header: {
'content-type': 'application/json'
},
success: res => {
res = JSON.parse(res.data)
console.log('🚀 ~ this.uploadFaceRecognition ~ res上传成功:', res)
if (res.data.code === 200) {
uni.showToast({
title: '人脸信息录入成功',
icon: 'none'
})
} else {
uni.showToast({
title: '人脸信息录入失败',
icon: 'none'
})
}
uni.navigateBack()
},
fail: err => {
console.log('🚀 ~ this.uploadFaceRecognition ~ err:', err)
}
})
}
})
}
}
}
</script>
@ -101,10 +158,10 @@ export default {
display: flex;
flex-direction: column;
align-items: center;
:nth-child(2) {
margin-top: 10px;
color: #6b6b6b;
}
:nth-child(2) {
margin-top: 10px;
color: #6b6b6b;
}
}
}
.btn {

BIN
static/images/user.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB