Merge branch 'main' into yxl

This commit is contained in:
2026-06-01 10:06:22 +08:00
15 changed files with 76 additions and 93 deletions

View File

@@ -13,7 +13,7 @@
v-for="(card, index) in localJobCardsList"
:key="index"
class="custom-card"
@tap="navigateToJobDetail(card.jobId)"
@tap="navigateToJobDetail(card.encryptJobId)"
>
<view class="card-title">
<text class="title-text">{{ card.jobTitle }}</text>
@@ -76,26 +76,24 @@ watch(() => renderedHtml.value, (newVal) => {
});
// 微信小程序端导航到岗位详情页面
const navigateToJobDetail = (jobId) => {
console.log('navigateToJobDetail called with jobId:', jobId);
if (jobId && jobId !== 'undefined' && jobId !== 'null') {
// 跳转到岗位详情页面
const navigateToJobDetail = (encryptJobId) => {
console.log('navigateToJobDetail called with encryptJobId:', encryptJobId);
if (encryptJobId && encryptJobId !== 'undefined' && encryptJobId !== 'null') {
let url = `/packageA/pages/post/post?encryptJobId=${encryptJobId}`
uni.navigateTo({
url: `/packageA/pages/post/post?jobId=${jobId}`,
url: url,
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}`,
url: url,
success: (res2) => {
console.log('redirectTo success:', res2);
},
fail: (err2) => {
console.error('redirectTo also failed:', err2);
// 如果还是失败,显示错误提示
uni.showToast({
title: '跳转失败,请稍后重试',
icon: 'none'
@@ -105,7 +103,7 @@ const navigateToJobDetail = (jobId) => {
}
});
} else {
console.error('Invalid jobId:', jobId);
console.error('Invalid encryptJobId:', encryptJobId);
uni.showToast({
title: '岗位信息不完整',
icon: 'none'
@@ -134,36 +132,33 @@ const handleH5Click = (e) => {
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);
let encryptJobId = cardElement.getAttribute('data-encrypt-job-id');
console.log('Found custom-card, data-encrypt-job-id attribute:', encryptJobId);
// 如果data-job-id为空尝试从onclick事件中提取jobId
if (!jobId) {
if (!encryptJobId) {
const onclick = cardElement.getAttribute('onclick');
if (onclick) {
const match = onclick.match(/jobId=(\w+)/);
const match = onclick.match(/encryptJobId=([^'"]+)/);
if (match && match[1]) {
jobId = match[1];
console.log('Extracted jobId from onclick:', jobId);
encryptJobId = match[1];
console.log('Extracted encryptJobId from onclick:', encryptJobId);
}
}
}
if (jobId) {
console.log('Final jobId for navigation:', jobId);
if (encryptJobId) {
console.log('Final encryptJobId for navigation:', encryptJobId);
try {
// 直接使用uni.navigateTo避免navTo函数的潜在问题
let url = `/packageA/pages/post/post?encryptJobId=${encryptJobId}`
uni.navigateTo({
url: `/packageA/pages/post/post?jobId=${jobId}`,
url: url,
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}`,
url: url,
success: (res2) => {
console.log('redirectTo success:', res2);
},
@@ -178,39 +173,36 @@ const handleH5Click = (e) => {
}
return;
} else {
console.error('No jobId found for custom-card');
console.error('No encryptJobId 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);
let encryptJobId = moreElement.getAttribute('data-encrypt-job-id');
console.log('Found custom-more, data-encrypt-job-id attribute:', encryptJobId);
// 如果data-job-id为空尝试从onclick事件中提取jobId
if (!jobId) {
if (!encryptJobId) {
const onclick = moreElement.getAttribute('onclick');
if (onclick) {
const match = onclick.match(/jobId=(\w+)/);
const match = onclick.match(/encryptJobId=([^'"]+)/);
if (match && match[1]) {
jobId = match[1];
console.log('Extracted jobId from onclick:', jobId);
encryptJobId = match[1];
console.log('Extracted encryptJobId from onclick:', encryptJobId);
}
}
}
if (jobId) {
console.log('Final jobId for more jobs:', jobId);
if (encryptJobId) {
console.log('Final encryptJobId for more jobs:', encryptJobId);
try {
// 直接使用uni.navigateTo避免navTo函数的潜在问题
let url = `/packageA/pages/moreJobs/moreJobs?encryptJobId=${encryptJobId}`
uni.navigateTo({
url: `/packageA/pages/moreJobs/moreJobs?jobId=${jobId}`,
url: url,
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}`,
url: url,
success: (res2) => {
console.log('redirectTo success:', res2);
},

View File

@@ -42,7 +42,7 @@ onReachBottom(() => {
});
function navToPost(job) {
navTo(`/packageA/pages/post/post?jobId=${encodeURIComponent(job.jobId)}&encryptJobId=${encodeURIComponent(job.encryptJobId)}`);
navTo(`/packageA/pages/post/post?encryptJobId=${encodeURIComponent(job.encryptJobId)}`);
}
function getJobList(type = 'add') {

View File

@@ -368,7 +368,7 @@
function navToJobDetail(jobId) {
return
if (jobId) {
navTo(`/packageA/pages/post/post?jobId=${encodeURIComponent(jobId)}`);
navTo(`/packageA/pages/post/post`);
}
}

View File

@@ -84,7 +84,7 @@ function toSelectDate() {
}
function navToPost(job) {
navTo(`/packageA/pages/post/post?jobId=${encodeURIComponent(job.jobId)}&encryptJobId=${encodeURIComponent(job.encryptJobId)}`);
navTo(`/packageA/pages/post/post?encryptJobId=${encodeURIComponent(job.encryptJobId)}`);
}
function searchCollection(e) {

View File

@@ -48,7 +48,7 @@ onReachBottom(() => {
});
function navToPost(job) {
navTo(`/packageA/pages/post/post?jobId=${encodeURIComponent(job.jobId)}&encryptJobId=${encodeURIComponent(job.encryptJobId)}`);
navTo(`/packageA/pages/post/post?encryptJobId=${encodeURIComponent(job.encryptJobId)}`);
}
function getJobList(type = 'add') {

View File

@@ -197,7 +197,7 @@ onLoad(() => {
});
function navToPost(jobId) {
navTo(`/packageA/pages/post/post?jobId=${encodeURIComponent(jobId)}`);
navTo(`/packageA/pages/post/post`);
}
async function loadData() {

View File

@@ -187,7 +187,7 @@ const fromValue = reactive({
politicalAffiliation: '',
idCard: '',
phone: '',
userType: ''
userTag: ''
});
// 输入校验相关
@@ -280,9 +280,9 @@ function initLoad() {
}
// 回显人员类型
if (currentUserInfo.userType) {
fromValue.userType = currentUserInfo.userType;
const userTypeValues = currentUserInfo.userType.split(',');
if (currentUserInfo.userTag) {
fromValue.userTag = currentUserInfo.userTag;
const userTypeValues = currentUserInfo.userTag.split(',');
state.userTypeValues = userTypeValues;
initUserTypeText(userTypeValues);
}
@@ -355,10 +355,10 @@ function initUserTypeText(userTypeValues) {
getDictSelectOption('user_type').then(data => {
if (!trySetText(data)) {
state.userTypeText = fromValue.userType;
state.userTypeText = fromValue.userTag;
}
}).catch(() => {
state.userTypeText = fromValue.userType;
state.userTypeText = fromValue.userTag;
});
}
@@ -375,9 +375,7 @@ const confirm = () => {
if (!fromValue.politicalAffiliation) {
return $api.msg('请选择政治面貌');
}
if (!fromValue.userType) {
return $api.msg('请选择人员类型');
}
if (!checkingPhoneRegExp(fromValue.phone)) {
return $api.msg('请输入正确手机号');
}
@@ -724,7 +722,7 @@ async function changeUserType() {
defaultValues: state.userTypeValues,
success: (selectedValues, selectedItems) => {
state.userTypeValues = selectedValues;
fromValue.userType = selectedValues.join(',');
fromValue.userTag = selectedValues.join(',');
state.userTypeText = selectedItems.map(item => item.label).join('、');
},
});

View File

@@ -272,7 +272,6 @@ const jobInfo = ref({});
const state = reactive({});
const mapCovers = ref([]);
const jobIdRef = ref();
const jobId = ref();
// 竞争力分析数据,初始化为包含默认值的完整结构,确保雷达图能正常渲染
const raderData = ref({
matchScore: 0,
@@ -316,9 +315,6 @@ onShow(() => {
});
function initLoad(option) {
const encryptJobId = decodeURIComponent(option.encryptJobId);
if (option.jobId) {
jobId.value = decodeURIComponent(option.jobId);
}
if (encryptJobId !== jobIdRef.value) {
jobIdRef.value = encryptJobId;
getDetail(encryptJobId);
@@ -468,12 +464,9 @@ function confirmAction() {
const encryptJobId = jobIdRef.value;
if (jobInfo.value.isApply === 1) {
// 取消投递
const cancelJobId = jobId.value || jobInfo.value.jobId;
console.log(jobInfo.value.jobId, 'jobInfo.value.jobId');
$api.createRequest(`/app/job/applyJobCencal`, { jobId: jobInfo.value.jobId }, 'DELETE').then((resData) => {
$api.createRequest(`/app/job/applyJobCencal/${encryptJobId}`, {}, 'DELETE').then((resData) => {
$api.msg('取消投递成功');
getDetail(encryptJobId); // 刷新职位信息
getDetail(encryptJobId);
showConfirmDialog.value = false;
});
} else {
@@ -501,8 +494,7 @@ function confirmApply() {
// 取消投递
function cancelApply() {
const cancelJobId = jobId.value || jobInfo.value.jobId;
$api.createRequest(`/app/job/applyJobCencal`, { jobId: cancelJobId }, 'DELETE').then((resData) => {
$api.createRequest(`/app/job/applyJobCencal`, { jobId: jobIdRef.value }, 'DELETE').then((resData) => {
$api.msg('取消投递成功');
showConfirmDialog.value = false;
});

View File

@@ -53,7 +53,7 @@ function nextDetail() {
recommedIndexDb.addRecord(recordData);
}
console.log(job.jobId);
navTo(`/packageA/pages/post/post?jobId=${encodeURIComponent(job.jobId)}`);
navTo(`/packageA/pages/post/post`);
}
function getNextVideoSrc(num) {

View File

@@ -1102,7 +1102,7 @@ function clearfindJob(job) {
}
function nextDetail(job) {
navTo(`/packageA/pages/post/post?jobId=${encodeURIComponent(job.jobId)}&encryptJobId=${encodeURIComponent(job.encryptJobId)}`);
navTo(`/packageA/pages/post/post?encryptJobId=${encodeURIComponent(job.encryptJobId)}`);
}
function navToService(serviceType) {

View File

@@ -151,7 +151,7 @@ function nextDetail(job) {
const recordData = recommedIndexDb.JobParameter(job);
recommedIndexDb.addRecord(recordData);
}
navTo(`/packageA/pages/post/post?jobId=${encodeURIComponent(job.jobId)}`);
navTo(`/packageA/pages/post/post`);
}
function nextVideo(job) {

View File

@@ -113,7 +113,7 @@ function handleMsgClick() {
if (item.noticeType === '4') {
if (item.bussinessIdEncrypt) {
navTo(`/packageA/pages/post/post?jobId=${encodeURIComponent(item.bussinessId)}&encryptJobId=${encodeURIComponent(item.bussinessIdEncrypt)}`);
navTo(`/packageA/pages/post/post?encryptJobId=${encodeURIComponent(item.bussinessIdEncrypt)}`);
}
return;
}

View File

@@ -134,7 +134,7 @@ function nextDetail(job) {
const recordData = recommedIndexDb.JobParameter(job);
recommedIndexDb.addRecord(recordData);
}
navTo(`/packageA/pages/post/post?jobId=${encodeURIComponent(job.jobId)}&encryptJobId=${encodeURIComponent(job.encryptJobId)}`);
navTo(`/packageA/pages/post/post?encryptJobId=${encodeURIComponent(job.encryptJobId)}`);
}
function nextVideo(job) {

View File

@@ -19,30 +19,31 @@ const md = new MarkdownIt({
if (lang === 'job-json') {
const result = safeExtractJson(str);
if (result) { // json解析成功
let jobId = result.appJobUrl;
let encryptJobId = 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];
if (encryptJobId && encryptJobId.includes('jobId=')) {
encryptJobId = encryptJobId.split('jobId=')[1];
// 如果还有额外的参数,只取encryptJobId部分
if (encryptJobId.includes('&')) {
encryptJobId = encryptJobId.split('&')[0];
}
}
console.log('Job JSON result:', result, 'Extracted jobId:', jobId);
console.log('Job JSON result:', result, 'Extracted encryptJobId:', encryptJobId);
// 确保jobId有效
if (!jobId || jobId === 'undefined' || jobId === 'null') {
console.error('Invalid jobId extracted:', jobId, 'from appJobUrl:', result.appJobUrl);
// 尝试从其他字段获取jobId
// 确保encryptJobId有效
if (!encryptJobId || encryptJobId === 'undefined' || encryptJobId === 'null') {
console.error('Invalid encryptJobId extracted:', encryptJobId, 'from appJobUrl:', result.appJobUrl);
// 尝试从其他字段获取encryptJobId
if (result.jobId) {
jobId = result.jobId;
console.log('Using jobId from result.jobId:', jobId);
encryptJobId = result.jobId;
console.log('Using jobId from result.jobId as encryptJobId:', encryptJobId);
}
}
// 添加到岗位卡片列表,供小程序端单独渲染
jobCardsList.push({
jobId,
jobId: encryptJobId,
encryptJobId,
jobTitle: result.jobTitle,
salary: result.salary,
location: result.location,
@@ -53,13 +54,13 @@ const md = new MarkdownIt({
// 生成岗位卡片HTML注意微信小程序rich-text组件只支持部分HTML属性
// 使用普通的href属性微信小程序rich-text会将其转换为可点击链接
// 添加data-job-id属性方便获取jobId
// 添加data-encrypt-job-id属性方便获取encryptJobId
// 为所有平台添加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>`
let domContext = `<a class="custom-card" href="/packageA/pages/post/post?encryptJobId=${encryptJobId}" data-encrypt-job-id="${encryptJobId}" onclick="if(typeof uni !== 'undefined'){uni.navigateTo({url: '/packageA/pages/post/post?encryptJobId=${encryptJobId}'});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; display: inline-flex; align-items: center; justify-content: center; height: 15px; line-height: 15px;">${result.experience}</div></div><div class="info-item">查看详情<div class="position-nav" style="width: 14px; height: 14px; background: url('@/static/svg/position-nav.svg') center center no-repeat; background-size: 100% 100%; margin-left: 10px;padding-right: 50rpx"></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>`
jobMoreMap.set(encryptJobId, result.data)
domContext += `<a class="custom-more" href="/packageA/pages/moreJobs/moreJobs?encryptJobId=${encryptJobId}" data-encrypt-job-id="${encryptJobId}" onclick="if(typeof uni !== 'undefined'){uni.navigateTo({url: '/packageA/pages/moreJobs/moreJobs?encryptJobId=${encryptJobId}'});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
}

View File

@@ -188,8 +188,8 @@ export function createRequest(url, data = {}, method = 'GET', loading = false, h
header,
success: resData => {
const responseData = handleResponseData(resData.data)
// console.log('[请求] 接口地址:', config.baseUrl + url)
// console.log('[请求] 解密后数据:', JSON.stringify(responseData))
console.log('[请求] 接口地址:', config.baseUrl + url)
console.log('[请求] 解密后数据:', JSON.stringify(responseData))
// 响应拦截
if (resData.statusCode === 200) {
const {