From 862b488dcf0c30de4a715a02504a9f449255d8d2 Mon Sep 17 00:00:00 2001 From: huliyong <2783385703@qq.com> Date: Fri, 20 Jun 2025 00:46:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E8=80=83=E8=AF=95?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E5=8A=9F=E8=83=BD=E5=B9=B6=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=A4=9A=E4=B8=AA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增考试结果查询接口getAnswerBuildData - 修改考试提交接口为addBaseAnswerV2 - 修复订单服务项显示顺序问题 - 增加补充信息字数限制和校验 - 优化考试流程和错误处理逻辑 - 更新图片资源路径 - 添加考试工具函数和错误详情页面 --- api/examination/index.js | 17 +- components/order/ServiceItems.vue | 2 +- otherPages/authentication/examination/base.vue | 50 ++-- .../examination/errorDetail - 副本.vue | 206 ++++++++++++++++ .../authentication/examination/errorDetail.vue | 271 ++++++++++++++------- otherPages/authentication/examination/start.vue | 93 ++++++- otherPages/myOrdersManage/clock/index.vue | 7 +- pages/myOrdersManage/index.vue | 7 + pages/orderTakingManage/components/list.vue | 18 +- pages/userManage/index.vue | 4 +- pages/workbenchManage/index.vue | 20 +- static/images/user/a1.png | Bin 0 -> 10113 bytes static/images/user/a2.png | Bin 0 -> 10536 bytes utils/exam.js | 69 ++++++ utils/getUrl.js | 4 +- utils/serviceTime.js | 2 + 16 files changed, 633 insertions(+), 137 deletions(-) create mode 100644 otherPages/authentication/examination/errorDetail - 副本.vue create mode 100644 static/images/user/a1.png create mode 100644 static/images/user/a2.png create mode 100644 utils/exam.js diff --git a/api/examination/index.js b/api/examination/index.js index ef3a46f..8270475 100644 --- a/api/examination/index.js +++ b/api/examination/index.js @@ -80,7 +80,7 @@ export const getQuestionOptions = (params) => { // 伴宠师工作台-添加用户基本考核答案 export const addBaseAnswer = (data) => { return request({ - url: '/applet/examination/addBaseAnswer', + url: '/applet/examination/addBaseAnswerV2', headers: { isToken: true }, @@ -185,3 +185,18 @@ export const retakeExam = (params) => { }) } + + +// 伴宠师工作台-查询考试结果对象 +export const getAnswerBuildData = (userId) => { + return request({ + url: '/applet/examination/getAnswerBuildData', + headers: { + isToken: true + }, + method: 'get', + params : { + userId + } + }).then(res => res.data) +} \ No newline at end of file diff --git a/components/order/ServiceItems.vue b/components/order/ServiceItems.vue index 27fb4f7..10b5aa8 100644 --- a/components/order/ServiceItems.vue +++ b/components/order/ServiceItems.vue @@ -11,10 +11,10 @@ {{item.day}} | - {{ item.itemsText[0] }} {{ item.itemsText[0] }}+{{ item.itemsText[item.itemsText.length - 1] }}{{ item.itemsText.length }}项 + {{ item.itemsText[0] }} ¥{{item.price.toFixed(2)}} diff --git a/otherPages/authentication/examination/base.vue b/otherPages/authentication/examination/base.vue index b67c281..e07cb71 100644 --- a/otherPages/authentication/examination/base.vue +++ b/otherPages/authentication/examination/base.vue @@ -39,7 +39,8 @@ + + \ No newline at end of file diff --git a/otherPages/authentication/examination/errorDetail.vue b/otherPages/authentication/examination/errorDetail.vue index 4a50de4..b59de19 100644 --- a/otherPages/authentication/examination/errorDetail.vue +++ b/otherPages/authentication/examination/errorDetail.vue @@ -3,27 +3,56 @@ - - - {{ group.title }} + + + 选择题 + + + {{ `${question.title}` }} + + + {{ option.title }} + + + + + + + - - + + + + + 培训题 + + + {{ `${question.title}` }} + + + {{ question.userAppletAnswerTrain?.answer || '未作答' }} + {{ question.answer }} + + + + + + 驳回原因 + + {{ detail.reason }} - + - 剩余考试机会:{{ restTimes }}次 + 剩余考试机会:{{ restTimes - examNumber }} 重新考试 @@ -34,14 +63,16 @@ @@ -203,4 +194,102 @@ } } } + + .question-section { + margin-bottom: 40rpx; + } + + .section-title { + font-size: 32rpx; + font-weight: bold; + color: #333; + margin: 30rpx 0; + padding-left: 20rpx; + border-left: 8rpx solid #FFBF60; + } + + .question { + color: #000000; + } + + .option { + background-color: #F3F3F3; + color: #707070; + line-height: 37rpx; + padding: 23rpx; + border-radius: 28rpx; + position: relative; + + &+& { + margin-top: 20rpx; + } + + .icon { + position: absolute; + right: 45rpx; + bottom: 23rpx; + display: none; + } + + &.is-correct { + background-color: rgba($color: #05C160, $alpha: 0.08); + color: #05C160; + + .icon-correct { + display: block; + } + } + + &.is-error { + background-color: rgba($color: #FFEBCE, $alpha: 0.36); + color: #FF2A2A; + + .icon-error { + display: block; + } + } + } + + .textarea { + background-color: #F3F3F3; + padding: 23rpx; + border-radius: 16rpx; + margin-top: 20rpx; + + .answer-content { + font-size: 28rpx; + color: #333; + line-height: 1.6; + margin-bottom: 20rpx; + } + + .highlight { + color: #FF2A2A; + font-size: 28rpx; + line-height: 1.6; + padding-top: 20rpx; + border-top: 1px solid rgba(0, 0, 0, 0.1); + } + } + + .footer-btn { + position: fixed; + left: 0; + right: 0; + bottom: 0; + height: $bar-height; + background: #fff; + box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05); + } + + .btn { + width: 600rpx; + height: 80rpx; + line-height: 80rpx; + text-align: center; + background: #FFBF60; + color: #fff; + border-radius: 40rpx; + font-size: 32rpx; + } \ No newline at end of file diff --git a/otherPages/authentication/examination/start.vue b/otherPages/authentication/examination/start.vue index 2ad377b..3727815 100644 --- a/otherPages/authentication/examination/start.vue +++ b/otherPages/authentication/examination/start.vue @@ -30,15 +30,18 @@ - - - 剩余考试机会:{{ restTimes }}次 + + - - 开始考试 + + {{ canTakeExam ? '开始考试' : '暂无考试机会' }} @@ -48,15 +51,61 @@ import { ref, computed } from 'vue' import { useStore } from 'vuex' import { onLoad } from '@dcloudio/uni-app' + import { insertUser, udpateUser, getUserOne } from '@/api/userTeacher' + import dayjs from 'dayjs' const store = useStore() const petType = ref([]) const restTimes = ref() + const lastExamTime = ref('') + + //已考试次数 + const examNumber = ref(0) const configList = computed(() => { return store.getters.configList }) + const userId = computed(() => { + return store.state.user.userInfo.userId + }) + + // 计算下次考试时间 + const nextExamTime = computed(() => { + if (!lastExamTime.value) return '' + const nextTime = dayjs(lastExamTime.value).add(1, 'year') + return nextTime.format('YYYY年MM月DD日') + }) + + // 判断是否可以参加考试 + const canTakeExam = computed(() => { + + if((restTimes.value - examNumber.value) > 0){ + return true + } + + if (!lastExamTime.value) return true + const nextTime = dayjs(lastExamTime.value).add(1, 'year') + return dayjs().isAfter(nextTime) + }) + + const getInfo = async () => { + try { + if(!userId.value) { + return + } + + const data = await getUserOne(userId.value) + + examNumber.value = data.examNumber || 0 + lastExamTime.value = data.examTime + + petType.value = data.petType.split(',').map(n => parseInt(n)) + + } catch (err) { + console.log('--err', err) + } + } const petTypeImg = computed(() => { return store.getters.petTypeOptions. @@ -64,15 +113,19 @@ }) onLoad((option) => { - store.dispatch('fetchPetTypeOptions') - - petType.value = option.petType.split(',').map(n => parseInt(n)) - - // todo: fetch + store.dispatch('fetchPetTypeOptions') + getInfo() restTimes.value = parseInt(configList.value.pet_work_num.paramValueText || 0) }) const toNext = () => { + if (!canTakeExam.value) { + uni.showToast({ + title: `请于${nextExamTime.value}后再来考试`, + icon: 'none' + }) + return + } uni.navigateTo({ url: "/otherPages/authentication/examination/base" }) @@ -138,9 +191,29 @@ } } + .next-exam-time { + color: #FF2A2A; + } + .footer-btn { height: 163rpx; box-sizing: border-box; padding-bottom: 18rpx; } + + .btn { + width: 600rpx; + height: 80rpx; + line-height: 80rpx; + text-align: center; + background: #FFBF60; + color: #fff; + border-radius: 40rpx; + font-size: 32rpx; + + &-disabled { + background: #CCCCCC; + color: #FFFFFF; + } + } \ No newline at end of file diff --git a/otherPages/myOrdersManage/clock/index.vue b/otherPages/myOrdersManage/clock/index.vue index c050d0e..b45e0a3 100644 --- a/otherPages/myOrdersManage/clock/index.vue +++ b/otherPages/myOrdersManage/clock/index.vue @@ -197,7 +197,7 @@ 其他补充信息(必填) - 可记录一下今日趣事、宠物状况、提醒事项等 + 可记录一下今日趣事、宠物状况、提醒事项等,最少30个字