From 60b53e611a7a04268fa3911371c8792b29c31890 Mon Sep 17 00:00:00 2001 From: huliyong <2783385703@qq.com> Date: Sat, 10 May 2025 22:32:55 +0800 Subject: [PATCH] =?UTF-8?q?feat(workbench):=20=E6=B7=BB=E5=8A=A0=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E8=80=83=E6=A0=B8=E5=AE=8C=E6=88=90=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E5=B9=B6=E8=B0=83=E6=95=B4=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在用户点击伴宠师工作台时,新增对用户基本考核和培训考核完成状态的检查。根据检查结果,调整导航逻辑,确保用户被引导至正确的页面。同时,优化了部分代码的可读性和维护性。 --- api/examination/index.js | 32 +++++++++++++++++++++- .../authentication/components/questionCard.vue | 4 +-- otherPages/authentication/examination/base.vue | 14 +++++++++- otherPages/authentication/examination/train.vue | 17 +++++++++++- otherPages/authentication/list/index.vue | 1 + pages/workbenchManage/index.vue | 30 ++++++++++++++++++-- utils/getUrl.js | 4 +-- 7 files changed, 92 insertions(+), 10 deletions(-) diff --git a/api/examination/index.js b/api/examination/index.js index 6be61fe..82876d5 100644 --- a/api/examination/index.js +++ b/api/examination/index.js @@ -127,4 +127,34 @@ export const answeTrainByQuestionId = (params) => { }).then(res => { return res.data?.pop() || {} }) -} \ No newline at end of file +} + + +// 伴宠师工作台-查询用户基本考核是否完成 +export const answeBaseIsFinish = (params) => { + return request({ + url: '/applet/examination/answeBaseIsFinish', + headers: { + isToken: true + }, + method: "get", + params + }).then(res => { + return res.code == 200 + }) +} + + +// 伴宠师工作台-查询用户培训考核是否完成 +export const answeTrainIsFinish = (params) => { + return request({ + url: '/applet/examination/answeTrainIsFinish', + headers: { + isToken: true + }, + method: "get", + params + }).then(res => { + return res.code == 200 + }) +} diff --git a/otherPages/authentication/components/questionCard.vue b/otherPages/authentication/components/questionCard.vue index f45051d..8000d19 100644 --- a/otherPages/authentication/components/questionCard.vue +++ b/otherPages/authentication/components/questionCard.vue @@ -74,7 +74,7 @@ } }, modelValue: { - type: String | Number, + type: [String, Number], default: null, }, mode: { @@ -86,7 +86,7 @@ default: null, // '基本' | '培训' } }) - + const min = 700 const emit = defineEmits(['update:modelValue']) diff --git a/otherPages/authentication/examination/base.vue b/otherPages/authentication/examination/base.vue index 97c80dc..89a87dc 100644 --- a/otherPages/authentication/examination/base.vue +++ b/otherPages/authentication/examination/base.vue @@ -68,7 +68,19 @@ const initQuestion = async () => { } const answered = computed(() => { - return list.value.filter(item => item.value !== null).length + return list.value.filter(item => { + + if(item.value == null){ + return false + } + + // if(typeof item.value == 'string'){ + // return item.value.length >= 700 + // } + + return true + + }).length }) const progress = computed(() => { diff --git a/otherPages/authentication/examination/train.vue b/otherPages/authentication/examination/train.vue index 28d5593..b0f8a98 100644 --- a/otherPages/authentication/examination/train.vue +++ b/otherPages/authentication/examination/train.vue @@ -61,7 +61,22 @@ const initQuestion = async () => { } const answered = computed(() => { - return list.value.filter(item => item.value?.length).length + + return list.value.filter(item => { + + if(item.value == null){ + return false + } + + if(typeof item.value == 'string'){ + return item.value.length >= 700 + } + + return true + + }).length + + // return list.value.filter(item => item.value?.length).length }) const progress = computed(() => { diff --git a/otherPages/authentication/list/index.vue b/otherPages/authentication/list/index.vue index d13ab1a..1339a1e 100644 --- a/otherPages/authentication/list/index.vue +++ b/otherPages/authentication/list/index.vue @@ -199,6 +199,7 @@ }) return } + id.value = _id diff --git a/pages/workbenchManage/index.vue b/pages/workbenchManage/index.vue index cb11e07..e0347ac 100644 --- a/pages/workbenchManage/index.vue +++ b/pages/workbenchManage/index.vue @@ -91,6 +91,7 @@ useStore } from "vuex" import configPopup from '@/components/configPopup.vue' + import { answeBaseIsFinish, answeTrainIsFinish } from '@/api/examination' const configPopupRef = ref(null) const store = useStore(); @@ -208,10 +209,33 @@ const handleOpen = () => { show.value = false } - const handleBc = () => { - uni.navigateTo({ - url: "/otherPages/authentication/list/index" + const handleBc = async () => { + + if(!userInfo.value || !userInfo.value.userId){ + uni.navigateTo({ + url: "/otherPages/authentication/list/index" + }) + return + } + + uni.showLoading({ + title: '加载中...' }) + + let code1 = await answeBaseIsFinish({userId : userInfo.value.userId}) + let code2 = await answeTrainIsFinish({userId : userInfo.value.userId}) + + uni.hideLoading() + + if(code1 && code2){ + uni.navigateTo({ + url: `/otherPages/authentication/examination/trainCompleted/index?status=0` + }) + }else{ + uni.navigateTo({ + url: "/otherPages/authentication/list/index" + }) + } } diff --git a/utils/getUrl.js b/utils/getUrl.js index 019460a..4ac295e 100644 --- a/utils/getUrl.js +++ b/utils/getUrl.js @@ -3,9 +3,9 @@ const accountInfo = wx.getAccountInfoSync(); current = accountInfo.miniProgram.envVersion; const api = { - // develop:"http://h5.xzaiyp.top", + develop:"http://h5.xzaiyp.top", // develop:"https://api.catmdogd.com/prod-api", - develop:"http://pet-admin.hhlm1688.com/api", + // develop:"http://pet-admin.hhlm1688.com/api", // develop: "http://youyi-test.natapp1.cc/prod-api", // 开发 trial: "https://api.catmdogd.com/prod-api", //测试 release: "https://api.catmdogd.com/prod-api",