58 Commits

Author SHA1 Message Date
a8a9d792a3 Merge remote-tracking branch 'origin/main' 2026-02-02 13:22:25 +08:00
francis_fh
7634a24c3a 细节优化 2026-01-28 17:17:29 +08:00
francis_fh
a128926c21 首页九宫格样式优化 2026-01-28 11:44:11 +08:00
francis_fh
3387ea8dbc 首页上下滑动优化 2026-01-27 18:51:58 +08:00
francis_fh
05105488bd tabbar大小调整 2026-01-27 17:13:45 +08:00
francis_fh
910862cb5f 分享功能开发 2026-01-27 17:11:35 +08:00
francis_fh
fb88fdbb89 分享功能开发 2026-01-27 17:10:58 +08:00
francis_fh
1de0bacebf 1 2026-01-27 16:13:28 +08:00
francis_fh
95a23be4bf 岗位详情页面弹窗优化 2026-01-27 16:05:00 +08:00
francis_fh
40eb1b29e8 取消投递列表页面开发 2026-01-27 15:12:05 +08:00
francis_fh
dbdb330189 投递简历添加确认弹窗 2026-01-27 13:58:46 +08:00
francis_fh
e0f8faf757 Merge branch 'main' of http://124.243.245.42:3000/sdz/ks-app-employment-service 2026-01-27 11:04:32 +08:00
francis_fh
951905fd09 发布岗位新增字段 2026-01-27 11:04:30 +08:00
bde805e905 Merge branch 'main' of http://124.243.245.42:3000/sdz/ks-app-employment-service 2026-01-27 09:30:39 +08:00
3f714d4a69 首页岗位/政策左右结构 2026-01-27 09:27:55 +08:00
xuchao
360d4f96ea 首页技能培训入口名称改为技能课堂 2026-01-26 10:35:25 +08:00
francis_fh
a3bc821bc3 流式数据请求优化。 2026-01-24 18:29:47 +08:00
francis_fh
7a7aa33128 同时播放聊条音频的问题修复 2026-01-24 17:57:25 +08:00
francis_fh
cbf8bd7c41 H5卡片样式修复 2026-01-24 16:51:32 +08:00
francis_fh
07e0f3083b AI回复内容,岗位卡片的点击事件绑定问题解决 2026-01-24 16:47:11 +08:00
francis_fh
c4c6cea579 语音射别修复 2026-01-23 22:01:38 +08:00
c3d26cdd54 = 职业规划推荐 2026-01-23 18:46:13 +08:00
b030d45d49 = 职业规划推荐 2026-01-23 18:38:13 +08:00
a45b247496 = 职业规划推荐 2026-01-23 15:43:53 +08:00
francis_fh
ebb6bc6e33 bug修复 2026-01-23 13:10:40 +08:00
francis_fh
7bfc765a73 Revert "音频问题解决"
This reverts commit 34cad2543d.
2026-01-23 12:36:27 +08:00
francis_fh
34cad2543d 音频问题解决 2026-01-23 12:34:04 +08:00
francis_fh
134c900946 音频bug修复 2026-01-23 12:12:51 +08:00
francis_fh
5bf94a6223 Merge branch 'main' of http://124.243.245.42:3000/sdz/ks-app-employment-service 2026-01-22 18:58:20 +08:00
francis_fh
b92e3b8adb AI模块联调 2026-01-22 18:58:19 +08:00
xuchao
292b8ae33c 培训评价公告添加审核通过过滤条件 2026-01-22 16:58:19 +08:00
e0efa9c1cf = 职业规划推荐 2026-01-22 16:46:45 +08:00
4dce6d3e39 = 职业规划推荐 2026-01-22 15:18:12 +08:00
172d4fab05 = 职业规划推荐 2026-01-22 15:09:13 +08:00
fce328566a = 职业规划推荐 2026-01-22 15:08:19 +08:00
1d2b0458a5 Merge branch 'main' into yxl 2026-01-22 14:25:27 +08:00
francis_fh
80bd1ee181 AI小程序端样式修复 2026-01-22 14:05:22 +08:00
francis_fh
96c89e0210 修改api地址为正式环境 2026-01-22 13:25:42 +08:00
francis_fh
598a3205fa Merge branch 'main' of http://124.243.245.42:3000/sdz/ks-app-employment-service 2026-01-22 12:57:03 +08:00
francis_fh
f73d3f7a8c 地区选择开发,AI接口联调 2026-01-22 12:57:01 +08:00
bd0c2d0497 = 职业规划推荐 2026-01-22 09:31:07 +08:00
ef9d38d41f = 职业规划推荐 2026-01-22 09:27:38 +08:00
dcbb3e02a7 = 职业规划推荐 2026-01-22 01:15:41 +08:00
xuchao
98e0d5d833 招聘会列表添加地区筛选 2026-01-21 18:44:04 +08:00
7480651af2 = 职业规划推荐 2026-01-21 16:12:19 +08:00
3f7664f017 = 职业规划推荐 2026-01-21 14:26:34 +08:00
hanguangpu01
d817ce2524 fix(practice): 修复练习页面题目列表滚动和接口调用问题
- 为题目编号容器添加高度限制和滚动样式
- 修复练习列表页面接口地址错误,从 trainVideoList 改为 getQuestionTypes
- 优化题目列表的显示效果和用户体验
2026-01-21 11:30:17 +08:00
a5e30ac7f5 = 职业规划推荐 2026-01-21 09:47:09 +08:00
xuchao
5430678eaf 简历投递添加确认弹窗、企业招聘会自动更新统一社会信用代码及userid 2026-01-20 12:07:30 +08:00
699035026e Merge branch 'main' of http://124.243.245.42:3000/sdz/ks-app-employment-service 2026-01-20 09:55:34 +08:00
abd2e79a15 素质测评 ai面试修改域名访问地址 2026-01-20 09:55:27 +08:00
francis_fh
7dcfbd35fe 增加零工市场 2026-01-19 19:09:14 +08:00
9cf5905d5f 素质测评 删除多余代码,运行web 2026-01-19 11:36:17 +08:00
xuchao
a1a94b264c 模拟考试卡片样式优化 2026-01-19 10:46:22 +08:00
xuchao
cf3ed1bae2 删除帮扶、招聘会多余点击事件 2026-01-19 10:35:07 +08:00
francis_fh
445121ac8d Merge branch 'main' of http://124.243.245.42:3000/sdz/ks-app-employment-service 2026-01-19 10:25:59 +08:00
francis_fh
afcb29c51c 帮扶点击事件误删修复 2026-01-19 10:25:58 +08:00
francis_fh
e444f07dc4 帮扶入口点击事件修复 2026-01-16 11:58:07 +08:00
85 changed files with 5892 additions and 2631 deletions

View File

@@ -1,33 +0,0 @@
/*
* @Date: 2025-11-12
* @Description: 职业推荐相关接口
*/
import request from '@/utilsRc/request'
function createFormData(payload = {}) {
if (typeof FormData !== 'undefined') {
const formData = new FormData()
Object.keys(payload).forEach(key => {
const value = payload[key]
if (value !== undefined && value !== null && value !== '') {
formData.append(key, value)
}
})
return formData
}
return payload
}
export function recommendJob(data) {
const params = {};
if (data?.jobName !== undefined && data?.jobName !== null && data?.jobName !== '') {
params.jobName = String(data.jobName);
}
return request({
url: '/job/recommendJobByJobName',
method: 'get',
params: params,
baseUrlType: 'zytp'
})
}

View File

@@ -1,55 +0,0 @@
/*
* @Date: 2025-11-12
* @Description: 职业技能相关接口
*/
import request from '@/utilsRc/request'
export function getJobSkillDetail(params) {
return request({
url: '/jobSkillDet/getJobSkillDet',
method: 'get',
params,
baseUrlType: 'zytp'
})
}
// 获取技能权重
export function getJobSkillWeight(params) {
return request({
url: '/jobSkillDet/getJobSkillWeight',
method: 'get',
params,
baseUrlType: 'zytp'
})
}
// 暂未使用 - 如果需要在 CareerPath.vue 中点击路径职位查看详细技能信息时使用
// 使用场景:获取职业路径中某个职位的详细技能信息(包含技能分数、类型等)
// export function getJobPathSkill(data) {
// let formData
// if (typeof FormData !== 'undefined') {
// formData = new FormData()
// if (data?.pathId !== undefined && data?.pathId !== null) {
// formData.append('pathId', data.pathId)
// }
// if (data?.currentJobName !== undefined && data?.currentJobName !== null) {
// formData.append('currentJobName', data.currentJobName)
// }
// } else {
// formData = {
// pathId: data?.pathId ?? '',
// currentJobName: data?.currentJobName ?? ''
// }
// }
// return request({
// url: '/jobSkillDet/getJobPathSkill',
// method: 'post',
// data: formData,
// baseUrlType: 'zytp',
// header: {
// 'content-type': 'multipart/form-data'
// }
// })
// }

View File

@@ -0,0 +1,37 @@
/*
* @Date: 2024-09-25 11:14:29
* @LastEditors: shirlwang
* @LastEditTime: 2025-12-23 17:40:11
* @Description: 职业路径相关接口
*/
import request from '@/utilsRc/request'
// 获取当前职位
export function getCurrentPosition(query) {
return request({
url: '/jobPath/getJob',
method: 'get',
params: query,
baseUrlType: 'zytp'
})
}
// 获取路径列表
export function getPath(query) {
return request({
url: '/jobPath/getJobPathList',
method: 'get',
params: query,
baseUrlType: 'zytp'
})
}
// 获取路径详情
export function getPathDetail(query) {
return request({
url: '/jobPath/getJobPathById',
method: 'get',
params: query,
baseUrlType: 'zytp'
})
}

View File

@@ -0,0 +1,37 @@
/*
* @Date: 2024-09-25 11:14:29
* @LastEditors: shirlwang
* @LastEditTime: 2025-12-23 17:40:11
* @Description: 职业推荐相关接口
*/
import request from '@/utilsRc/request'
// 获取职业列表
export function getProfessions(query) {
return request({
url: '/jobSimilarity/getJob',
method: 'get',
params: query,
baseUrlType: 'zytp'
})
}
// 获取技能标签
export function getSkillTags(query) {
return request({
url: '/jobSkillDet/getJobSkill',
method: 'get',
params: query,
baseUrlType: 'zytp'
})
}
// 获取推荐职业
export function getRecommend(query) {
return request({
url: '/jobSimilarity/recommendJobByJobName',
method: 'get',
params: query,
baseUrlType: 'zytp'
})
}

View File

@@ -76,11 +76,16 @@ export function getAddedJobs(params) {
})
}
// // 获取推荐岗位
// export function getAddedJobs(params) {
// return request({
// url: '/personnel/personBaseInfo/postRecommend',
// method: 'get',
// params,
// })
// }
export function recommendJob(data) {
const params = {};
if (data?.jobName !== undefined && data?.jobName !== null && data?.jobName !== '') {
params.jobName = String(data.jobName);
}
return request({
url: '/job/recommendJobByJobName',
method: 'get',
params: params,
baseUrlType: 'zytp'
})
}

24
apiRc/service/jobSkill.js Normal file
View File

@@ -0,0 +1,24 @@
/*
* @Date: 2025-11-12
* @Description: 职业技能相关接口
*/
import request from '@/utilsRc/request'
export function getJobSkillDetail(params) {
return request({
url: '/jobSkillDet/getJobSkillDet',
method: 'get',
params,
baseUrlType: 'zytp'
})
}
// 获取技能权重
export function getJobSkillWeight(params) {
return request({
url: '/jobSkillDet/getJobSkillWeight',
method: 'get',
params,
baseUrlType: 'zytp'
})
}

View File

@@ -0,0 +1,27 @@
/*
* @Date: 2024-09-25 11:14:29
* @LastEditors: shirlwang
* @LastEditTime: 2025-12-23 17:40:11
* @Description: 技能发展相关接口
*/
import request from '@/utilsRc/request'
// 获取技能信息
export function getCareerPath(query) {
return request({
url: '/jobPath/getJobPathJobList',
method: 'get',
params: query,
baseUrlType: 'zytp'
})
}
// 获取技能信息
export function getSkillResult(query) {
return request({
url: '/jobDimScore/getJobDimScoreList',
method: 'get',
params: query,
baseUrlType: 'zytp'
})
}

View File

@@ -72,18 +72,18 @@ export const navTo = function(url, {
const pages = getCurrentPages();
if (pages.length >= 10) {
uni.redirectTo({
url: '/pages/complete-info/complete-info',
url: '/packageA/pages/complete-info/complete-info',
fail: (err) => {
console.error('页面跳转失败:', err);
}
});
} else {
uni.navigateTo({
url: '/pages/complete-info/complete-info',
url: '/packageA/pages/complete-info/complete-info',
fail: (err) => {
console.error('页面跳转失败:', err);
uni.redirectTo({
url: '/pages/complete-info/complete-info',
url: '/packageA/pages/complete-info/complete-info',
fail: (err2) => {
console.error('redirectTo也失败:', err2);
}

View File

@@ -59,7 +59,7 @@ const generateTabbarList = () => {
},
{
id: 2,
text: 'AI+',
text: '智能客服',
path: '/pages/chat/chat',
iconPath: '/static/tabbar/logo3.png',
selectedIconPath: '/static/tabbar/logo3.png',
@@ -104,7 +104,7 @@ const generateTabbarList = () => {
baseItems.splice(1, 0, {
id: 1,
text: '发布岗位',
path: '/pages/job/publishJob',
path: '/packageA/pages/job/publishJob',
iconPath: '/static/tabbar/post.png',
selectedIconPath: '/static/tabbar/posted.png',
centerItem: false,
@@ -173,9 +173,10 @@ const switchTab = (item, index) => {
// 检查是否为需要登录的页面
const loginRequiredPages = [
'/pages/job/publishJob',
'/packageA/pages/job/publishJob',
'/pages/mine/mine',
'/pages/mine/company-mine'
'/pages/mine/company-mine',
'/pages/msglog/msglog'
];
if (loginRequiredPages.includes(item.path)) {
@@ -190,7 +191,7 @@ const switchTab = (item, index) => {
}
// 已登录,处理特定页面的逻辑
if (item.path === '/pages/job/publishJob') {
if (item.path === '/packageA/pages/job/publishJob') {
// 检查企业信息是否完整
const cachedUserInfo = uni.getStorageSync('userInfo') || {};
const storeUserInfo = userInfo.value || {};
@@ -200,12 +201,12 @@ const switchTab = (item, index) => {
if (!currentUserInfo.company || currentUserInfo.company === null) {
// 企业信息为空,跳转到企业信息补全页面
uni.navigateTo({
url: '/pages/complete-info/company-info',
url: '/packageA/pages/complete-info/company-info',
});
} else {
// 企业信息完整,跳转到发布岗位页面
uni.navigateTo({
url: '/pages/job/publishJob',
url: '/packageA/pages/job/publishJob',
});
}
@@ -279,7 +280,7 @@ onMounted(() => {
bottom: 0;
left: 0;
right: 0;
height: 88rpx;
height: 100rpx;
background-color: #ffffff;
border-top: 1rpx solid #e5e5e5;
display: flex;
@@ -306,8 +307,8 @@ onMounted(() => {
}
.tabbar-icon {
width: 44rpx;
height: 44rpx;
width: 50rpx;
height: 50rpx;
margin-bottom: 4rpx;
position: relative;
}
@@ -318,7 +319,7 @@ onMounted(() => {
}
.tabbar-text {
font-size: 20rpx;
font-size: 22rpx;
line-height: 1;
transition: color 0.3s ease;
}
@@ -332,14 +333,14 @@ onMounted(() => {
position: absolute;
top: 4rpx;
right: 20rpx;
min-width: 30rpx;
height: 30rpx;
min-width: 32rpx;
height: 32rpx;
background-color: #ff4444;
color: #fff;
font-size: 18rpx;
border-radius: 15rpx;
font-size: 19rpx;
border-radius: 16rpx;
text-align: center;
line-height: 30rpx;
line-height: 32rpx;
padding: 0 10rpx;
transform: scale(0.8);
}
@@ -347,8 +348,8 @@ onMounted(() => {
/* 中间按钮特殊样式 */
.tabbar-item:has(.center-item) {
.tabbar-icon {
width: 60rpx;
height: 60rpx;
width: 68rpx;
height: 68rpx;
margin-bottom: 0;
}
}

View File

@@ -1,13 +1,45 @@
<template>
<view class="markdown-body">
<rich-text class="markdownRich" id="markdown-content" :nodes="renderedHtml" @itemclick="handleItemClick" />
<!-- <view class="markdown-body" v-html="renderedHtml"></view> -->
<!-- 根据不同平台使用不同的渲染方式 -->
<!-- #ifdef MP-WEIXIN -->
<!-- 微信小程序端使用v-for遍历岗位卡片列表每个卡片单独渲染支持点击事件 -->
<scroll-view class="markdownRich" id="markdown-content">
<!-- 渲染普通markdown内容 -->
<rich-text :nodes="renderedHtml" />
<!-- 单独渲染岗位卡片支持点击事件 -->
<view v-if="localJobCardsList.length > 0" class="job-cards-container">
<view
v-for="(card, index) in localJobCardsList"
:key="index"
class="custom-card"
@tap="navigateToJobDetail(card.jobId)"
>
<view class="card-title">
<text class="title-text">{{ card.jobTitle }}</text>
<view class="card-salary">{{ card.salary }}</view>
</view>
<view class="card-company">{{ card.location }}·{{ card.companyName }}</view>
<view class="card-info">
<view class="info-item">
<view class="card-tag">{{ card.education }}</view>
<view class="card-tag">{{ card.experience }}</view>
</view>
<view class="info-item">查看详情<view class="position-nav"></view></view>
</view>
</view>
</view>
</scroll-view>
<!-- #endif -->
<!-- #ifndef MP-WEIXIN -->
<view class="markdown-body" v-html="renderedHtml" @click="handleH5Click"></view>
<!-- #endif -->
</view>
</template>
<script setup>
import { computed, onMounted, inject } from 'vue';
import { parseMarkdown, codeDataList } from '@/utils/markdownParser';
import { computed, onMounted, inject, ref, watch, nextTick } from 'vue';
import { parseMarkdown, codeDataList, jobCardsList } from '@/utils/markdownParser';
const { navTo } = inject('globalFunction');
const props = defineProps({
content: {
@@ -21,30 +53,191 @@ const props = defineProps({
});
const renderedHtml = computed(() => parseMarkdown(props.content));
const markdownContainer = ref(null);
// 响应式岗位卡片列表,用于微信小程序端单独渲染
const localJobCardsList = ref([]);
const handleItemClick = (e) => {
let { attrs } = e.detail.node;
console.log(attrs);
let { 'data-copy-index': codeDataIndex, 'data-job-id': jobId, class: className } = attrs;
switch (className) {
case 'custom-card':
return navTo('/packageA/pages/post/post?jobId=' + jobId);
case 'custom-more':
return navTo('/packageA/pages/moreJobs/moreJobs?jobId=' + jobId);
case 'copy-btn':
uni.setClipboardData({
data: codeDataList[codeDataIndex],
showToast: false,
success() {
uni.showToast({
title: '复制成功',
icon: 'none',
});
},
});
break;
// 监听content的变化当内容更新时解析岗位卡片
watch(() => props.content, (newContent) => {
if (newContent) {
// 直接调用parseMarkdown来触发jobCardsList的更新
parseMarkdown(newContent);
// 将解析器生成的岗位卡片列表赋值给响应式数据
localJobCardsList.value = [...jobCardsList];
console.log('Content changed, jobCardsList updated:', localJobCardsList.value);
}
}, { immediate: true });
// 同时监听renderedHtml的变化作为备份
watch(() => renderedHtml.value, (newVal) => {
console.log('renderedHtml changed, jobCardsList from parser:', jobCardsList);
// 将解析器生成的岗位卡片列表赋值给响应式数据
localJobCardsList.value = [...jobCardsList];
});
// 微信小程序端导航到岗位详情页面
const navigateToJobDetail = (jobId) => {
console.log('navigateToJobDetail called with jobId:', jobId);
if (jobId && jobId !== 'undefined' && jobId !== 'null') {
// 跳转到岗位详情页面
uni.navigateTo({
url: `/packageA/pages/post/post?jobId=${jobId}`,
success: (res) => {
console.log('navigateTo success:', res);
},
fail: (err) => {
console.error('navigateTo failed:', err);
// 如果navigateTo失败尝试redirectTo
uni.redirectTo({
url: `/packageA/pages/post/post?jobId=${jobId}`,
success: (res2) => {
console.log('redirectTo success:', res2);
},
fail: (err2) => {
console.error('redirectTo also failed:', err2);
// 如果还是失败,显示错误提示
uni.showToast({
title: '跳转失败,请稍后重试',
icon: 'none'
});
}
});
}
});
} else {
console.error('Invalid jobId:', jobId);
uni.showToast({
title: '岗位信息不完整',
icon: 'none'
});
}
};
// 微信小程序端点击事件处理已移除改用v-for遍历岗位卡片列表每个卡片单独渲染支持点击事件
// 微信小程序端和H5端的jobId取值方式一致都是从JSON数据的appJobUrl字段提取
// 不同的是微信小程序端现在使用v-for遍历渲染而H5端使用v-html渲染
// H5平台点击事件处理
// 微信小程序端和H5端的jobId取值方式一致都是从JSON数据的appJobUrl字段提取
// 不同的是H5端可以直接从DOM属性获取而微信小程序端使用v-for遍历渲染
const handleH5Click = (e) => {
console.log('H5 click event triggered:', e.target);
let target = e.target;
// 查找最接近的带有class的元素
while (target && target.tagName !== 'BODY') {
console.log('Checking target:', target, 'className:', target.className, 'tagName:', target.tagName);
// 直接使用closest方法查找不依赖className
const cardElement = target.closest('.custom-card');
const moreElement = target.closest('.custom-more');
console.log('Found elements:', { cardElement, moreElement });
if (cardElement) {
// 尝试多种方式获取jobId
let jobId = cardElement.getAttribute('data-job-id');
console.log('Found custom-card, data-job-id attribute:', jobId);
// 如果data-job-id为空尝试从onclick事件中提取jobId
if (!jobId) {
const onclick = cardElement.getAttribute('onclick');
if (onclick) {
const match = onclick.match(/jobId=(\w+)/);
if (match && match[1]) {
jobId = match[1];
console.log('Extracted jobId from onclick:', jobId);
}
}
}
if (jobId) {
console.log('Final jobId for navigation:', jobId);
try {
// 直接使用uni.navigateTo避免navTo函数的潜在问题
uni.navigateTo({
url: `/packageA/pages/post/post?jobId=${jobId}`,
success: (res) => {
console.log('navigateTo success:', res);
},
fail: (err) => {
console.error('navigateTo failed:', err);
// 如果navigateTo失败尝试redirectTo
uni.redirectTo({
url: `/packageA/pages/post/post?jobId=${jobId}`,
success: (res2) => {
console.log('redirectTo success:', res2);
},
fail: (err2) => {
console.error('redirectTo also failed:', err2);
}
});
}
});
} catch (error) {
console.error('Navigation error:', error);
}
return;
} else {
console.error('No jobId found for custom-card');
}
} else if (moreElement) {
// 尝试多种方式获取jobId
let jobId = moreElement.getAttribute('data-job-id');
console.log('Found custom-more, data-job-id attribute:', jobId);
// 如果data-job-id为空尝试从onclick事件中提取jobId
if (!jobId) {
const onclick = moreElement.getAttribute('onclick');
if (onclick) {
const match = onclick.match(/jobId=(\w+)/);
if (match && match[1]) {
jobId = match[1];
console.log('Extracted jobId from onclick:', jobId);
}
}
}
if (jobId) {
console.log('Final jobId for more jobs:', jobId);
try {
// 直接使用uni.navigateTo避免navTo函数的潜在问题
uni.navigateTo({
url: `/packageA/pages/moreJobs/moreJobs?jobId=${jobId}`,
success: (res) => {
console.log('navigateTo success:', res);
},
fail: (err) => {
console.error('navigateTo failed:', err);
// 如果navigateTo失败尝试redirectTo
uni.redirectTo({
url: `/packageA/pages/moreJobs/moreJobs?jobId=${jobId}`,
success: (res2) => {
console.log('redirectTo success:', res2);
},
fail: (err2) => {
console.error('redirectTo also failed:', err2);
}
});
}
});
} catch (error) {
console.error('Navigation error:', error);
}
return;
} else {
console.error('No jobId found for custom-more');
}
}
target = target.parentElement;
}
};
// 移除旧的事件监听逻辑,改用全局点击处理
onMounted(() => {
console.log('onMounted called');
});
</script>
<style lang="scss">
@@ -267,7 +460,7 @@ ol {
</style>
<style lang="stylus">
.custom-more{
.custom-more
display: flex
justify-content: center
align-items: center
@@ -282,15 +475,16 @@ ol {
transition: all 0.3s ease
position: relative
overflow: hidden
.more-icon{
width: 32rpx;
height: 32rpx;
background: url('@/static/svg/seemore.svg') center center no-repeat;
.more-icon
width: 32rpx
height: 32rpx
background: url('@/static/svg/seemore.svg') center center no-repeat
background-size: 100% 100%
margin-left: 12rpx
filter: brightness(0) invert(1)
}
&::before {
&::before
content: ''
position: absolute
top: 0
@@ -299,93 +493,492 @@ ol {
height: 100%
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent)
transition: left 0.5s ease
}
&:active {
&:active
transform: translateY(2rpx)
box-shadow: 0rpx 4rpx 16rpx rgba(37, 107, 250, 0.4)
}
&:active::before {
&:active::before
left: 100%
/* 为小程序专门优化的样式 */
/* #ifdef MP-WEIXIN */
.rich-text-container
padding: 0 20rpx
.markdownRich
padding: 0
/* #endif */
/* H5端和小程序端样式优化 */
.custom-card
background: #FFFFFF !important
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0,0,0,0.04) !important
border-radius: 20rpx !important
padding: 28rpx 24rpx !important
font-weight: 400 !important
font-size: 28rpx !important
color: #333333 !important
margin-bottom: 22rpx !important
position: relative !important
display: block !important
flex-direction: column !important
/* 确保在所有平台中边距正确应用 */
margin-left: auto !important
margin-right: auto !important
width: 100% !important
box-sizing: border-box !important
text-decoration: none !important
overflow: hidden !important
.custom-card .card-title
font-weight: 600 !important
display: flex !important
align-items: center !important
justify-content: space-between !important
margin-bottom: 16rpx !important
.custom-card .card-title .title-text
font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif !important
max-width: calc(100% - 160rpx) !important
overflow: hidden !important
text-overflow: ellipsis !important
font-size: 32rpx !important
line-height: 1.4 !important
white-space: nowrap !important
margin-bottom: 0 !important
.custom-card .card-title .card-salary
font-family: DIN-Medium !important
font-size: 32rpx !important
color: #4C6EFB !important
line-height: 1.4 !important
font-weight: 500 !important
margin-bottom: 0 !important
.custom-card .card-company
margin-bottom: 18rpx !important
max-width: 100% !important
overflow: hidden !important
text-overflow: ellipsis !important
color: #6C7282 !important
line-height: 1.4 !important
white-space: nowrap !important
font-size: 28rpx !important
margin-top: 0 !important
display: block !important
.custom-card .card-tags
display: flex !important
flex-wrap: wrap !important
margin-bottom: 24rpx !important
.custom-card .card-tag
font-weight: 400 !important
font-size: 24rpx !important
color: #6C7282 !important
width: fit-content !important
background: #F4F4F4 !important
border-radius: 4rpx !important
padding: 6rpx 20rpx !important
margin-right: 20rpx !important
margin-bottom: 14rpx !important
display: inline-flex !important
align-items: center !important
justify-content: center !important
height: 30rpx !important
line-height: 30rpx !important
.custom-card .card-bottom
display: flex !important
justify-content: space-between !important
font-size: 24rpx !important
color: #6C7282 !important
margin-top: 0 !important
margin-bottom: 0 !important
.custom-card .card-bottom .info-item
display: flex !important
align-items: center !important
justify-content: center !important
margin-bottom: 0 !important
.custom-card .card-info
display: flex !important
align-items: center !important
justify-content: space-between !important
padding-right: 40rpx !important
.custom-card .card-info .info-item
display: flex !important
position: relative !important
align-items: center !important
.custom-card .card-info .info-item:last-child
color: #256BFA !important
font-size: 28rpx !important
padding-right: 10rpx !important
.custom-card .position-nav
position: absolute !important
right: -10rpx !important
top: 50% !important
transform: translateY(-50%) !important
.custom-card .position-nav::before
position: absolute !important
left: 0 !important
top: -4rpx !important
content: '' !important
width: 4rpx !important
height: 16rpx !important
border-radius: 2rpx !important
background: #256BFA !important
transform: translate(0, -50%) rotate(-45deg) !important
.custom-card .position-nav::after
position: absolute !important
left: 0 !important
top: -4rpx !important
content: '' !important
width: 4rpx !important
height: 16rpx !important
border-radius: 2rpx !important
background: #256BFA !important
transform: rotate(45deg) !important
/* 为微信小程序专门优化的样式选择器 */
/* #ifdef MP-WEIXIN */
.job-cards-container .custom-card
background: #FFFFFF !important
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0,0,0,0.04) !important
border-radius: 20rpx !important
padding: 28rpx 24rpx !important
font-weight: 400 !important
font-size: 28rpx !important
color: #333333 !important
margin-bottom: 22rpx !important
position: relative !important
display: block !important
flex-direction: column !important
margin-left: auto !important
margin-right: auto !important
width: 100% !important
box-sizing: border-box !important
text-decoration: none !important
overflow: hidden !important
.job-cards-container .custom-card .card-title
font-weight: 600 !important
display: flex !important
align-items: center !important
justify-content: space-between !important
margin-bottom: 16rpx !important
.job-cards-container .custom-card .card-title .title-text
font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif !important
max-width: calc(100% - 160rpx) !important
overflow: hidden !important
text-overflow: ellipsis !important
font-size: 32rpx !important
line-height: 1.4 !important
white-space: nowrap !important
margin-bottom: 0 !important
.job-cards-container .custom-card .card-title .card-salary
font-family: DIN-Medium !important
font-size: 32rpx !important
color: #4C6EFB !important
line-height: 1.4 !important
font-weight: 500 !important
margin-bottom: 0 !important
.job-cards-container .custom-card .card-company
margin-bottom: 18rpx !important
max-width: 100% !important
overflow: hidden !important
text-overflow: ellipsis !important
color: #6C7282 !important
line-height: 1.4 !important
white-space: nowrap !important
font-size: 28rpx !important
margin-top: 0 !important
display: block !important
.job-cards-container .custom-card .card-info
display: flex !important
align-items: center !important
justify-content: space-between !important
padding-right: 40rpx !important
.job-cards-container .custom-card .card-info .info-item
display: flex !important
position: relative !important
align-items: center !important
.job-cards-container .custom-card .card-info .info-item:last-child
color: #256BFA !important
font-size: 28rpx !important
padding-right: 10rpx !important
.job-cards-container .custom-card .card-info .info-item .card-tag
font-weight: 400 !important
font-size: 24rpx !important
color: #6C7282 !important
width: fit-content !important
background: #F4F4F4 !important
border-radius: 4rpx !important
padding: 6rpx 20rpx !important
margin-right: 20rpx !important
margin-bottom: 14rpx !important
display: inline-flex !important
align-items: center !important
justify-content: center !important
height: 30rpx !important
line-height: 30rpx !important
.job-cards-container .custom-card .position-nav
position: absolute !important
right: -10rpx !important
top: 50% !important
transform: translateY(-50%) !important
.job-cards-container .custom-card .position-nav::before
position: absolute !important
left: 0 !important
top: -4rpx !important
content: '' !important
width: 4rpx !important
height: 16rpx !important
border-radius: 2rpx !important
background: #256BFA !important
transform: translate(0, -50%) rotate(-45deg) !important
.job-cards-container .custom-card .position-nav::after
position: absolute !important
left: 0 !important
top: -4rpx !important
content: '' !important
width: 4rpx !important
height: 16rpx !important
border-radius: 2rpx !important
background: #256BFA !important
transform: rotate(45deg) !important
/* #endif */
/* 额外的H5端样式优化 */
/* #ifndef MP-WEIXIN */
/* 确保样式能正确应用到v-html生成的内容 */
.markdown-body {
/* 重置v-html容器样式 */
display: block !important;
/* 为v-html生成的a.custom-card标签添加基础样式 */
a.custom-card {
display: flex !important;
flex-direction: column !important;
margin-bottom: 22rpx !important;
background: #FFFFFF !important;
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0,0,0,0.04) !important;
border-radius: 20rpx !important;
padding: 28rpx 24rpx !important;
font-weight: 400 !important;
font-size: 28rpx !important;
color: #333333 !important;
text-decoration: none !important;
overflow: hidden !important;
box-sizing: border-box !important;
width: calc(100% - 0rpx) !important;
max-width: 100% !important;
}
/* 卡片标题样式 */
a.custom-card .card-title {
font-weight: 600 !important;
display: flex !important;
align-items: center !important;
justify-content: space-between !important;
margin-bottom: 16rpx !important;
}
a.custom-card .card-title .title-text {
font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif !important;
font-size: 32rpx !important;
line-height: 1.4 !important;
color: #333333 !important;
max-width: calc(100% - 160rpx) !important;
overflow: hidden !important;
text-overflow: ellipsis !important;
white-space: nowrap !important;
margin-bottom: 0 !important;
}
a.custom-card .card-title .card-salary {
font-family: DIN-Medium !important;
font-size: 32rpx !important;
color: #4C6EFB !important;
line-height: 1.4 !important;
font-weight: 500 !important;
margin-bottom: 0 !important;
}
/* 公司信息样式 */
a.custom-card .card-company {
margin-bottom: 18rpx !important;
font-size: 28rpx !important;
color: #6C7282 !important;
line-height: 1.4 !important;
max-width: 100% !important;
overflow: hidden !important;
text-overflow: ellipsis !important;
white-space: nowrap !important;
margin-top: 0 !important;
display: block !important;
}
/* 标签容器样式 */
a.custom-card .card-tags {
display: flex !important;
flex-wrap: wrap !important;
margin-bottom: 24rpx !important;
}
/* 单个标签样式 */
a.custom-card .card-tag {
font-weight: 400 !important;
font-size: 24rpx !important;
color: #6C7282 !important;
width: fit-content !important;
background: #F4F4F4 !important;
border-radius: 4rpx !important;
padding: 6rpx 20rpx !important;
margin-right: 20rpx !important;
margin-bottom: 14rpx !important;
display: inline-flex !important;
align-items: center !important;
justify-content: center !important;
height: 30rpx !important;
line-height: 30rpx !important;
}
/* 卡片底部样式 */
a.custom-card .card-bottom {
display: flex !important;
justify-content: space-between !important;
font-size: 24rpx !important;
color: #6C7282 !important;
margin-top: 0 !important;
margin-bottom: 0 !important;
}
a.custom-card .card-bottom .info-item {
display: flex !important;
align-items: center !important;
justify-content: center !important;
margin-bottom: 0 !important;
}
/* 卡片信息区域样式 */
a.custom-card .card-info {
display: flex !important;
align-items: center !important;
justify-content: space-between !important;
padding-right: 40rpx !important;
}
a.custom-card .card-info .info-item {
display: flex !important;
align-items: center !important;
}
a.custom-card .card-info .info-item:last-child {
color: #256BFA !important;
font-size: 28rpx !important;
padding-right: 10rpx !important;
position: relative !important;
}
/* 查看详情箭头样式 */
a.custom-card .position-nav {
position: absolute !important;
right: -10rpx !important;
top: 50% !important;
transform: translateY(-50%) !important;
}
a.custom-card .position-nav::before {
position: absolute !important;
left: 0 !important;
top: -4rpx !important;
content: '' !important;
width: 4rpx !important;
height: 16rpx !important;
border-radius: 2rpx !important;
background: #256BFA !important;
transform: translate(0, -50%) rotate(-45deg) !important;
}
a.custom-card .position-nav::after {
position: absolute !important;
left: 0 !important;
top: -4rpx !important;
content: '' !important;
width: 4rpx !important;
height: 16rpx !important;
border-radius: 2rpx !important;
background: #256BFA !important;
transform: rotate(45deg) !important;
}
/* 查看更多按钮样式 */
a.custom-more {
display: flex !important;
justify-content: center !important;
align-items: center !important;
color: #FFFFFF !important;
background: linear-gradient(135deg, #256BFA 0%, #9E74FD 100%) !important;
border-radius: 50rpx !important;
padding: 20rpx 32rpx !important;
margin: 20rpx 0 !important;
font-size: 28rpx !important;
font-weight: 600 !important;
box-shadow: 0rpx 8rpx 24rpx rgba(37, 107, 250, 0.3) !important;
transition: all 0.3s ease !important;
position: relative !important;
overflow: hidden !important;
text-decoration: none !important;
box-sizing: border-box !important;
width: 100% !important;
}
a.custom-more .more-icon {
width: 32rpx !important;
height: 32rpx !important;
background: url('@/static/svg/seemore.svg') center center no-repeat !important;
background-size: 100% 100% !important;
margin-left: 12rpx !important;
filter: brightness(0) invert(1) !important;
}
a.custom-more::before {
content: '' !important;
position: absolute !important;
top: 0 !important;
left: -100% !important;
width: 100% !important;
height: 100% !important;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent) !important;
transition: left 0.5s ease !important;
}
a.custom-more:active {
transform: translateY(2rpx) !important;
box-shadow: 0rpx 4rpx 16rpx rgba(37, 107, 250, 0.4) !important;
}
a.custom-more:active::before {
left: 100% !important;
}
}
.custom-card
background: #FFFFFF;
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0,0,0,0.04);
border-radius: 20rpx 20rpx 20rpx 20rpx;
padding: 28rpx 24rpx;
font-weight: 400;
font-size: 28rpx;
color: #333333;
margin-bottom: 20rpx;
position: relative;
display: flex;
flex-direction: column
.card-title
font-weight: 600;
display: flex;
align-items: center;
justify-content: space-between
.title-text
font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif;
max-width: calc(100% - 160rpx);
overflow: hidden
text-overflow: ellipsis
font-size: 30rpx
.card-salary
font-family: DIN-Medium;
font-size: 28rpx;
color: #FF6E1C;
.card-company
margin-top: 16rpx;
max-width: calc(100%);
overflow: hidden;
text-overflow: ellipsis
color: #6C7282;
.card-info
margin-top: 22rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding-right: 40rpx;
.info-item
display: flex;
position: relative;
align-items: center;
color: #256BFA;
font-size: 28rpx;
padding-right: 10rpx
.position-nav
position: absolute;
right: -10rpx;
top: 50%;
.position-nav::before
position: absolute;
left: 0;
top: -4rpx;
content: '';
width: 4rpx;
height: 16rpx;
border-radius: 2rpx
background: #256BFA;
transform: translate(0, -50%) rotate(-45deg) ;
.position-nav::after
position: absolute;
left: 0;
top: -4rpx;
content: '';
width: 4rpx;
height: 16rpx;
border-radius: 2rpx
background: #256BFA;
transform: rotate(45deg)
.card-tag
font-weight: 500;
font-size: 24rpx;
color: #333333;
width: fit-content;
background: #F4F4F4;
border-radius: 4rpx 4rpx 4rpx 4rpx;
padding: 4rpx 20rpx;
margin-right: 16rpx;
/* #endif */
</style>

View File

@@ -110,7 +110,7 @@ const generateTabbarList = () => {
baseItems.splice(1, 0, {
id: 1,
text: '发布岗位',
path: '/pages/job/publishJob',
path: '/packageA/pages/job/publishJob',
iconPath: '../../static/tabbar/post.png',
selectedIconPath: '../../static/tabbar/posted.png',
centerItem: false,

View File

@@ -11,7 +11,6 @@
<view class="auth-header">
<image class="auth-logo" src="@/static/logo2-S.png" mode="aspectFit"></image>
<view class="auth-title">欢迎使用就业服务</view>
<view class="auth-subtitle">需要您授权手机号登录</view>
</view>
<!-- 角色选择 -->
@@ -26,7 +25,7 @@
<view class="role-icon">
<uni-icons type="person" size="32" :color="userType === 1 ? '#256BFA' : '#999'"></uni-icons>
</view>
<view class="role-text">我是求职者</view>
<view class="role-text">个人</view>
</view>
<view
class="role-item"
@@ -36,7 +35,23 @@
<view class="role-icon">
<uni-icons type="shop" size="32" :color="userType === 0 ? '#256BFA' : '#999'"></uni-icons>
</view>
<view class="role-text">我是招聘者</view>
<view class="role-text">单位</view>
</view>
</view>
</view>
<!-- 机构类型选择仅单位角色显示 -->
<view v-if="userType === 0" class="org-type-select">
<view class="org-type-title">请选择机构类型</view>
<view class="org-type-options">
<view
v-for="option in orgTypeOptions"
:key="option.value"
class="org-type-item"
:class="{ active: orgType === option.value }"
@click="selectOrgType(option.value)"
>
<view class="org-type-text">{{ option.label }}</view>
</view>
</view>
</view>
@@ -100,21 +115,50 @@
</template>
<script setup>
import { ref, inject } from 'vue';
import { ref, inject, onMounted } from 'vue';
import useUserStore from '@/stores/useUserStore';
import useDictStore from '@/stores/useDictStore';
import { tabbarManager } from '@/utils/tabbarManager';
const { $api } = inject('globalFunction');
const { loginSetToken } = useUserStore();
const dictStore = useDictStore();
const popup = ref(null);
const userType = ref(null); // 用户角色1-求职者0-企业
const orgType = ref(null); // 机构类型
const orgTypeOptions = ref([]); // 机构类型选项
const emit = defineEmits(['success', 'cancel']);
// 获取机构类型字典
const getOrgTypeDict = async () => {
try {
const options = await dictStore.getDictSelectOption('org_type');
orgTypeOptions.value = options;
} catch (error) {
console.error('获取机构类型字典失败:', error);
// 使用备用数据
orgTypeOptions.value = [
{ label: '有限责任公司', value: '1' },
{ label: '股份有限公司', value: '2' },
{ label: '个人独资企业', value: '3' },
{ label: '合伙企业', value: '4' },
{ label: '外商投资企业', value: '5' },
{ label: '其他', value: '6' }
];
}
};
// 组件挂载时获取字典数据
onMounted(() => {
getOrgTypeDict();
});
// 打开弹窗
const open = () => {
popup.value?.open();
userType.value = null; // 重置角色选择
orgType.value = null; // 重置机构类型选择
};
// 关闭弹窗
@@ -126,6 +170,12 @@ const close = () => {
// 选择角色
const selectRole = (type) => {
userType.value = type;
orgType.value = null; // 切换角色时重置机构类型选择
};
// 选择机构类型
const selectOrgType = (type) => {
orgType.value = type;
};
// 验证角色是否已选择
@@ -134,6 +184,13 @@ const validateRole = () => {
$api.msg('请先选择您的角色');
return false;
}
// 验证机构类型是否已选择(仅单位角色)
if (userType.value === 0 && orgType.value === null) {
$api.msg('请选择机构类型');
return false;
}
return true;
};
@@ -148,6 +205,12 @@ const getPhoneNumber = (e) => {
$api.msg('请先选择您的角色');
return true;
}
// 验证机构类型是否已选择(仅单位角色)
if (userType.value === 0 && orgType.value === null) {
$api.msg('请选择机构类型');
return true;
}
uni.login({
provider: 'weixin',
success: (loginRes) => {
@@ -162,7 +225,8 @@ const getPhoneNumber = (e) => {
code,
encryptedData,
iv,
userType: userType.value
userType: userType.value,
orgType: orgType.value
}, 'post').then((resData) => {
uni.hideLoading();
console.log(resData, 'resume.idCard');
@@ -189,12 +253,12 @@ const getPhoneNumber = (e) => {
if (userType.value === 1 && !resData.idCard) {
// 求职者跳转到个人信息补全页面
uni.navigateTo({
url: '/pages/complete-info/complete-info?step=1'
url: '/packageA/pages/complete-info/complete-info?step=1'
});
} else if (userType.value === 0 && !resData.idCard) {
// 招聘者跳转到企业信息补全页面
uni.navigateTo({
url: '/pages/complete-info/company-info'
url: '/packageA/pages/complete-info/company-info'
});
}
}
@@ -251,7 +315,8 @@ const wxLogin = () => {
// 调用后端接口进行登录
$api.createRequest('/app/appLogin', {
code: loginRes.code,
userType: userType.value
userType: userType.value,
orgType: orgType.value
}, 'post').then((resData) => {
if (resData.token) {
loginSetToken(resData.token).then((resume) => {
@@ -272,12 +337,12 @@ const wxLogin = () => {
if (userType.value === 1) {
// 求职者跳转到个人信息补全页面
uni.navigateTo({
url: '/pages/complete-info/complete-info?step=1'
url: '/packageA/pages/complete-info/complete-info?step=1'
});
} else if (userType.value === 0) {
// 招聘者跳转到企业信息补全页面
uni.navigateTo({
url: '/pages/complete-info/company-info'
url: '/packageA/pages/complete-info/company-info'
});
}
}
@@ -326,12 +391,12 @@ const testLogin = () => {
if (userType.value === 1) {
// 求职者跳转到个人信息补全页面
uni.navigateTo({
url: '/pages/complete-info/complete-info?step=1'
url: '/packageA/pages/complete-info/complete-info?step=1'
});
} else if (userType.value === 0) {
// 招聘者跳转到企业信息补全页面
uni.navigateTo({
url: '/pages/complete-info/company-info'
url: '/packageA/pages/complete-info/company-info'
});
}
}
@@ -373,7 +438,7 @@ defineExpose({
overflow: hidden
.modal-content
padding: 60rpx 40rpx 40rpx
padding: 40rpx 40rpx 40rpx
position: relative
.close-btn
@@ -389,11 +454,11 @@ defineExpose({
.auth-header
text-align: center
margin-bottom: 40rpx
margin-bottom: 20rpx
.auth-logo
width: 120rpx
height: 120rpx
width: 90rpx
height: 90rpx
margin: 0 auto 24rpx
.auth-title
@@ -408,7 +473,6 @@ defineExpose({
.role-select
margin-bottom: 32rpx
.role-title
font-size: 28rpx
font-weight: 500
@@ -447,6 +511,41 @@ defineExpose({
color: #333333
font-weight: 500
.org-type-select
margin-bottom: 22rpx
.org-type-title
font-size: 28rpx
font-weight: 500
color: #333333
margin-bottom: 20rpx
text-align: center
.org-type-options
display: flex
flex-wrap: wrap
gap: 16rpx
.org-type-item
display:inline-block
background: #F7F8FA
border: 2rpx solid #E5E5E5
border-radius: 10rpx
padding: 10rpx 10rpx
transition: all 0.3s ease
cursor: pointer
text-align: center
&.active
background: #F0F5FF
border-color: #256BFA
box-shadow: 0 4rpx 12rpx rgba(37, 107, 250, 0.15)
.org-type-text
font-size: 22rpx
color: #333333
font-weight: 500
.auth-tips
background: #F7F8FA
border-radius: 16rpx

View File

@@ -1,13 +1,12 @@
/*
* @Descripttion:
* @Descripttion:
* @Author: lip
* @Date: 2025-12-04 13:40:08
* @LastEditors: lip
*/
export default {
// baseUrl: 'http://39.98.44.136:8080', // 测试
baseUrl: 'https://www.xjksly.cn/api/ks', // 测试
// baseUrl: 'https://www.xjksly.cn/api/ks', // 测试
baseUrl: 'https://www.xjksly.cn/api/ks', // 正式环境
// baseUrl: 'http://ks.zhaopinzao8dian.com/api/ks', // 测试
// LCBaseUrl:'http://10.110.145.145:9100',//内网端口
@@ -20,13 +19,14 @@ export default {
trainVideoImgUrl:'https://www.xjksly.cn/prod-api/file/file/minio',
// sseAI+
// StreamBaseURl: 'http://39.98.44.136:8000',
StreamBaseURl: 'https://qd.zhaopinzao8dian.com/ai',
StreamBaseURl: 'https://www.xjksly.cn/api/ks/app/chat',
// StreamBaseURl: 'https://qd.zhaopinzao8dian.com/ai/test',
// 语音转文字
// vioceBaseURl: 'ws://39.98.44.136:8080/speech-recognition',
vioceBaseURl: 'wss://qd.zhaopinzao8dian.com/api/speech-recognition',
vioceBaseURl: 'https://www.xjksly.cn/api/ks/app/speech/asr',
// vioceBaseURl: 'wss://qd.zhaopinzao8dian.com/api/speech-recognition',
// 语音合成
speechSynthesis: 'wss://qd.zhaopinzao8dian.com/api/speech-synthesis',
speechSynthesis: 'https://www.xjksly.cn/api/ks/app/speech/tts',
// speechSynthesis: 'wss://qd.zhaopinzao8dian.com/api/speech-synthesis',
// indexedDB
DBversion: 2,
// 只使用本地缓寸的数据

View File

@@ -45,7 +45,7 @@
---
### 2. ``getJobPathById`- 根据职业路径ID获取详情
### 2. `getJobPathById`- 根据职业路径ID获取详情
- **接口路径**: `/jobPath/getJobPathById`
- **请求方法**: `GET`
- **接口类型**: `zytp`

View File

@@ -20,6 +20,7 @@ export function useAudioRecorder() {
const recognizedText = ref('')
const lastFinalText = ref('')
const isRecognizing = ref(false) // 识别状态,暴露给外部
let audioStream = null
let audioContext = null
@@ -132,11 +133,15 @@ export function useAudioRecorder() {
}
case 'TranscriptionCompleted': {
lastFinalText.value = ''
isRecognizing.value = false // 识别完成,重置状态
// console.log('识别全部完成')
cleanup()
break
}
case 'TaskFailed': {
console.error('识别失败:', msg?.header?.status_text)
isRecognizing.value = false // 识别失败,重置状态
cleanup()
break
}
default:
@@ -151,7 +156,104 @@ export function useAudioRecorder() {
if (isRecording.value) return
// #ifdef MP-WEIXIN
$api.msg('小程序暂不支持语音识别功能');
try {
recognizedText.value = ''
lastFinalText.value = ''
// 开始录音时不设置isRecognizing为true只有在停止录音后才保持isRecognizing为true
const recorderManager = uni.getRecorderManager()
// 监听录音完成事件
recorderManager.onStop(async (res) => {
console.log('小程序录音完成:', res)
try {
// 停止录音后设置isRecognizing为true显示loading
isRecognizing.value = true
// 打印请求配置,便于调试
console.log('准备上传语音识别请求配置:', {
url: config.vioceBaseURl,
name: 'file',
method: 'POST',
fileType: 'audio',
filePath: res.tempFilePath
})
// 上传录音文件到服务器进行语音识别
const uploadResult = await uni.uploadFile({
url: config.vioceBaseURl,
filePath: res.tempFilePath,
name: 'file',
fileType: 'audio',
method: 'POST' // 显式设置为POST请求
})
console.log('语音识别上传结果:', uploadResult)
if (uploadResult.statusCode === 200) {
try {
const result = JSON.parse(uploadResult.data)
console.log('语音识别结果:', result)
if (result.code === 200 && result.data) {
recognizedText.value = result.data
console.log('语音识别成功,识别结果:', recognizedText.value)
// 语音识别成功后,自动发送消息
// 这里需要触发一个事件,让父组件知道识别成功
// 或者直接调用发送消息的方法
isRecognizing.value = false // 识别成功,重置状态
} else {
console.error('语音识别返回错误:', result.message || '未知错误')
$api.msg('语音识别失败,请重试')
isRecognizing.value = false // 识别失败,重置状态
}
} catch (parseErr) {
console.error('语音识别结果解析失败:', parseErr)
$api.msg('语音识别失败,请重试')
isRecognizing.value = false // 解析失败,重置状态
}
} else {
console.error('语音识别请求失败,状态码:', uploadResult.statusCode)
$api.msg('语音识别失败,请重试')
isRecognizing.value = false // 请求失败,重置状态
}
} catch (err) {
console.error('语音识别上传失败:', err)
$api.msg('语音识别失败,请重试')
isRecognizing.value = false // 上传失败,重置状态
}
})
// 监听录音错误事件
recorderManager.onError((err) => {
console.error('小程序录音错误:', err)
$api.msg('录音失败,请重试');
cleanup()
})
// 微信小程序录音API
await recorderManager.start({
duration: 60000, // 最长录音60秒
sampleRate: 16000,
numberOfChannels: 1,
encodeBitRate: 96000,
format: 'mp3'
})
isRecording.value = true
recordingDuration.value = 0
durationTimer = setInterval(() => recordingDuration.value++, 1000)
// 监听录音事件(可选)
recorderManager.onFrameRecorded((res) => {
// 更新音量显示
volumeLevel.value = res.volume || 0
audioDataForDisplay.value = Array(16).fill(volumeLevel.value)
})
} catch (err) {
console.error('小程序录音启动失败:', err)
$api.msg('录音启动失败,请重试');
cleanup()
}
return;
// #endif
@@ -164,6 +266,7 @@ export function useAudioRecorder() {
recognizedText.value = ''
lastFinalText.value = ''
// 开始录音时不设置isRecognizing为true只有在停止录音后才保持isRecognizing为true
await connectWebSocket()
audioStream = await navigator.mediaDevices.getUserMedia({
@@ -201,6 +304,7 @@ export function useAudioRecorder() {
durationTimer = setInterval(() => recordingDuration.value++, 1000)
} catch (err) {
console.error('启动失败:', err)
isRecognizing.value = false // 启动失败,重置状态
cleanup()
}
// #endif
@@ -210,6 +314,12 @@ export function useAudioRecorder() {
if (!isRecording.value || isStopping.value) return
isStopping.value = true
// #ifdef MP-WEIXIN
uni.getRecorderManager().stop()
// 小程序中录音停止后会触发onStop事件在onStop事件中处理识别结果和状态重置
// #endif
// #ifdef H5
if (websocket?.readyState === WebSocket.OPEN) {
websocket.send(JSON.stringify({
header: {
@@ -218,18 +328,39 @@ export function useAudioRecorder() {
message_id: generateUUID()
}
}))
websocket.close()
// H5中不立即调用cleanup等待识别完成
}
// #endif
cleanup()
// 只清理录音相关资源,不重置识别状态
clearInterval(durationTimer)
audioStream?.getTracks().forEach(track => track.stop())
audioContext?.close()
audioStream = null
audioContext = null
audioInput = null
scriptProcessor = null
isRecording.value = false
isSocketConnected.value = false
isStopping.value = false
}
const cancelRecording = () => {
if (!isRecording.value || isStopping.value) return
isStopping.value = true
// #ifdef MP-WEIXIN
uni.getRecorderManager().stop()
// #endif
// #ifdef H5
websocket?.close()
// #endif
// 取消录音时重置所有状态
cleanup()
isRecognizing.value = false
isStopping.value = false
}
@@ -249,16 +380,22 @@ export function useAudioRecorder() {
isRecording.value = false
isSocketConnected.value = false
isRecognizing.value = false // 停止录音,重置识别状态
}
onUnmounted(() => {
if (isRecording.value) stopRecording()
})
const reset = () => {
cleanup()
}
return {
isRecording,
isStopping,
isSocketConnected,
isRecognizing,
recordingDuration,
audioDataForDisplay,
volumeLevel,
@@ -266,6 +403,7 @@ export function useAudioRecorder() {
lastFinalText,
startRecording,
stopRecording,
cancelRecording
cancelRecording,
reset
}
}

File diff suppressed because it is too large Load Diff

26
main.js
View File

@@ -9,20 +9,13 @@ import globalFunction from '@/common/globalFunction'
import '@/lib/string-similarity.min.js'
import similarityJobs from '@/utils/similarity_Job.js';
import config from '@/config.js';
import shareMixin from './mixins/share.js';
// 组件
import AppLayout from './components/AppLayout/AppLayout.vue';
import Empty from './components/empty/empty.vue';
import NoBouncePage from '@/components/NoBouncePage/NoBouncePage.vue'
import MsgTips from '@/components/MsgTips/MsgTips.vue'
import SelectPopup from '@/components/selectPopup/selectPopup.vue'
import SelectPopupPlugin from '@/components/selectPopup/selectPopupPlugin';
import RenderJobs from '@/components/renderJobs/renderJobs.vue';
import RenderCompanys from '@/components/renderCompanys/renderCompanys.vue';
import uniIcons from './uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
import uniPopup from './uni_modules/uni-popup/components/uni-popup/uni-popup.vue'
import uniDataSelect from './uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue'
import uniSwipeAction from './uni_modules/uni-swipe-action/components/uni-swipe-action/uni-swipe-action.vue'
import uniSwipeActionItem from './uni_modules/uni-swipe-action/components/uni-swipe-action-item/uni-swipe-action-item.vue'
import storeRc from './utilsRc/store/index.js'
import {processFileUrl,} from '@/utilsRc/common.js'
// iconfont.css 已在 App.vue 中通过 @import 引入,无需在此处重复引入
@@ -44,20 +37,15 @@ import { getDict } from '@/apiRc/system/dict.js';
export function createApp() {
const app = createSSRApp(App)
// 注册全局分享混入
app.mixin(shareMixin)
app.component('AppLayout', AppLayout)
app.component('Empty', Empty)
app.component('NoBouncePage', NoBouncePage)
app.component('MsgTips', MsgTips)
app.component('SelectPopup', SelectPopup)
app.component('RenderJobs', RenderJobs)
app.component('RenderCompanys', RenderCompanys)
app.component('uni-icons', uniIcons)
app.component('uni-popup', uniPopup)
app.component('uni-data-select', uniDataSelect)
app.component('uni-swipe-action', uniSwipeAction)
app.component('uni-swipe-action-item', uniSwipeActionItem)
app.config.globalProperties.$processFileUrl = processFileUrl;
app.config.globalProperties.$getDict = getDict;
app.config.globalProperties.$store = storeRc;
@@ -94,4 +82,4 @@ export function createApp() {
app,
Pinia
}
}
}

16
mixins/share.js Normal file
View File

@@ -0,0 +1,16 @@
export default {
onShareAppMessage() {
return {
title: '喀什智慧就业平台',
path: '/pages/index/index',
imageUrl: ''
};
},
onShareTimeline() {
return {
title: '喀什智慧就业平台',
path: '/pages/index/index',
imageUrl: ''
};
}
};

View File

@@ -0,0 +1,99 @@
<template>
<AppLayout :show-bg-image="false" :use-scroll-view="false">
<view class="collection-content">
<scroll-view scroll-y class="main-scroll" @scrolltolower="getJobList('add')">
<view class="one-cards">
<view class="mian">
<renderJobs
seeDate="shareTime"
v-if="pageState.list.length"
:list="pageState.list"
:longitude="longitudeVal"
:latitude="latitudeVal"
></renderJobs>
<empty v-else pdTop="200"></empty>
</view>
</view>
</scroll-view>
</view>
</AppLayout>
</template>
<script setup>
import dictLabel from '@/components/dict-Label/dict-Label.vue';
import AppLayout from '@/components/AppLayout/AppLayout.vue';
import { reactive, inject, watch, ref, onMounted } from 'vue';
import { onLoad, onShow, onReachBottom } from '@dcloudio/uni-app';
import useUserStore from '@/stores/useUserStore';
const { $api, navTo, vacanciesTo } = inject('globalFunction');
import { storeToRefs } from 'pinia';
import useLocationStore from '@/stores/useLocationStore';
const { longitudeVal, latitudeVal } = storeToRefs(useLocationStore());
const userStore = useUserStore();
const state = reactive({});
const pageState = reactive({
page: 0,
list: [],
total: 0,
maxPage: 1,
pageSize: 10,
});
onLoad(() => {
console.log('onLoad');
getJobList('refresh');
});
onReachBottom(() => {
getJobList();
});
function navToPost(jobId) {
navTo(`/packageA/pages/post/post?jobId=${encodeURIComponent(jobId)}`);
}
function getJobList(type = 'add') {
if (type === 'refresh') {
pageState.page = 1;
pageState.maxPage = 1;
}
if (type === 'add' && pageState.page < pageState.maxPage) {
pageState.page += 1;
}
let params = {
current: pageState.page,
pageSize: pageState.pageSize,
};
$api.createRequest('/app/job/selectCencalList', params, 'GET').then((resData) => {
const { rows, total } = resData;
if (type === 'add') {
const str = pageState.pageSize * (pageState.page - 1);
const end = pageState.list.length;
const reslist = rows;
pageState.list.splice(str, end, ...reslist);
} else {
pageState.list = rows;
}
pageState.total = resData.total;
pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize);
console.log(pageState.list);
});
}
</script>
<style lang="stylus" scoped>
.collection-content
height: 100%
display: flex
flex-direction: column
.main-scroll{
flex: 1
overflow: hidden
}
.one-cards{
padding: 0 28rpx 20rpx 28rpx;
background: #f4f4f4
}
</style>

View File

@@ -364,7 +364,7 @@ const changeSkillName = (index) => {
state.currentEditingSkillIndex = index;
//
uni.navigateTo({
url: `/pages/complete-info/skill-search?selected=${encodeURIComponent(JSON.stringify([]))}`
url: `/packageA/pages/complete-info/skill-search?selected=${encodeURIComponent(JSON.stringify([]))}`
});
};

View File

@@ -76,6 +76,18 @@
<view class="picker-text" data-placeholder="请选择学历要求">{{ selectedEducation || '请选择学历要求' }}</view>
</picker>
</view>
<view class="form-group">
<view class="label">人员类型</view>
<picker
mode="selector"
:range="staffTypes"
range-key="label"
@change="onStaffTypeChange"
class="picker"
>
<view class="picker-text" data-placeholder="请选择人员类型">{{ selectedStaffType || '请选择人员类型' }}</view>
</picker>
</view>
<view class="form-group">
<view class="label">工作经验</view>
<picker
@@ -302,6 +314,7 @@ const formData = reactive({
jobLocationAreaCode: '', //
education: '', //
experience: '', //
staffType: '', //
images: [], //
contacts: [
{
@@ -324,6 +337,7 @@ const experienceLevels = ref([]);
const workDistricts = ref([]);
const workLocations = ref([]);
const jobCategories = ref([]); //
const staffTypes = ref([]); //
//
const selectedEducation = ref('');
@@ -333,6 +347,7 @@ const selectedWorkLocation = ref('');
const selectedJobCategory = ref('');
const selectedJobTypeLabel = ref(''); //
const selectedJobTypeIds = ref(''); // ID
const selectedStaffType = ref(''); //
//
const scrollViewHeight = ref('calc(100vh - 200rpx)');
@@ -451,6 +466,11 @@ const initFormData = async () => {
}
console.log('岗位分类选项:', jobCategories.value);
// - staffType
const staffTypeDict = await dictStore.getDictSelectOption('staff_type');
console.log('从字典获取的人员类型数据:', staffTypeDict);
staffTypes.value = staffTypeDict;
// ID
if (userStore.userInfo && userStore.userInfo.id) {
formData.companyId = userStore.userInfo.id;
@@ -512,6 +532,14 @@ const onJobCategoryChange = (e) => {
formData.type = selectedItem.value; // type
};
// change
const onStaffTypeChange = (e) => {
const index = e.detail.value;
const selectedItem = staffTypes.value[index];
selectedStaffType.value = selectedItem.label;
formData.staffType = selectedItem.value; // staffType
};
//
const openJobTypeSelector = () => {
if (!jobTypeSelector.value) return;
@@ -706,6 +734,7 @@ const publishJob = async () => {
jobCategory: formData.jobCategory, //
companyId: formData.companyId,
companyName: formData.companyName,
staffType: formData.staffType, //
jobContactList: formData.contacts.filter(contact => contact.name.trim() && contact.phone.trim()).map(contact => ({
contactPerson: contact.name,
contactPersonPhone: contact.phone,
@@ -760,6 +789,7 @@ const validateForm = () => {
{ field: 'minSalary', message: '请输入最小薪资' },
{ field: 'maxSalary', message: '请输入最大薪资' },
{ field: 'education', message: '请选择学历要求' },
{ field: 'staffType', message: '请选择人员类型' },
{ field: 'experience', message: '请选择工作经验' },
{ field: 'jobLocation', message: '请选择工作地点' },
{ field: 'jobLocationAreaCode', message: '请选择工作区县' },

View File

@@ -472,7 +472,7 @@ function changeSkillName(index) {
// 将当前已选中的技能名称传递给查询页面
const selectedSkills = state.skills.map(skill => skill.name).filter(name => name);
uni.navigateTo({
url: `/pages/complete-info/skill-search?selected=${encodeURIComponent(JSON.stringify(selectedSkills))}`
url: `/packageA/pages/complete-info/skill-search?selected=${encodeURIComponent(JSON.stringify(selectedSkills))}`
});
}

View File

@@ -32,9 +32,9 @@
<!-- 控制栏 -->
<view class="controls">
<!-- <text @click="togglePlay">{{ isPlaying ? '暂停' : '播放' }}</text>
<text @click="toggleFullScreen">{{ isFullScreen ? '退出全屏' : '全屏' }}</text> -->
<text @click="close">关闭</text>
<!-- <view class="control-text" @click="togglePlay">{{ isPlaying ? '暂停' : '播放' }}</view>
<view class="control-text" @click="toggleFullScreen">{{ isFullScreen ? '退出全屏' : '全屏' }}</view> -->
<view class="control-text" @click="close">关闭</view>
</view>
</view>
</template>
@@ -180,7 +180,7 @@ defineExpose({ open });
justify-content: space-around;
}
.controls text {
.controls .control-text {
color: #fff;
font-size: 24rpx;
padding: 8rpx 16rpx;

View File

@@ -218,10 +218,22 @@
<view style="height: 34px"></view>
<template #footer>
<view class="footer">
<view class="btn-wq button-click" @click="jobApply">投递简历</view>
<view class="btn-wq button-click" @click="jobApply">{{ jobInfo.isApply === 1 ? '取消投递简历' : '投递简历' }}</view>
</view>
</template>
<VideoPlayer ref="videoPalyerRef" />
<!-- 确认弹窗 -->
<view v-if="showConfirmDialog" class="confirm-dialog">
<view class="dialog-content">
<view class="dialog-title">{{ jobInfo.isApply === 1 ? '确认取消投递' : '确认投递' }}</view>
<view class="dialog-message">{{ jobInfo.isApply === 1 ? '确定要取消投递此职位吗?' : '确定要投递此职位吗?' }}</view>
<view class="dialog-buttons">
<view class="btn-cancel button-click" @click="hideDialog">取消</view>
<view class="btn-confirm button-click" @click="confirmAction">确认</view>
</view>
</view>
</view>
</AppLayout>
</template>
@@ -229,7 +241,7 @@
import point from '@/static/icon/point.png';
import VideoPlayer from './component/videoPlayer.vue';
import { reactive, inject, watch, ref, onMounted, computed } from 'vue';
import { onLoad, onShow, onHide } from '@dcloudio/uni-app';
import { onLoad, onShow, onHide, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
import dictLabel from '@/components/dict-Label/dict-Label.vue';
import RadarMap from './component/radarMap.vue';
import { storeToRefs } from 'pinia';
@@ -266,6 +278,7 @@ const raderData = ref({
});
const videoPalyerRef = ref(null);
const explainUrlRef = ref('');
const showConfirmDialog = ref(false);
// 申请人列表直接使用接口返回的applyUsers数组
@@ -351,10 +364,10 @@ function getCompanyIsAJobs(companyId) {
}
function getTextWidth(text, size = 12) {
const canvas = document.createElement('canvas');
const context = canvas.getContext('2d');
context.font = `${12}px Arial`;
return -(context.measureText(text).width / 2) - 20; // 计算文字中心点
// 在小程序环境中document 对象不存在,使用估算方法
// 简单估算:每个字符大约占 8px 宽度
const estimatedWidth = text.length * 8;
return -(estimatedWidth / 2) - 20; // 计算文字中心点
}
function getCompetivetuveness(jobId) {
@@ -422,24 +435,53 @@ function jobApply() {
$api.msg('请您先登录');
return;
}
// 显示确认弹窗
showConfirmDialog.value = true;
}
// 隐藏弹窗
function hideDialog() {
showConfirmDialog.value = false;
}
// 确认操作
function confirmAction() {
const jobId = jobInfo.value.jobId;
if (jobInfo.value.isApply === 1) {
// 取消投递
$api.createRequest(`/app/job/applyJobCencal`, { jobId }, 'DELETE').then((resData) => {
$api.msg('取消投递成功');
getDetail(jobId); // 刷新职位信息
showConfirmDialog.value = false;
});
} else {
// 确认投递
$api.createRequest(`/app/job/apply/${jobId}`, {}, 'GET').then((resData) => {
$api.msg('申请成功');
getDetail(jobId); // 刷新职位信息
showConfirmDialog.value = false;
});
}
}
// 确认投递
function confirmApply() {
const jobId = jobInfo.value.jobId;
$api.createRequest(`/app/job/apply/${jobId}`, {}, 'GET').then((resData) => {
getDetail(jobId);
$api.msg('申请成功');
const jobUrl = jobInfo.value.jobUrl;
// return window.open(jobUrl);
});
// if (jobInfo.value.isApply) {
// const jobUrl = jobInfo.value.jobUrl;
// return window.open(jobUrl);
// } else {
// $api.createRequest(`/app/job/apply/${jobId}`, {}, 'GET').then((resData) => {
// getDetail(jobId);
// $api.msg('申请成功');
// const jobUrl = jobInfo.value.jobUrl;
// return window.open(jobUrl);
// });
// }
$api.msg('申请成功');
const jobUrl = jobInfo.value.jobUrl;
// return window.open(jobUrl);
showConfirmDialog.value = false;
});
}
// 取消投递
function cancelApply() {
const jobId = jobInfo.value.jobId;
$api.createRequest(`/app/job/applyJobCencal`, { jobId }, 'DELETE').then((resData) => {
$api.msg('取消投递成功');
showConfirmDialog.value = false;
});
}
// 取消/收藏岗位
@@ -524,6 +566,24 @@ function handleCompanyDetailClick() {
$api.msg('没有企业信息');
}
}
// 分享给朋友
onShareAppMessage(() => {
return {
title: '喀什智慧就业平台',
path: '/pages/index/index',
imageUrl: ''
};
});
// 分享到朋友圈
onShareTimeline(() => {
return {
title: '喀什智慧就业平台',
path: '/pages/index/index',
imageUrl: ''
};
});
</script>
<style lang="stylus" scoped>
@@ -966,4 +1026,70 @@ for i in 0..100
font-weight: bold;
color: #333;
}
// 确认弹窗样式
.confirm-dialog {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;
z-index: 9999;
}
.dialog-content {
width: 80%;
max-width: 500rpx;
background-color: #fff;
border-radius: 20rpx;
padding: 40rpx;
display: flex;
flex-direction: column;
align-items: center;
}
.dialog-title {
font-size: 32rpx;
font-weight: 600;
color: #333;
margin-bottom: 30rpx;
}
.dialog-message {
font-size: 28rpx;
color: #666;
margin-bottom: 40rpx;
text-align: center;
}
.dialog-buttons {
width: 100%;
display: flex;
justify-content: space-between;
gap: 20rpx;
}
.btn-cancel, .btn-confirm {
flex: 1;
height: 80rpx;
border-radius: 12rpx;
display: flex;
justify-content: center;
align-items: center;
font-size: 28rpx;
font-weight: 500;
}
.btn-cancel {
background-color: #f5f5f5;
color: #666;
}
.btn-confirm {
background-color: #256BFA;
color: #fff;
}
</style>

View File

@@ -323,46 +323,59 @@
const deliveringJobs = reactive({});
// 岗位投递
function deliverResume(job) {
if(deliveringJobs[job.jobId]) return
deliveringJobs[job.jobId] = true
const raw = uni.getStorageSync("Padmin-Token");
const token = typeof raw === "string" ? raw.trim() : "";
const headers = token ? {
Authorization: raw.startsWith("Bearer ") ? raw : `Bearer ${token}`
} : {};
$api.myRequest("/dashboard/auth/heart", {}, "POST", 10100, headers).then((resData1) => {
if (resData1.code == 200) {
$api.myRequest("/system/user/login/user/info", {}, "GET", 10100, headers).then((resData) => {
$api.myRequest("/jobfair/public/job-fair-person-job/insert", {
jobFairId: job.jobFairId, // 招聘会id
personId: resData.info.userId, // 当前登录用户id
enterpriseId: job.companyId, // 企业id
jobId: job.jobId, // 岗位id
idCard:resData.info.personCardNo
}, "post", 9100, {
"Content-Type": "application/json"
}).then((data) => {
if (data && data.code === 200) {
$api.msg("简历投递成功");
if (!job.jobFairPersonJob) {
job.jobFairPersonJob = {};
}
job.jobFairPersonJob.status = "1";
getList(false);
uni.showModal({
title: "提示",
content: "请确认是否投递简历?",
showCancel: true,
confirmText: "确定",
cancelText: "取消",
success: (res) => {
if(res.confirm){
if(deliveringJobs[job.jobId]) return
deliveringJobs[job.jobId] = true
const raw = uni.getStorageSync("Padmin-Token");
const token = typeof raw === "string" ? raw.trim() : "";
const headers = token ? {
Authorization: raw.startsWith("Bearer ") ? raw : `Bearer ${token}`
} : {};
$api.myRequest("/dashboard/auth/heart", {}, "POST", 10100, headers).then((resData1) => {
if (resData1.code == 200) {
$api.myRequest("/system/user/login/user/info", {}, "GET", 10100, headers).then((resData) => {
$api.myRequest("/jobfair/public/job-fair-person-job/insert", {
jobFairId: job.jobFairId, // 招聘会id
personId: resData.info.userId, // 当前登录用户id
enterpriseId: job.companyId, // 企业id
jobId: job.jobId, // 岗位id
idCard:resData.info.personCardNo
}, "post", 9100, {
"Content-Type": "application/json"
}).then((data) => {
if (data && data.code === 200) {
$api.msg("简历投递成功");
if (!job.jobFairPersonJob) {
job.jobFairPersonJob = {};
}
job.jobFairPersonJob.status = "1";
getList(false);
} else {
$api.msg((data && data.msg) || "简历投递失败");
}
deliveringJobs[job.jobId] = false
});
});
} else {
$api.msg((data && data.msg) || "简历投递失败");
$api.msg('请先登录');
deliveringJobs[job.jobId] =false
}
deliveringJobs[job.jobId] = false
}).catch(() => {
deliveringJobs[job.jobId] =false;
});
});
} else {
$api.msg('请先登录');
deliveringJobs[job.jobId] =false
}
}
}).catch(() => {
deliveringJobs[job.jobId] =false;
});
})
}
// 提交面试邀请

View File

@@ -81,7 +81,8 @@ function getPolicyData(type = 'add',currentTab='train') {
params={
pageSize:pageSize.value,
pageNum:pageNum.value,
type:current.value
type:current.value,
shenhe: '1',
}
$api.myRequest('/train/public/announcement/list', params).then((resData) => {
if(resData.code==200){
@@ -99,7 +100,8 @@ function getPolicyData(type = 'add',currentTab='train') {
params={
pageSize:pageSize.value,
pageNum:pageNum.value,
type:current.value
type:current.value,
shenhe: '1',
}
$api.myRequest('/train/public/announcement/list', params).then((resData) => {
if(resData.code==200){

View File

@@ -332,13 +332,12 @@ function handleOperation(row,i) {
height: 90%;
.cards{
width: 100%;
height: 280rpx;
background: linear-gradient(0deg, #E3EFFF 0%, #FBFDFF 100%);
// box-shadow: 0px 0px 6px 0px rgba(0,71,200,0.32);
border-radius: 12rpx;
border: 2px solid #EDF5FF;
margin-bottom: 30rpx;
padding: 30rpx 40rpx 0;
padding: 30rpx 40rpx 10rpx;
box-sizing: border-box
.cardHead{
display: flex;

View File

@@ -109,7 +109,7 @@
<div>题号</div>
<div style="font-size: 40rpx;" @click="clones()">×</div>
</div>
<div class="questionNums">
<div class="questionNums" style = "height:77vh;overflow: auto;">
<div class="questions" :class="item.whether=='正确'?'questionCorrect':item.whether=='错误'?'questionError':questionIndex==(index+1)?'questionsActive':''" @click="switchs(index)" v-for="(item,index) in problemList" :key="index">{{index+1}}</div>
</div>
</div>

View File

@@ -126,10 +126,11 @@ function getDataList(type = 'add') {
pageSize:pageSize.value,
pageNum:pageNum.value
}
$api.myRequest('/train/public/trainVideo/trainVideoList', params).then((resData) => {
$api.myRequest('/train/public/trainQuestion/getQuestionTypes', params).then((resData) => {
dataList.value=dataList.value.concat(resData.rows)
totalNum.value=resData.total
});
}
}

View File

@@ -14,7 +14,6 @@
</view>
</view>
</view>
<!-- :style="{height: winHeight - barHeight - loginHeight + 'px'}" -->
<view class="u-menu-wrap" >
<scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view" :scroll-top="scrollTop" :scroll-into-view="itemId">
<view v-for="(item,index) in jobList" :key="index" class="u-tab-item"
@@ -48,7 +47,6 @@
return {
kw: "", //搜索关键
user: uni.getStorageSync("CAuserInfo").user,
barHeight: wx.getWindowInfo().statusBarHeight,
winHeight: wx.getWindowInfo().windowHeight,
jobDataList: [],
jobList,

View File

@@ -56,7 +56,6 @@
export default {
data() {
return {
barHeight: wx.getWindowInfo().statusBarHeight,
list: [],
allNum: 0, //总题目数
pageIndex: 0, //显示页

View File

@@ -64,7 +64,6 @@
export default {
data() {
return {
barHeight: wx.getWindowInfo().statusBarHeight,
list: [],
allNum: 0,//总题目数
pageIndex: 0, //显示页

View File

@@ -48,7 +48,6 @@
export default {
data() {
return {
barHeight: wx.getWindowInfo().statusBarHeight,
list: [],
allNum: 0,//总题目数
pageIndex: 0, //显示页

View File

@@ -29,7 +29,6 @@
export default {
data() {
return {
barHeight: wx.getWindowInfo().statusBarHeight,
refreshIfNeeded: false, //是否返回刷新
dataList: [],
}

View File

@@ -47,7 +47,6 @@
export default {
data() {
return {
barHeight: wx.getWindowInfo().statusBarHeight,
list: [],
allNum: 0,//总题目数
pageIndex: 0, //显示页

View File

@@ -9,7 +9,6 @@
export default {
data() {
return {
barHeight: wx.getWindowInfo().statusBarHeight,
user: null,//用户信息
userId: 0,
name: "",

View File

@@ -49,15 +49,19 @@
export default {
data() {
return {
barHeight: wx.getWindowInfo().statusBarHeight,
user: null,//用户信息
name: "",
idCard: ""
}
},
onLoad(e) {
this.idCard = e.idCard;
if(e.idCard){
this.idCard = e.idCard;
}else {
this.idCard = e.userId;
}
this.name = e.name;
console.log(e);
this.queryKaShiToken();
},
methods: {

View File

@@ -82,7 +82,6 @@
},
data() {
return {
barHeight: wx.getWindowInfo().statusBarHeight,
videoUrl: "",
introduceUrl: "",
id: "",

View File

@@ -254,7 +254,6 @@
data() {
return {
platform: uni.getDeviceInfo().platform,
barHeight: wx.getWindowInfo().statusBarHeight,
showTip: false,
layerTitile: "",
layerDesc: "",

View File

@@ -123,7 +123,6 @@
data() {
return {
platform: uni.getDeviceInfo().platform,
barHeight: wx.getWindowInfo().statusBarHeight,
introduceUrl: "https://51xuanxiao.oss-cn-hangzhou.aliyuncs.com/Resource/xcx_sygh/report/multipleAbilityTestReport-1.png",
introduceUrl2: "https://51xuanxiao.oss-cn-hangzhou.aliyuncs.com/Resource/xcx_sygh/report/multipleAbilityTestReport-2.png",
videoUrl: "http://2-video.oss-cn-shenzhen.aliyuncs.com/2023%E5%B9%B4%E8%A7%86%E9%A2%91/%E5%88%9D%E4%B8%AD%E8%AF%BE%E7%A8%8B%E8%B5%84%E6%BA%90/%E5%A4%9A%E5%85%83%E6%99%BA%E8%83%BD%E6%B5%8B%E8%AF%84%E8%A7%A3%E8%AF%BB1.16%E4%BF%AE%E6%94%B92.mp4",

View File

@@ -410,7 +410,6 @@
data() {
return {
platform: uni.getDeviceInfo().platform,
barHeight: wx.getWindowInfo().statusBarHeight,
showTip: false,
videoUrl: "http://2-video.oss-cn-shenzhen.aliyuncs.com/2023%E5%B9%B4%E8%A7%86%E9%A2%91/%E5%88%9D%E4%B8%AD%E8%AF%BE%E7%A8%8B%E8%B5%84%E6%BA%90/%E4%BA%BA%E6%A0%BC%E6%B5%8B%E8%AF%84%E8%A7%A3%E8%AF%BB1.16%E4%BF%AE%E6%94%B92.mp4",
introduceUrl: "https://51xuanxiao.oss-cn-hangzhou.aliyuncs.com/Resource/xcx_sygh/report/personalTestReport.png",

View File

@@ -49,7 +49,6 @@
},
data() {
return {
barHeight: wx.getWindowInfo().statusBarHeight,
showVideo: false,
showIntroduce: false, // 测评介绍
videoUrl: "http://2-video.oss-cn-shenzhen.aliyuncs.com/2023%E5%B9%B4%E8%A7%86%E9%A2%91/%E5%88%9D%E4%B8%AD%E8%AF%BE%E7%A8%8B%E8%B5%84%E6%BA%90/%E5%B7%A5%E4%BD%9C%E4%BB%B7%E5%80%BC%E8%A7%82%E8%A7%A3%E8%AF%BB1.16%E4%BF%AE%E6%94%B92.mp4",

View File

@@ -108,7 +108,6 @@
export default {
data() {
return {
barHeight: wx.getWindowInfo().statusBarHeight,
compassList: [],//罗盘列表
checkedIndex: null,
jobList: [],//我的职业

View File

@@ -124,7 +124,6 @@
export default {
data() {
return {
barHeight: wx.getWindowInfo().statusBarHeight,
tabs:['目标一 ', '目标二 ', '目标三 ', '目标四 ', '目标五 '],
targetForm: {}, //当前选中的目标
targetList: [],//目标列表

View File

@@ -252,7 +252,6 @@ import api1 from "@/packageCa/apiCa/studentProfile.js"
data() {
return {
refreshIfNeeded: false, //是否返回刷新
barHeight: wx.getWindowInfo().statusBarHeight,
user: uni.getStorageSync("CAuserInfo").user,
customInfo: uni.getStorageSync("customInfo"),
intentionJobList: [],//意向职业

View File

@@ -130,7 +130,6 @@
export default {
data() {
return {
barHeight: wx.getWindowInfo().statusBarHeight,
jobList: [],//
checkedCode: null,
jobIntroduce: "",

View File

@@ -178,7 +178,6 @@
export default {
data() {
return {
barHeight: wx.getWindowInfo().statusBarHeight,
tabs:['目标一 ', '目标二 ', '目标三 ', '目标四 ', '目标五 '],
targetList: [],////目标列表
checkedTargetCode: "",//// 目标码

View File

@@ -1,13 +1,10 @@
let baseUrl = ""
// #ifdef MP-WEIXIN
// 编译项目因为使用插件lime-echartechart文件过大需要非压缩代码方式编译不然会很慢发布的时候才压缩代码方式编译
if (wx.getAccountInfoSync().miniProgram.envVersion === 'develop') {
baseUrl = 'https://www.xjksly.cn/career' // 开发环境
} else {
baseUrl = 'https://www.xjksly.cn/career' // 生产环境
}
// #endif
// let baseUrl = ""
// // #ifdef MP-WEIXIN
// // 编译项目因为使用插件lime-echartechart文件过大需要非压缩代码方式编译不然会很慢发布的时候才压缩代码方式编译
export {
baseUrl
}
// baseUrl = 'https://www.xjksly.cn/career' // 生产环境
// // #endif
// export {
// baseUrl
// }

View File

@@ -1,5 +1,5 @@
import { baseUrl} from './config.js'
// const baseUrl = "https://localhost:7026/career";
const baseUrl = "https://www.xjksly.cn/career";
const request = {}
const headers = {}

View File

@@ -1,11 +1,11 @@
<!--
* @Date: 2025-10-16 15:15:47
* @LastEditors: lip
* @LastEditTime: 2026-01-14 21:33:18
* @LastEditors: shirlwang
* @LastEditTime: 2026-01-27 09:30:18
-->
<template>
<!-- @scroll="handleScroll" @scrolltolower="scrollBottom" -->
<scroll-view :scroll-y="true" class="container" style="background-image: url('../../../packageRc/static/pageBg.png');">
<scroll-view :scroll-y="true" class="container" style="background-image: url('../../../packageRc/static/pageBgIndex.png');">
<view style="padding: 40rpx 28rpx;">
<!-- #ifdef MP-WEIXIN -->
<view class="kinggang">
@@ -31,54 +31,69 @@
</view>
</view>
<!-- #endif -->
<view class="tabs">
<view class="tab" :class="{active: pageState.type == ''}" @click="changeJobType('')">岗位列表</view>
<view class="tab" :class="{active: pageState.type == 2}" @click="changeJobType(2)">实习实训</view>
<view class="tab" :class="{active: pageState.type == 3}" @click="changeJobType(3)">社区实践</view>
</view>
<view class="titles">
<view class="title-item" :class="{active: activeTitle == 1}" @click="activeTitle = 1,getJobRecommed()"><view>推荐岗位</view></view>
<view class="title-item" :class="{active: activeTitle == 2}" @click="activeTitle = 2,getJobList()"><view>热门岗位</view></view>
</view>
<view v-for="(item, index) in jobList" :key="index" @click="nextDetail(item)" class="job-list">
<view class="top-line">
<view class="salary">{{item.minSalary}}-{{item.maxSalary}}/</view>
<view class="time"><uni-icons color="#A2A2A2" type="info" size="12"></uni-icons>发布日期{{ item.postingDate }}</view>
<view class="showtab">
<view class="tabItem" @click="changeType(1)">
<image src="/packageRc/static/gw.png"/>
<image v-show="tabType == 1" class="activeImg" src="/packageRc/static/activeTangle.png"/>
</view>
<view class="title">{{ item.jobTitle }}</view>
<view class="infos">
<view>
<dict-Label dictType="education" :value="item.education"></dict-Label>
<view class="tabItem" @click="changeType(2)">
<image src="/packageRc/static/zc.png"/>
<image v-show="tabType == 2" class="activeImg" src="/packageRc/static/activeTangle.png"/>
</view>
</view>
<template v-if="tabType == 1">
<view class="tabs">
<view class="tab" :class="{active: pageState.type == ''}" @click="changeJobType('')">岗位列表</view>
<view class="tab" :class="{active: pageState.type == 2}" @click="changeJobType(2)">实习实训</view>
<view class="tab" :class="{active: pageState.type == 3}" @click="changeJobType(3)">社区实践</view>
</view>
<view class="titles">
<view class="title-item" :class="{active: activeTitle == 1}" @click="activeTitle = 1,getJobRecommed()"><view>推荐岗位</view></view>
<view class="title-item" :class="{active: activeTitle == 2}" @click="activeTitle = 2,getJobList()"><view>热门岗位</view></view>
</view>
<view v-for="(item, index) in jobList" :key="index" @click="nextDetail(item)" class="job-list">
<view class="top-line">
<view class="salary">{{item.minSalary}}-{{item.maxSalary}}/</view>
<view class="time"><uni-icons color="#A2A2A2" type="info" size="12"></uni-icons>发布日期{{ item.postingDate }}</view>
</view>
<view>
<dict-Label dictType="experience" :value="item.experience"></dict-Label>
<view class="title">{{ item.jobTitle }}</view>
<view class="infos">
<view>
<dict-Label dictType="education" :value="item.education"></dict-Label>
</view>
<view>
<dict-Label dictType="experience" :value="item.experience"></dict-Label>
</view>
<view>{{ item.jobLocation }}</view>
</view>
<view class="bottom-line">
<view><uni-icons color="#A2A2A2" type="person" size="12"></uni-icons>{{item.vacancies}}</view>
<view>{{ item.companyName }}</view>
</view>
<view>{{ item.jobLocation }}</view>
</view>
<view class="bottom-line">
<view><uni-icons color="#A2A2A2" type="person" size="12"></uni-icons>{{item.vacancies}}</view>
<view>{{ item.companyName }}</view>
<view class="view-more-btn" @click="viewMore">查看更多内容</view>
</template>
<template v-else>
<view class="titles" style="justify-content: space-between;">
<view class="title-item active"><view>政策专区</view></view>
<view @click="toPolicyList">{{'查看更多 >'}}</view>
</view>
</view>
<view class="view-more-btn" @click="viewMore">查看更多内容</view>
<view class="titles" style="justify-content: space-between;">
<view class="title-item active"><view>政策专区</view></view>
<view @click="toPolicyList">{{'查看更多 >'}}</view>
</view>
<view v-for="(item, index) in policyList" :key="index" class="job-list" @click="toPolicyDetail(item)">
<view class="sign">推荐</view>
<view class="title">
<image src="../../../packageRc/static/zcLeft.png"/>
{{item.zcmc}}</view>
<view class="infos">
<view v-if="item.zcLevel">{{item.zcLevel}}</view>
<view v-if="item.sourceUnit">{{item.sourceUnit}}</view>
<view v-for="(item, index) in policyList" :key="index" class="job-list" @click="toPolicyDetail(item)">
<view class="sign">推荐</view>
<view class="title">
<image src="../../../packageRc/static/zcLeft.png"/>
{{item.zcmc}}</view>
<view class="infos">
<view v-if="item.zcLevel">{{item.zcLevel}}</view>
<view v-if="item.sourceUnit">{{item.sourceUnit}}</view>
</view>
<view class="bottom-line">
<view><uni-icons color="#A2A2A2" type="info" size="12"></uni-icons>发布日期:{{item.createTime}}</view>
</view>
</view>
<view class="bottom-line">
<view><uni-icons color="#A2A2A2" type="info" size="12"></uni-icons>发布日期:{{item.createTime}}</view>
</view>
</view>
</template>
</view>
</scroll-view>
</template>
@@ -94,7 +109,10 @@ function getPolicy() {
policyList.value = res.rows
})
}
let tabType = ref(1)
function changeType(type) {
tabType.value = type
}
function toPolicyList() {
navTo(`/packageRc/pages/policy/policyList?zclx=1`)
}
@@ -377,4 +395,22 @@ view{box-sizing: border-box;display: block;}
margin: 0 auto;
margin-bottom: 20rpx;
}
.showtab{
display: flex;
justify-content: space-between;
margin-bottom: 40rpx;
.tabItem{
position: relative;
width: calc(50% - 8rpx);
height: 144rpx;
}
.activeImg{
position: absolute;
width: 143rpx;
height: 18rpx;
bottom: -24rpx;
right: 50%;
transform: translateX(50%);
}
}
</style>

View File

@@ -70,7 +70,7 @@
</view>
<view class="company-grid">
<view class="company-item press-button" @click="navTo('/pages/job/publishJob')">
<view class="company-item press-button" @click="navTo('/packageA/pages/job/publishJob')">
<view class="company-icon company-icon-1">
<uni-icons type="plus-filled" size="32" color="#FFFFFF"></uni-icons>
</view>
@@ -731,7 +731,7 @@ const handleLoginSuccess = () => {
// 处理附近工作点击
const handleNearbyClick = () => {
if (checkLogin()) {
navTo("/pages/nearby/nearby");
navTo("/packageA/pages/nearby/nearby");
}
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 734 B

BIN
packageRc/static/gw.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

BIN
packageRc/static/zc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -6,6 +6,12 @@
"navigationBarTitleText": "喀什智慧就业平台"
}
},
{
"path": "pages/city-select/index",
"style": {
"navigationBarTitleText": "选择城市"
}
},
{
"path": "pages/mine/mine",
"style": {
@@ -25,67 +31,20 @@
}
},
{
"path": "pages/complete-info/complete-info",
"path": "pages/search/search",
"style": {
"navigationBarTitleText": "补全信息"
}
},
{
"path": "pages/complete-info/company-info",
"style": {
"navigationBarTitleText": "企业信息"
}
},
{
"path": "pages/complete-info/components/map-location-picker",
"style": {
"navigationBarTitleText": "选择地址"
}
},
{
"path": "pages/complete-info/skill-search",
"style": {
"navigationBarTitleText": "技能查询"
}
},
{
"path": "pages/nearby/nearby",
"style": {
"navigationBarTitleText": "附近",
"navigationBarBackgroundColor": "#4778EC",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/job/publishJob",
"style": {
"navigationBarTitleText": "发布岗位"
}
},
{
"path": "pages/job/companySearch",
"style": {
"navigationBarTitleText": "选择企业",
"disableScroll": false,
"enablePullDownRefresh": false,
"backgroundColor": "#f5f5f5"
"navigationBarTitleText": "搜索职位"
}
},
{
"path": "pages/chat/chat",
"style": {
"navigationBarTitleText": "AI+",
"navigationBarTitleText": "智能客服",
"navigationBarBackgroundColor": "#4778EC",
"navigationBarTextStyle": "white",
"enablePullDownRefresh": false
}
},
{
"path": "pages/search/search",
"style": {
"navigationBarTitleText": "搜索职位"
}
},
{
"path": "pages/service/career-planning",
"style": {
@@ -155,6 +114,53 @@
{
"root": "packageA",
"pages": [
{
"path": "pages/complete-info/complete-info",
"style": {
"navigationBarTitleText": "补全信息"
}
},
{
"path": "pages/complete-info/company-info",
"style": {
"navigationBarTitleText": "企业信息"
}
},
{
"path": "pages/complete-info/components/map-location-picker",
"style": {
"navigationBarTitleText": "选择地址"
}
},
{
"path": "pages/complete-info/skill-search",
"style": {
"navigationBarTitleText": "技能查询"
}
},
{
"path": "pages/nearby/nearby",
"style": {
"navigationBarTitleText": "附近",
"navigationBarBackgroundColor": "#4778EC",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/job/publishJob",
"style": {
"navigationBarTitleText": "发布岗位"
}
},
{
"path": "pages/job/companySearch",
"style": {
"navigationBarTitleText": "选择企业",
"disableScroll": false,
"enablePullDownRefresh": false,
"backgroundColor": "#f5f5f5"
}
},
{
"path": "pages/addWorkExperience/addWorkExperience",
"style": {
@@ -306,6 +312,13 @@
"navigationBarBackgroundColor": "#4778EC",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/cancelApplication/cancelApplication",
"style": {
"navigationBarTitleText": "取消投递",
"navigationBarBackgroundColor": "#FFFFFF"
}
}
]
},

View File

@@ -22,9 +22,65 @@
@click="getFair('refresh')"></uni-icons>
<input class="input" placeholder="招聘会" placeholder-class="inputplace"
v-model="pageState.jobFairTitle" />
<view class="btn-feel" v-show="state.current != 3" @click="openFilter">筛选</view>
</view>
</view>
<uni-popup
ref="selectFilterModel"
type="bottom"
borderRadius="10px 10px 0 0"
background-color="#FFFFFF"
class="popup-fix"
>
<view class="popup-content">
<view class="popup-list">
<view class="content-wrapper">
<!-- 左侧筛选类别 -->
<!-- <scroll-view class="filter-nav" scroll-y>
<view
v-for="(item, index) in filterOptions"
:key="index"
class="nav-item button-click"
:class="{ active: activeTab === item.key }"
@click="scrollTo(item.key)"
>
{{ item.label }}
</view>
</scroll-view> -->
<!-- 右侧筛选内容 -->
<scroll-view class="filter-content" :scroll-into-view="activeTab" scroll-y>
<view v-for="(item, index) in filterOptions" :key="index">
<view class="content-item">
<view class="item-title" :id="item.key">{{ item.label }}</view>
<radio-group class="check-content" @change="handleSelect">
<label
v-for="option in item.options"
:key="option.value"
class="checkbox-item button-click"
:class="{
checkedstyle: selectedValues === String(option.value),
}"
>
<radio
style="display: none"
:value="String(option.value)"
:checked="selectedValues === String(option.value)"
/>
<text class="option-label">{{ option.label }}</text>
</label>
</radio-group>
</view>
</view>
</scroll-view>
</view>
</view>
<view class="popup-bottom">
<view class="btn-cancel btn-feel" @click="cleanup">重置</view>
<view class="btn-confirm btn-feel" @click="confirm">确认</view>
</view>
</view>
</uni-popup>
<!-- 主体内容区域 -->
<view class="container-main">
<scroll-view scroll-y class="main-scroll" :class="{fullHeightScroll:!showTabar}" @scrolltolower="handleScrollToLower">
@@ -151,10 +207,57 @@
onShow(() => {
// 更新自定义tabbar选中状态
tabbarManager.updateSelected(1);
getoptions();
});//
//筛选
const filterOptions = ref([]);
const activeTab = ref('');
const selectFilterModel = ref(null);
const selectedValues = ref(null);
function openFilter() {
selectFilterModel.value?.open();
}
const scrollTo = (key) => {
activeTab.value = key;
};
const handleSelect = (e) => {
selectedValues.value = e.detail.value
};
function cleanup(){
selectedValues.value = null
confirm()
}
function confirm(){
getFair("refresh");
selectFilterModel.value?.close();
}
function getoptions() {
let headers = {
'Content-Type': 'application/x-www-form-urlencoded',
}
let params = {
dictType:'administrative_division',
dictParentValue:'653100000000',
childFlag:'1',
}
filterOptions.value = [{
label: '所在区域',
key: 'area',
options: []
}];
$api.myRequest('/system/public/dict/data/getByParentValue',params,'POST',9100,headers).then(res=>{
if (res.code == 200) {
filterOptions.value[0].options = res.data.map(item=>{
return {
label: item.dictLabel,
value: item.dictValue,
}
})
}
})
activeTab.value = 'area';
}
async function thirdLogin(needToast){
let form={}
if (uni.getStorageSync('userInfo') && (uni.getStorageSync('userInfo').isCompanyUser=='1' || uni.getStorageSync('userInfo').isCompanyUser=='2')) {
@@ -339,11 +442,27 @@
// 正确映射响应为用户信息(优先使用 data 字段)
const data = resData?.data ?? resData;
userInfo.value = data || {};
if(data?.info?.entCreditCode && data?.info?.userId){
updateEnterpriseId({
unifiedSocialCreditCode: data?.info?.entCreditCode,
userId: data?.info?.userId,
})
}
getFair("refresh");
return userInfo.value;
});
}
function updateEnterpriseId(params){
const headers = {
'Content-Type':'application/json'
}
return $api.myRequest("/jobfair/public/job-fair-sign-up-enterprise/update-enterprise-id", params, "POST", 9100, headers).then((resData) => {
if(resData.code == 200 && resData.data !=0){
state.current = 3
getMyFair("refresh");
}
});
}
function getMyFair(type = "add") {
if (type === "refresh") {
pageState.pageNum = 1;
@@ -404,6 +523,7 @@
pageSize: pageState.pageSize,
jobFairTitle: pageState.jobFairTitle,
jobFairType: state.current,
dictValue: selectedValues.value,
};
if (isLogin.value) {
if (userInfo.value.userType == "ent") {
@@ -561,7 +681,168 @@
return dates;
}
</script>
<style lang="scss" scoped>
.popup-fix {
z-index: 9999 !important;
}
.popup-content {
color: #000000;
height: 70vh;
padding-bottom: 20rpx;
}
.popup-bottom {
padding: 40rpx 28rpx 20rpx 28rpx;
display: flex;
justify-content: space-between;
.btn-cancel {
font-weight: 400;
font-size: 32rpx;
color: #666d7f;
line-height: 90rpx;
width: 33%;
min-width: 222rpx;
height: 90rpx;
background: #f5f5f5;
border-radius: 12rpx 12rpx 12rpx 12rpx;
text-align: center;
}
.btn-confirm {
font-weight: 400;
font-size: 32rpx;
color: #ffffff;
text-align: center;
width: 67%;
height: 90rpx;
margin-left: 28rpx;
line-height: 90rpx;
background: #256bfa;
min-width: 444rpx;
border-radius: 12rpx 12rpx 12rpx 12rpx;
}
}
.popup-list {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
justify-content: space-evenly;
height: calc(77vh - 100rpx - 150rpx);
overflow: hidden;
.picker-view {
width: 100%;
height: 500rpx;
margin-top: 20rpx;
.uni-picker-view-mask {
background: rgba(0, 0, 0, 0);
}
.item {
line-height: 84rpx;
height: 84rpx;
text-align: center;
font-weight: 400;
font-size: 32rpx;
color: #cccccc;
}
.item-active {
color: #333333;
}
.uni-picker-view-indicator:after {
border-color: #e3e3e3;
}
.uni-picker-view-indicator:before {
border-color: #e3e3e3;
}
}
// .list {
// .row {
// font-weight: 400;
// font-size: 32rpx;
// color: #333333;
// line-height: 84rpx;
// text-align: center;
// }
// }
}
.content-wrapper {
flex: 1;
display: flex;
overflow: hidden;
height: 100%;
}
.filter-nav {
width: 200rpx;
background-color: #ffffff;
.nav-item {
height: 100rpx;
line-height: 100rpx;
text-align: center;
font-weight: 400;
font-size: 28rpx;
color: #666d7f;
&.active {
font-weight: 500;
font-size: 28rpx;
color: #256bfa;
}
}
}
.filter-content {
flex: 1;
padding: 20rpx;
background-color: #f6f6f6;
.content-item {
margin-top: 30rpx;
.item-title {
font-weight: 400;
font-size: 28rpx;
color: #333333;
margin-bottom: 15rpx;
}
}
.content-item:first-child {
margin-top: 0rpx;
}
.check-content {
display: grid;
gap: 16rpx;
grid-template-columns: repeat(auto-fill, minmax(300rpx, 1fr));
place-items: stretch;
.checkbox-item {
display: flex;
align-items: center;
text-align: center;
background-color: #d9d9d9;
min-width: 0;
padding: 0 10rpx;
height: 80rpx;
background: #e8eaee;
border-radius: 12rpx 12rpx 12rpx 12rpx;
.option-label {
font-size: 28rpx;
width: 100%;
white-space: nowrap;
overflow: hidden;
}
}
.checkedstyle {
height: 76rpx;
background: rgba(37, 107, 250, 0.06);
border-radius: 12rpx 12rpx 12rpx 12rpx;
border: 2rpx solid #256bfa;
color: #256bfa;
}
}
}
</style>
<style scoped lang="stylus">
.app-custom-root {
position: fixed;
@@ -623,6 +904,8 @@
padding: 0 24rpx;
width: calc(100% - 48rpx);
position: relative;
display: flex;
align-items: center;
}
.app-container .container-header .header-input .iconsearch {
@@ -638,6 +921,7 @@
background: #ffffff;
border-radius: 75rpx;
font-size: 28rpx;
flex:1
}
.app-container .container-header .header-input .inputplace {
@@ -645,7 +929,13 @@
font-size: 28rpx;
color: #b5b5b5;
}
.app-container .container-header .header-input .btn-feel {
font-weight: 400;
font-size: 28rpx;
text-align: center;
color: #484444;
width: 80rpx;
}
.app-container .container-header .header-date {
padding: 28rpx;
display: flex;

View File

@@ -61,6 +61,7 @@
<view class="main-header">
<image src="/static/icon/Hamburger-button.png" @click="toggleDrawer"></image>
<view class="title">{{ config.appInfo.areaName }}岗位推荐</view>
<!-- <view class="title">智能客服</view> -->
<image src="/static/icon/Comment-one.png" @click="addNewDialogue"></image>
</view>
</header>

View File

@@ -65,6 +65,26 @@ const centerIndex = ref(0);
// 动画帧ID
let animationId = null;
// 为小程序环境提供requestAnimationFrame兼容
const requestAnimationFramePolyfill = (callback) => {
// #ifdef MP-WEIXIN
return setTimeout(callback, 16); // 约60fps
// #endif
// #ifdef H5
return requestAnimationFrame(callback);
// #endif
};
// 为小程序环境提供cancelAnimationFrame兼容
const cancelAnimationFramePolyfill = (id) => {
// #ifdef MP-WEIXIN
clearTimeout(id);
// #endif
// #ifdef H5
cancelAnimationFrame(id);
// #endif
};
// 格式化显示时间
const formattedTime = computed(() => {
const mins = Math.floor(props.recordingTime / 60)
@@ -125,7 +145,7 @@ const updateWaveform = () => {
}
}
animationId = requestAnimationFrame(updateWaveform);
animationId = requestAnimationFramePolyfill(updateWaveform);
};
// 更新单个波形条
@@ -157,14 +177,14 @@ const updateWaveBar = (index, value) => {
// 开始动画
const startAnimation = () => {
if (!animationId) {
animationId = requestAnimationFrame(updateWaveform);
animationId = requestAnimationFramePolyfill(updateWaveform);
}
};
// 停止动画
const stopAnimation = () => {
if (animationId) {
cancelAnimationFrame(animationId);
cancelAnimationFramePolyfill(animationId);
animationId = null;
}
};

View File

@@ -133,10 +133,31 @@
<view class="chat-item self" v-if="isRecording">
<view class="message">{{ recognizedText }} {{ lastFinalText }}</view>
</view>
<!-- 语音正在识别提示 -->
<!-- <view>{{isRecognizing}}</view> -->
<view class="chat-item self" v-if="isRecognizing">
<view class="message msg-loading">
<view class="loading-content">
<view class="ai-loading">
<view></view>
<view></view>
<view></view>
</view>
<text class="loading-text">正在识别语音...</text>
</view>
</view>
</view>
<view v-if="isTyping" class="self">
<text class="message msg-loading">
<span class="ai-loading"></span>
</text>
<view class="message msg-loading">
<view class="loading-content">
<view class="ai-loading">
<view></view>
<view></view>
<view></view>
</view>
<text class="loading-text">AI正在思考中...</text>
</view>
</view>
</view>
</view>
</scroll-view>
@@ -168,9 +189,6 @@
@touchmove="handleTouchMove"
@touchend="handleTouchEnd"
@touchcancel="handleTouchCancel"
:catchtouchstart="true"
:catchtouchmove="true"
:catchtouchend="true"
v-show="isVoice"
type="default"
>
@@ -276,7 +294,7 @@ import {
getCurrentInstance,
} from 'vue';
import { storeToRefs } from 'pinia';
// import config from '@/config.js';
// 移除重复导入使用从globalFunction注入的config
import useChatGroupDBStore from '@/stores/userChatGroupStore';
import MdRender from '@/components/md-render/md-render.vue';
import CollapseTransition from '@/components/CollapseTransition/CollapseTransition.vue';
@@ -287,11 +305,11 @@ import FileIcon from './fileIcon.vue';
import FileText from './fileText.vue';
import { useAudioRecorder } from '@/hook/useRealtimeRecorder.js';
import { useTTSPlayer } from '@/hook/useTTSPlayer.js';
import successIcon from '@/static/icon/success.png';
// 全局
const { $api, navTo, throttle, config } = inject('globalFunction');
const emit = defineEmits(['onConfirm']);
const { messages, isTyping, textInput, chatSessionID } = storeToRefs(useChatGroupDBStore());
import successIcon from '@/static/icon/success.png';
// hook
const {
isRecording,
@@ -302,8 +320,32 @@ const {
volumeLevel,
recognizedText,
lastFinalText,
recordingDuration,
isRecognizing,
reset
} = useAudioRecorder();
// 监听语音识别结果变化,自动发送消息
watch(
() => recognizedText.value,
(newVal) => {
if (newVal && newVal.trim()) {
console.log('监听到语音识别结果变化,自动发送消息:', newVal);
sendMessage(newVal);
}
}
);
// 监听isRecognizing状态显示提示
watch(
() => isRecognizing.value,
(newVal) => {
if (newVal) {
$api.msg('正在识别语音...');
}
}
);
const { speak, pause, resume, isSpeaking, isPaused, cancelAudio } = useTTSPlayer(config.speechSynthesis);
// 获取组件实例(用于小程序 SelectorQuery
@@ -355,6 +397,7 @@ onMounted(async () => {
changeQueries();
scrollToBottom();
isAudioPermission.value = await requestMicPermission();
reset(); // 重置语音识别状态
});
const requestMicPermission = async () => {
@@ -436,11 +479,16 @@ const sendMessage = (text) => {
console.log('📝 Has job info:', hasJobInfo);
// 开始朗读当前消息
speechIndex.value = index;
readMarkdown(message.displayText, index);
speechIndex.value = index;
readMarkdown(message.displayText, index, { immediate: false });
// 一旦开始朗读就设置speechIndex避免重复调用
speechIndex.value = index;
} else {
console.log('⏳ Waiting for more content before TTS, current length:', message.displayText.length);
}
} else {
// 已经开始朗读这条消息,不再重复调用
console.log('⏭️ Already speaking this message, skipping duplicate TTS call');
}
}
},
@@ -465,7 +513,7 @@ const sendMessage = (text) => {
// 开始朗读完整的内容
speechIndex.value = lastMessageIndex;
readMarkdown(lastMessage.displayText, lastMessageIndex);
readMarkdown(lastMessage.displayText, lastMessageIndex, { immediate: true });
}
}
},
@@ -551,7 +599,9 @@ const scrollToBottom = throttle(function () {
}, 500);
function getGuess() {
$api.chatRequest('/guest', { sessionId: chatSessionID.value }, 'POST').then((res) => {
// $api.chatRequest('/guest', { sessionId: chatSessionID.value }, 'POST').then((res) => {
$api.chatRequest('/guest', undefined, 'POST').then((res) => {
console.log('getGuess ---- res:', res);
guessList.value = res.data;
showGuess.value = true;
nextTick(() => {
@@ -675,17 +725,22 @@ const handleTouchEnd = () => {
if (status.value === 'cancel') {
console.log('取消发送');
cancelRecording();
status.value = 'idle';
} else {
stopRecording();
if (isAudioPermission.value) {
if (recognizedText.value) {
sendMessage(recognizedText.value);
} else {
// 主要根据录音时长判断,而不是完全依赖识别结果
// 由于setInterval是异步的这里需要考虑计时延迟
const actualDuration = recordingDuration.value > 0 ? recordingDuration.value : (isRecording.value ? 0.5 : 0);
if (actualDuration < 1) {
$api.msg('说话时长太短');
status.value = 'idle';
} else {
// 状态管理由useAudioRecorder hook内部处理
status.value = 'idle';
}
}
}
status.value = 'idle';
};
const handleTouchCancel = () => {
@@ -731,7 +786,10 @@ function confirmFeeBack(value) {
// 防抖定时器
let ttsDebounceTimer = null;
function readMarkdown(value, index) {
// 保存上一次调用的文本内容避免重复调用TTS
let lastSpeechText = '';
function readMarkdown(value, index, options = {}) {
console.log('🎤 readMarkdown called');
console.log('📝 Text to speak:', value ? value.substring(0, 100) + '...' : 'No text');
console.log('🔢 Index:', index);
@@ -744,40 +802,37 @@ function readMarkdown(value, index) {
clearTimeout(ttsDebounceTimer);
}
// 如果当前正在播放其他消息,先停止
if (speechIndex.value !== index && speechIndex.value !== 0) {
console.log('🛑 Stopping current speech and starting new one');
speechIndex.value = index;
speak(value);
return;
}
// 总是先停止当前播放,无论是不是同一消息
console.log('🛑 Always stopping current speech before starting new one');
speechIndex.value = index;
// 如果当前正在播放且暂停了,直接恢复
if (isPaused.value && isSpeaking.value) {
console.log('▶️ Resuming paused speech');
resume();
return;
}
// 如果当前正在播放且没有暂停,不需要重新开始
if (isSpeaking.value && !isPaused.value) {
console.log('🔊 Already speaking, no need to restart');
return;
}
// 使用防抖避免频繁调用TTS
ttsDebounceTimer = setTimeout(() => {
console.log('🎵 Starting new speech');
console.log('🎵 Calling speak function with text length:', value ? value.length : 0);
try {
speak(value);
console.log('✅ Speak function called successfully');
} catch (error) {
console.error('❌ Error calling speak function:', error);
// 立即调用speak不使用防抖延迟
const speakNow = () => {
// 检查文本内容是否发生变化避免重复调用TTS
if (value !== lastSpeechText) {
console.log('🎵 Starting new speech');
console.log('🎵 Calling speak function with text length:', value ? value.length : 0);
try {
speak(value);
console.log('✅ Speak function called successfully');
// 更新上一次调用的文本内容
lastSpeechText = value;
} catch (error) {
console.error('❌ Error calling speak function:', error);
}
} else {
console.log('🔄 Same text as last speech, skipping duplicate TTS call');
}
}, 300); // 300ms防抖延迟
};
// 改进防抖逻辑,确保在短时间内只调用一次
if (options.immediate) {
// 如果是onComplete回调立即播放
speakNow();
} else {
// 对于流式数据,总是使用防抖,避免频繁调用
ttsDebounceTimer = setTimeout(speakNow, 500); // 延长防抖时间到500ms
}
}
function stopMarkdown(value, index) {
console.log('⏸️ stopMarkdown called for index:', index);
@@ -804,22 +859,22 @@ function refreshMarkdown(index) {
}
const jobSearchQueries = [
'青岛有哪些薪资 12K 以上的岗位适合我?',
'青岛 3 年工作经验能找到哪些 12K 以上的工作?',
'青岛哪些公司在招聘,薪资范围在 12K 以上?',
'青岛有哪些企业提供 15K 以上的岗位?',
'青岛哪些公司在招 3-5 年经验的岗位?',
'我有三年的工作经验,能否推荐一些适合我的青岛的国企 岗位?',
'青岛国企目前在招聘哪些岗位?',
'青岛有哪些适合 3 年经验的国企岗位?',
'青岛国企招聘的岗位待遇如何?',
'青岛国企岗位的薪资水平是多少?',
'青岛哪些国企支持双休 & 五险一金完善?',
'青岛有哪些公司支持远程办公?',
'青岛有哪些外企的岗位,薪资 12K 以上的多吗?',
'青岛哪些企业在招聘 Web3.0 相关岗位?',
'青岛哪些岗位支持海外远程?薪资如何?',
'青岛招聘 AI/大数据相关岗位的公司有哪些?',
'喀什地区有哪些薪资 12K 以上的岗位适合我?',
'喀什地区 3 年工作经验能找到哪些 12K 以上的工作?',
'喀什地区哪些公司在招聘,薪资范围在 12K 以上?',
'喀什地区有哪些企业提供 15K 以上的岗位?',
'喀什地区哪些公司在招 3-5 年经验的岗位?',
'我有三年的工作经验,能否推荐一些适合我的喀什地区的国企 岗位?',
'喀什地区国企目前在招聘哪些岗位?',
'喀什地区有哪些适合 3 年经验的国企岗位?',
'喀什地区国企招聘的岗位待遇如何?',
'喀什地区国企岗位的薪资水平是多少?',
'喀什地区哪些国企支持双休 & 五险一金完善?',
'喀什地区有哪些公司支持远程办公?',
'喀什地区有哪些外企的岗位,薪资 12K 以上的多吗?',
'喀什地区哪些企业在招聘 Web3.0 相关岗位?',
'喀什地区哪些岗位支持海外远程?薪资如何?',
'喀什地区招聘 AI/大数据相关岗位的公司有哪些?',
];
function changeQueries(value) {
@@ -1003,12 +1058,26 @@ image-margin-top = 40rpx
.messageNull
display: none
.msg-loading{
background: transparent;
font-size: 24rpx;
color: #8f8d8e;
background: #F6F6F6;
border-radius: 20rpx 0 20rpx 20rpx;
padding: 20rpx;
width: fit-content;
display: flex;
align-items: flex-end;
justify-content: flex-start;
align-items: center;
justify-content: center;
.loading-content{
display: flex;
align-items: center;
justify-content: center;
gap: 16rpx;
}
.loading-text{
font-size: 28rpx;
color: #666666;
font-weight: 500;
}
}
.loaded{
padding-left: 20rpx
@@ -1095,6 +1164,11 @@ image-margin-top = 40rpx
-moz-user-select:none;
-ms-user-select:none;
touch-action: none; /* 禁用默认滚动 */
position: fixed;
left: 0;
right: 0;
bottom: 160rpx; /* 为底部导航栏留出空间 */
z-index: 9999; /* 确保高于其他元素 */
.record-tip
font-weight: 400;
color: #909090;
@@ -1248,25 +1322,55 @@ image-margin-top = 40rpx
.file-border
width: 160rpx !important;
@keyframes ai-circle {
0% {
-webkit-transform: rotate(0);
transform: rotate(0);
/* 更美观的loading动画 - 兼容H5和小程序 */
@keyframes ai-loading-dots {
0%, 20%, 80%, 100% {
transform: scale(1);
opacity: 0.6;
}
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
40% {
transform: scale(1.2);
opacity: 1;
}
}
.ai-loading
/* 重置默认样式 */
.ai-loading {
display: inline-flex;
vertical-align: middle;
width: 28rpx;
height: 28rpx;
background: 0 0;
align-items: center;
justify-content: center;
gap: 8rpx;
width: auto;
height: auto;
background: transparent;
border: none;
border-radius: 0;
padding: 0;
margin: 0;
}
/* 三个点的样式 - 使用标准CSS语法不使用嵌套 */
.ai-loading view {
display: inline-block;
width: 12rpx;
height: 12rpx;
border-radius: 50%;
border: 4rpx solid;
border-color: #e5e5e5 #e5e5e5 #e5e5e5 #8f8d8e;
-webkit-animation: ai-circle 1s linear infinite;
animation: ai-circle 1s linear infinite;
background-color: #256BFA;
animation: ai-loading-dots 1.4s ease-in-out infinite both;
margin: 0;
padding: 0;
}
/* 为每个点设置不同的动画延迟 */
.ai-loading view:nth-child(1) {
animation-delay: -0.32s;
}
.ai-loading view:nth-child(2) {
animation-delay: -0.16s;
}
.ai-loading view:nth-child(3) {
animation-delay: 0s;
}
</style>

425
pages/city-select/index.vue Normal file
View File

@@ -0,0 +1,425 @@
<template>
<view class="city-select-container">
<!-- 顶部导航栏 -->
<!-- <view class="nav-bar">
<view class="nav-left" @click="navBack">
<uni-icons type="left" size="24" color="#333"></uni-icons>
</view>
<view class="nav-title">选择城市</view>
<view class="nav-right"></view>
</view> -->
<!-- 搜索框 -->
<view class="search-box">
<uni-icons class="search-icon" type="search" size="20" color="#999"></uni-icons>
<input
class="search-input"
placeholder="搜索城市名/拼音"
placeholder-style="color: #999"
v-model="searchText"
@input="handleSearch"
>
</view>
<!-- 定位城市 -->
<!-- <view class="location-section">
<view class="section-title">定位城市</view>
<view class="location-city" :class="{ active: selectedCity.code === locationCity.code }" @click="selectCity(locationCity)">
{{ locationCity.name }}
</view>
</view> -->
<!-- 热门城市 -->
<!-- <view class="hot-section">
<view class="section-title">热门城市</view>
<view class="hot-cities">
<view
class="city-item"
:class="{ active: selectedCity.code === item.code }"
v-for="item in hotCities"
:key="item.code"
@click="selectCity(item)"
>
{{ item.name }}
</view>
</view>
</view> -->
<!-- 城市数量统计 -->
<!-- <view class="city-count" v-if="allCities.length > 0">
共找到 {{ allCities.length }} 个城市
</view> -->
<!-- 城市列表 -->
<view class="city-list-section">
<scroll-view
class="city-list-content"
scroll-y
:scroll-into-view="currentScrollId"
:scroll-with-animation="true"
>
<view
class="city-group"
v-for="group in cityGroups"
:key="group.letter"
:id="`city-group-${group.letter}`"
>
<view class="group-title">{{ group.letter }}</view>
<view
class="city-item"
:class="{ active: selectedCity.code === item.code }"
v-for="item in group.cities"
:key="item.code"
@click="selectCity(item)"
>
{{ item.name }}
</view>
</view>
</scroll-view>
<!-- 右侧字母索引 -->
<view class="letter-index">
<view
class="letter-item"
v-for="letter in letters"
:key="letter"
@click="scrollToLetter(letter)"
:class="{ active: currentLetter === letter }"
>
{{ letter }}
</view>
</view>
</view>
</view>
</template>
<script setup>
import { ref, reactive, onMounted, computed, inject } from 'vue';
const { $api, navTo } = inject('globalFunction');
// 搜索文本
const searchText = ref('');
// 定位城市
const locationCity = ref({ code: '110100', name: '北京' });
// 选中的城市
const selectedCity = ref({ code: '', name: '' });
// 当前显示的字母
const currentLetter = ref('');
// 当前滚动到的城市组ID
const currentScrollId = ref('');
// 城市数据
const allCities = ref([]);
// 字母列表
const letters = ref(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']);
// 按字母分组的城市
const cityGroups = computed(() => {
const groups = {};
const filteredCities = allCities.value.filter(city => {
if (!searchText.value) return true;
return city.name.includes(searchText.value) || city.pinyin?.includes(searchText.value.toUpperCase());
});
console.log('过滤后用于分组的城市:', filteredCities);
// 初始化字母分组
letters.value.forEach(letter => {
groups[letter] = { letter, cities: [] };
});
// 将城市分配到对应字母组
filteredCities.forEach(city => {
const firstLetter = city.pinyin || '#';
// 如果字母不在预定义列表中,将其添加到分组中
if (!groups[firstLetter]) {
groups[firstLetter] = { letter: firstLetter, cities: [] };
}
groups[firstLetter].cities.push(city);
});
const result = Object.values(groups).filter(group => group.cities.length > 0);
// 对城市组进行排序
result.sort((a, b) => {
// '#' 符号应该排在最前面
if (a.letter === '#') return -1;
if (b.letter === '#') return 1;
// 其他字母按字母顺序排序
return a.letter.localeCompare(b.letter);
});
console.log('最终分组结果:', result);
return result;
});
// 获取城市数据
const getCityData = async () => {
try {
// 直接获取所有城市数据,新接口已经返回了所有层级的数据
const res = await $api.createRequest('/cms/dict/sysarea/listCity', {});
console.log('城市数据接口返回:', res);
if (res.code === 200 && res.data) {
console.log('原始城市数据:', res.data);
// 显示接口返回的所有城市数据
const filteredCities = res.data;
console.log('过滤后城市数据:', filteredCities);
// 直接使用后端返回的zm字段作为拼音首字母并转换为大写
allCities.value = filteredCities.map(city => ({
...city,
pinyin: (city.zm || '#').toUpperCase()
}));
console.log('使用后端zm字段的城市数据:', allCities.value);
// 按拼音首字母排序
allCities.value.sort((a, b) => {
// 首先按拼音首字母排序
if (a.pinyin !== b.pinyin) {
// '#' 符号应该排在最前面
if (a.pinyin === '#') return -1;
if (b.pinyin === '#') return 1;
return a.pinyin.localeCompare(b.pinyin);
}
// 首字母相同时,按城市名称排序
return a.name.localeCompare(b.name);
});
}
} catch (error) {
console.error('获取城市数据失败:', error);
}
};
// 获取拼音首字母(使用更准确的映射表)
const getPinyinFirstLetter = (name) => {
const firstChar = name.charAt(0);
// 查找对应的拼音首字母
for (const [letter, chars] of Object.entries(pinyinMap)) {
if (chars.includes(firstChar)) {
return letter;
}
}
// 如果没有找到,返回#
return '#';
};
// 处理搜索
const handleSearch = () => {
// 搜索逻辑已在cityGroups计算属性中处理
};
// 选择城市
const selectCity = (city) => {
selectedCity.value = city;
// 返回上一页并传递选择的城市
uni.navigateBack({
delta: 1,
success: () => {
// 发送事件通知首页选择了城市
uni.$emit('citySelected', city);
}
});
};
// 滚动到指定字母
const scrollToLetter = (letter) => {
currentLetter.value = letter;
// 更新滚动ID触发scroll-view滚动
currentScrollId.value = `city-group-${letter}`;
};
// 返回上一页
const navBack = () => {
uni.navigateBack({ delta: 1 });
};
// 组件挂载时获取城市数据
onMounted(() => {
getCityData();
});
</script>
<style scoped>
.city-select-container {
background-color: #f5f5f5;
min-height: 100vh;
padding-top: 16px;
}
/* 导航栏 */
.nav-bar {
display: flex;
align-items: center;
justify-content: space-between;
height: 44px;
padding: 0 16px;
background-color: #fff;
border-bottom: 1px solid #e5e5e5;
}
.nav-left,
.nav-right {
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
}
.nav-title {
font-size: 18px;
font-weight: 500;
color: #333;
}
/* 搜索框 */
.search-box {
display: flex;
align-items: center;
margin: 12px 16px;
padding:8px 16px;
background-color: #fff;
border-radius: 20px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
.search-icon {
margin-right: 8px;
}
.search-input {
flex: 1;
font-size: 14px;
color: #333;
border: none;
outline: none;
}
/* 定位城市 */
.location-section {
padding: 16px;
background-color: #fff;
margin-bottom: 8px;
}
.section-title {
font-size: 14px;
color: #666;
margin-bottom: 12px;
}
.location-city {
display: inline-block;
padding: 8px 20px;
background-color: #f0f9ff;
color: #007aff;
border-radius: 20px;
font-size: 14px;
}
.location-city.active {
background-color: #007aff;
color: #fff;
}
/* 热门城市 */
.hot-section {
padding: 16px;
background-color: #fff;
margin-bottom: 8px;
}
.city-count {
padding: 0 16px 12px;
background-color: #fff;
font-size: 12px;
color: #999;
margin-bottom: 8px;
}
.hot-cities {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
.city-item {
padding: 8px 20px;
background-color: #f5f5f5;
color: #333;
border-radius: 20px;
font-size: 14px;
}
.city-item.active {
background-color: #007aff;
color: #fff;
}
/* 城市列表 */
.city-list-section {
display: flex;
background-color: #fff;
height: calc(100vh - 180px);
}
.city-list-content {
flex: 1;
overflow-y: auto;
}
.city-group {
padding: 0 16px;
}
.group-title {
font-size: 14px;
color: #666;
margin: 12px 0 8px 0;
padding-left: 4px;
}
.city-list-content .city-item {
display: block;
padding: 12px 4px;
margin-bottom: 0;
background-color: transparent;
border-radius: 0;
border-bottom: 1px solid #f0f0f0;
}
.city-list-content .city-item.active {
background-color: transparent;
color: #007aff;
}
/* 右侧字母索引 */
.letter-index {
width: 30px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: #f5f5f5;
}
.letter-item {
width: 24px;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
color: #666;
margin: 2px 0;
}
.letter-item.active {
color: #007aff;
font-weight: bold;
}
</style>

View File

@@ -1,5 +1,5 @@
<template>
<view class="app-container">
<view class="app-container" @touchstart="handleTouchStart" @touchmove="handleTouchMove">
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序背景图片 -->
<image class="mp-background" src="/static/icon/background2.png" mode="aspectFill"></image>
@@ -78,7 +78,7 @@
<!-- <view class="h5-action-btn press-button" @click="handleH5SalaryClick">
<view class="btn-text">薪酬信息</view>
</view> -->
<view class="h5-action-btn press-button" @click="handleServiceClick('resume-creation')">
<view class="h5-action-btn press-button" @click="handelGoResumeGuide()">
<view class="btn-text">简历指导</view>
</view>
@@ -110,7 +110,7 @@
<view class="service-icon service-icon-5">
<IconfontIcon name="jinengpeixun" :size="48" color="#FFFFFF" />
</view>
<view class="service-title">技能培训</view>
<view class="service-title">技能课堂</view>
</view>
<view class="service-item press-button" @click="handleServiceClick('skill-evaluation')">
<view class="service-icon service-icon-6">
@@ -136,12 +136,7 @@
</view>
<view class="service-title">虚拟面试</view>
</view>
<view class="service-item press-button" style="justify-content:normal" @click="goRc()">
<view class="service-icon service-icon-9">
<IconfontIcon name="Graduation-simple-" :size="32" color="#FFFFFF" />
</view>
<view class="service-title" style="overflow:unset">高校毕业生<br/>智慧就业服务</view>
</view>
<view class="service-item press-button" @click="handleServiceClick('career-planning')">
<view class="service-icon service-icon-11">
<image class="service-icon-img" src="/static/icon/antOutline.png" mode="aspectFit"></image>
@@ -185,6 +180,12 @@
</view>
<view class="service-title">评价机构信息</view>
</view>
<view class="service-item press-button" style="justify-content:normal" @click="goRc()">
<view class="service-icon service-icon-9">
<IconfontIcon name="Graduation-simple-" :size="32" color="#FFFFFF" />
</view>
<view class="service-title" style="overflow:unset">高校毕业生<br/>智慧就业服务</view>
</view>
</view>
<!-- #endif -->
</view>
@@ -197,7 +198,7 @@
</view>
<view class="company-grid">
<view class="company-item press-button" @click="navTo('/pages/job/publishJob')">
<view class="company-item press-button" @click="navTo('/packageA/pages/job/publishJob')">
<view class="company-icon company-icon-1">
<uni-icons type="plus-filled" size="32" color="#FFFFFF"></uni-icons>
</view>
@@ -229,7 +230,7 @@
<view class="nav-filter" :class="{ 'sticky-filter': shouldStickyFilter }" v-if="shouldShowJobSeekerContent">
<view class="filter-top" @touchmove.stop.prevent>
<view class="filter-top">
<scroll-view :scroll-x="true" :show-scrollbar="false" class="tab-scroll">
<view class="jobs-left">
<view
@@ -250,10 +251,15 @@
</view>
</view>
</scroll-view>
<view class="jobs-add button-click" @click="navTo('/packageA/pages/addPosition/addPosition')">
<uni-icons class="iconsearch" color="#666D7F" type="plusempty" size="18"></uni-icons>
<text>添加</text>
</view>
<view class="jobs-add button-click" @click="navTo('/pages/city-select/index')" style="padding-right:0;">
<text>{{ selectedCity.name || '地区' }}</text>
<image class="right-sx" :class="{ active: showFilter }" src="@/static/icon/shaixun.png"></image>
</view>
</view>
<view class="filter-bottom">
<view class="btm-left">
@@ -281,7 +287,6 @@
@scrolltolower="scrollBottom"
:enable-back-to-top="false"
:scroll-with-animation="false"
@touchmove.stop.prevent
>
<view class="falls" v-if="list.length">
<!-- #ifdef MP-WEIXIN -->
@@ -317,7 +322,7 @@
<view class="falls-card-company" v-show="isShowJw !== 3">
{{ config.appInfo.areaName }}
<!-- {{ job.jobLocation }} -->
<dict-Label dictType="area" :value="job.jobLocationAreaCode"></dict-Label>
<dict-Label dictType="jobLocationAreaCode" :value="job.jobLocationAreaCode"></dict-Label>
</view>
<view class="falls-card-pepleNumber">
<view>
@@ -394,7 +399,7 @@
<view class="falls-card-company" v-show="isShowJw !== 3">
{{ config.appInfo.areaName }}
<!-- {{ job.jobLocation }} -->
<dict-Label dictType="area" :value="job.jobLocationAreaCode"></dict-Label>
<dict-Label dictType="jobLocationAreaCode" :value="job.jobLocationAreaCode"></dict-Label>
</view>
<view class="falls-card-pepleNumber">
<view>
@@ -562,10 +567,48 @@ const lastScrollTop = ref(0);
const scrollTop = ref(0);
// 当用户与筛选/导航交互时,临时锁定头部显示状态,避免因数据刷新导致回弹显示
const isInteractingWithFilter = ref(false);
// 触摸事件状态
const touchStartY = ref(0);
const touchMoveY = ref(0);
// 滚动阈值配置
const HIDE_THRESHOLD = 50; // 隐藏顶部区域的滚动阈值(降低阈值,更容易触发)
const SHOW_THRESHOLD = 5; // 显示顶部区域的滚动阈值(接近顶部)
const STICKY_THRESHOLD = 80; // 筛选区域吸顶的滚动阈值
const TOUCH_MOVE_THRESHOLD = 30; // 触摸滑动阈值,用于判断是否为有效滑动
// 处理触摸开始事件
function handleTouchStart(e) {
// 记录触摸起始位置
touchStartY.value = e.touches[0].clientY;
}
// 处理触摸移动事件
function handleTouchMove(e) {
// 记录触摸移动位置
touchMoveY.value = e.touches[0].clientY;
// 计算滑动距离
const diffY = touchStartY.value - touchMoveY.value;
// 当向上滑动超过阈值时,隐藏顶部区域
if (diffY > TOUCH_MOVE_THRESHOLD) {
if (!shouldHideTop.value) {
shouldHideTop.value = true;
}
if (!shouldStickyFilter.value) {
shouldStickyFilter.value = true;
}
}
// 当向下滑动超过阈值且在顶部附近时,显示顶部区域
else if (diffY < -TOUCH_MOVE_THRESHOLD && scrollTop.value <= SHOW_THRESHOLD) {
if (shouldHideTop.value && !isInteractingWithFilter.value) {
shouldHideTop.value = false;
}
if (shouldStickyFilter.value) {
shouldStickyFilter.value = false;
}
}
}
// 简化的滚动处理函数
function handleScroll(e) {
@@ -631,11 +674,14 @@ const inputText = ref('');
const showFilter = ref(false);
const selectFilterModel = ref(null);
const showModel = ref(false);
// 选中的城市
const selectedCity = ref({ code: '', name: '' });
const rangeOptions = ref([
{ value: 0, text: '推荐' },
{ value: 1, text: '最热' },
{ value: 2, text: '最新发布' },
{ value: 3, text: '疆外' },
{ value: 4, text: '零工市场' }
]);
const isLoaded = ref(false);
const isInitialized = ref(false); // 添加初始化标志
@@ -722,6 +768,7 @@ onMounted(() => {
// 在组件挂载时绑定事件监听,确保只绑定一次
// 先移除可能存在的旧监听,避免重复绑定
uni.$off('showLoginModal');
uni.$off('citySelected');
// 绑定新的监听
uni.$on('showLoginModal', () => {
@@ -730,6 +777,15 @@ onMounted(() => {
pageNull.value = 0;
});
// 监听城市选择事件
uni.$on('citySelected', (city) => {
console.log('收到citySelected事件选择的城市:', city);
selectedCity.value = city;
// 可以在这里添加根据城市筛选职位的逻辑
conditionSearch.value.regionCode = city.code;
getJobRecommend('refresh');
});
// 获取企业信息
getCompanyInfo();
});
@@ -737,6 +793,7 @@ onMounted(() => {
onUnmounted(() => {
// 组件销毁时移除事件监听
uni.$off('showLoginModal');
uni.$off('citySelected');
});
onShow(() => {
@@ -775,10 +832,9 @@ const handleLoginSuccess = () => {
getIsFourLevelLinkagePurview()
};
// H5环境下从URL获取token并自动登录
onLoad((options) => {
onLoad(() => {
// #ifdef H5
const token = options.token || uni.getStorageSync('zkr-token');
myToken.value = token;
const token = uni.getStorageSync('zkr-token');
if (token) {
useUserStore().loginSetToken(token);
}
@@ -786,10 +842,18 @@ onLoad((options) => {
});
// 处理附近工作点击
const handleNearbyClick = () => {
const handleNearbyClick = (options ) => {
// #ifdef MP-WEIXIN
if (checkLogin()) {
navTo('/pages/nearby/nearby');
navTo('/packageA/pages/nearby/nearby');
}
// #endif
// #ifdef H5
const token = options.token || uni.getStorageSync('zkr-token');
if (token) {
navTo('/packageA/pages/nearby/nearby');
}
// #endif
};
const handleNoticeClick = () =>{
uni.navigateTo({
@@ -814,7 +878,16 @@ const handleServiceClick = (serviceType) => {
navToService(serviceType);
}
};
// H5的简历指导跳转
const handelGoResumeGuide = () => {
const token = uni.getStorageSync('zkr-token');
// myToken.value = token;
if (token) {
// navTo()
navTo('/pages/resume-guide/resume-guide');
}
}
// 处理直播按钮点击
const handleLiveClick = () => {
// #ifdef MP-WEIXIN
@@ -848,6 +921,12 @@ const handleLiveClick = () => {
const handleSalaryInfoClick = () => {
navTo('/pages/service/salary-info');
};
const handleH5SalaryClick = () => {
const salaryUrl = "https://www.mohrss.gov.cn/SYrlzyhshbzb/laodongguanxi_/fwyd/202506/t20250627_544623.html";
window.location.assign(salaryUrl);
};
async function loadData() {
try {
if (isLoaded.value) return;
@@ -1017,6 +1096,12 @@ function handelHostestSearch(val) {
isShowJw.value = val.value;
pageState.search.order = val.value;
pageState.search.jobType = val.value === 3 ? 1 : 0;
if(val.value === 4) {
pageState.search.type = 4;
} else {
delete pageState.search.type;
}
if (state.tabIndex === 'all') {
getJobRecommend('refresh');
} else {
@@ -1037,6 +1122,10 @@ function getJobRecommend(type = 'add') {
...conditionSearch.value,
isPublish: 1,
};
// 当选中零工市场(4)或疆外(3)时order参数传递0
if (pageState.search.order === 3 || pageState.search.order === 4) {
params.order = 0;
}
// 优先从store获取如果为空则从缓存获取
const storeIsCompanyUser = userInfo.value?.isCompanyUser;
const cachedUserInfo = uni.getStorageSync('userInfo') || {};
@@ -1115,6 +1204,10 @@ function getJobList(type = 'add') {
...pageState.search,
// ...conditionSearch.value,
};
// 当选中零工市场(4)或疆外(3)时order参数传递0
if (pageState.search.order === 3 || pageState.search.order === 4) {
params.order = 0;
}
$api.createRequest('/app/job/list', params).then((resData) => {
const { rows, total } = resData;
@@ -1456,10 +1549,10 @@ defineExpose({ loadData });
color: #256BFA
// 服务功能网格样式
.service-grid
padding: 20rpx 28rpx
padding: 10rpx 28rpx
display: grid
grid-template-columns: 1fr 1fr 1fr 1fr
grid-gap: 20rpx
grid-gap: 10rpx
.service-item
display: flex
flex-direction: column
@@ -1467,12 +1560,12 @@ defineExpose({ loadData });
justify-content: center
height: 120rpx
background: transparent
padding: 10px 0px
padding: 2rpx 0px
.service-icon
width: 88rpx
height: 88rpx
border-radius: 12rpx
margin-bottom: 8rpx
width: 62rpx
height: 62rpx
border-radius: 10rpx
margin-bottom: 14rpx
flex-shrink: 0
.service-icon-1
background: linear-gradient(180deg, #FF8E8E 0%, #E53E3E 100%)
@@ -1691,6 +1784,9 @@ defineExpose({ loadData });
min-width: 80rpx;
padding: 8rpx 12rpx;
white-space: nowrap;
.right-sx
width: 28rpx;
height: 28rpx;
.filter-bottom
display: flex
justify-content: space-between
@@ -1702,8 +1798,8 @@ defineExpose({ loadData });
font-weight: 400;
font-size: 32rpx;
color: #666D7F;
margin-right: 24rpx
padding: 0rpx 16rpx
margin-right: 8rpx
padding: 0rpx 6rpx
.active
font-weight: 500;
font-size: 32rpx;

View File

@@ -47,6 +47,10 @@
<view class="mini-num">{{ counts.fairCollecitonCount }}</view>
<view class="mini-text">预约</view>
</view>
<view class="numbe-item button-click" @click="navTo('/packageA/pages/cancelApplication/cancelApplication')">
<view class="mini-num">{{ counts.applyCencalCount || 0 }}</view>
<view class="mini-text">取消投递</view>
</view>
</view>
<view class="mini-cards">
<view class="card-top btn-feel">
@@ -201,7 +205,7 @@ function seeDetail() {
function goToJobHelper() {
// 跳转到求职者信息补全页面
navTo('/pages/complete-info/complete-info');
navTo('/packageA/pages/complete-info/complete-info');
}
// 跳转到素质测评
function goCa(){

View File

@@ -0,0 +1,590 @@
<template>
<view class="career-planning-page">
<!-- 提醒弹窗 -->
<RemindPopup
ref="remindPopup"
:remind-list="remindList"
@cancel="handleCancel"
@confirm="handleConfirm"
/>
<!-- 技能详情弹出层 -->
<SkillDetailPopup
ref="skillDetailPopup"
:job-title="selectedJobTitle"
:possessed-skills="selectedJobPossessedSkills"
:improvement-skills="selectedJobImprovementSkills"
@close="handleSkillPopupClose"
/>
<!-- 页面内容 -->
<view class="page-content" v-if="showContent">
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序背景图片 -->
<image class="mp-background" src="/static/icon/background2.png" mode="aspectFill"></image>
<!-- #endif -->
<!-- 头部区域 -->
<PageHeader
:active-tab="activeTab"
@tab-change="switchTab"
@search-click="handleSearchClick"
@menu-click="handleMenuClick"
@more-click="handleMoreClick"
/>
<!-- 内容区域 -->
<scroll-view scroll-y class="content-scroll">
<CareerRecommend
v-if="activeTab === 0"
:current-job-id="currentJobId"
:current-job-name="currentJobName"
@job-card-click="handleJobCardClick"
@skills-updated="handleRecommendSkillsUpdated"
/>
<CareerPath
v-else-if="activeTab === 1"
:current-job-name="currentJobName"
@path-data-updated="handlePathDataUpdated"
/>
<SkillDevelopment
v-else
:current-job-name="currentJobName"
@path-data-updated="handlePathDataUpdated"
/>
</scroll-view>
</view>
<!-- 底部导航栏 -->
<view class="tabbar-wrapper" v-if="showContent">
<CustomTabBar :currentPage="0" />
</view>
</view>
</template>
<script setup>
import { ref, inject, nextTick, onMounted } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import { appUserInfo } from '@/apiRc/user/user.js';
import RemindPopup from './components/RemindPopup.vue';
import PageHeader from './components/PageHeader.vue';
import SkillDetailPopup from './components/SkillDetailPopup.vue';
import CareerRecommend from './components/CareerRecommend.vue';
import CareerPath from './components/CareerPath.vue';
import SkillDevelopment from './components/SkillDevelopment.vue';
import CustomTabBar from '@/components/CustomTabBar/CustomTabBar.vue';
const { navBack, navTo } = inject('globalFunction');
// 弹窗引用
const remindPopup = ref(null);
const skillDetailPopup = ref(null);
// 提醒列表(由接口返回)
const remindList = ref([]);
// 是否显示页面内容
const showContent = ref(false);
// 当前激活的tab
const activeTab = ref(0);
// 选中的职位信息
const selectedJobTitle = ref('');
const selectedJobPossessedSkills = ref([]);
const selectedJobImprovementSkills = ref([]);
const isLoadingJobSkill = ref(false);
const currentJobId = ref(null);
const currentJobName = ref('');
// 技能发展所需的数据
const recommendSkillsData = ref({
currentJobSkills: [],
recommendedJobs: []
});
const pathSkillsData = ref({
pathData: {
start: { title: '', skills: [] },
steps: [],
end: { title: '', skills: [] }
},
targetCareer: ''
});
// 打开弹窗
function openRemindPopup() {
nextTick(() => {
if (remindPopup.value) {
try {
remindPopup.value.open();
} catch (error) {
// 静默处理错误
}
} else {
setTimeout(() => {
if (remindPopup.value) {
try {
remindPopup.value.open();
} catch (error) {
// 静默处理错误
}
} else {
setTimeout(() => {
if (remindPopup.value) {
try {
remindPopup.value.open();
} catch (error) {
// 静默处理错误
}
}
}, 500);
}
}, 500);
}
});
}
// 检查用户是否完善了个人信息(调用接口获取)
let hasCheckedRemindInfo = false;
// 保存缺失信息的标识
const missingInfo = ref({
hasJobInfo: false,
hasSkills: false
});
async function getRemindInfo() {
if (hasCheckedRemindInfo) {
return;
}
hasCheckedRemindInfo = true;
try {
const response = await appUserInfo();
const userInfo = response?.data || {};
// 检查 idCard身份证- 必须项
let idCard = userInfo?.resume?.idCard ?? userInfo?.idCard ?? null;
const cachedUserInfo = uni.getStorageSync('userInfo') || {};
if (!idCard || idCard === null || idCard === '') {
idCard = cachedUserInfo?.resume?.idCard ?? cachedUserInfo?.idCard ?? null;
}
const hasIdCard = idCard !== null && idCard !== undefined && idCard !== '';
// 检查职位信息:优先从 jobTitles 数组获取
const jobTitles = Array.isArray(userInfo?.jobTitles) ? userInfo.jobTitles : [];
const hasJobTitle = jobTitles.length > 0;
// 如果 jobTitles 为空,尝试从其他字段获取
let jobName = '';
if (!hasJobTitle) {
jobName = userInfo?.jobName ??
userInfo?.currentJobName ??
userInfo?.resume?.jobName ??
userInfo?.resume?.currentJobName ??
'';
}
const hasJobInfo = hasJobTitle || (jobName && jobName.trim() !== '');
// 检查技能标签:从 appSkillsList 获取
const appSkillsList = Array.isArray(userInfo?.appSkillsList) ? userInfo.appSkillsList : [];
// 检查是否有有效的技能name 或 nameStr 不为空)
const hasSkills = appSkillsList.some(skill => {
const skillName = skill?.name || skill?.nameStr;
return skillName && skillName.trim() !== '';
});
// 保存缺失信息标识(只保存职位信息和技能标签,身份证信息跳转到个人信息页面)
missingInfo.value.hasJobInfo = hasJobInfo;
missingInfo.value.hasSkills = hasSkills;
// 判断信息是否完整idCard、职位信息、技能标签都必须有
const isComplete = hasIdCard && hasJobInfo && hasSkills;
if (!isComplete) {
// 收集缺失的信息提示
const missingItems = [];
if (!hasIdCard) {
missingItems.push('身份证信息');
}
if (!hasJobInfo) {
missingItems.push('职位信息');
}
if (!hasSkills) {
missingItems.push('技能标签');
}
remindList.value = [`请完善${missingItems.join('、')}`];
} else {
// 信息完整,设置职位信息
if (hasJobTitle) {
currentJobName.value = jobTitles[0];
} else {
currentJobName.value = jobName;
currentJobId.value = userInfo?.jobId ??
userInfo?.currentJobId ??
userInfo?.resume?.jobId ??
userInfo?.resume?.currentJobId ??
null;
}
// 信息完整,直接显示页面内容
showContent.value = true;
return;
}
setTimeout(() => {
openRemindPopup();
}, 500);
} catch (error) {
// 接口调用失败时,使用缓存作为降级方案
const cachedUserInfo = uni.getStorageSync('userInfo') || {};
// 检查 idCard
const idCard = cachedUserInfo?.resume?.idCard ?? cachedUserInfo?.idCard ?? null;
const hasIdCard = idCard !== null && idCard !== undefined && idCard !== '';
// 检查职位信息
const cachedJobTitles = Array.isArray(cachedUserInfo?.jobTitles) ? cachedUserInfo.jobTitles : [];
const hasJobTitle = cachedJobTitles.length > 0;
let jobName = '';
if (!hasJobTitle) {
jobName = cachedUserInfo?.jobName ??
cachedUserInfo?.currentJobName ??
cachedUserInfo?.resume?.jobName ??
cachedUserInfo?.resume?.currentJobName ??
'';
}
const hasJobInfo = hasJobTitle || (jobName && jobName.trim() !== '');
// 检查技能标签
const cachedAppSkillsList = Array.isArray(cachedUserInfo?.appSkillsList) ? cachedUserInfo.appSkillsList : [];
const hasSkills = cachedAppSkillsList.some(skill => {
const skillName = skill?.name || skill?.nameStr;
return skillName && skillName.trim() !== '';
});
// 保存缺失信息标识
missingInfo.value.hasJobInfo = hasJobInfo;
missingInfo.value.hasSkills = hasSkills;
// 判断信息是否完整idCard、职位信息、技能标签都必须有
const isComplete = hasIdCard && hasJobInfo && hasSkills;
if (!isComplete) {
// 收集缺失的信息提示
const missingItems = [];
if (!hasIdCard) {
missingItems.push('身份证信息');
}
if (!hasJobInfo) {
missingItems.push('职位信息');
}
if (!hasSkills) {
missingItems.push('技能标签');
}
remindList.value = [`请完善${missingItems.join('、')}`];
} else {
// 信息完整,设置职位信息
if (hasJobTitle) {
currentJobName.value = cachedJobTitles[0];
} else {
currentJobName.value = jobName;
currentJobId.value = cachedUserInfo?.jobId ??
cachedUserInfo?.currentJobId ??
cachedUserInfo?.resume?.jobId ??
cachedUserInfo?.resume?.currentJobId ??
null;
}
// 信息完整,直接显示页面内容
showContent.value = true;
return;
}
setTimeout(() => {
openRemindPopup();
}, 500);
}
}
// 取消按钮
function handleCancel() {
remindPopup.value?.close();
navBack();
}
// 确认按钮
async function handleConfirm() {
remindPopup.value?.close();
const { hasJobInfo, hasSkills } = missingInfo.value;
// 如果同时缺少职位信息和技能标签:先跳转到职位信息页面,并传递参数表示完成后需要继续跳转到技能页面
if (!hasJobInfo && !hasSkills) {
// 跳转到职位信息页面,传递参数表示完成后需要继续跳转到技能页面
navTo('/packageA/pages/jobExpect/jobExpect?needSkill=true');
}
// 如果只缺少技能标签:直接跳转到技能页面(个人信息页面的技能部分)
else if (!hasSkills) {
navTo('/packageA/pages/personalInfo/personalInfo');
}
// 如果只缺少职位信息:直接跳转到职位信息页面
else if (!hasJobInfo) {
navTo('/packageA/pages/jobExpect/jobExpect');
}
// 如果只缺少身份证信息:跳转到个人信息页面
else {
navTo('/packageA/pages/personalInfo/personalInfo');
}
}
// 切换tab
function switchTab(index) {
activeTab.value = index;
if (index === 0 && !currentJobId.value) {
const cachedUserInfo = uni.getStorageSync('userInfo') || {};
// 优先从缓存中的 jobTitles 数组获取职位信息(取第一个)
const cachedJobTitles = Array.isArray(cachedUserInfo?.jobTitles) ? cachedUserInfo.jobTitles : [];
let newJobName = '';
if (cachedJobTitles.length > 0) {
newJobName = cachedJobTitles[0];
} else {
// 如果缓存中没有 jobTitles从其他字段获取
newJobName = currentJobName.value ||
(cachedUserInfo?.jobName ??
cachedUserInfo?.currentJobName ??
cachedUserInfo?.resume?.jobName ??
cachedUserInfo?.resume?.currentJobName ??
'市场专员');
}
const newJobId = cachedUserInfo?.jobId ??
cachedUserInfo?.currentJobId ??
cachedUserInfo?.resume?.jobId ??
cachedUserInfo?.resume?.currentJobId ??
null;
currentJobId.value = newJobId;
currentJobName.value = newJobName;
}
}
// 搜索点击
function handleSearchClick() {
navTo('/pages/search/search');
}
// 菜单点击
function handleMenuClick() {
// TODO: 实现菜单功能
}
// 更多点击
function handleMoreClick() {
// TODO: 实现更多功能
}
function normalizeSkillLevel(score) {
const numericScore = Number(score);
if (Number.isNaN(numericScore)) {
return 0;
}
const rounded = Math.round(numericScore);
return Math.max(1, Math.min(6, rounded));
}
function splitSkillListByScore(skills = []) {
if (!Array.isArray(skills) || skills.length === 0) {
return {
possessed: [],
improvement: []
};
}
const sorted = [...skills].sort((a, b) => (Number(b.skillScore) || 0) - (Number(a.skillScore) || 0));
const midpoint = Math.ceil(sorted.length / 2);
const mapSkill = (item) => ({
name: item?.skillName || '',
level: normalizeSkillLevel(item?.skillScore)
});
return {
possessed: sorted.slice(0, midpoint).map(mapSkill),
improvement: sorted.slice(midpoint).map(mapSkill)
};
}
// 处理职位卡片点击
async function handleJobCardClick(job) {
if (!job) {
return;
}
selectedJobTitle.value = job.title || job.jobName || '';
selectedJobPossessedSkills.value = [];
selectedJobImprovementSkills.value = [];
if (isLoadingJobSkill.value) {
return;
}
isLoadingJobSkill.value = true;
uni.showLoading({
title: '加载中...',
mask: true
});
try {
// 从 appUserInfo 接口获取技能数据
const response = await appUserInfo();
const userInfo = response?.data || {};
const appSkillsList = Array.isArray(userInfo?.appSkillsList) ? userInfo.appSkillsList : [];
// 将 appSkillsList 转换为 splitSkillListByScore 需要的格式
const skillList = appSkillsList.map(item => ({
skillName: item?.name || item?.nameStr || '',
skillScore: item?.levels || item?.levelStr || 0
})).filter(item => item.skillName);
const { possessed, improvement } = splitSkillListByScore(skillList);
if (possessed.length === 0 && improvement.length === 0) {
// 如果 appUserInfo 中没有技能数据,尝试使用推荐职位数据中的技能信息
const fallbackSkills = Array.isArray(job?.rawSkills) ? job.rawSkills : [];
if (fallbackSkills.length === 0) {
uni.showToast({
title: '暂无技能数据',
icon: 'none'
});
return;
}
const fallbackSplit = splitSkillListByScore(fallbackSkills);
selectedJobPossessedSkills.value = fallbackSplit.possessed;
selectedJobImprovementSkills.value = fallbackSplit.improvement;
} else {
selectedJobPossessedSkills.value = possessed;
selectedJobImprovementSkills.value = improvement;
}
skillDetailPopup.value?.open();
} catch (error) {
// 接口调用失败,尝试使用推荐职位数据中的技能信息
const fallbackSkills = Array.isArray(job?.rawSkills) ? job.rawSkills : [];
if (fallbackSkills.length > 0) {
const fallbackSplit = splitSkillListByScore(fallbackSkills);
selectedJobPossessedSkills.value = fallbackSplit.possessed;
selectedJobImprovementSkills.value = fallbackSplit.improvement;
skillDetailPopup.value?.open();
} else {
uni.showToast({
title: '获取技能信息失败',
icon: 'none'
});
}
} finally {
isLoadingJobSkill.value = false;
uni.hideLoading();
}
}
// 处理技能弹出层关闭
function handleSkillPopupClose() {
// 可以在这里处理关闭后的逻辑
}
// 处理职业推荐技能数据更新
function handleRecommendSkillsUpdated(data) {
recommendSkillsData.value = {
currentJobSkills: data.currentJobSkills || [],
recommendedJobs: data.recommendedJobs || []
};
}
// 处理职业路径数据更新
function handlePathDataUpdated(data) {
pathSkillsData.value = {
pathData: data.pathData || {
start: { title: '', skills: [] },
steps: [],
end: { title: '', skills: [] }
},
targetCareer: data.targetCareer || ''
};
}
onLoad(() => {
getRemindInfo();
});
onShow(() => {
// 返回本页后,如果之前因为信息缺失未展示内容,则重新检查
if (!showContent.value) {
hasCheckedRemindInfo = false;
getRemindInfo();
}
});
onMounted(() => {
if (remindList.value.length > 0 && !showContent.value) {
setTimeout(() => {
if (remindPopup.value) {
openRemindPopup();
}
}, 300);
}
});
</script>
<style lang="scss" scoped>
.career-planning-page {
width: 100vw;
/* #ifdef H5 */
height: calc(100vh - var(--window-top) - var(--status-bar-height) - var(--window-bottom));
background: url('@/static/icon/background2.png') 0 0 no-repeat;
background-size: 100% 728rpx;
/* #endif */
/* #ifdef MP-WEIXIN */
height: 100vh;
position: relative;
/* #endif */
background-color: #FFFFFF;
overflow: hidden;
display: flex;
flex-direction: column;
position: relative;
}
/* #ifdef MP-WEIXIN */
.mp-background {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 728rpx;
z-index: 0;
}
/* #endif */
.page-content {
flex: 1;
display: flex;
flex-direction: column;
position: relative;
z-index: 1;
overflow: hidden;
}
.content-scroll {
flex: 1;
height: 0;
width: 100%;
padding-bottom: calc(88rpx + env(safe-area-inset-bottom));
box-sizing: border-box;
}
.tabbar-wrapper {
position: fixed;
bottom: 0;
left: 0;
right: 0;
z-index: 999;
}
</style>

View File

@@ -1,67 +1,4 @@
<template>
<view class="career-planning-page">
<!-- 提醒弹窗 -->
<RemindPopup
ref="remindPopup"
:remind-list="remindList"
@cancel="handleCancel"
@confirm="handleConfirm"
/>
<!-- 技能详情弹出层 -->
<SkillDetailPopup
ref="skillDetailPopup"
:job-title="selectedJobTitle"
:possessed-skills="selectedJobPossessedSkills"
:improvement-skills="selectedJobImprovementSkills"
@close="handleSkillPopupClose"
/>
<!-- 页面内容 -->
<view class="page-content" v-if="showContent">
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序背景图片 -->
<image class="mp-background" src="/static/icon/background2.png" mode="aspectFill"></image>
<!-- #endif -->
<!-- 头部区域 -->
<PageHeader
:active-tab="activeTab"
@tab-change="switchTab"
@search-click="handleSearchClick"
@menu-click="handleMenuClick"
@more-click="handleMoreClick"
/>
<!-- 内容区域 -->
<scroll-view scroll-y class="content-scroll">
<CareerRecommend
v-if="activeTab === 0"
:current-job-id="currentJobId"
:current-job-name="currentJobName"
@job-card-click="handleJobCardClick"
@skills-updated="handleRecommendSkillsUpdated"
/>
<CareerPath
v-else-if="activeTab === 1"
:current-job-name="currentJobName"
@path-data-updated="handlePathDataUpdated"
/>
<SkillDevelopment
v-else
:current-job-name="currentJobName"
@path-data-updated="handlePathDataUpdated"
/>
</scroll-view>
</view>
<!-- 底部导航栏 -->
<view class="tabbar-wrapper" v-if="showContent">
<CustomTabBar :currentPage="0" />
</view>
</view>
</template>
<!--suppress HtmlUnknownTag, NpmUsedModulesInstalled, JSFileReferences -->
<script setup>
import { ref, inject, nextTick, onMounted } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
@@ -89,15 +26,9 @@ const activeTab = ref(0);
const selectedJobTitle = ref('');
const selectedJobPossessedSkills = ref([]);
const selectedJobImprovementSkills = ref([]);
const isLoadingJobSkill = ref(false);
const currentJobId = ref(null);
const currentJobName = ref('');
// 技能发展所需的数据
const recommendSkillsData = ref({
currentJobSkills: [],
recommendedJobs: []
});
const pathSkillsData = ref({
pathData: {
@@ -153,13 +84,13 @@ async function getRemindInfo() {
if (hasCheckedRemindInfo) {
return;
}
hasCheckedRemindInfo = true;
try {
const response = await appUserInfo();
const userInfo = response?.data || {};
// 检查 idCard身份证- 必须项
let idCard = userInfo?.resume?.idCard ?? userInfo?.idCard ?? null;
const cachedUserInfo = uni.getStorageSync('userInfo') || {};
@@ -167,22 +98,22 @@ async function getRemindInfo() {
idCard = cachedUserInfo?.resume?.idCard ?? cachedUserInfo?.idCard ?? null;
}
const hasIdCard = idCard !== null && idCard !== undefined && idCard !== '';
// 检查职位信息:优先从 jobTitles 数组获取
const jobTitles = Array.isArray(userInfo?.jobTitles) ? userInfo.jobTitles : [];
const hasJobTitle = jobTitles.length > 0;
// 如果 jobTitles 为空,尝试从其他字段获取
let jobName = '';
if (!hasJobTitle) {
jobName = userInfo?.jobName ??
userInfo?.currentJobName ??
userInfo?.resume?.jobName ??
userInfo?.resume?.currentJobName ??
'';
jobName = userInfo?.jobName ??
userInfo?.currentJobName ??
userInfo?.resume?.jobName ??
userInfo?.resume?.currentJobName ??
'';
}
const hasJobInfo = hasJobTitle || (jobName && jobName.trim() !== '');
// 检查技能标签:从 appSkillsList 获取
const appSkillsList = Array.isArray(userInfo?.appSkillsList) ? userInfo.appSkillsList : [];
// 检查是否有有效的技能name 或 nameStr 不为空)
@@ -190,14 +121,14 @@ async function getRemindInfo() {
const skillName = skill?.name || skill?.nameStr;
return skillName && skillName.trim() !== '';
});
// 保存缺失信息标识(只保存职位信息和技能标签,身份证信息跳转到个人信息页面)
missingInfo.value.hasJobInfo = hasJobInfo;
missingInfo.value.hasSkills = hasSkills;
// 判断信息是否完整idCard、职位信息、技能标签都必须有
const isComplete = hasIdCard && hasJobInfo && hasSkills;
if (!isComplete) {
// 收集缺失的信息提示
const missingItems = [];
@@ -217,55 +148,55 @@ async function getRemindInfo() {
currentJobName.value = jobTitles[0];
} else {
currentJobName.value = jobName;
currentJobId.value = userInfo?.jobId ??
userInfo?.currentJobId ??
userInfo?.resume?.jobId ??
userInfo?.resume?.currentJobId ??
null;
currentJobId.value = userInfo?.jobId ??
userInfo?.currentJobId ??
userInfo?.resume?.jobId ??
userInfo?.resume?.currentJobId ??
null;
}
// 信息完整,直接显示页面内容
showContent.value = true;
return;
}
setTimeout(() => {
openRemindPopup();
}, 500);
} catch (error) {
// 接口调用失败时,使用缓存作为降级方案
const cachedUserInfo = uni.getStorageSync('userInfo') || {};
// 检查 idCard
const idCard = cachedUserInfo?.resume?.idCard ?? cachedUserInfo?.idCard ?? null;
const hasIdCard = idCard !== null && idCard !== undefined && idCard !== '';
// 检查职位信息
const cachedJobTitles = Array.isArray(cachedUserInfo?.jobTitles) ? cachedUserInfo.jobTitles : [];
const hasJobTitle = cachedJobTitles.length > 0;
let jobName = '';
if (!hasJobTitle) {
jobName = cachedUserInfo?.jobName ??
cachedUserInfo?.currentJobName ??
cachedUserInfo?.resume?.jobName ??
cachedUserInfo?.resume?.currentJobName ??
'';
jobName = cachedUserInfo?.jobName ??
cachedUserInfo?.currentJobName ??
cachedUserInfo?.resume?.jobName ??
cachedUserInfo?.resume?.currentJobName ??
'';
}
const hasJobInfo = hasJobTitle || (jobName && jobName.trim() !== '');
// 检查技能标签
const cachedAppSkillsList = Array.isArray(cachedUserInfo?.appSkillsList) ? cachedUserInfo.appSkillsList : [];
const hasSkills = cachedAppSkillsList.some(skill => {
const skillName = skill?.name || skill?.nameStr;
return skillName && skillName.trim() !== '';
});
// 保存缺失信息标识
missingInfo.value.hasJobInfo = hasJobInfo;
missingInfo.value.hasSkills = hasSkills;
// 判断信息是否完整idCard、职位信息、技能标签都必须有
const isComplete = hasIdCard && hasJobInfo && hasSkills;
if (!isComplete) {
// 收集缺失的信息提示
const missingItems = [];
@@ -285,17 +216,17 @@ async function getRemindInfo() {
currentJobName.value = cachedJobTitles[0];
} else {
currentJobName.value = jobName;
currentJobId.value = cachedUserInfo?.jobId ??
cachedUserInfo?.currentJobId ??
cachedUserInfo?.resume?.jobId ??
cachedUserInfo?.resume?.currentJobId ??
null;
currentJobId.value = cachedUserInfo?.jobId ??
cachedUserInfo?.currentJobId ??
cachedUserInfo?.resume?.jobId ??
cachedUserInfo?.resume?.currentJobId ??
null;
}
// 信息完整,直接显示页面内容
showContent.value = true;
return;
}
setTimeout(() => {
openRemindPopup();
}, 500);
@@ -311,18 +242,18 @@ function handleCancel() {
// 确认按钮
async function handleConfirm() {
remindPopup.value?.close();
const { hasJobInfo, hasSkills } = missingInfo.value;
// 如果同时缺少职位信息和技能标签:先跳转到职位信息页面,并传递参数表示完成后需要继续跳转到技能页面
if (!hasJobInfo && !hasSkills) {
// 跳转到职位信息页面,传递参数表示完成后需要继续跳转到技能页面
navTo('/packageA/pages/jobExpect/jobExpect?needSkill=true');
}
}
// 如果只缺少技能标签:直接跳转到技能页面(个人信息页面的技能部分)
else if (!hasSkills) {
navTo('/packageA/pages/personalInfo/personalInfo');
}
}
// 如果只缺少职位信息:直接跳转到职位信息页面
else if (!hasJobInfo) {
navTo('/packageA/pages/jobExpect/jobExpect');
@@ -336,32 +267,32 @@ async function handleConfirm() {
// 切换tab
function switchTab(index) {
activeTab.value = index;
if (index === 0 && !currentJobId.value) {
const cachedUserInfo = uni.getStorageSync('userInfo') || {};
// 优先从缓存中的 jobTitles 数组获取职位信息(取第一个)
const cachedJobTitles = Array.isArray(cachedUserInfo?.jobTitles) ? cachedUserInfo.jobTitles : [];
let newJobName = '';
if (cachedJobTitles.length > 0) {
newJobName = cachedJobTitles[0];
} else {
// 如果缓存中没有 jobTitles从其他字段获取
newJobName = currentJobName.value ||
(cachedUserInfo?.jobName ??
cachedUserInfo?.currentJobName ??
cachedUserInfo?.resume?.jobName ??
cachedUserInfo?.resume?.currentJobName ??
'市场专员');
newJobName = currentJobName.value ||
(cachedUserInfo?.jobName ??
cachedUserInfo?.currentJobName ??
cachedUserInfo?.resume?.jobName ??
cachedUserInfo?.resume?.currentJobName ??
'市场专员');
}
const newJobId = cachedUserInfo?.jobId ??
cachedUserInfo?.currentJobId ??
cachedUserInfo?.resume?.jobId ??
cachedUserInfo?.resume?.currentJobId ??
null;
const newJobId = cachedUserInfo?.jobId ??
cachedUserInfo?.currentJobId ??
cachedUserInfo?.resume?.jobId ??
cachedUserInfo?.resume?.currentJobId ??
null;
currentJobId.value = newJobId;
currentJobName.value = newJobName;
}
@@ -382,121 +313,6 @@ function handleMoreClick() {
// TODO: 实现更多功能
}
function normalizeSkillLevel(score) {
const numericScore = Number(score);
if (Number.isNaN(numericScore)) {
return 0;
}
const rounded = Math.round(numericScore);
return Math.max(1, Math.min(6, rounded));
}
function splitSkillListByScore(skills = []) {
if (!Array.isArray(skills) || skills.length === 0) {
return {
possessed: [],
improvement: []
};
}
const sorted = [...skills].sort((a, b) => (Number(b.skillScore) || 0) - (Number(a.skillScore) || 0));
const midpoint = Math.ceil(sorted.length / 2);
const mapSkill = (item) => ({
name: item?.skillName || '',
level: normalizeSkillLevel(item?.skillScore)
});
return {
possessed: sorted.slice(0, midpoint).map(mapSkill),
improvement: sorted.slice(midpoint).map(mapSkill)
};
}
// 处理职位卡片点击
async function handleJobCardClick(job) {
if (!job) {
return;
}
selectedJobTitle.value = job.title || job.jobName || '';
selectedJobPossessedSkills.value = [];
selectedJobImprovementSkills.value = [];
if (isLoadingJobSkill.value) {
return;
}
isLoadingJobSkill.value = true;
uni.showLoading({
title: '加载中...',
mask: true
});
try {
// 从 appUserInfo 接口获取技能数据
const response = await appUserInfo();
const userInfo = response?.data || {};
const appSkillsList = Array.isArray(userInfo?.appSkillsList) ? userInfo.appSkillsList : [];
// 将 appSkillsList 转换为 splitSkillListByScore 需要的格式
const skillList = appSkillsList.map(item => ({
skillName: item?.name || item?.nameStr || '',
skillScore: item?.levels || item?.levelStr || 0
})).filter(item => item.skillName);
const { possessed, improvement } = splitSkillListByScore(skillList);
if (possessed.length === 0 && improvement.length === 0) {
// 如果 appUserInfo 中没有技能数据,尝试使用推荐职位数据中的技能信息
const fallbackSkills = Array.isArray(job?.rawSkills) ? job.rawSkills : [];
if (fallbackSkills.length === 0) {
uni.showToast({
title: '暂无技能数据',
icon: 'none'
});
return;
}
const fallbackSplit = splitSkillListByScore(fallbackSkills);
selectedJobPossessedSkills.value = fallbackSplit.possessed;
selectedJobImprovementSkills.value = fallbackSplit.improvement;
} else {
selectedJobPossessedSkills.value = possessed;
selectedJobImprovementSkills.value = improvement;
}
skillDetailPopup.value?.open();
} catch (error) {
// 接口调用失败,尝试使用推荐职位数据中的技能信息
const fallbackSkills = Array.isArray(job?.rawSkills) ? job.rawSkills : [];
if (fallbackSkills.length > 0) {
const fallbackSplit = splitSkillListByScore(fallbackSkills);
selectedJobPossessedSkills.value = fallbackSplit.possessed;
selectedJobImprovementSkills.value = fallbackSplit.improvement;
skillDetailPopup.value?.open();
} else {
uni.showToast({
title: '获取技能信息失败',
icon: 'none'
});
}
} finally {
isLoadingJobSkill.value = false;
uni.hideLoading();
}
}
// 处理技能弹出层关闭
function handleSkillPopupClose() {
// 可以在这里处理关闭后的逻辑
}
// 处理职业推荐技能数据更新
function handleRecommendSkillsUpdated(data) {
recommendSkillsData.value = {
currentJobSkills: data.currentJobSkills || [],
recommendedJobs: data.recommendedJobs || []
};
}
// 处理职业路径数据更新
function handlePathDataUpdated(data) {
pathSkillsData.value = {
@@ -532,6 +348,114 @@ onMounted(() => {
});
</script>
<template>
<div class="career-planning-page">
<!-- 提醒弹窗 -->
<RemindPopup
ref="remindPopup"
:remind-list="remindList"
@cancel="handleCancel"
@confirm="handleConfirm"
/>
<!-- 技能详情弹出层 -->
<SkillDetailPopup
ref="skillDetailPopup"
:job-title="selectedJobTitle"
:possessed-skills="selectedJobPossessedSkills"
:improvement-skills="selectedJobImprovementSkills"
/>
<!-- 页面内容 -->
<div class="page-content" v-if="showContent">
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序背景图片 -->
<image class="mp-background" src="/static/icon/background2.png" mode="aspectFill"></image>
<!-- #endif -->
<!-- 头部区域 -->
<PageHeader
:active-tab="activeTab"
@tab-change="switchTab"
@search-click="handleSearchClick"
@menu-click="handleMenuClick"
@more-click="handleMoreClick"
/>
<!-- 内容区域 -->
<scroll-view scroll-y class="content-scroll">
<CareerRecommend v-if="activeTab === 0"/>
<CareerPath v-else-if="activeTab === 1" />
<SkillDevelopment v-else />
</scroll-view>
</div>
<!-- 底部导航栏 -->
<div class="tabbar-wrapper" v-if="showContent">
<CustomTabBar :currentPage="0" />
</div>
</div>
</template>
<style lang="scss">
.query-btn {
width: 100%;
height: 80rpx;
line-height: 40rpx;
border-radius: 14rpx;
background: linear-gradient(180deg, rgba(18, 125, 240, 1) 0%, rgba(59, 14, 123, 0.71) 100%);
color: rgba(255, 255, 255, 1);
font-size: 28rpx;
text-align: center;
font-family: '阿里巴巴普惠体3.0-regular', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif;
border: 2rpx solid rgba(187, 187, 187, 1);
display: flex;
align-items: center;
justify-content: center;
gap: 12rpx;
padding: 0;
}
.empty-text {
font-size: 26rpx;
text-align: center;
line-height: 1.5;
}
.input-group {
display: flex;
flex-direction: column;
gap: 30rpx;
}
.input-item {
display: flex;
flex-direction: column;
gap: 12rpx;
}
.picker-field {
background-color: #F5F5F5;
border: 1rpx solid #E0E0E0;
border-radius: 12rpx;
padding: 20rpx 24rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.picker-text {
font-size: 28rpx;
color: #000000;
}
.picker-placeholder {
font-size: 28rpx;
color: #999999;
}
</style>
<style lang="scss" scoped>
.career-planning-page {
width: 100vw;

View File

@@ -1,374 +1,107 @@
<!--suppress JSFileReferences, NpmUsedModulesInstalled, VueMissingComponentImportInspection, HtmlUnknownTag -->
<script setup>
import { useCareerPathStore } from '@/stores/useCareerPathStore';
const store = useCareerPathStore();
</script>
<template>
<view class="career-path">
<!-- 职业路径查询区域 -->
<view class="query-section">
<view class="section-title">
<uni-icons type="search" size="18" color="#286BFA"></uni-icons>
<text class="title-text">职业路径查询</text>
</view>
<view class="input-group">
<view class="input-item">
<text class="input-label">当前职位</text>
<input
class="input-field"
:value="currentPosition"
placeholder="市场专员"
placeholder-style="color: #999999"
disabled
/>
</view>
<view class="input-item">
<text class="input-label">目标职业</text>
<picker
mode="selector"
:range="targetCareerOptions"
range-key="label"
:value="selectedTargetIndex"
@change="handleTargetChange"
>
<view class="picker-field">
<text :class="selectedTargetIndex >= 0 ? 'picker-text' : 'picker-placeholder'">
{{ selectedTargetIndex >= 0 ? targetCareerOptions[selectedTargetIndex].label : '请选择目标职业' }}
</text>
<uni-icons type="arrowdown" size="16" color="#999999"></uni-icons>
</view>
</picker>
</view>
</view>
<button class="query-btn" @click="handleQuery">
<text>查询职业发展路径</text>
<div class="career-path">
<!-- 职业路径查询区域 -->
<div class="query-section">
<div class="section-title">
<uni-icons color="#286BFA" size="18" type="search"></uni-icons>
<span class="title-text">职业路径查询</span>
</div>
<div class="input-group">
<div class="input-item">
<span class="label">当前职位</span>
<picker @change="store.eventProfession" :value="store.professionIndex" :range="store.professionsRef" range-key="label">
<div class="picker-field">
<span :class="store.professionLabel ? 'picker-text' : 'picker-placeholder'">
{{ store.professionLabel || '请选择职位' }}
</span>
<uni-icons color="#999999" size="16" type="down"></uni-icons>
</div>
</picker>
</div>
<div class="input-item">
<span class="label">目标职业</span>
<picker :range="store.pathsRef" :value="store.targetCareerIndex" range-key="label" @change="store.eventTargetCareer">
<div class="picker-field">
<span :class="store.targetCareerLabel ? 'picker-text' : 'picker-placeholder'">
{{ store.targetCareerLabel || '请选择目标职业' }}
</span>
<uni-icons color="#999999" size="16" type="down"></uni-icons>
</div>
</picker>
</div>
<button class="query-btn" @click="store.eventSearch">
<span>查询职业发展路径</span>
<uni-icons type="search" size="18" color="#FFFFFF"></uni-icons>
</button>
<view v-if="totalPathCount > 0" class="path-summary">
系统已收录 {{ totalPathCount }} 条职业路径
</view>
</view>
</div>
</div>
<!-- 职业发展路径区域 -->
<view class="path-section">
<view class="section-title">
<uni-icons type="person-filled" size="24" color="#000000"></uni-icons>
<text class="title-text">职业发展路径</text>
</view>
<!-- 职业发展路径区域 -->
<div class="path-section">
<div class="section-title">
<uni-icons color="#000000" size="24" type="person-filled"></uni-icons>
<text class="title-text">职业发展路径</text>
</div>
<view class="timeline">
<!-- 起点 -->
<view class="timeline-item start">
<view class="timeline-marker start-marker"></view>
<view class="timeline-content">
<view class="step-title">: {{ pathData.start.title }}</view>
<view class="skill-tags">
<view
class="skill-tag"
v-for="(skill, index) in pathData.start.skills"
:key="index"
>
{{ skill }}
</view>
</view>
</view>
</view>
<!-- 步骤 -->
<view
class="timeline-item step"
v-for="(step, index) in pathData.steps"
:key="index"
>
<view class="timeline-marker step-marker"></view>
<view class="timeline-content">
<view class="step-title">{{ index + 1 }}: {{ step.title }}</view>
<view class="skill-tags">
<view
class="skill-tag"
v-for="(skill, sIndex) in step.skills"
:key="sIndex"
>
{{ skill }}
</view>
</view>
</view>
</view>
<!-- 终点 -->
<view class="timeline-item end">
<view class="timeline-marker end-marker"></view>
<view class="timeline-content">
<view class="step-title">终点: {{ pathData.end.title }}</view>
<view class="skill-tags">
<view
class="skill-tag"
v-for="(skill, index) in pathData.end.skills"
:key="index"
>
{{ skill }}
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<div class="timeline">
<div v-for="(step, index) in store.result" :key="index" class="timeline-item" :class="[step.type]">
<div class="timeline-marker" :class="[`${step.type}-marker`]"></div>
<div class="timeline-content">
<div v-if="step.type === 'start'" class="step-title">起点: {{ step.title }}</div>
<div v-else-if="step.type === 'end'" class="step-title">: {{ step.title }}</div>
<div v-else class="step-title">{{ step.step }}: {{ step.title }}</div>
<div class="skill-tags">
<div v-for="(skill, sIndex) in step.tags" :key="sIndex" class="skill-tag">{{ skill }}</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup>
import { ref, computed, onMounted } from 'vue';
import { getJobPathPage, getJobPathDetail, getJobPathNum } from '@/apiRc/jobPath.js';
// 接收父组件传递的当前职位名称
const props = defineProps({
currentJobName: {
type: String,
default: ''
}
});
const emit = defineEmits(['path-data-updated']);
// 当前职位(从父组件获取,统一使用)
const currentPosition = computed(() => props.currentJobName || '市场专员');
// 目标职业选项列表
const targetCareerOptions = ref([]);
const selectedTargetIndex = ref(-1);
const selectedJobPathId = ref(null);
// 职业路径数量
const totalPathCount = ref(0);
// 初始路径数据
const emptyPathData = {
start: {
title: '暂无数据',
skills: []
},
steps: [],
end: {
title: '暂无数据',
skills: []
}
};
const pathData = ref({ ...emptyPathData });
const isLoadingPath = ref(false);
function parseSkillList(skillString) {
if (!skillString) {
return [];
}
return skillString
.split(/[,]/)
.map(item => item.trim())
.filter(item => item.length > 0);
}
function resetPathData() {
pathData.value = {
start: { ...emptyPathData.start },
steps: [],
end: { ...emptyPathData.end }
};
}
async function fetchTargetCareerOptions(keyword = '') {
try {
const response = await getJobPathPage({
jobName: keyword,
pageNo: 1,
pageSize: 100
});
const list = response?.data?.list || response?.list || [];
targetCareerOptions.value = list.map(item => ({
label: item.endJob || item.startJob || '未知职位',
value: item.id,
startJob: item.startJob,
endJob: item.endJob,
jobOrder: item.jobOrder,
startJobId: item.startJobId,
endJobId: item.endJobId
}));
if (targetCareerOptions.value.length === 0) {
selectedTargetIndex.value = -1;
selectedJobPathId.value = null;
}
} catch (error) {
targetCareerOptions.value = [];
selectedTargetIndex.value = -1;
selectedJobPathId.value = null;
uni.showToast({
title: '职业路径列表获取失败',
icon: 'none'
});
}
}
async function fetchPathCount() {
try {
const response = await getJobPathNum();
totalPathCount.value = response?.data ?? 0;
} catch (error) {
totalPathCount.value = 0;
}
}
async function loadPathDetail(startJobId, endJobId) {
if (startJobId === null || startJobId === undefined || startJobId === '' || endJobId === null || endJobId === undefined || endJobId === '') {
uni.showToast({
title: '职业路径ID无效',
icon: 'none'
});
resetPathData();
return;
}
try {
const requestParams = {
startJobId,
endJobId
};
const response = await getJobPathDetail(requestParams);
const details = Array.isArray(response?.data) ? response.data : [];
if (details.length === 0) {
resetPathData();
uni.showToast({
title: '暂无职业路径数据',
icon: 'none'
});
return;
}
const normalized = details.map(item => ({
title: item?.name || '未命名职位',
skills: parseSkillList(item?.skillNameList)
}));
const start = normalized[0] || { title: '暂无数据', skills: [] };
const end = normalized[normalized.length - 1] || { title: '暂无数据', skills: [] };
const steps = normalized.slice(1, normalized.length - 1);
pathData.value = {
start,
steps,
end
};
// 通知父组件路径数据已更新
emit('path-data-updated', {
pathData: pathData.value,
targetCareer: targetCareerOptions.value[selectedTargetIndex.value]?.label || ''
});
} catch (error) {
console.warn(error, 22222);
uni.showToast({
title: '获取路径详情失败',
icon: 'none'
});
resetPathData();
emit('path-data-updated', {
pathData: { ...emptyPathData },
targetCareer: ''
});
}
}
function handleTargetChange(e) {
const index = Number(e.detail.value);
selectedTargetIndex.value = index;
const option = targetCareerOptions.value[index];
selectedJobPathId.value = option ? option.value : null;
}
async function handleQuery() {
if (selectedTargetIndex.value < 0) {
uni.showToast({
title: '请选择目标职业',
icon: 'none'
});
return;
}
const option = targetCareerOptions.value[selectedTargetIndex.value];
if (!option) {
uni.showToast({
title: '目标职业数据异常',
icon: 'none'
});
return;
}
isLoadingPath.value = true;
uni.showLoading({
title: '加载中...',
mask: true
});
console.log(option);
try {
let { value: jobPathId, startJobId, endJobId } = option;
/*if (!jobPathId) {
const response = await getJobPathPage({
jobName: option.label,
pageNo: 1,
pageSize: 100
});
jobPathId = response?.data?.list?.[0]?.id || null;
}
if (!jobPathId) {
uni.showToast({
title: '未找到职业路径',
icon: 'none'
});
resetPathData();
return;
}*/
// selectedJobPathId.value = jobPathId;
await loadPathDetail(startJobId, endJobId);
} catch (error) {
console.warn(error, 11111);
uni.showToast({
title: '查询失败,请重试',
icon: 'none'
});
} finally {
isLoadingPath.value = false;
uni.hideLoading();
}
}
// 获取当前职位信息(从接口获取)
async function getCurrentPosition() {
// TODO: 调用接口获取当前职位
// const response = await getCareerCurrentPosition();
// if (response && response.code === 200) {
// currentPosition.value = response.data?.position || '';
// }
}
onMounted(async () => {
await getCurrentPosition();
await Promise.all([
fetchTargetCareerOptions(),
fetchPathCount()
]);
});
</script>
<style lang="scss" scoped>
.career-path {
padding: 10rpx 28rpx 20rpx;
}
.card-content {
display: flex;
justify-content: space-between;
align-items: center;
.label {
font-size: 24rpx;
line-height: 34rpx;
color: rgba(154, 154, 154, 1);
text-align: left;
font-family: 'PingFangSC-Bold', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif;
font-weight: 600;
}
.value {
font-size: 32rpx;
line-height: 46rpx;
color: rgb(16, 16, 16);
font-weight: 600;
text-align: left;
font-family: 'PingFangSC-Bold', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif;
&.placeholder {
font-weight: 500;
color: #ccc;
}
}
}
.query-section {
background-color: #FFFFFF;
border-radius: 16rpx;
@@ -378,6 +111,8 @@ onMounted(async () => {
}
.section-title {
font-size: 32rpx;
color: #000000;
display: flex;
align-items: center;
gap: 12rpx;
@@ -390,19 +125,6 @@ onMounted(async () => {
color: #157DF0;
}
.input-group {
display: flex;
flex-direction: column;
gap: 20rpx;
margin-bottom: 24rpx;
}
.input-item {
display: flex;
flex-direction: column;
gap: 12rpx;
}
.input-label {
font-size: 28rpx;
color: #000000;
@@ -418,44 +140,6 @@ onMounted(async () => {
color: #666666;
}
.picker-field {
background-color: #F5F5F5;
border: 1rpx solid #E0E0E0;
border-radius: 12rpx;
padding: 20rpx 24rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.picker-text {
font-size: 28rpx;
color: #000000;
}
.picker-placeholder {
font-size: 28rpx;
color: #999999;
}
.query-btn {
width: 100%;
height: 80rpx;
line-height: 40rpx;
border-radius: 20rpx;
background: linear-gradient(180deg, rgba(18, 125, 240, 1) 0%, rgba(59, 14, 123, 0.71) 100%);
color: rgba(255, 255, 255, 1);
font-size: 28rpx;
text-align: center;
font-family: '阿里巴巴普惠体3.0-regular', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif;
border: 2rpx solid rgba(187, 187, 187, 1);
display: flex;
align-items: center;
justify-content: center;
gap: 12rpx;
padding: 0;
}
.path-summary {
margin-top: 16rpx;
font-size: 24rpx;
@@ -491,11 +175,11 @@ onMounted(async () => {
width: 2rpx;
height: 100%;
background: repeating-linear-gradient(
to bottom,
#E0E0E0 0,
#E0E0E0 6rpx,
transparent 6rpx,
transparent 12rpx
to bottom,
#E0E0E0 0,
#E0E0E0 6rpx,
transparent 6rpx,
transparent 12rpx
);
transform: translateX(-50%);
z-index: 1;

View File

@@ -1,225 +1,84 @@
<template>
<view class="career-recommend">
<!-- 当前职位信息卡片 -->
<view class="info-card">
<view class="card-title">当前职位信息</view>
<view class="card-content">
<text class="label">当前职位</text>
<text class="value">{{ currentJobDisplay }}</text>
</view>
</view>
<!-- 我的技能标签卡片 -->
<view class="info-card">
<view class="card-title">我的技能标签</view>
<view class="skill-tags">
<view
class="skill-tag"
v-for="(skill, index) in skillTags"
:key="index"
>
{{ skill }}
</view>
<text v-if="!skillTags.length && !isLoadingSkillTags" class="empty-text">暂无技能数据</text>
<text v-if="isLoadingSkillTags" class="empty-text">加载中...</text>
</view>
</view>
<!-- 相似推荐职位 -->
<view class="section-title">
相似推荐职位
</view>
<view v-if="!isLoadingRecommend && recommendedJobs.length === 0" class="empty-text">暂无推荐职位</view>
<view
class="job-item-card"
v-for="(job, index) in recommendedJobs"
:key="index"
@click="handleJobCardClick(job)"
>
<view class="job-header">
<text class="job-title">{{ job.title }}</text>
</view>
<view class="job-skills">
<view
class="job-skill-tag"
v-for="(skill, skillIndex) in job.skills"
:key="skillIndex"
>
{{ skill }}
</view>
</view>
</view>
</view>
</template>
<!--suppress JSFileReferences, NpmUsedModulesInstalled, VueMissingComponentImportInspection, HtmlUnknownTag -->
<script setup>
import { ref, computed, watch, onMounted } from 'vue';
import { recommendJob } from '@/apiRc/jobRecommend.js';
import { appUserInfo } from '@/apiRc/user/user.js';
import { useCareerRecommendationStore } from '@/stores/useCareerRecommendationStore';
const props = defineProps({
currentJobId: {
type: [Number, String],
default: null
},
currentJobName: {
type: String,
default: ''
}
});
const emit = defineEmits(['job-card-click', 'skills-updated']);
// 数据状态
const skillTags = ref([]);
const recommendedJobs = ref([]);
const isLoadingSkillTags = ref(false);
const isLoadingRecommend = ref(false);
// 计算属性
const currentJobDisplay = computed(() => props.currentJobName || '市场专员');
// 从 appSkillsList 中提取技能名称
function extractSkillsFromAppSkillsList(appSkillsList = []) {
return (Array.isArray(appSkillsList) ? appSkillsList : [])
.map(item => item?.name || item?.nameStr || '')
.filter(name => !!name && name.trim().length > 0);
}
// 从技能列表中提取技能名称用于显示(用于推荐职位数据)
function extractSkillNames(skillList = []) {
return (Array.isArray(skillList) ? skillList : [])
.map(item => item?.skillName || '')
.filter(name => !!name && name.trim().length > 0);
}
// 获取当前职位的技能标签
async function fetchCurrentJobSkills() {
isLoadingSkillTags.value = true;
try {
// 优先从 appUserInfo 接口获取技能标签
const response = await appUserInfo();
const userInfo = response?.data || {};
// 从 appSkillsList 中提取技能名称
const appSkillsList = Array.isArray(userInfo?.appSkillsList) ? userInfo.appSkillsList : [];
const apiSkills = extractSkillsFromAppSkillsList(appSkillsList);
// 如果接口返回了技能数据,使用接口数据
if (apiSkills.length > 0) {
skillTags.value = apiSkills;
} else {
// 如果接口没有返回技能数据,从缓存中读取
const cachedUserInfo = uni.getStorageSync('userInfo') || {};
const cachedAppSkills = Array.isArray(cachedUserInfo?.appSkillsList) ? cachedUserInfo.appSkillsList : [];
const cachedSkills = extractSkillsFromAppSkillsList(cachedAppSkills);
if (cachedSkills.length > 0) {
skillTags.value = cachedSkills;
} else {
skillTags.value = [];
}
}
// 通知父组件技能数据已更新
emit('skills-updated', {
currentJobSkills: skillTags.value,
recommendedJobs: recommendedJobs.value
});
} catch (error) {
// appUserInfo 接口调用失败时,从缓存中读取
const cachedUserInfo = uni.getStorageSync('userInfo') || {};
const cachedAppSkills = Array.isArray(cachedUserInfo?.appSkillsList) ? cachedUserInfo.appSkillsList : [];
const cachedSkills = extractSkillsFromAppSkillsList(cachedAppSkills);
if (cachedSkills.length > 0) {
skillTags.value = cachedSkills;
} else {
skillTags.value = [];
}
emit('skills-updated', {
currentJobSkills: skillTags.value,
recommendedJobs: recommendedJobs.value
});
} finally {
isLoadingSkillTags.value = false;
}
}
// 获取推荐职位列表
async function fetchRecommendedJobs() {
isLoadingRecommend.value = true;
try {
const response = await recommendJob({
jobName: props.currentJobName
});
const list = Array.isArray(response?.data) ? response.data : [];
recommendedJobs.value = list.map((item, index) => {
const skillList = Array.isArray(item?.skillList) ? item.skillList : [];
const skillNames = extractSkillNames(skillList);
return {
id: item?.jobId ?? index,
jobId: item?.jobId ?? null,
title: item?.jobName || `推荐职位${index + 1}`,
jobName: item?.jobName || '',
skills: skillNames,
rawSkills: skillList
};
});
// 通知父组件推荐职位数据已更新
emit('skills-updated', {
currentJobSkills: skillTags.value,
recommendedJobs: recommendedJobs.value
});
} catch (error) {
recommendedJobs.value = [];
emit('skills-updated', {
currentJobSkills: skillTags.value,
recommendedJobs: []
});
} finally {
isLoadingRecommend.value = false;
}
}
// 组件挂载时检查并调用
onMounted(() => {
setTimeout(() => {
if (props.currentJobName) {
fetchCurrentJobSkills();
fetchRecommendedJobs();
}
}, 100);
});
// 监听 props 变化,自动获取推荐职位和技能标签
watch(
() => [props.currentJobId, props.currentJobName],
() => {
if (props.currentJobName) {
fetchCurrentJobSkills();
fetchRecommendedJobs();
}
},
{ immediate: true }
);
// 事件处理
function handleJobCardClick(job) {
emit('job-card-click', job);
}
const store = useCareerRecommendationStore();
</script>
<template>
<div class="career-recommend">
<div class="info-card">
<div class="section-title">
<uni-icons color="#286BFA" size="18" type="search"></uni-icons>
<span class="title-text">我的职业</span>
</div>
<div class="input-group">
<div class="input-item">
<picker @change="store.eventProfession" :value="store.professionIndex" :range="store.professionsRef" range-key="label">
<div class="picker-field">
<span :class="store.professionLabel ? 'picker-text' : 'picker-placeholder'">
{{ store.professionLabel || '请选择职业' }}
</span>
<uni-icons color="#999999" size="16" type="down"></uni-icons>
</div>
</picker>
</div>
<button class="query-btn" @click="store.eventSearch">
<span>搜索</span>
<uni-icons type="search" size="18" color="#FFFFFF"></uni-icons>
</button>
</div>
</div>
<div class="info-card">
<div class="card-title">我的技能标签</div>
<div class="skill-tags">
<div v-for="(skill, index) in store.skillTags" :key="index" class="skill-tag">
{{ skill }}
</div>
<span v-if="!store.skillTags.length" class="empty-text">暂无技能数据</span>
</div>
</div>
<div class="section-title">
相似推荐职位
</div>
<div v-if="!store.result && store.result.length === 0" class="empty-text">暂无推荐职位</div>
<div v-for="(job, index) in store.result" :key="index" class="job-item-card">
<div class="job-header">
<span class="job-title">{{ job.title }}</span>
</div>
<div class="job-header">
<span>职业相似度{{ job.percentage }}%</span>
</div>
<div class="job-skills">
<div v-for="tag in job.tags" :key="tag" class="job-skill-tag">
{{ tag }}
</div>
</div>
</div>
</div>
</template>
<style lang="scss" scoped>
.career-recommend {
padding: 10rpx 28rpx 20rpx;
}
.section-title {
font-size: 32rpx;
color: #000000;
display: flex;
align-items: center;
gap: 12rpx;
margin-bottom: 24rpx;
}
.title-text {
font-size: 32rpx;
font-weight: 600;
color: #157DF0;
}
.info-card {
background-color: #FFFFFF;
border-radius: 16rpx;
@@ -239,7 +98,7 @@ function handleJobCardClick(job) {
display: flex;
justify-content: space-between;
align-items: center;
.label {
font-size: 24rpx;
line-height: 34rpx;
@@ -248,7 +107,7 @@ function handleJobCardClick(job) {
font-family: 'PingFangSC-Bold', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif;
font-weight: 600;
}
.value {
font-size: 32rpx;
line-height: 46rpx;
@@ -274,14 +133,6 @@ function handleJobCardClick(job) {
white-space: nowrap;
}
.section-title {
font-size: 32rpx;
font-weight: 600;
color: #000000;
margin-bottom: 20rpx;
margin-top: 8rpx;
}
.job-item-card {
background-color: #FFFFFF;
border-radius: 16rpx;
@@ -290,7 +141,6 @@ function handleJobCardClick(job) {
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
border-left: 6rpx solid #409EFF;
position: relative;
cursor: pointer;
}
.job-header {

View File

@@ -1,382 +1,102 @@
<template>
<view class="skill-development">
<!-- 职业技能查询区域 -->
<view class="query-section">
<view class="section-title">
<uni-icons type="search" size="18" color="#286BFA"></uni-icons>
<text class="title-text">职业技能查询</text>
</view>
<view class="input-group">
<view class="input-item">
<text class="input-label">当前职位</text>
<input
class="input-field"
:value="currentPosition"
placeholder="市场专员"
placeholder-style="color: #999999"
disabled
/>
</view>
<view class="input-item">
<text class="input-label">目标职业</text>
<picker
mode="selector"
:range="targetCareerOptions"
range-key="label"
:value="selectedTargetIndex"
@change="handleTargetChange"
>
<view class="picker-field">
<text :class="selectedTargetIndex >= 0 ? 'picker-text' : 'picker-placeholder'">
{{ selectedTargetIndex >= 0 ? targetCareerOptions[selectedTargetIndex].label : '请选择目标职业' }}
</text>
<uni-icons type="arrowdown" size="16" color="#999999"></uni-icons>
</view>
</picker>
</view>
</view>
<button class="query-btn" @click="handleQuery">
<text>查询技能发展路径</text>
<uni-icons type="search" size="18" color="#FFFFFF"></uni-icons>
</button>
<view v-if="totalPathCount > 0" class="path-summary">
系统已收录 {{ totalPathCount }} 条职业路径
</view>
</view>
<view class="content-section">
<view class="section-title">
<uni-icons type="person-filled" size="18" color="#000000"></uni-icons>
<text class="title-text">技能发展路径</text>
</view>
<view class="intro-text">
基于您的当前职业和目标职业,以下是您需要重点发展的技能:
</view>
<view class="skill-list">
<view v-if="isLoadingSkills" class="empty-text">加载中...</view>
<view v-else-if="!hasQueried" class="empty-text">请先查询职业路径以获取技能发展数据</view>
<view v-else-if="skillList.length === 0" class="empty-text">暂无数据</view>
<view
v-else
class="skill-item"
v-for="(skill, index) in skillList"
:key="index"
>
<view class="skill-header">
<text class="skill-name">{{ skill.name }}</text>
<view class="skill-info">
<text class="skill-score">技能分数: {{ skill.score }}</text>
<text class="skill-weight">权重: {{ skill.weight }}</text>
</view>
</view>
<view class="skill-tags" v-if="skill.tags && skill.tags.length > 0">
<view
class="skill-tag"
v-for="(tag, tagIndex) in skill.tags"
:key="tagIndex"
>
{{ tag }}
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<!--suppress JSFileReferences, NpmUsedModulesInstalled, VueMissingComponentImportInspection, HtmlUnknownTag -->
<script setup>
import { ref, computed, watch, onMounted } from 'vue';
import { getJobPathPage, getJobPathDetail, getJobPathNum } from '@/apiRc/jobPath.js';
import { getJobSkillWeight } from '@/apiRc/jobSkill.js';
import { useSkillDevelopmentStore } from '@/stores/useSkillDevelopmentStore';
const props = defineProps({
// 当前职位名称
currentJobName: {
type: String,
default: ''
}
});
const emit = defineEmits(['path-data-updated']);
// 当前职位(从父组件获取)
const currentPosition = computed(() => props.currentJobName || '市场专员');
// 目标职业选项列表
const targetCareerOptions = ref([]);
const selectedTargetIndex = ref(-1);
const selectedJobPathId = ref(null);
// 职业路径数量
const totalPathCount = ref(0);
// 技能列表数据(从接口获取)
const skillList = ref([]);
const isLoadingSkills = ref(false);
// 是否已经查询过(用于区分未查询和已查询但无数据)
const hasQueried = ref(false);
function parseSkillList(skillString) {
if (!skillString) {
return [];
}
return skillString
.split(/[,]/)
.map(item => item.trim())
.filter(item => item.length > 0);
}
async function fetchTargetCareerOptions(keyword = '') {
try {
const response = await getJobPathPage({
jobName: keyword,
pageNo: 1,
pageSize: 100
});
const list = response?.data?.list || response?.list || [];
targetCareerOptions.value = list.map(item => ({
label: item.endJob || item.startJob || '未知职位',
value: item.id,
startJob: item.startJob,
endJob: item.endJob,
jobOrder: item.jobOrder
}));
if (targetCareerOptions.value.length === 0) {
selectedTargetIndex.value = -1;
selectedJobPathId.value = null;
}
} catch (error) {
targetCareerOptions.value = [];
selectedTargetIndex.value = -1;
selectedJobPathId.value = null;
uni.showToast({
title: '职业路径列表获取失败',
icon: 'none'
});
}
}
async function fetchPathCount() {
try {
const response = await getJobPathNum();
totalPathCount.value = response?.data ?? 0;
} catch (error) {
totalPathCount.value = 0;
}
}
async function loadPathDetail(jobPathId) {
if (!jobPathId || jobPathId === null || jobPathId === undefined || jobPathId === '') {
uni.showToast({
title: '职业路径ID无效',
icon: 'none'
});
localPathData.value = {
start: { title: '暂无数据', skills: [] },
steps: [],
end: { title: '暂无数据', skills: [] }
};
return;
}
try {
const requestParams = {
jobPathId: jobPathId
};
const response = await getJobPathDetail(requestParams);
const details = Array.isArray(response?.data) ? response.data : [];
if (details.length === 0) {
localPathData.value = {
start: { title: '暂无数据', skills: [] },
steps: [],
end: { title: '暂无数据', skills: [] }
};
uni.showToast({
title: '暂无职业路径数据',
icon: 'none'
});
return;
}
const normalized = details.map(item => ({
title: item?.name || '未命名职位',
skills: parseSkillList(item?.skillNameList)
}));
const start = normalized[0] || { title: '暂无数据', skills: [] };
const end = normalized[normalized.length - 1] || { title: '暂无数据', skills: [] };
const steps = normalized.slice(1, normalized.length - 1);
localPathData.value = {
start,
steps,
end
};
// 通知父组件路径数据已更新
emit('path-data-updated', {
pathData: localPathData.value,
targetCareer: targetCareerOptions.value[selectedTargetIndex.value]?.label || ''
});
} catch (error) {
uni.showToast({
title: '获取路径详情失败',
icon: 'none'
});
localPathData.value = {
start: { title: '暂无数据', skills: [] },
steps: [],
end: { title: '暂无数据', skills: [] }
};
emit('path-data-updated', {
pathData: localPathData.value,
targetCareer: ''
});
}
}
function handleTargetChange(e) {
const index = Number(e.detail.value);
selectedTargetIndex.value = index;
const option = targetCareerOptions.value[index];
selectedJobPathId.value = option ? option.value : null;
// 重新选择目标职业时,重置查询状态和技能列表
hasQueried.value = false;
skillList.value = [];
}
async function handleQuery() {
if (selectedTargetIndex.value < 0) {
uni.showToast({
title: '请选择目标职业',
icon: 'none'
});
return;
}
const option = targetCareerOptions.value[selectedTargetIndex.value];
if (!option) {
uni.showToast({
title: '目标职业数据异常',
icon: 'none'
});
return;
}
// 获取技能权重数据
await fetchSkillWeight();
}
// 获取技能权重数据
async function fetchSkillWeight() {
// 获取当前职位(使用界面上显示的值)
const currentJob = currentPosition.value || props.currentJobName || '';
if (!currentJob) {
skillList.value = [];
uni.showToast({
title: '当前职位信息缺失',
icon: 'none'
});
return;
}
// 获取目标职业(使用界面上选择的值)
const targetCareer = selectedTargetIndex.value >= 0
? targetCareerOptions.value[selectedTargetIndex.value]?.label
: '';
if (!targetCareer) {
skillList.value = [];
uni.showToast({
title: '请选择目标职业',
icon: 'none'
});
return;
}
isLoadingSkills.value = true;
uni.showLoading({
title: '加载中...',
mask: true
});
try {
const response = await getJobSkillWeight({
currentJobName: currentJob,
targetJobName: targetCareer
});
// 标记已经查询过
hasQueried.value = true;
// 处理接口返回的数据
const responseData = response?.data || response || [];
const dataItem = Array.isArray(responseData) ? responseData[0] : responseData;
// 合并当前职位和目标职位的技能列表
const currentSkills = Array.isArray(dataItem?.currentSkillDetList) ? dataItem.currentSkillDetList : [];
const targetSkills = Array.isArray(dataItem?.targetSkillDetList) ? dataItem.targetSkillDetList : [];
const allSkills = [...currentSkills, ...targetSkills];
// 转换为组件需要的格式
skillList.value = allSkills.map(item => ({
name: item?.skillName || item?.name || '',
weight: item?.skillWeight || item?.weight || '0',
score: item?.skillScore !== undefined && item?.skillScore !== null ? item.skillScore : 0,
tags: item?.tags || [],
currentLevel: item?.currentLevel || item?.level || 0
})).filter(item => item.name).sort((a, b) => {
// 按技能分数降序排序skillScore
const scoreA = parseFloat(a.score) || 0;
const scoreB = parseFloat(b.score) || 0;
return scoreB - scoreA;
});
if (skillList.value.length === 0) {
uni.showToast({
title: '暂无技能数据',
icon: 'none'
});
}
} catch (error) {
// 查询失败也标记为已查询
hasQueried.value = true;
uni.showToast({
title: '获取技能权重失败',
icon: 'none'
});
skillList.value = [];
} finally {
isLoadingSkills.value = false;
uni.hideLoading();
}
}
onMounted(async () => {
await Promise.all([
fetchTargetCareerOptions(),
fetchPathCount()
]);
});
const store = useSkillDevelopmentStore();
</script>
<template>
<div class="skill-development">
<!-- 职业技能查询区域 -->
<div class="query-section">
<div class="section-title">
<uni-icons color="#286BFA" size="18" type="search"></uni-icons>
<span class="title-text">技能发展路径查询</span>
</div>
<div class="input-group">
<div class="input-item">
<span class="input-label">当前职位</span>
<picker @change="store.eventProfession" :value="store.professionIndex" :range="store.professionsRef" range-key="label">
<div class="picker-field">
<span :class="store.professionLabel ? 'picker-text' : 'picker-placeholder'">
{{ store.professionLabel || '请选择目标职业' }}
</span>
<uni-icons color="#999999" size="16" type="down"></uni-icons>
</div>
</picker>
</div>
<div class="input-item">
<span class="input-label">目标职业</span>
<picker :range="store.pathsRef" :value="store.targetCareerIndex" range-key="label" @change="store.eventTargetCareer">
<div class="picker-field">
<span :class="store.targetCareerLabel ? 'picker-text' : 'picker-placeholder'">
{{ store.targetCareerLabel || '请选择目标职业' }}
</span>
<uni-icons color="#999999" size="16" type="down"></uni-icons>
</div>
</picker>
</div>
<button class="query-btn" @click="store.eventSearch">
<span>查询技能发展路径</span>
<uni-icons color="#FFFFFF" size="18" type="search"></uni-icons>
</button>
</div>
</div>
<div v-if="store.careerPaths.length" class="content-section career-section">
<div class="section-title">
<span class="title-text">职业路径</span>
</div>
<div class="">
<scroll-view scroll-x>
<div class="career-paths">
<template v-for="(item, index) in store.careerPaths" :key="item.label">
<div
:class="{ 'career-active': store.currentCareer && store.currentCareer.value === item.value }"
class="career-path-item"
@click="store.eventResult(index)"
>
<div
class="career-index"
>
<span class="index">{{ item.index }}</span>
</div>
<div class="career-label">{{ item.label }}</div>
</div>
</template>
</div>
</scroll-view>
</div>
</div>
<div v-if="store.careerPaths.length" class="content-section">
<div class="section-title">
<uni-icons color="#000000" size="18" type="person-filled"></uni-icons>
<span class="title-text">{{ store.currentCareerLabel }}技能</span>
</div>
<div class="skill-list">
<div v-if="store.result.length === 0" class="empty-text">暂无数据</div>
<div v-for="(item, index) in store.result" :key="index" class="skill-card">
<div class="skill-label">{{ item.label }}</div>
<div class="skill-detail">
<div v-for="d in item.children" :key="d.label" class="skill-detail-item">
<div class="skill-detail-item-label">{{ d.label }}</div>
<div class="skill-detail-item-value">
<div class="value-item">技能得分{{ d.value }}</div>
<div class="value-item">权重{{ d.weight }}</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<style lang="scss" scoped>
.skill-development {
padding: 10rpx 28rpx 20rpx;
background-color: #EBF4FF;
min-height:95%;
min-height: 95%;
}
.query-section {
@@ -385,7 +105,7 @@ onMounted(async () => {
padding: 28rpx;
margin-bottom: 20rpx;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
.section-title {
margin-top: 0;
}
@@ -395,6 +115,7 @@ onMounted(async () => {
background-color: #FFFFFF;
border-radius: 16rpx;
padding: 28rpx;
margin-bottom: 20rpx;
box-sizing: border-box;
overflow: visible;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
@@ -407,12 +128,6 @@ onMounted(async () => {
margin-bottom: 24rpx;
}
.input-item {
display: flex;
flex-direction: column;
gap: 12rpx;
}
.input-label {
font-size: 28rpx;
color: #000000;
@@ -428,44 +143,6 @@ onMounted(async () => {
color: #666666;
}
.picker-field {
background-color: #F5F5F5;
border: 1rpx solid #E0E0E0;
border-radius: 12rpx;
padding: 20rpx 24rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.picker-text {
font-size: 28rpx;
color: #000000;
}
.picker-placeholder {
font-size: 28rpx;
color: #999999;
}
.query-btn {
width: 100%;
height: 80rpx;
line-height: 40rpx;
border-radius: 20rpx;
background: linear-gradient(180deg, rgba(18, 125, 240, 1) 0%, rgba(59, 14, 123, 0.71) 100%);
color: rgba(255, 255, 255, 1);
font-size: 28rpx;
text-align: center;
font-family: '阿里巴巴普惠体3.0-regular', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif;
border: 2rpx solid rgba(187, 187, 187, 1);
display: flex;
align-items: center;
justify-content: center;
gap: 12rpx;
padding: 0;
}
.path-summary {
margin-top: 16rpx;
font-size: 24rpx;
@@ -478,125 +155,201 @@ button::after {
}
.section-title {
font-size: 32rpx;
color: #000000;
display: flex;
align-items: center;
gap: 12rpx;
margin-bottom: 24rpx;
.content-section & {
margin-top: 0;
}
}
.career-paths {
display: grid;
grid-auto-flow: column;
gap: 20px;
padding-bottom: 10px;
.career-path-item {
display: flex;
flex-direction: column;
align-items: center;
width: 80px;
padding: 5px;
font-weight: 700;
cursor: pointer;
.career-index {
position: relative;
display: flex;
justify-content: center;
align-items: center;
width: 48px;
height: 48px;
font-size: 20px;
color: #fff;
border-radius: 50%;
.index {
position: relative;
z-index: 10;
}
&:before,
&:after {
content: '';
position: absolute;
}
&:before {
inset: 0;
z-index: 1;
background: #6c64e7;
border: 3px solid #fff;
border-radius: 50%;
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
}
&:after {
content: '';
position: absolute;
top: 50%;
right: 50%;
z-index: 0;
width: 100px;
border-bottom: 4px solid #ccc;
}
}
.career-label {
margin-top: 10px;
font-size: 16px;
text-align: center;
color: #6c64e7;
}
&.career-active {
.career-index {
&:before {
background: #22c55e;
}
&:after {
border-color: #22c55e;
}
}
.career-label {
color: #000;
}
& + .career-path-item {
.career-index {
&:after {
border-color: #22c55e;
}
}
}
}
&:first-child {
.career-index {
font-size: 16px;
&:after {
display: none;
}
}
}
&:last-child {
.career-index {
font-size: 16px;
}
}
}
}
</style>
<style lang="scss" scoped>
.title-text {
font-size: 32rpx;
font-weight: 600;
color: #167CF1;
}
.intro-text {
font-size: 24rpx;
line-height: 34rpx;
color: rgba(154, 154, 154, 1);
text-align: left;
font-family: 'PingFangSC-Bold', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif;
font-weight: 600;
margin-bottom: 90rpx;
width: 672rpx;
}
.skill-list {
display: flex;
flex-direction: column;
gap: 20rpx;
}
.skill-item {
width: 100%;
max-width: 796rpx;
min-height: 162rpx;
line-height: 40rpx;
border-radius: 20rpx;
background-color: rgba(239, 239, 239, 1);
color: rgba(16, 16, 16, 1);
font-size: 28rpx;
text-align: center;
padding: 24rpx;
.skill-card {
margin-bottom: 14px;
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: center;
overflow: visible;
position: relative;
font-weight: 700;
.skill-list {
display: flex;
flex-direction: column;
gap: 20rpx;
}
.skill-item {
width: 100%;
max-width: 796rpx;
min-height: 162rpx;
line-height: 40rpx;
border-radius: 20rpx;
background-color: rgba(239, 239, 239, 1);
color: rgba(16, 16, 16, 1);
font-size: 28rpx;
text-align: center;
padding: 24rpx;
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: center;
overflow: visible;
position: relative;
}
.skill-label {
margin-bottom: 10px;
font-size: 16px;
color: #94a3b8;
}
.skill-detail {
display: flex;
flex-direction: column;
gap: 8px;
.skill-detail-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px;
border-radius: 3px;
background: #c1d2ea;
}
.skill-detail-item-label {
width: 55%;
word-wrap: break-word;
white-space: pre-wrap;
word-break: break-all;
color: #334155;
}
.skill-detail-item-value {
width: 45%;
padding-left: 6px;
color: #4f46e5;
box-sizing: border-box;
.value-item {
text-wrap: nowrap;
}
}
}
}
.skill-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16rpx;
width: 100%;
box-sizing: border-box;
}
.skill-name {
font-size: 32rpx;
line-height: 46rpx;
color: rgb(16, 16, 16);
text-align: left;
font-family: 'PingFangSC-Bold', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif;
font-weight: 600;
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.skill-info {
display: flex;
align-items: center;
gap: 12rpx;
flex-shrink: 0;
margin-left: 16rpx;
}
.skill-score {
font-size: 24rpx;
line-height: 34rpx;
border-radius: 10rpx;
background-color: rgba(49, 100, 239, 0.1);
color: rgba(44, 101, 247, 1);
text-align: center;
padding: 6rpx 12rpx;
white-space: nowrap;
}
.skill-weight {
font-size: 24rpx;
line-height: 34rpx;
border-radius: 10rpx;
background-color: rgba(49, 100, 239, 0.1);
color: rgba(44, 101, 247, 1);
text-align: center;
padding: 6rpx 12rpx;
white-space: nowrap;
}
.skill-tags {
display: flex;
flex-wrap: wrap;
gap: 12rpx;
}
.skill-tag {
background-color: rgba(49, 100, 239, 0.1);
color: rgba(44, 101, 247, 1);
padding: 6rpx 12rpx;
border-radius: 8rpx;
font-size: 24rpx;
line-height: 34rpx;
text-align: center;
white-space: nowrap;
}
</style>

View File

@@ -0,0 +1,223 @@
import { computed, ref, watch } from 'vue';
import { defineStore } from 'pinia';
import { getCurrentPosition, getPath, getPathDetail } from '@/apiRc/service/careerPath';
export const useCareerPathStore = defineStore('career-path', () => {
const userInfo = ref({
userName: '',
professions: [],
skills: []
});
try {
const data = uni.getStorageSync('userInfo');
userInfo.value.professions = data.jobTitle.map((d) => {
return {
label: d,
value: d
};
});
userInfo.value.skills = data.appSkillsList.map((d) => {
return {
label: d.name,
value: d.name
};
});
} catch (e) {
console.warn(e);
}
const professionIndex = ref(0);
const profession = ref('');
const professionLabel = ref('');
const professions = ref([]);
const professionsRef = computed(() => {
if (!userInfo.value || !userInfo.value.professions || userInfo.value.professions.length === 0) {
return professions.value;
}
const userProfessionsLabels = userInfo.value.professions.map((d) => d.label);
let professionsA = [];
let professionsB = [];
professions.value.filter((d) => userProfessionsLabels.includes(d.label));
for (const d of professions.value) {
if (userProfessionsLabels.includes(d.label)) {
professionsA.push(d);
} else {
professionsB.push(d);
}
}
if (professionsA.length === 0) {
professionsA = userInfo.value.professions;
professionsB = professions.value;
}
return [ ...professionsA, ...professionsB ];
});
const targetCareerIndex = ref(0);
const targetCareer = ref('');
const targetCareerLabel = ref('');
const paths = ref([]);
const pathsRef = computed(() => {
return paths.value.filter((d) => {
return `${ d.startJobId }` === profession.value;
});
});
const result = ref([]);
const fetchData = async () => {
try {
const { code, msg, data } = await getCurrentPosition();
if (code !== 0) {
uni.showToast({
title: msg,
icon: 'none'
});
return;
}
if (!data) {
return;
}
professions.value = data.map((d) => {
return {
label: d.name,
value: `${ d.jobId }`
};
});
} catch (e) {
console.warn(e);
}
};
const fetchDataPath = async () => {
try {
const { code, msg, data } = await getPath();
if (code !== 0) {
uni.showToast({
title: msg,
icon: 'none'
});
return;
}
if (!data) {
return;
}
paths.value = data.map((d) => {
return {
label: d.endJob,
value: `${ d.startJobId }-${ d.endJobId }`,
startJobId: d.startJobId
};
});
} catch (e) {
console.warn(e);
}
};
const fetchResult = async () => {
if (!targetCareer.value) {
return;
}
const [ startJobId, endJobId ] = targetCareer.value.split('-');
const params = {
startJobId: Number(startJobId),
endJobId: Number(endJobId)
};
try {
const { code, msg, data } = await getPathDetail(params);
if (code !== 0) {
uni.showToast({
title: msg,
icon: 'none'
});
return;
}
if (!data) {
return;
}
result.value = data.map((d, i) => {
return {
type: i === 0 ? 'start' : i === data.length - 1 ? 'end' : 'step',
step: i,
title: d.name,
tags: d.skillNameList.split(',')
};
});
} catch (e) {
console.warn(e);
}
};
const eventSearch = () => {
if (pathsRef.value.length === 0) {
uni.showToast({
title: '当前职业暂无发展路径,敬请期待!',
icon: 'none'
});
return;
}
if (!profession.value) {
uni.showToast({
title: '请选择当前职位!',
icon: 'none'
});
return;
}
if (!targetCareer.value) {
uni.showToast({
title: '请选择目标职业!',
icon: 'none'
});
return;
}
void fetchResult();
};
const eventProfession = (e) => {
professionIndex.value = Number(e.detail.value);
const item = professionsRef.value[e.detail.value]
profession.value = item.value;
professionLabel.value = item.label;
targetCareer.value = '';
targetCareerLabel.value = '';
result.value = [];
};
const eventTargetCareer = (e) => {
targetCareerIndex.value = Number(e.detail.value);
const item = pathsRef.value[e.detail.value]
targetCareer.value = item.value;
targetCareerLabel.value = item.label;
result.value = [];
};
void fetchData();
void fetchDataPath();
watch(
() => professionsRef.value,
() => {
if (professionsRef.value[ 0 ]) {
profession.value = professionsRef.value[ 0 ].value;
professionLabel.value = professionsRef.value[ 0 ].label;
}
}
);
return {
professionIndex,
professionLabel,
profession,
professionsRef,
targetCareerIndex,
targetCareer,
targetCareerLabel,
pathsRef,
result,
eventProfession,
eventTargetCareer,
eventSearch
};
});

View File

@@ -0,0 +1,187 @@
import { computed, ref, watch } from 'vue';
import { defineStore } from 'pinia';
import { getProfessions, getRecommend, getSkillTags } from '@/apiRc/service/careerRecommendation';
export const useCareerRecommendationStore = defineStore('career-recommendation', () => {
const userInfo = ref({
userName: '',
professions: [],
skills: []
});
try {
const data = uni.getStorageSync('userInfo');
userInfo.value.professions = data.jobTitle.map((d) => {
return {
label: d,
value: d
};
});
userInfo.value.skills = data.appSkillsList.map((d) => {
return {
label: d.name,
value: d.name
};
});
} catch (e) {
console.warn(e);
}
const professionIndex = ref(0);
const profession = ref('');
const professionLabel = ref('');
const professions = ref([]);
const professionsRef = computed(() => {
if (!userInfo.value || !userInfo.value.professions || userInfo.value.professions.length === 0) {
return professions.value;
}
const userProfessionsLabels = userInfo.value.professions.map((d) => d.label);
let professionsA = [];
let professionsB = [];
professions.value.filter((d) => userProfessionsLabels.includes(d.label));
for (const d of professions.value) {
if (userProfessionsLabels.includes(d.label)) {
professionsA.push(d);
} else {
professionsB.push(d);
}
}
if (professionsA.length === 0) {
professionsA = userInfo.value.professions;
professionsB = professions.value;
}
return [ ...professionsA, ...professionsB ];
});
const skills = ref([]);
const skillTags = computed(() => {
if (userInfo.value.professions[ 0 ] && professionLabel.value === userInfo.value.professions[ 0 ].value) {
return userInfo.value.skills.map((d) => d.label);
}
return skills.value;
});
const result = ref([]);
const fetchData = async () => {
try {
const { code, msg, data } = await getProfessions();
if (code !== 0) {
uni.showToast({
title: msg,
icon: 'none'
});
return;
}
if (!data) {
return;
}
professions.value = data.map((d) => {
return {
label: d.name,
value: d.name
};
});
} catch (e) {
console.warn(e);
}
};
const fetchSkillTags = async () => {
const params = {
jobName: professionLabel.value
};
try {
const { code, msg, data } = await getSkillTags(params);
if (code !== 0) {
uni.showToast({
title: msg,
icon: 'none'
});
return;
}
if (typeof data !== 'undefined' && Array.isArray(data) && data.length > 0 && data[ 0 ]) {
skills.value = data[ 0 ].skillDetList.map((d) => d.skillName);
}
} catch (e) {
console.warn(e);
}
};
const fetchRecommend = async () => {
const params = {
jobName: professionLabel.value
};
try {
const { code, msg, data } = await getRecommend(params);
if (code !== 0) {
uni.showToast({
title: msg,
icon: 'none'
});
return;
}
if (!data) {
return;
}
result.value = data.map((d) => {
return {
title: d.jobName,
tags: d.skillList.map((d) => d.skillName),
percentage: d.similarityScore ?? 0
};
});
} catch (e) {
console.warn(e);
}
};
const eventSearch = () => {
void fetchRecommend();
};
const eventProfession = (e) => {
professionIndex.value = Number(e.detail.value);
const item = professionsRef.value[e.detail.value]
profession.value = item.value;
professionLabel.value = item.label;
};
void fetchData();
watch(
() => profession.value,
() => {
if (profession.value) {
void fetchSkillTags();
result.value = [];
}
},
{
immediate: true
}
);
watch(
() => professionsRef.value,
() => {
if (professionsRef.value[ 0 ]) {
profession.value = professionsRef.value[ 0 ].value;
professionLabel.value = professionsRef.value[ 0 ].label;
}
}
);
return {
professionIndex,
profession,
professionLabel,
professionsRef,
skillTags,
result,
eventProfession,
eventSearch
};
});

View File

@@ -0,0 +1,293 @@
import { computed, ref, watch } from 'vue';
import { defineStore } from 'pinia';
import { getCurrentPosition, getPath } from '@/apiRc/service/careerPath';
import { getCareerPath, getSkillResult } from '@/apiRc/service/skillDevelopment';
export const useSkillDevelopmentStore = defineStore('skill-development', () => {
const userInfo = ref({
userName: '',
professions: [],
skills: []
});
try {
const data = uni.getStorageSync('userInfo');
userInfo.value.professions = data.jobTitle.map((d) => {
return {
label: d,
value: d
};
});
userInfo.value.skills = data.appSkillsList.map((d) => {
return {
label: d.name,
value: d.name
};
});
} catch (e) {
console.warn(e);
}
const professionIndex = ref(0);
const profession = ref('');
const professionLabel = ref('');
const professions = ref([]);
const professionsRef = computed(() => {
if (!userInfo.value || !userInfo.value.professions || userInfo.value.professions.length === 0) {
return professions.value;
}
const userProfessionsLabels = userInfo.value.professions.map((d) => d.label);
let professionsA = [];
let professionsB = [];
professions.value.filter((d) => userProfessionsLabels.includes(d.label));
for (const d of professions.value) {
if (userProfessionsLabels.includes(d.label)) {
professionsA.push(d);
} else {
professionsB.push(d);
}
}
if (professionsA.length === 0) {
professionsA = userInfo.value.professions;
professionsB = professions.value;
}
return [ ...professionsA, ...professionsB ];
});
const targetCareerIndex = ref(0);
const targetCareer = ref('');
const targetCareerLabel = ref('');
const paths = ref([]);
const pathsRef = computed(() => {
return paths.value.filter((d) => {
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 '';
}
return currentCareer.value.label;
});
const result = ref([]);
const fetchData = async () => {
try {
const { code, msg, data } = await getCurrentPosition();
if (code !== 0) {
uni.showToast({
title: msg,
icon: 'none'
});
return;
}
if (!data) {
return;
}
professions.value = data.map((d) => {
return {
label: d.name,
value: `${ d.jobId }`
};
});
} catch (e) {
console.warn(e);
}
};
const fetchDataPath = async () => {
try {
const { code, msg, data } = await getPath();
if (code !== 0) {
uni.showToast({
title: msg,
icon: 'none'
});
return;
}
if (!data) {
return;
}
paths.value = data.map((d) => {
return {
label: d.endJob,
value: `${d.startJobId}-${d.endJobId}`
};
});
} catch (e) {
console.warn(e);
}
};
const fetchCareerPaths = async () => {
if (!targetCareer.value) {
return;
}
const [startJobId, endJobId] = targetCareer.value.split('-');
const params = {
startJobId,
endJobId
};
try {
const { code, msg, data } = await getCareerPath(params);
if (code !== 0) {
uni.showToast({
title: msg,
icon: 'none'
});
return;
}
if (!data) {
return;
}
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,
fontSize
};
});
if (careerPaths.value[0]) {
void eventResult(0);
}
} catch (e) {
console.warn(e);
careerPaths.value = [];
}
};
const eventResult = async (index) => {
currentCareerIndex.value = index;
currentCareer.value = careerPaths.value[index] ?? null;
const params = {
jobId: currentCareer.value?.value
};
try {
const { code, msg, data } = await getSkillResult(params);
if (code !== 0) {
uni.showToast({
title: msg,
icon: 'none'
});
return;
}
if (!data) {
return;
}
result.value = data.map((d) => {
return {
label: d.secDimName,
value: d.secDimId,
children: d.skillDetList.map((d) => {
return {
label: d.skillName,
value: d.skillScore,
weight: d.skillWeight
};
})
};
});
} catch (e) {
console.warn(e);
}
};
const eventSearch = () => {
if (pathsRef.value.length === 0) {
uni.showToast({
title: '当前职业暂无发展路径,敬请期待!',
icon: 'none'
});
return;
}
if (!profession.value) {
uni.showToast({
title: '请选择当前职位!',
icon: 'none'
});
return;
}
if (!targetCareer.value) {
uni.showToast({
title: '请选择目标职业!',
icon: 'none'
});
return;
}
void fetchCareerPaths();
};
const eventProfession = (e) => {
professionIndex.value = Number(e.detail.value);
const item = professionsRef.value[ e.detail.value ];
profession.value = item.value;
professionLabel.value = item.label;
targetCareer.value = '';
targetCareerLabel.value = '';
careerPaths.value = [];
result.value = [];
};
const eventTargetCareer = (e) => {
targetCareerIndex.value = Number(e.detail.value);
const item = pathsRef.value[ e.detail.value ];
targetCareer.value = item.value;
targetCareerLabel.value = item.label;
careerPaths.value = [];
result.value = [];
};
void fetchData();
void fetchDataPath();
watch(
() => professionsRef.value,
() => {
if (professionsRef.value[ 0 ]) {
profession.value = professionsRef.value[ 0 ].value;
professionLabel.value = professionsRef.value[ 0 ].label;
}
}
);
return {
professionIndex,
professionLabel,
profession,
professionsRef,
targetCareerIndex,
targetCareer,
targetCareerLabel,
pathsRef,
careerPaths,
currentCareer,
currentCareerLabel,
currentCareerIndex,
result,
eventProfession,
eventTargetCareer,
eventSearch,
eventResult
};
});

View File

@@ -107,102 +107,108 @@ const useChatGroupDBStore = defineStore("messageGroup", () => {
return await baseDB.db.add(massageName.value, payload);
}
async function getStearm(text, fileUrls = [], progress, options = {}) {
return new Promise((resolve, reject) => {
try {
toggleTyping(true);
const customDataID = 'message_' + UUID.generate()
const params = {
data: text,
sessionId: chatSessionID.value,
dataId: customDataID
};
if (fileUrls && fileUrls.length) {
params['fileUrl'] = fileUrls.map((item) => item.url);
}
// ------>
const MsgData = {
text: text,
self: true,
displayText: text,
files: fileUrls
};
addMessage(MsgData); // 添加message数据
// <------
const newMsg = {
text: '', // 存储原始结构化内容
self: false,
displayText: '', // 用于流式渲染展示
dataId: customDataID
};
const index = messages.value.length;
messages.value.push(newMsg);
const rawParts = Array.isArray(text) ? text : [text]; // 统一处理
// 用于追加每个部分的流式数据
let partIndex = 0;
function handleUnload() {
newMsg.parentGroupId = chatSessionID.value;
baseDB.db.add(massageName.value, newMsg).then((id) => {
messages.value[index] = {
...newMsg,
id
};
});
}
// #ifdef H5
if (typeof window !== 'undefined') {
window.addEventListener("unload", handleUnload);
}
// #endif
function onDataReceived(data) {
// 支持追加多个部分
newMsg.text += data;
newMsg.displayText += data;
messages.value[index] = {
...newMsg
};
progress && progress();
// 调用外部传入的onDataReceived回调
if (options.onDataReceived) {
options.onDataReceived(data, newMsg, index);
}
}
function onError(error) {
msg('服务响应异常');
reject(error);
}
function onComplete() {
messages.value[index] = {
...newMsg
};
toggleTyping(false);
// #ifdef H5
if (typeof window !== 'undefined') {
window.removeEventListener("unload", handleUnload);
}
// #endif
handleUnload();
// 调用外部传入的onComplete回调
if (options.onComplete) {
options.onComplete();
}
resolve();
}
$api.streamRequest('/chat', params, onDataReceived, onError, onComplete);
} catch (err) {
console.log(err);
reject(err);
}
});
async function getStearm(text, fileUrls = [], progress, options = {}) {
return new Promise((resolve, reject) => {
try {
toggleTyping(true);
const customDataID = 'message_' + UUID.generate()
// 对话历史管理只保留最近的N条消息防止token超限
// 计算消息数量只保留最近的10条消息可根据实际情况调整
const MAX_HISTORY_MESSAGES = 10;
const historyMessages = messages.value.slice(-MAX_HISTORY_MESSAGES);
const params = {
data: text,
sessionId: chatSessionID.value,
dataId: customDataID
};
if (fileUrls && fileUrls.length) {
params['fileUrl'] = fileUrls.map((item) => item.url);
}
// ------>
const MsgData = {
text: text,
self: true,
displayText: text,
files: fileUrls
};
addMessage(MsgData); // 添加message数据
// <------
const newMsg = {
text: '', // 存储原始结构化内容
self: false,
displayText: '', // 用于流式渲染展示
dataId: customDataID
};
const index = messages.value.length;
messages.value.push(newMsg);
const rawParts = Array.isArray(text) ? text : [text]; // 统一处理
// 用于追加每个部分的流式数据
let partIndex = 0;
function handleUnload() {
newMsg.parentGroupId = chatSessionID.value;
baseDB.db.add(massageName.value, newMsg).then((id) => {
messages.value[index] = {
...newMsg,
id
};
});
}
// #ifdef H5
if (typeof window !== 'undefined') {
window.addEventListener("unload", handleUnload);
}
// #endif
function onDataReceived(data) {
// 支持追加多个部分
newMsg.text += data;
newMsg.displayText += data;
messages.value[index] = {
...newMsg
};
progress && progress();
// 调用外部传入的onDataReceived回调
if (options.onDataReceived) {
options.onDataReceived(data, newMsg, index);
}
}
function onError(error) {
msg('服务响应异常');
reject(error);
}
function onComplete() {
messages.value[index] = {
...newMsg
};
toggleTyping(false);
// #ifdef H5
if (typeof window !== 'undefined') {
window.removeEventListener("unload", handleUnload);
}
// #endif
handleUnload();
// 调用外部传入的onComplete回调
if (options.onComplete) {
options.onComplete();
}
resolve();
}
$api.streamRequest('/chat', params, onDataReceived, onError, onComplete);
} catch (err) {
console.log(err);
reject(err);
}
});
}
// 状态控制

View File

@@ -49,14 +49,12 @@ export function navigateToLoginPage(options = {}) {
return;
case 'h5':
if (loginType === 'idCard') {
// H5端身份证号码登录
loginPage = '/pages/login/id-card-login';
} else {
// H5端账号密码登录
loginPage = '/pages/login/h5-login';
}
break;
uni.showToast({
title: '请先登录',
icon: 'none',
duration: 2000
});
return;
case 'app':
// App端使用微信授权登录

View File

@@ -1,135 +1,195 @@
import MarkdownIt from '@/lib/markdown-it.min.js';
import hljs from "@/lib/highlight/highlight-uni.min.js";
import parseHtml from '@/lib/html-parser.js';
// import DOMPurify from '@/lib/dompurify@3.2.4es.js';
export let codeDataList = []
export let jobMoreMap = new Map()
const md = new MarkdownIt({
html: true, // 允许 HTML 标签
linkify: true, // 自动解析 URL
typographer: true, // 美化标点符号
tables: true,
breaks: true, // 让 \n 自动换行
langPrefix: 'language-', // 代码高亮前缀
// 如果结果以 <pre ... 开头,内部包装器则会跳过。
highlight: function(str, lang) {
if (lang === 'job-json') {
const result = safeExtractJson(str);
if (result) { // json解析成功
const jobId = result.appJobUrl.split('jobId=')[1]
let domContext = `
<a class="custom-card" data-job-id="${jobId}">
<div class="card-title">
<span class="title-text" >${result.jobTitle}</span>
<div class="card-salary">${result.salary}</div>
</div>
<div class="card-company">${result.location}·${result.companyName}</div>
<div class="card-info">
<div class="info-item">
<div class="card-tag">${result.education}</div>
<div class="card-tag">${result.experience}</div>
</div>
<div class="info-item">查看详情<div class="position-nav"></div></div>
</div>
</a>
`
if (result.data) {
jobMoreMap.set(jobId, result.data)
domContext +=
`<a class="custom-more" data-job-id="${jobId}">查看更多岗位<div class="more-icon"></div></a>`
}
return domContext
}
}
// <div class="card-tag">${result.location}</div>
// <div class="info-item">${result.salary}</div>
// 代码块
let preCode = ""
try {
preCode = hljs.highlightAuto(str).value
} catch (err) {
preCode = markdownIt.utils.escapeHtml(str);
}
// 以换行进行分割 , 按行拆分代码
const lines = preCode.split(/\n/).slice(0, -1);
const html = lines
.map((line, index) =>
line ?
`<li><span class="line-num" data-line="${index + 1}"></span>${line}</li>` :
''
)
.join('');
// 代码复制功能
const cacheIndex = codeDataList.length;
codeDataList.push(str);
return `
<div class="code-container">
<div class="code-header">
<span class="lang-label">${lang || 'plaintext'}</span>
<a class="copy-btn" data-copy-index="${cacheIndex}">复制代码</a>
</div>
<pre class="hljs"><code><ol>${html}</ol></code></pre>
</div>
`;
}
})
function extractFirstJson(text) {
let stack = [];
let startIndex = -1;
let endIndex = -1;
for (let i = 0; i < text.length; i++) {
const char = text[i];
if (char === '{') {
if (stack.length === 0) startIndex = i; // 记录第一个 '{' 的位置
stack.push(char);
} else if (char === '}') {
stack.pop();
if (stack.length === 0) {
endIndex = i; // 找到配对的 '}'
break;
}
}
}
if (startIndex !== -1 && endIndex !== -1) {
const jsonString = text.slice(startIndex, endIndex + 1);
try {
const jsonObject = JSON.parse(jsonString);
return jsonObject;
} catch (e) {
return null; // 如果不是有效的 JSON
}
}
return null; // 如果没有找到有效的 JSON 对象
}
function safeExtractJson(text) {
try {
const jsonObject = extractFirstJson(text);
return jsonObject
} catch (e) {
console.error('JSON 解析失败:', e);
}
return null;
}
export function clearJobMoreMap() { // 切换对话清空
jobMoreMap.clear()
}
export function parseMarkdown(content) {
if (!content) {
return //处理特殊情况,比如网络异常导致的响应的 content 的值为空
}
codeDataList = []
const unsafeHtml = md.render(content || '')
return unsafeHtml
}
import MarkdownIt from '@/lib/markdown-it.min.js';
import hljs from "@/lib/highlight/highlight-uni.min.js";
import parseHtml from '@/lib/html-parser.js';
// import DOMPurify from '@/lib/dompurify@3.2.4es.js';
export let codeDataList = []
export let jobMoreMap = new Map()
export let jobCardsList = []
const md = new MarkdownIt({
html: true, // 允许 HTML 标签
linkify: true, // 自动解析 URL
typographer: true, // 美化标点符号
tables: true,
breaks: true, // 让 \n 自动换行
langPrefix: 'language-', // 代码高亮前缀
// 如果结果以 <pre ... 开头,内部包装器则会跳过。
highlight: function(str, lang) {
if (lang === 'job-json') {
const result = safeExtractJson(str);
if (result) { // json解析成功
let jobId = result.appJobUrl;
// If appJobUrl contains 'jobId=', extract the value after it, otherwise use it directly
if (jobId && jobId.includes('jobId=')) {
jobId = jobId.split('jobId=')[1];
// 如果还有额外的参数只取jobId部分
if (jobId.includes('&')) {
jobId = jobId.split('&')[0];
}
}
console.log('Job JSON result:', result, 'Extracted jobId:', jobId);
// 确保jobId有效
if (!jobId || jobId === 'undefined' || jobId === 'null') {
console.error('Invalid jobId extracted:', jobId, 'from appJobUrl:', result.appJobUrl);
// 尝试从其他字段获取jobId
if (result.jobId) {
jobId = result.jobId;
console.log('Using jobId from result.jobId:', jobId);
}
}
// 添加到岗位卡片列表,供小程序端单独渲染
jobCardsList.push({
jobId,
jobTitle: result.jobTitle,
salary: result.salary,
location: result.location,
companyName: result.companyName,
education: result.education,
experience: result.experience
});
// 生成岗位卡片HTML注意微信小程序rich-text组件只支持部分HTML属性
// 使用普通的href属性微信小程序rich-text会将其转换为可点击链接
// 添加data-job-id属性方便获取jobId
// 为所有平台添加onclick事件微信小程序可能会忽略但H5端会生效
// 内联基础样式确保在所有平台上正确显示使用px单位以确保H5兼容性
let domContext = `<a class="custom-card" href="/packageA/pages/post/post?jobId=${jobId}" data-job-id="${jobId}" data-jobid="${jobId}" onclick="if(typeof uni !== 'undefined'){uni.navigateTo({url: '/packageA/pages/post/post?jobId=${jobId}'});return false;}" style="display: flex; flex-direction: column; margin-bottom: 11px; background: #FFFFFF; box-shadow: 0 0 4px rgba(0,0,0,0.04); border-radius: 10px; padding: 14px 12px; font-weight: 400; font-size: 14px; color: #333333; text-decoration: none; overflow: hidden; box-sizing: border-box; width: 100%; max-width: 100%;"><div class="card-title" style="font-weight: 600; display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;"><span class="title-text" style="font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif; font-size: 16px; line-height: 1.4; color: #333333; max-width: calc(100% - 80px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">${result.jobTitle}</span><div class="card-salary" style="font-family: DIN-Medium; font-size: 16px; color: #4C6EFB; line-height: 1.4; font-weight: 500;">${result.salary}</div></div><div class="card-company" style="margin-bottom: 9px; font-size: 14px; color: #6C7282; line-height: 1.4; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">${result.location}·${result.companyName}</div><div class="card-info" style="display: flex; align-items: center; justify-content: space-between; padding-right: 20px;"><div class="info-item" style="display: flex; position: relative; align-items: center;"><div class="card-tag" style="font-weight: 400; font-size: 12px; color: #6C7282; width: fit-content; background: #F4F4F4; border-radius: 2px; padding: 3px 10px; margin-right: 10px; display: inline-flex; align-items: center; justify-content: center; height: 15px; line-height: 15px;">${result.education}</div><div class="card-tag" style="font-weight: 400; font-size: 12px; color: #6C7282; width: fit-content; background: #F4F4F4; border-radius: 2px; padding: 3px 10px; margin-right: 10px; display: inline-flex; align-items: center; justify-content: center; height: 15px; line-height: 15px;">${result.experience}</div></div><div class="info-item" style="color: #256BFA; font-size: 14px; padding-right: 5px; position: relative;">查看详情<div class="position-nav" style="position: absolute; right: -5px; top: 50%; transform: translateY(-50%);"></div></div></div></a>`
if (result.data) {
jobMoreMap.set(jobId, result.data)
domContext += `<a class="custom-more" href="/packageA/pages/moreJobs/moreJobs?jobId=${jobId}" data-job-id="${jobId}" data-jobid="${jobId}" onclick="if(typeof uni !== 'undefined'){uni.navigateTo({url: '/packageA/pages/moreJobs/moreJobs?jobId=${jobId}'});return false;}" style="display: flex; justify-content: center; align-items: center; color: #FFFFFF; background: linear-gradient(135deg, #256BFA 0%, #9E74FD 100%); border-radius: 25px; padding: 10px 16px; margin: 10px 0; font-size: 14px; font-weight: 600; box-shadow: 0 4px 12px rgba(37, 107, 250, 0.3); text-decoration: none; box-sizing: border-box; width: 100%;">查看更多岗位<div class="more-icon" style="width: 16px; height: 16px; background: url('@/static/svg/seemore.svg') center center no-repeat; background-size: 100% 100%; margin-left: 6px;"></div></a>`
}
return domContext
}
}
// 代码块
let preCode = ""
try {
preCode = hljs.highlightAuto(str).value
} catch (err) {
preCode = md.utils.escapeHtml(str);
}
// 以换行进行分割 , 按行拆分代码
const lines = preCode.split(/\n/).slice(0, -1);
const html = lines
.map((line, index) =>
line ?
`<li><span class="line-num" data-line="${index + 1}"></span>${line}</li>` :
'<li></li>'
)
.join('');
// 代码复制功能
const cacheIndex = codeDataList.length;
codeDataList.push(str);
return `
<div class="code-container">
<div class="code-header">
<span class="lang-label">${lang || 'plaintext'}</span>
<a class="copy-btn" data-copy-index="${cacheIndex}">复制代码</a>
</div>
<pre class="hljs"><code><ol>${html}</ol></code></pre>
</div>
`;
}
})
function extractFirstJson(text) {
let stack = [];
let startIndex = -1;
let endIndex = -1;
for (let i = 0; i < text.length; i++) {
const char = text[i];
if (char === '{') {
if (stack.length === 0) startIndex = i; // 记录第一个 '{' 的位置
stack.push(char);
} else if (char === '}') {
stack.pop();
if (stack.length === 0) {
endIndex = i; // 找到配对的 '}'
break;
}
}
}
if (startIndex !== -1 && endIndex !== -1) {
const jsonString = text.slice(startIndex, endIndex + 1);
try {
const jsonObject = JSON.parse(jsonString);
return jsonObject;
} catch (e) {
return null; // 如果不是有效的 JSON
}
}
return null; // 如果没有找到有效的 JSON 对象
}
function safeExtractJson(text) {
try {
const jsonObject = extractFirstJson(text);
return jsonObject
} catch (e) {
console.error('JSON 解析失败:', e);
}
return null;
}
export function clearJobMoreMap() { // 切换对话清空
jobMoreMap.clear()
}
export function parseMarkdown(content) {
if (!content) {
return [] //处理特殊情况,比如网络异常导致的响应的 content 的值为空
}
// 过滤掉<think>标签及其内容这些是AI内部思考过程不应该显示给用户
// 1. 处理原始标签(支持多行)
content = content.replace(/<\s*think\s*>[\s\S]*?<\s*\/\s*think\s*>/gi, '')
// 2. 处理HTML编码的标签
content = content.replace(/&lt;\s*think\s*&gt;[\s\S]*?&lt;\s*\/\s*think\s*&gt;/gi, '')
// 3. 处理部分编码的标签
content = content.replace(/&lt;\s*think\s*>/gi, '')
content = content.replace(/<\s*\/\s*think\s*&gt;/gi, '')
codeDataList = []
jobCardsList = [] // 清空岗位卡片列表,避免重复
const unsafeHtml = md.render(content || '')
// 在markdown渲染后再次过滤确保没有遗漏
let filteredHtml = unsafeHtml
// 1. 处理原始标签(支持多行)
filteredHtml = filteredHtml.replace(/<\s*think\s*>[\s\S]*?<\s*\/\s*think\s*>/gi, '')
// 2. 处理HTML编码的标签
filteredHtml = filteredHtml.replace(/&lt;\s*think\s*&gt;[\s\S]*?&lt;\s*\/\s*think\s*&gt;/gi, '')
// 3. 处理部分编码的标签
filteredHtml = filteredHtml.replace(/&lt;\s*think\s*>/gi, '')
filteredHtml = filteredHtml.replace(/<\s*\/\s*think\s*&gt;/gi, '')
// 4. 单独处理剩余的think标签对
filteredHtml = filteredHtml.replace(/&lt;think&gt;/gi, '')
filteredHtml = filteredHtml.replace(/&lt;\/think&gt;/gi, '')
filteredHtml = filteredHtml.replace(/<think>/gi, '')
filteredHtml = filteredHtml.replace(/<\/think>/gi, '')
// 根据平台返回不同的内容格式
// 微信小程序返回rich-text组件支持的nodes格式
// H5直接返回HTML字符串避免HTML解析错误
if (process.env.UNI_PLATFORM === 'mp-weixin') {
try {
return parseHtml(filteredHtml)
} catch (error) {
console.error('HTML解析失败:', error)
// 解析失败时返回空数组,避免页面崩溃
return []
}
} else {
// H5端直接返回HTML字符串
return filteredHtml
}
}

View File

@@ -27,6 +27,7 @@ function StreamRequestMiniProgram(url, data = {}, onDataReceived, onError, onCom
return new Promise((resolve, reject) => {
let buffer = '';
let hasReceivedContent = false;
const requestTask = uni.request({
url: config.StreamBaseURl + url,
@@ -50,20 +51,127 @@ function StreamRequestMiniProgram(url, data = {}, onDataReceived, onError, onCom
}
});
// UTF-8解码函数用于微信小程序真机环境
function utf8Decode(uint8Array) {
let result = '';
let i = 0;
const len = uint8Array.length;
while (i < len) {
const byte1 = uint8Array[i];
// 1字节字符 (0xxxxxxx)
if (byte1 < 0x80) {
result += String.fromCharCode(byte1);
i++;
}
// 2字节字符 (110xxxxx 10xxxxxx)
else if (byte1 >= 0xC0 && byte1 < 0xE0) {
if (i + 1 < len) {
const byte2 = uint8Array[i + 1];
if (byte2 >= 0x80 && byte2 < 0xC0) {
const codePoint = ((byte1 & 0x1F) << 6) | (byte2 & 0x3F);
result += String.fromCharCode(codePoint);
i += 2;
continue;
}
}
// 无效的UTF-8序列跳过
result += '<27>';
i++;
}
// 3字节字符 (1110xxxx 10xxxxxx 10xxxxxx)
else if (byte1 >= 0xE0 && byte1 < 0xF0) {
if (i + 2 < len) {
const byte2 = uint8Array[i + 1];
const byte3 = uint8Array[i + 2];
if ((byte2 >= 0x80 && byte2 < 0xC0) && (byte3 >= 0x80 && byte3 < 0xC0)) {
const codePoint = ((byte1 & 0x0F) << 12) | ((byte2 & 0x3F) << 6) | (byte3 & 0x3F);
result += String.fromCharCode(codePoint);
i += 3;
continue;
}
}
// 无效的UTF-8序列跳过
result += '<27>';
i++;
}
// 4字节字符 (11110xxx 10xxxxxx 10xxxxxx 10xxxxxx)
else if (byte1 >= 0xF0 && byte1 < 0xF8) {
if (i + 3 < len) {
const byte2 = uint8Array[i + 1];
const byte3 = uint8Array[i + 2];
const byte4 = uint8Array[i + 3];
if ((byte2 >= 0x80 && byte2 < 0xC0) && (byte3 >= 0x80 && byte3 < 0xC0) && (byte4 >= 0x80 && byte4 < 0xC0)) {
let codePoint = ((byte1 & 0x07) << 18) | ((byte2 & 0x3F) << 12) | ((byte3 & 0x3F) << 6) | (byte4 & 0x3F);
// 处理UTF-16代理对
if (codePoint >= 0x10000) {
codePoint -= 0x10000;
const highSurrogate = (codePoint >> 10) + 0xD800;
const lowSurrogate = (codePoint & 0x3FF) + 0xDC00;
result += String.fromCharCode(highSurrogate, lowSurrogate);
} else {
result += String.fromCharCode(codePoint);
}
i += 4;
continue;
}
}
// 无效的UTF-8序列跳过
result += '<27>';
i++;
}
// 无效的UTF-8序列跳过
else {
result += '<27>';
i++;
}
}
return result;
}
// 监听分块数据
requestTask.onChunkReceived((res) => {
try {
const decoder = new TextDecoder('utf-8');
const chunk = decoder.decode(new Uint8Array(res.data));
// 微信小程序兼容处理微信小程序不支持TextDecoder使用自定义UTF-8解码
let chunk = '';
if (typeof TextDecoder !== 'undefined') {
// 支持TextDecoder的环境如开发者工具
const decoder = new TextDecoder('utf-8');
chunk = decoder.decode(new Uint8Array(res.data));
} else {
// 微信小程序真机环境使用自定义UTF-8解码函数
const uint8Array = new Uint8Array(res.data);
chunk = utf8Decode(uint8Array);
}
console.log('📦 收到分块数据:', chunk);
buffer += chunk;
let lines = buffer.split("\n");
buffer = lines.pop() || ''; // 保留不完整的行
console.log('📝 解析到行:', lines.length, '行,缓冲区剩余:', buffer.length, '字符');
for (let line of lines) {
if (line.startsWith("data: ")) {
const jsonData = line.slice(6).trim();
console.log('🔍 处理行:', line);
// 处理重复的 data: 前缀
let processedLine = line;
// 移除所有开头的 data: 前缀(无论是否有空格),直到只剩下一个或没有
while (processedLine.startsWith("data:")) {
// 检查是否还有另一个 data: 前缀
const nextPart = processedLine.slice(5).trimStart();
if (nextPart.startsWith("data:")) {
processedLine = nextPart;
} else {
break;
}
}
if (processedLine.startsWith("data: ")) {
const jsonData = processedLine.slice(6).trim();
console.log('📄 提取的JSON数据:', jsonData);
if (jsonData === "[DONE]") {
console.log('✅ 收到结束标记 [DONE]');
onComplete && onComplete();
resolve();
return;
@@ -72,11 +180,35 @@ function StreamRequestMiniProgram(url, data = {}, onDataReceived, onError, onCom
if (jsonData && jsonData.trim()) {
try {
const parsedData = JSON.parse(jsonData);
console.log('🔧 解析后的JSON:', parsedData);
// 检查是否有错误信息
const finishReason = parsedData?.choices?.[0]?.finish_reason;
if (finishReason === "error") {
let errorContent = parsedData?.choices?.[0]?.delta?.content || "流式请求失败";
console.error('❌ 收到错误信息:', errorContent);
// 优化token超限错误提示
if (errorContent.includes("maximum input ids length")) {
errorContent = "对话历史过长,请尝试清除部分历史记录或简化问题";
}
// 只有当未收到正常内容时才显示错误信息
if (!hasReceivedContent) {
// 显示错误信息给用户
uni.showToast({
title: errorContent,
icon: 'none',
duration: 3000
});
}
}
// 处理标准的choices格式
if (parsedData?.choices?.[0]?.delta?.content) {
else if (parsedData?.choices?.[0]?.delta?.content) {
const content = parsedData.choices[0].delta.content;
if (content) {
hasReceivedContent = true;
console.log('📤 调用onDataReceived(content):', content);
onDataReceived && onDataReceived(content);
}
}
@@ -84,6 +216,8 @@ function StreamRequestMiniProgram(url, data = {}, onDataReceived, onError, onCom
else if (parsedData?.choices?.[0]?.delta?.reasoning_content) {
const content = parsedData.choices[0].delta.reasoning_content;
if (content) {
hasReceivedContent = true;
console.log('📤 调用onDataReceived(reasoning_content):', content);
onDataReceived && onDataReceived(content);
}
}
@@ -91,14 +225,42 @@ function StreamRequestMiniProgram(url, data = {}, onDataReceived, onError, onCom
else if (parsedData?.tool?.response) {
const content = parsedData.tool.response;
if (content) {
hasReceivedContent = true;
console.log('📤 调用onDataReceived(tool.response):', content);
onDataReceived && onDataReceived(content);
}
}
// 处理其他可能的内容格式
else if (parsedData?.content) {
// 直接返回content字段的情况
const content = parsedData.content;
if (content) {
hasReceivedContent = true;
console.log('📤 调用onDataReceived(direct content):', content);
onDataReceived && onDataReceived(content);
}
}
// 处理完整的text字段非流式
else if (parsedData?.choices?.[0]?.text) {
const content = parsedData.choices[0].text;
if (content) {
hasReceivedContent = true;
console.log('📤 调用onDataReceived(full text):', content);
onDataReceived && onDataReceived(content);
}
}
else {
console.warn('⚠️ 未匹配到任何内容格式:', parsedData);
}
} catch (e) {
console.error("JSON 解析失败:", e.message);
console.error("JSON 解析失败:", e.message, "原始数据:", jsonData);
}
}
}
else if (processedLine.trim()) {
// 处理非data:开头的行
console.warn('⚠️ 收到非data:开头的行:', processedLine);
}
}
} catch (error) {
console.error('处理分块数据失败:', error);
@@ -135,6 +297,7 @@ function StreamRequestH5(url, data = {}, onDataReceived, onError, onComplete) {
let buffer = "";
let retryCount = 0;
const maxRetries = 3;
let hasReceivedContent = false;
while (true) {
const {
@@ -157,9 +320,25 @@ function StreamRequestH5(url, data = {}, onDataReceived, onError, onComplete) {
console.log(`📦 Processing ${lines.length} lines, buffer length: ${buffer.length}`);
for (let line of lines) {
if (line.startsWith("data: ")) {
const jsonData = line.slice(6).trim();
console.log('🔍 处理行:', line);
// 处理重复的 data: 前缀
let processedLine = line;
// 移除所有开头的 data: 前缀(无论是否有空格),直到只剩下一个或没有
while (processedLine.startsWith("data:")) {
// 检查是否还有另一个 data: 前缀
const nextPart = processedLine.slice(5).trimStart();
if (nextPart.startsWith("data:")) {
processedLine = nextPart;
} else {
break;
}
}
if (processedLine.startsWith("data: ")) {
const jsonData = processedLine.slice(6).trim();
console.log('📄 提取的JSON数据:', jsonData);
if (jsonData === "[DONE]") {
console.log('✅ 收到结束标记 [DONE]');
onComplete && onComplete();
resolve();
return;
@@ -169,11 +348,35 @@ function StreamRequestH5(url, data = {}, onDataReceived, onError, onComplete) {
// 检查JSON数据是否完整
if (jsonData && jsonData.trim() && jsonData !== "[DONE]") {
const parsedData = JSON.parse(jsonData);
console.log('🔧 解析后的JSON:', parsedData);
// 检查是否有错误信息
const finishReason = parsedData?.choices?.[0]?.finish_reason;
if (finishReason === "error") {
let errorContent = parsedData?.choices?.[0]?.delta?.content || "流式请求失败";
console.error('❌ 收到错误信息:', errorContent);
// 优化token超限错误提示
if (errorContent.includes("maximum input ids length")) {
errorContent = "对话历史过长,请尝试清除部分历史记录或简化问题";
}
// 只有当未收到正常内容时才显示错误信息
if (!hasReceivedContent) {
// 显示错误信息给用户
uni.showToast({
title: errorContent,
icon: 'none',
duration: 3000
});
}
}
// 处理标准的choices格式
if (parsedData?.choices?.[0]?.delta?.content) {
else if (parsedData?.choices?.[0]?.delta?.content) {
const content = parsedData.choices[0].delta.content;
if (content) {
hasReceivedContent = true;
console.log('📤 调用onDataReceived(content):', content);
onDataReceived && onDataReceived(content);
}
}
@@ -181,6 +384,8 @@ function StreamRequestH5(url, data = {}, onDataReceived, onError, onComplete) {
else if (parsedData?.choices?.[0]?.delta?.reasoning_content) {
const content = parsedData.choices[0].delta.reasoning_content;
if (content) {
hasReceivedContent = true;
console.log('📤 调用onDataReceived(reasoning_content):', content);
onDataReceived && onDataReceived(content);
}
}
@@ -188,6 +393,27 @@ function StreamRequestH5(url, data = {}, onDataReceived, onError, onComplete) {
else if (parsedData?.tool?.response) {
const content = parsedData.tool.response;
if (content) {
hasReceivedContent = true;
console.log('📤 调用onDataReceived(tool.response):', content);
onDataReceived && onDataReceived(content);
}
}
// 处理其他可能的内容格式
else if (parsedData?.content) {
// 直接返回content字段的情况
const content = parsedData.content;
if (content) {
hasReceivedContent = true;
console.log('📤 调用onDataReceived(direct content):', content);
onDataReceived && onDataReceived(content);
}
}
// 处理完整的text字段非流式
else if (parsedData?.choices?.[0]?.text) {
const content = parsedData.choices[0].text;
if (content) {
hasReceivedContent = true;
console.log('📤 调用onDataReceived(full text):', content);
onDataReceived && onDataReceived(content);
}
}
@@ -201,6 +427,10 @@ function StreamRequestH5(url, data = {}, onDataReceived, onError, onComplete) {
// 不抛出错误,继续处理下一个数据块
}
}
else if (processedLine.trim()) {
// 处理非data:开头的行
console.warn('⚠️ 收到非data:开头的行:', processedLine);
}
}
}
@@ -209,16 +439,55 @@ function StreamRequestH5(url, data = {}, onDataReceived, onError, onComplete) {
console.log("📦 Processing remaining buffer:", buffer.substring(0, 100) + "...");
const lines = buffer.split("\n");
for (let line of lines) {
if (line.startsWith("data: ")) {
const jsonData = line.slice(6).trim();
console.log('🔍 处理剩余缓冲区行:', line);
// 处理重复的 data: 前缀
let processedLine = line;
// 移除所有开头的 data: 前缀(无论是否有空格),直到只剩下一个或没有
while (processedLine.startsWith("data:")) {
// 检查是否还有另一个 data: 前缀
const nextPart = processedLine.slice(5).trimStart();
if (nextPart.startsWith("data:")) {
processedLine = nextPart;
} else {
break;
}
}
if (processedLine.startsWith("data: ")) {
const jsonData = processedLine.slice(6).trim();
console.log('📄 提取的剩余JSON数据:', jsonData);
if (jsonData && jsonData !== "[DONE]") {
try {
const parsedData = JSON.parse(jsonData);
console.log('🔧 解析后的剩余JSON:', parsedData);
// 检查是否有错误信息
const finishReason = parsedData?.choices?.[0]?.finish_reason;
if (finishReason === "error") {
let errorContent = parsedData?.choices?.[0]?.delta?.content || "流式请求失败";
console.error('❌ 收到错误信息:', errorContent);
// 优化token超限错误提示
if (errorContent.includes("maximum input ids length")) {
errorContent = "对话历史过长,请尝试清除部分历史记录或简化问题";
}
// 只有当未收到正常内容时才显示错误信息
if (!hasReceivedContent) {
// 显示错误信息给用户
uni.showToast({
title: errorContent,
icon: 'none',
duration: 3000
});
}
}
// 处理标准的choices格式
if (parsedData?.choices?.[0]?.delta?.content) {
else if (parsedData?.choices?.[0]?.delta?.content) {
const content = parsedData.choices[0].delta.content;
if (content) {
hasReceivedContent = true;
console.log('📤 调用onDataReceived(content):', content);
onDataReceived && onDataReceived(content);
}
}
@@ -226,6 +495,8 @@ function StreamRequestH5(url, data = {}, onDataReceived, onError, onComplete) {
else if (parsedData?.choices?.[0]?.delta?.reasoning_content) {
const content = parsedData.choices[0].delta.reasoning_content;
if (content) {
hasReceivedContent = true;
console.log('📤 调用onDataReceived(reasoning_content):', content);
onDataReceived && onDataReceived(content);
}
}
@@ -233,6 +504,27 @@ function StreamRequestH5(url, data = {}, onDataReceived, onError, onComplete) {
else if (parsedData?.tool?.response) {
const content = parsedData.tool.response;
if (content) {
hasReceivedContent = true;
console.log('📤 调用onDataReceived(tool.response):', content);
onDataReceived && onDataReceived(content);
}
}
// 处理其他可能的内容格式
else if (parsedData?.content) {
// 直接返回content字段的情况
const content = parsedData.content;
if (content) {
hasReceivedContent = true;
console.log('📤 调用onDataReceived(direct content):', content);
onDataReceived && onDataReceived(content);
}
}
// 处理完整的text字段非流式
else if (parsedData?.choices?.[0]?.text) {
const content = parsedData.choices[0].text;
if (content) {
hasReceivedContent = true;
console.log('📤 调用onDataReceived(full text):', content);
onDataReceived && onDataReceived(content);
}
}
@@ -241,6 +533,10 @@ function StreamRequestH5(url, data = {}, onDataReceived, onError, onComplete) {
}
}
}
else if (processedLine.trim()) {
// 处理非data:开头的行
console.warn('⚠️ 收到非data:开头的剩余行:', processedLine);
}
}
}
@@ -295,16 +591,27 @@ export function chatRequest(url, data = {}, method = 'GET', loading = false, hea
return
}
uni.showToast({
title: msg,
title: msg || '请求失败',
icon: 'none'
})
// 拒绝Promise并提供详细错误信息
const err = new Error(msg || '请求失败,服务器返回错误码: ' + code)
err.error = resData
reject(err)
} else {
// 处理非200状态码
const errorMsg = `请求失败HTTP状态码: ${resData.statusCode}`
uni.showToast({
title: errorMsg,
icon: 'none'
})
const err = new Error(errorMsg)
err.error = resData
reject(err)
}
if (resData.data?.code === 401 || resData.data?.code === 402) {
useUserStore().logOut()
}
const err = new Error('请求出现异常,请联系工作人员')
err.error = resData
reject(err)
},
fail: (err) => {
reject(err)