企业用户bug修复

This commit is contained in:
冯辉
2025-11-13 19:28:00 +08:00
parent 1863cd8f62
commit 4ab0bc2f6e
8 changed files with 221 additions and 47 deletions

View File

@@ -5,7 +5,7 @@
<input class="uni-input searchinput" confirm-type="search" />
</view>
<view class="sex-content">
<scroll-view :show-scrollbar="false" :scroll-y="true" class="sex-content-left">
<scroll-view ref="leftScroll" :show-scrollbar="false" :scroll-y="true" class="sex-content-left">
<view
v-for="item in copyTree"
:key="item.id"
@@ -25,6 +25,7 @@
@scroll="scrollTopBack"
:scroll-y="true"
class="sex-content-right"
@wheel="handleWheel"
>
<view v-for="item in rightValue" :key="item.id">
<view class="secondary-title">{{ item.label }}</view>
@@ -94,9 +95,104 @@ export default {
this.leftValue = item;
this.rightValue = item.children;
this.scrollTop = 0;
// 确保左侧列表滚动到正确位置,让当前选中的标签可见
this.$nextTick(() => {
const index = this.copyTree.findIndex(i => i.id === item.id);
if (index !== -1 && this.$refs.leftScroll) {
// 计算需要滚动的距离每个选项高度约160rpx
const scrollTop = index * 160;
// 获取左侧列表的可见高度假设可见区域能显示约3-4个选项
const visibleHeight = 4 * 160; // 约4个选项的高度
// 确保选中的标签在可见区域内
let targetScrollTop = scrollTop;
// 如果选中的标签在底部,确保它不会滚动出可见区域
if (scrollTop > this.$refs.leftScroll.scrollHeight - visibleHeight) {
targetScrollTop = Math.max(0, this.$refs.leftScroll.scrollHeight - visibleHeight);
}
this.$refs.leftScroll.scrollTo({
top: targetScrollTop,
duration: 300
});
}
});
},
scrollTopBack(e) {
this.scrollTop = e.detail.scrollTop;
// 滚动时自动选中对应的左侧标签
const scrollTop = e.detail.scrollTop;
let currentSection = null;
let minDistance = Infinity;
// 遍历所有右侧的二级标题,找到当前最接近顶部的那个
this.rightValue.forEach((section, index) => {
// 估算每个section的位置假设每个section高度大约为 200rpx
const sectionTop = index * 200;
const distance = Math.abs(sectionTop - scrollTop);
if (distance < minDistance) {
minDistance = distance;
currentSection = section;
}
});
// 如果找到了对应的section并且不是当前选中的左侧标签则切换左侧标签
if (currentSection && this.leftValue.id !== currentSection.parentId) {
const parentItem = this.copyTree.find(item => item.id === currentSection.parentId);
if (parentItem) {
this.leftValue = parentItem;
// 确保左侧列表滚动到正确位置,让当前选中的标签可见
this.$nextTick(() => {
const index = this.copyTree.findIndex(i => i.id === parentItem.id);
if (index !== -1 && this.$refs.leftScroll) {
// 计算需要滚动的距离每个选项高度约160rpx
const scrollTop = index * 160;
// 获取左侧列表的可见高度假设可见区域能显示约3-4个选项
const visibleHeight = 4 * 160; // 约4个选项的高度
// 确保选中的标签在可见区域内
let targetScrollTop = scrollTop;
// 如果选中的标签在底部,确保它不会滚动出可见区域
if (scrollTop > this.$refs.leftScroll.scrollHeight - visibleHeight) {
targetScrollTop = Math.max(0, this.$refs.leftScroll.scrollHeight - visibleHeight);
}
this.$refs.leftScroll.scrollTo({
top: targetScrollTop,
duration: 300
});
}
});
}
}
},
handleWheel(e) {
// 处理鼠标滚轮事件,让右侧内容可以滚动
e.preventDefault();
const delta = e.deltaY || e.wheelDelta;
// 更平滑的滚动,根据滚轮速度调整滚动量
const scrollAmount = Math.abs(delta) > 100 ? 80 : 40;
const direction = delta > 0 ? 1 : -1;
// 更新scrollTop来模拟滚动
this.scrollTop += scrollAmount * direction;
// 确保scrollTop在合理范围内
this.scrollTop = Math.max(0, this.scrollTop);
// 触发scroll事件来更新左侧标签选中状态
this.$nextTick(() => {
this.scrollTopBack({ detail: { scrollTop: this.scrollTop } });
});
},
addItem(item) {
let titiles = [];

View File

@@ -125,6 +125,12 @@ const cleanup = () => {
};
const changeJobTitleId = (e) => {
if (!e.ids) {
count.value = 0;
JobsIdsValue.value = '';
JobsLabelValue.value = '';
return;
}
const ids = e.ids.split(',').map((id) => Number(id));
count.value = ids.length;
JobsIdsValue.value = e.ids;
@@ -147,9 +153,9 @@ function serchforIt(defaultId) {
if (state.stations.length) {
const ids = defaultId
? defaultId.split(',').map((id) => Number(id))
: userInfo.value.jobTitleId.split(',').map((id) => Number(id));
: (userInfo.value.jobTitleId ? userInfo.value.jobTitleId.split(',').map((id) => Number(id)) : []);
count.value = ids.length;
state.jobTitleId = defaultId ? defaultId : userInfo.value.jobTitleId;
state.jobTitleId = defaultId ? defaultId : (userInfo.value.jobTitleId || '');
setCheckedNodes(state.stations, ids);
state.visible = true;
return;
@@ -160,7 +166,7 @@ function serchforIt(defaultId) {
count.value = ids.length;
setCheckedNodes(resData.data, ids);
}
state.jobTitleId = userInfo.value.jobTitleId;
state.jobTitleId = userInfo.value.jobTitleId || '';
state.stations = resData.data;
state.visible = true;
});

View File

@@ -153,7 +153,7 @@ const percent = ref('0%');
const state = reactive({
educationText: '',
politicalAffiliationText: '',
skills: [], // 新的技能数据结构
skills: [], // 新的技能数据结构包含id字段
currentEditingSkillIndex: -1 // 当前正在编辑的技能索引
});
const fromValue = reactive({
@@ -244,13 +244,14 @@ function initLoad() {
fromValue.politicalAffiliation = currentUserInfo.politicalAffiliation || '';
fromValue.idCard = currentUserInfo.idCard || '';
// 初始化技能数据 - 从appSkillsList获取
// 初始化技能数据 - 从appSkillsList获取保留原始id
if (currentUserInfo.appSkillsList && Array.isArray(currentUserInfo.appSkillsList)) {
// 过滤掉name为空的技能项
const validSkills = currentUserInfo.appSkillsList.filter(item => item.name && item.name.trim() !== '');
if (validSkills.length > 0) {
// 将appSkillsList转换为新的技能数据结构
// 将appSkillsList转换为新的技能数据结构保留原始id
state.skills = validSkills.map(skill => ({
id: skill.id, // 保留服务器返回的原始id
name: skill.name,
level: skill.levels || ''
}));
@@ -350,10 +351,11 @@ const confirm = () => {
return $api.msg('请输入正确手机号');
}
// 构建appSkillsList数据结构 - 使用新的技能数据结构
// 构建appSkillsList数据结构 - 使用新的技能数据结构包含id字段
const appSkillsList = state.skills
.filter(skill => skill.name && skill.name.trim() !== '')
.map(skill => ({
id: skill.id, // 包含技能id用于更新操作
name: skill.name,
levels: skill.level || ''
}));
@@ -379,7 +381,7 @@ function addSkill() {
return;
}
// 添加新的技能对象
// 添加新的技能对象新增技能不需要id后端会自动生成
state.skills.push({
name: '',
level: ''

View File

@@ -35,10 +35,13 @@
<dict-Label dictType="education" :value="jobInfo.education"></dict-Label>
</view>
</view>
<view class="position-source">
<text>来源&nbsp;</text>
{{ jobInfo.dataSource }}
</view>
<view class="position-source">
<text>来源&nbsp;</text>
{{ jobInfo.dataSource }}
</view>
<view class="publish-time" v-if="jobInfo.postingDate">
{{ formatPublishTime(jobInfo.postingDate) }}
</view>
</view>
</view>
<view class="ai-explain" v-if="jobInfo.isExplain">

View File

@@ -113,8 +113,8 @@
<view class="form-item clickable" @click="selectIndustry">
<view class="label">本地重点发展产业</view>
<view class="input-content">
<text class="input-text" :class="{ placeholder: !formData.industryType }">
{{ formData.industryType || '请选择产业类型' }}
<text class="input-text" :class="{ placeholder: !formData.industryTypeText }">
{{ formData.industryTypeText || '请选择产业类型' }}
</text>
<uni-icons type="arrowright" size="16" color="#999"></uni-icons>
</view>
@@ -255,7 +255,8 @@ const formData = reactive({
enterpriseType: null, // 是否是就业见习基地 (0=是, 1=否, null=未选择)
legalIdCard: '', // 法人身份证号
legalPhone: '', // 法人联系方式
industryType: '', // 是否是本地重点发展产业
industryType: '', // 本地重点发展产业
industryTypeText: '', // 本地重点发展产业显示文本
isLocalCompany: null, // 是否是本地企业 (true/false/null)
scale: '', // 企业规模
scaleText: '', // 企业规模显示文本
@@ -287,11 +288,17 @@ const openSelectPopup = (config) => {
// 产业类型选项数据
const industryOptions = [
'人工智能',
'生物医药',
'新能源',
'高端装备制造',
'其他'
{ label: '粮油产业集群', value: '0' },
{ label: '绿色矿业产业集群', value: '1' },
{ label: '绿色有机果蔬产业集群', value: '2' },
{ label: '煤炭煤电化工产业集群', value: '3' },
{ label: '棉花和纺织服装产业集群', value: '4' },
{ label: '新能源新材料等战略性新兴产业产业集群', value: '5' },
{ label: '优质畜产品产业集群', value: '6' },
{ label: '油气生产加工产业集群', value: '7' },
{ label: '旅游', value: '8' },
{ label: '电子产品', value: '9' },
{ label: '现代商贸物流产业', value: '10' }
]
// 备用企业类型选项(当字典数据加载失败时使用)
@@ -394,10 +401,16 @@ const editCompanyIntro = () => {
// 选择产业类型
const selectIndustry = () => {
uni.showActionSheet({
itemList: industryOptions,
success: (res) => {
formData.industryType = industryOptions[res.tapIndex]
console.log('点击本地重点发展产业,当前选项:', industryOptions)
openSelectPopup({
title: '本地重点发展产业',
maskClick: true,
data: [industryOptions],
success: (_, [value]) => {
console.log('选择的产业类型:', value)
formData.industryType = value.value // 存储数字值用于传值
formData.industryTypeText = value.label // 存储文字标签用于显示
updateCompletion()
$api.msg('产业类型选择成功')
}
@@ -485,6 +498,7 @@ const scaleOptions = computed(() => {
return scaleData
})
// 选择企业规模
const selectScale = () => {
console.log('点击企业规模,当前数据:', scaleOptions.value)
@@ -517,16 +531,6 @@ const selectScale = () => {
showScaleSelector(options)
}
// 备用企业规模选项(当字典数据加载失败时使用)
const fallbackScaleOptions = [
{ label: '1-10人', value: '1' },
{ label: '11-50人', value: '2' },
{ label: '51-100人', value: '3' },
{ label: '101-500人', value: '4' },
{ label: '501-1000人', value: '5' },
{ label: '1000人以上', value: '6' }
]
// 显示企业规模选择器
const showScaleSelector = (options) => {
console.log('企业规模选项列表:', options)
@@ -709,7 +713,7 @@ const confirm = () => {
legalPhone: formData.legalPhone,
industryType: formData.industryType,
isLocalCompany: formData.isLocalCompany,
scale: formData.scaleText,
scale: formData.scale, // 改为提交数字值
companyContactList: formData.companyContactList.filter(contact => contact.contactPerson.trim() && contact.contactPersonPhone.trim())
}
@@ -1008,4 +1012,3 @@ defineExpose({
button::after
border: none
</style>

View File

@@ -103,7 +103,7 @@
</view>
<view class="content-input" @click="changeEducation">
<view class="input-titile">学历</view>
<input class="input-con" v-model="state.educationText" disabled placeholder="本科" />
<input class="input-con" v-model="state.educationText" disabled placeholder="请选择学历" />
</view>
<view class="content-input" :class="{ 'input-error': idCardError }">
<view class="input-titile">身份证</view>
@@ -279,7 +279,7 @@ const state = reactive({
workExperience: '',
salayText: '',
jobsText: [],
skills: [], // 新的技能数据结构
skills: [], // 技能数据结构 { name, level }
currentEditingSkillIndex: -1 // 当前正在编辑的技能索引
});
const fromValue = reactive({

View File

@@ -30,6 +30,14 @@
<text class="size">{{ companyInfo.scale || '100-999人' }}</text>
</view>
</view>
<!-- 企业用户直播按钮 -->
<view class="company-live-button press-button" @click.stop="handleLiveClick">
<view class="live-icon">
<uni-icons type="videocam-filled" size="16" color="#FFFFFF"></uni-icons>
</view>
<view class="live-text">直播</view>
</view>
</view>
</view>
@@ -1939,7 +1947,39 @@ defineExpose({ loadData });
color: #CCCCCC
font-weight: 300
.size
color: #666666
font-weight: 400
.size
color: #666666
font-weight: 400
// 企业用户直播按钮样式
.company-live-button
display: flex
align-items: center
justify-content: center
width: 100rpx
height: 48rpx
background: linear-gradient(135deg, #FF6B6B 0%, #FF8E8E 100%)
border-radius: 40rpx
box-shadow: 0 4rpx 12rpx rgba(255, 107, 107, 0.3)
transition: all 0.2s ease
flex-shrink: 0
margin-left: 20rpx
&:active
transform: scale(0.95)
box-shadow: 0 2rpx 8rpx rgba(255, 107, 107, 0.4)
.live-icon
margin-right: 6rpx
display: flex
align-items: center
justify-content: center
.live-text
font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif
font-weight: 500
font-size: 24rpx
color: #FFFFFF
text-align: center
white-space: nowrap
</style>

View File

@@ -253,6 +253,9 @@ const formData = reactive({
]
});
// 是否是就业见习基地
const isInternshipBase = ref(false);
// 字典存储
const dictStore = useDictStore();
@@ -322,6 +325,16 @@ const getCompanyInfo = () => {
const company = cachedUserInfo.company;
formData.companyName = company.name || '';
formData.companyId = company.companyId || '';
// 检查是否是就业见习基地enterpriseType为0表示是1表示否
if (company.enterpriseType !== undefined) {
isInternshipBase.value = company.enterpriseType === '0';
console.log('就业见习基地状态:', isInternshipBase.value ? '是' : '否', 'enterpriseType:', company.enterpriseType);
} else {
console.log('未找到enterpriseType字段默认不是就业见习基地');
isInternshipBase.value = false;
}
console.log('从缓存获取企业名称:', company.name);
console.log('从缓存获取企业ID:', company.id);
} else {
@@ -336,6 +349,8 @@ const getCompanyInfo = () => {
formData.companyId = cachedUserInfo.id;
console.log('从用户ID获取企业ID:', cachedUserInfo.id);
}
// 默认不是就业见习基地
isInternshipBase.value = false;
}
} catch (error) {
console.error('获取企业信息失败:', error);
@@ -358,11 +373,20 @@ const initFormData = async () => {
workDistricts.value = dictStore.state.area;
// 设置岗位分类选项
jobCategories.value = [
{ label: '普通', value: '1' },
{ label: '零工', value: '2' },
{ label: '实习实训', value: '3' }
];
// 只有就业见习基地才能选择"实习实训"选项
if (isInternshipBase.value) {
jobCategories.value = [
{ label: '普通', value: '1' },
{ label: '零工', value: '2' },
{ label: '实习实训', value: '3' }
];
} else {
jobCategories.value = [
{ label: '普通', value: '1' },
{ label: '零工', value: '2' }
];
}
console.log('岗位分类选项:', jobCategories.value);
// 设置企业ID从用户信息获取
if (userStore.userInfo && userStore.userInfo.id) {