= 职业规划推荐
This commit is contained in:
@@ -62,12 +62,14 @@ export const useSkillDevelopmentStore = defineStore('skill-development', () => {
|
||||
const paths = ref([]);
|
||||
const pathsRef = computed(() => {
|
||||
return paths.value.filter((d) => {
|
||||
return `${ d.startJobId }` === profession.value;
|
||||
const [startJobId] = d.value.split('-');
|
||||
return startJobId === profession.value;
|
||||
});
|
||||
});
|
||||
|
||||
const careerPaths = ref([]);
|
||||
const currentCareer = ref(null);
|
||||
const currentCareerIndex = ref(0);
|
||||
const currentCareerLabel = computed(() => {
|
||||
if (!currentCareer.value) {
|
||||
return '';
|
||||
@@ -117,8 +119,8 @@ export const useSkillDevelopmentStore = defineStore('skill-development', () => {
|
||||
paths.value = data.map((d) => {
|
||||
return {
|
||||
label: d.endJob,
|
||||
value: d.endJob,
|
||||
startJobId: d.startJobId
|
||||
value: `${d.startJobId}-${d.endJobId}`
|
||||
|
||||
};
|
||||
});
|
||||
} catch (e) {
|
||||
@@ -147,14 +149,26 @@ export const useSkillDevelopmentStore = defineStore('skill-development', () => {
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
careerPaths.value = data.map((d) => {
|
||||
careerPaths.value = data.map((d, i) => {
|
||||
let index = `${i}`;
|
||||
let fontSize = 26;
|
||||
if (i === 0) {
|
||||
index = '起点';
|
||||
fontSize = 18;
|
||||
}
|
||||
if (i === data.length - 1) {
|
||||
index = '终点';
|
||||
fontSize = 18;
|
||||
}
|
||||
return {
|
||||
index,
|
||||
label: d.name,
|
||||
value: d.jobId
|
||||
value: d.jobId,
|
||||
fontSize
|
||||
};
|
||||
});
|
||||
if (careerPaths.value[0]) {
|
||||
void eventResult(careerPaths.value[0]);
|
||||
void eventResult(0);
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn(e);
|
||||
@@ -162,13 +176,15 @@ export const useSkillDevelopmentStore = defineStore('skill-development', () => {
|
||||
}
|
||||
};
|
||||
|
||||
const eventResult = async (path) => {
|
||||
currentCareer.value = path;
|
||||
const eventResult = async (index) => {
|
||||
currentCareerIndex.value = index;
|
||||
currentCareer.value = careerPaths.value[index] ?? null;
|
||||
|
||||
const params = {
|
||||
jobId: path.value
|
||||
jobId: currentCareer.value?.value
|
||||
};
|
||||
try {
|
||||
const { code, msg, data } = await $AxiosHttp.useAxiosRequest(getSkillResult, params);
|
||||
const { code, msg, data } = await getSkillResult(params);
|
||||
if (code !== 0) {
|
||||
uni.showToast({
|
||||
title: msg,
|
||||
@@ -267,6 +283,7 @@ export const useSkillDevelopmentStore = defineStore('skill-development', () => {
|
||||
careerPaths,
|
||||
currentCareer,
|
||||
currentCareerLabel,
|
||||
currentCareerIndex,
|
||||
result,
|
||||
eventProfession,
|
||||
eventTargetCareer,
|
||||
|
||||
Reference in New Issue
Block a user