Browse Source

feat(workbench): 添加用户考核完成状态检查并调整导航逻辑

在用户点击伴宠师工作台时,新增对用户基本考核和培训考核完成状态的检查。根据检查结果,调整导航逻辑,确保用户被引导至正确的页面。同时,优化了部分代码的可读性和维护性。
master
前端-胡立永 4 weeks ago
parent
commit
60b53e611a
7 changed files with 92 additions and 10 deletions
  1. +31
    -1
      api/examination/index.js
  2. +2
    -2
      otherPages/authentication/components/questionCard.vue
  3. +13
    -1
      otherPages/authentication/examination/base.vue
  4. +16
    -1
      otherPages/authentication/examination/train.vue
  5. +1
    -0
      otherPages/authentication/list/index.vue
  6. +27
    -3
      pages/workbenchManage/index.vue
  7. +2
    -2
      utils/getUrl.js

+ 31
- 1
api/examination/index.js View File

@ -127,4 +127,34 @@ export const answeTrainByQuestionId = (params) => {
}).then(res => {
return res.data?.pop() || {}
})
}
}
// 伴宠师工作台-查询用户基本考核是否完成
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
})
}

+ 2
- 2
otherPages/authentication/components/questionCard.vue View File

@ -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'])


+ 13
- 1
otherPages/authentication/examination/base.vue View File

@ -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(() => {


+ 16
- 1
otherPages/authentication/examination/train.vue View File

@ -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(() => {


+ 1
- 0
otherPages/authentication/list/index.vue View File

@ -199,6 +199,7 @@
})
return
}
id.value = _id


+ 27
- 3
pages/workbenchManage/index.vue View File

@ -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"
})
}
}
</script>


+ 2
- 2
utils/getUrl.js View File

@ -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",


Loading…
Cancel
Save