技能等级维护
This commit is contained in:
@@ -160,27 +160,7 @@
|
||||
<view class="nx-item" v-for="(item, index) in state.jobsText" :key="index">{{ item }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="content-input" @click="changeSkillLevel">
|
||||
<view class="input-titile">技能等级</view>
|
||||
<input
|
||||
class="input-con"
|
||||
v-model="state.skillLevelText"
|
||||
disabled
|
||||
placeholder="请选择您的技能等级"
|
||||
/>
|
||||
</view>
|
||||
<view class="content-input" @click="changeSkills">
|
||||
<view class="input-titile">技能名称</view>
|
||||
<input
|
||||
class="input-con"
|
||||
disabled
|
||||
v-if="!state.skillsText.length"
|
||||
placeholder="请选择您的技能名称"
|
||||
/>
|
||||
<view class="input-nx" @click="changeSkills" v-else>
|
||||
<view class="nx-item" v-for="(item, index) in state.skillsText" :key="index">{{ item }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="content-input" @click="changeSalay">
|
||||
<view class="input-titile">期望薪资</view>
|
||||
<input
|
||||
@@ -190,6 +170,55 @@
|
||||
placeholder="请选择您的期望薪资"
|
||||
/>
|
||||
</view>
|
||||
<view class="content-skills">
|
||||
<view class="skills-header">
|
||||
<view class="input-titile">技能信息</view>
|
||||
<view
|
||||
class="add-skill-btn"
|
||||
@click="addSkill"
|
||||
:class="{ 'disabled': state.skills.length >= 3 }"
|
||||
>
|
||||
+ 添加技能
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="skills-list">
|
||||
<view class="skill-item" v-for="(skill, index) in state.skills" :key="index">
|
||||
<view class="skill-header">
|
||||
<view class="skill-number">技能 {{ index + 1 }}</view>
|
||||
<view class="skill-actions" v-if="state.skills.length > 1">
|
||||
<view class="action-btn delete-btn" @click="removeSkill(index)">删除</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="skill-fields">
|
||||
<view class="skill-field" @click="changeSkillName(index)">
|
||||
<view class="field-label">技能名称</view>
|
||||
<input
|
||||
class="field-input triangle"
|
||||
disabled
|
||||
:value="skill.name"
|
||||
placeholder="请选择技能名称"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="skill-field" @click="changeSkillLevel(index)">
|
||||
<view class="field-label">技能等级</view>
|
||||
<input
|
||||
class="field-input triangle"
|
||||
disabled
|
||||
:value="getSkillLevelText(skill.level)"
|
||||
placeholder="请选择技能等级"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="empty-skills" v-if="state.skills.length === 0">
|
||||
<text class="empty-text">暂无技能信息,点击上方按钮添加</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!-- 固定按钮 -->
|
||||
@@ -250,8 +279,8 @@ const state = reactive({
|
||||
workExperience: '',
|
||||
salayText: '',
|
||||
jobsText: [],
|
||||
skillLevelText: '',
|
||||
skillsText: [],
|
||||
skills: [], // 新的技能数据结构
|
||||
currentEditingSkillIndex: -1 // 当前正在编辑的技能索引
|
||||
});
|
||||
const fromValue = reactive({
|
||||
sex: null,
|
||||
@@ -264,8 +293,6 @@ const fromValue = reactive({
|
||||
idCard: '',
|
||||
name: '',
|
||||
age: '',
|
||||
skillLevel: '',
|
||||
skills: '',
|
||||
ytjPassword: '',
|
||||
});
|
||||
|
||||
@@ -320,16 +347,62 @@ function initEducationText() {
|
||||
checkDictData();
|
||||
}
|
||||
|
||||
// 技能管理函数
|
||||
const addSkill = () => {
|
||||
if (state.skills.length >= 3) {
|
||||
$api.msg('最多只能添加3个技能');
|
||||
return;
|
||||
}
|
||||
state.skills.push({ name: '', level: '' });
|
||||
};
|
||||
|
||||
const removeSkill = (index) => {
|
||||
state.skills.splice(index, 1);
|
||||
};
|
||||
|
||||
const changeSkillName = (index) => {
|
||||
state.currentEditingSkillIndex = index;
|
||||
// 跳转到技能查询页面
|
||||
uni.navigateTo({
|
||||
url: `/pages/complete-info/skill-search?selected=${encodeURIComponent(JSON.stringify([]))}`
|
||||
});
|
||||
};
|
||||
|
||||
const changeSkillLevel = (index) => {
|
||||
state.currentEditingSkillIndex = index;
|
||||
const skillLevels = [
|
||||
{ label: '初级', value: '1' },
|
||||
{ label: '中级', value: '2' },
|
||||
{ label: '高级', value: '3' }
|
||||
];
|
||||
|
||||
openSelectPopup({
|
||||
title: '技能等级',
|
||||
maskClick: true,
|
||||
data: [skillLevels],
|
||||
success: (_, [value]) => {
|
||||
if (state.currentEditingSkillIndex >= 0) {
|
||||
state.skills[state.currentEditingSkillIndex].level = value.value;
|
||||
state.currentEditingSkillIndex = -1;
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const getSkillLevelText = (level) => {
|
||||
const levelMap = {
|
||||
'1': '初级',
|
||||
'2': '中级',
|
||||
'3': '高级'
|
||||
};
|
||||
return levelMap[level] || '';
|
||||
};
|
||||
|
||||
// 技能选择回调函数
|
||||
const handleSkillSelected = (skills) => {
|
||||
if (Array.isArray(skills) && skills.length > 0) {
|
||||
// 更新技能显示和值,技能字段值传name
|
||||
state.skillsText = skills;
|
||||
fromValue.skills = skills.join(',');
|
||||
} else {
|
||||
// 如果返回空数组,清空选择
|
||||
state.skillsText = [];
|
||||
fromValue.skills = '';
|
||||
const handleSkillSelected = (skillName) => {
|
||||
if (state.currentEditingSkillIndex >= 0 && skillName) {
|
||||
state.skills[state.currentEditingSkillIndex].name = skillName;
|
||||
state.currentEditingSkillIndex = -1;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -570,33 +643,6 @@ function changeJobs() {
|
||||
});
|
||||
}
|
||||
|
||||
// 技能等级选择
|
||||
function changeSkillLevel() {
|
||||
const skillLevels = [
|
||||
{ label: '初级', value: '1' },
|
||||
{ label: '中级', value: '2' },
|
||||
{ label: '高级', value: '3' }
|
||||
];
|
||||
|
||||
openSelectPopup({
|
||||
title: '技能等级',
|
||||
maskClick: true,
|
||||
data: [skillLevels],
|
||||
success: (_, [value]) => {
|
||||
fromValue.skillLevel = value.value;
|
||||
state.skillLevelText = value.label;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// 技能名称选择 - 跳转到模糊查询页面
|
||||
function changeSkills() {
|
||||
// 将当前已选中的技能名称传递给查询页面
|
||||
const selectedSkills = state.skillsText || [];
|
||||
uni.navigateTo({
|
||||
url: `/pages/complete-info/skill-search?selected=${encodeURIComponent(JSON.stringify(selectedSkills))}`
|
||||
});
|
||||
}
|
||||
|
||||
function nextStep() {
|
||||
// 统一必填与格式校验
|
||||
@@ -726,19 +772,16 @@ function complete() {
|
||||
}
|
||||
|
||||
if (isValid) {
|
||||
// 构建 experiencesList 数组
|
||||
// 构建 experiencesList 数组 - 使用新的技能数据结构
|
||||
const experiencesList = [];
|
||||
if (fromValue.skills && fromValue.skillLevel) {
|
||||
const skillsArray = fromValue.skills.split(',');
|
||||
skillsArray.forEach(skill => {
|
||||
if (skill.trim()) {
|
||||
experiencesList.push({
|
||||
name: skill.trim(),
|
||||
levels: fromValue.skillLevel
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
state.skills.forEach(skill => {
|
||||
if (skill.name && skill.level) {
|
||||
experiencesList.push({
|
||||
name: skill.name,
|
||||
levels: skill.level
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 构建符合要求的请求数据(experiencesList 与 appUser 同级)
|
||||
const requestData = {
|
||||
@@ -1009,5 +1052,95 @@ function complete() {
|
||||
line-height: 90rpx
|
||||
position: relative
|
||||
z-index: 100
|
||||
</style>
|
||||
|
||||
/* 技能列表样式 */
|
||||
.content-skills
|
||||
margin-bottom: 52rpx
|
||||
.skills-header
|
||||
display: flex
|
||||
justify-content: space-between
|
||||
align-items: center
|
||||
margin-bottom: 32rpx
|
||||
.input-titile
|
||||
font-weight: 400
|
||||
font-size: 28rpx
|
||||
color: #6A6A6A
|
||||
.add-skill-btn
|
||||
padding: 16rpx 24rpx
|
||||
background: #256BFA
|
||||
color: #FFFFFF
|
||||
border-radius: 8rpx
|
||||
font-size: 24rpx
|
||||
font-weight: 500
|
||||
&.disabled
|
||||
background: #CCCCCC
|
||||
color: #999999
|
||||
.skills-list
|
||||
.skill-item
|
||||
background: #F8F9FA
|
||||
border-radius: 12rpx
|
||||
padding: 24rpx
|
||||
margin-bottom: 24rpx
|
||||
.skill-header
|
||||
display: flex
|
||||
justify-content: space-between
|
||||
align-items: center
|
||||
margin-bottom: 20rpx
|
||||
.skill-number
|
||||
font-size: 28rpx
|
||||
font-weight: 500
|
||||
color: #333333
|
||||
.skill-actions
|
||||
.action-btn
|
||||
padding: 8rpx 16rpx
|
||||
border-radius: 6rpx
|
||||
font-size: 24rpx
|
||||
&.delete-btn
|
||||
background: #FF4757
|
||||
color: #FFFFFF
|
||||
.skill-fields
|
||||
.skill-field
|
||||
margin-bottom: 20rpx
|
||||
&:last-child
|
||||
margin-bottom: 0
|
||||
.field-label
|
||||
font-size: 24rpx
|
||||
color: #6A6A6A
|
||||
margin-bottom: 8rpx
|
||||
.field-input
|
||||
width: 100%
|
||||
height: 72rpx
|
||||
background: #FFFFFF
|
||||
border: 2rpx solid #E8EAEE
|
||||
border-radius: 8rpx
|
||||
padding: 0 20rpx
|
||||
font-size: 28rpx
|
||||
color: #333333
|
||||
position: relative
|
||||
&.triangle::before
|
||||
position: absolute
|
||||
right: 20rpx
|
||||
top: calc(50% - 2rpx)
|
||||
content: ''
|
||||
width: 4rpx
|
||||
height: 14rpx
|
||||
border-radius: 2rpx
|
||||
background: #697279
|
||||
transform: translate(0, -50%) rotate(-45deg)
|
||||
&.triangle::after
|
||||
position: absolute
|
||||
right: 20rpx
|
||||
top: 50%
|
||||
content: ''
|
||||
width: 4rpx
|
||||
height: 14rpx
|
||||
border-radius: 2rpx
|
||||
background: #697279
|
||||
transform: rotate(45deg)
|
||||
.empty-skills
|
||||
text-align: center
|
||||
padding: 60rpx 0
|
||||
.empty-text
|
||||
font-size: 28rpx
|
||||
color: #999999
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user