= 职业规划推荐

This commit is contained in:
2026-01-13 23:31:04 +08:00
parent 9d37f3a22a
commit 17366c05ee
3 changed files with 54 additions and 47 deletions

View File

@@ -16,17 +16,19 @@ export function getJobPathPage(params) {
// 根据职业路径ID获取详情 // 根据职业路径ID获取详情
export function getJobPathDetail(params) { export function getJobPathDetail(params) {
const {startJobId, endJobId} = params;
const requestParams = {}; const requestParams = {};
if (params?.jobPathId !== undefined && params?.jobPathId !== null && params?.jobPathId !== '') { if (startJobId !== undefined && startJobId !== null && startJobId !== '') {
requestParams.id = params.jobPathId; requestParams.startJobId = startJobId;
} else if (params?.id !== undefined && params?.id !== null && params?.id !== '') {
requestParams.id = params.id;
} }
if (endJobId !== undefined && endJobId !== null && endJobId !== '') {
if (!requestParams.id) { requestParams.endJobId = endJobId;
return Promise.reject('缺少必需的 id 参数');
} }
if (!startJobId || !endJobId) {
return Promise.reject('缺少必需的 startJobId 和 endJobId 参数');
}
return request({ return request({
url: '/jobPath/getJobPathById', url: '/jobPath/getJobPathById',
method: 'get', method: 'get',

2
package-lock.json generated
View File

@@ -1,5 +1,5 @@
{ {
"name": "ks-app", "name": "ks-app-employment-service",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {

View File

@@ -6,22 +6,22 @@
<uni-icons type="search" size="18" color="#286BFA"></uni-icons> <uni-icons type="search" size="18" color="#286BFA"></uni-icons>
<text class="title-text">职业路径查询</text> <text class="title-text">职业路径查询</text>
</view> </view>
<view class="input-group"> <view class="input-group">
<view class="input-item"> <view class="input-item">
<text class="input-label">当前职位</text> <text class="input-label">当前职位</text>
<input <input
class="input-field" class="input-field"
:value="currentPosition" :value="currentPosition"
placeholder="市场专员" placeholder="市场专员"
placeholder-style="color: #999999" placeholder-style="color: #999999"
disabled disabled
/> />
</view> </view>
<view class="input-item"> <view class="input-item">
<text class="input-label">目标职业</text> <text class="input-label">目标职业</text>
<picker <picker
mode="selector" mode="selector"
:range="targetCareerOptions" :range="targetCareerOptions"
range-key="label" range-key="label"
@@ -37,7 +37,7 @@
</picker> </picker>
</view> </view>
</view> </view>
<button class="query-btn" @click="handleQuery"> <button class="query-btn" @click="handleQuery">
<text>查询职业发展路径</text> <text>查询职业发展路径</text>
<uni-icons type="search" size="18" color="#FFFFFF"></uni-icons> <uni-icons type="search" size="18" color="#FFFFFF"></uni-icons>
@@ -53,7 +53,7 @@
<uni-icons type="person-filled" size="24" color="#000000"></uni-icons> <uni-icons type="person-filled" size="24" color="#000000"></uni-icons>
<text class="title-text">职业发展路径</text> <text class="title-text">职业发展路径</text>
</view> </view>
<view class="timeline"> <view class="timeline">
<!-- 起点 --> <!-- 起点 -->
<view class="timeline-item start"> <view class="timeline-item start">
@@ -61,9 +61,9 @@
<view class="timeline-content"> <view class="timeline-content">
<view class="step-title">起点: {{ pathData.start.title }}</view> <view class="step-title">起点: {{ pathData.start.title }}</view>
<view class="skill-tags"> <view class="skill-tags">
<view <view
class="skill-tag" class="skill-tag"
v-for="(skill, index) in pathData.start.skills" v-for="(skill, index) in pathData.start.skills"
:key="index" :key="index"
> >
{{ skill }} {{ skill }}
@@ -73,18 +73,18 @@
</view> </view>
<!-- 步骤 --> <!-- 步骤 -->
<view <view
class="timeline-item step" class="timeline-item step"
v-for="(step, index) in pathData.steps" v-for="(step, index) in pathData.steps"
:key="index" :key="index"
> >
<view class="timeline-marker step-marker"></view> <view class="timeline-marker step-marker"></view>
<view class="timeline-content"> <view class="timeline-content">
<view class="step-title">{{ index + 1 }}: {{ step.title }}</view> <view class="step-title">{{ index + 1 }}: {{ step.title }}</view>
<view class="skill-tags"> <view class="skill-tags">
<view <view
class="skill-tag" class="skill-tag"
v-for="(skill, sIndex) in step.skills" v-for="(skill, sIndex) in step.skills"
:key="sIndex" :key="sIndex"
> >
{{ skill }} {{ skill }}
@@ -99,9 +99,9 @@
<view class="timeline-content"> <view class="timeline-content">
<view class="step-title">终点: {{ pathData.end.title }}</view> <view class="step-title">终点: {{ pathData.end.title }}</view>
<view class="skill-tags"> <view class="skill-tags">
<view <view
class="skill-tag" class="skill-tag"
v-for="(skill, index) in pathData.end.skills" v-for="(skill, index) in pathData.end.skills"
:key="index" :key="index"
> >
{{ skill }} {{ skill }}
@@ -180,15 +180,17 @@ async function fetchTargetCareerOptions(keyword = '') {
pageNo: 1, pageNo: 1,
pageSize: 100 pageSize: 100
}); });
const list = response?.data?.list || response?.list || []; const list = response?.data?.list || response?.list || [];
targetCareerOptions.value = list.map(item => ({ targetCareerOptions.value = list.map(item => ({
label: item.endJob || item.startJob || '未知职位', label: item.endJob || item.startJob || '未知职位',
value: item.id, value: item.id,
startJob: item.startJob, startJob: item.startJob,
endJob: item.endJob, endJob: item.endJob,
jobOrder: item.jobOrder jobOrder: item.jobOrder,
startJobId: item.startJobId,
endJobId: item.endJobId
})); }));
if (targetCareerOptions.value.length === 0) { if (targetCareerOptions.value.length === 0) {
@@ -215,8 +217,8 @@ async function fetchPathCount() {
} }
} }
async function loadPathDetail(jobPathId) { async function loadPathDetail(startJobId, endJobId) {
if (!jobPathId || jobPathId === null || jobPathId === undefined || jobPathId === '') { if (startJobId === null || startJobId === undefined || startJobId === '' || endJobId === null || endJobId === undefined || endJobId === '') {
uni.showToast({ uni.showToast({
title: '职业路径ID无效', title: '职业路径ID无效',
icon: 'none' icon: 'none'
@@ -224,16 +226,17 @@ async function loadPathDetail(jobPathId) {
resetPathData(); resetPathData();
return; return;
} }
try { try {
const requestParams = { const requestParams = {
jobPathId: jobPathId startJobId,
endJobId
}; };
const response = await getJobPathDetail(requestParams); const response = await getJobPathDetail(requestParams);
const details = Array.isArray(response?.data) ? response.data : []; const details = Array.isArray(response?.data) ? response.data : [];
if (details.length === 0) { if (details.length === 0) {
resetPathData(); resetPathData();
uni.showToast({ uni.showToast({
@@ -257,13 +260,14 @@ async function loadPathDetail(jobPathId) {
steps, steps,
end end
}; };
// 通知父组件路径数据已更新 // 通知父组件路径数据已更新
emit('path-data-updated', { emit('path-data-updated', {
pathData: pathData.value, pathData: pathData.value,
targetCareer: targetCareerOptions.value[selectedTargetIndex.value]?.label || '' targetCareer: targetCareerOptions.value[selectedTargetIndex.value]?.label || ''
}); });
} catch (error) { } catch (error) {
console.warn(error, 22222);
uni.showToast({ uni.showToast({
title: '获取路径详情失败', title: '获取路径详情失败',
icon: 'none' icon: 'none'
@@ -301,16 +305,16 @@ async function handleQuery() {
return; return;
} }
let jobPathId = option.value;
isLoadingPath.value = true; isLoadingPath.value = true;
uni.showLoading({ uni.showLoading({
title: '加载中...', title: '加载中...',
mask: true mask: true
}); });
console.log(option);
try { try {
if (!jobPathId) { let { value: jobPathId, startJobId, endJobId } = option;
/*if (!jobPathId) {
const response = await getJobPathPage({ const response = await getJobPathPage({
jobName: option.label, jobName: option.label,
pageNo: 1, pageNo: 1,
@@ -326,11 +330,12 @@ async function handleQuery() {
}); });
resetPathData(); resetPathData();
return; return;
} }*/
selectedJobPathId.value = jobPathId; // selectedJobPathId.value = jobPathId;
await loadPathDetail(jobPathId); await loadPathDetail(startJobId, endJobId);
} catch (error) { } catch (error) {
console.warn(error, 11111);
uni.showToast({ uni.showToast({
title: '查询失败,请重试', title: '查询失败,请重试',
icon: 'none' icon: 'none'
@@ -473,11 +478,11 @@ onMounted(async () => {
.timeline-item { .timeline-item {
position: relative; position: relative;
margin-bottom: 32rpx; margin-bottom: 32rpx;
&:last-child { &:last-child {
margin-bottom: 0; margin-bottom: 0;
} }
&:not(:last-child)::before { &:not(:last-child)::before {
content: ''; content: '';
position: absolute; position: absolute;