bug修复

This commit is contained in:
FengHui
2026-05-15 16:44:25 +08:00
parent e857c008b4
commit 263573eeaa
8 changed files with 39 additions and 93 deletions

View File

@@ -47,7 +47,8 @@
/>
<view v-if="nameError" class="error-message">{{ nameError }}</view>
</view>
<view class="content-input" :class="{ 'input-error': passwordError }">
<!-- 密码模块已注释密码改为非必填 -->
<!-- <view class="content-input" :class="{ 'input-error': passwordError }">
<view class="input-titile">密码</view>
<input
class="input-con2"
@@ -59,7 +60,7 @@
/>
<view v-if="passwordError" class="error-message">{{ passwordError }}</view>
<view v-if="fromValue.ytjPassword && !passwordError" class="success-message"> 密码格式正确</view>
</view>
</view> -->
<view class="content-sex" :class="{ 'input-error': sexError }">
<view class="sex-titile">性别</view>
<view class="sext-ri">
@@ -649,7 +650,6 @@ function nextStep() {
validateName();
validateAge();
validateIdCard();
validatePassword();
if (fromValue.sex !== 0 && fromValue.sex !== 1) {
sexError.value = '请选择性别';
@@ -668,16 +668,6 @@ function nextStep() {
return;
}
// 密码校验
if (!fromValue.ytjPassword) {
$api.msg('请输入密码');
return;
}
if (passwordError.value) {
$api.msg(passwordError.value);
return;
}
// 检查所有错误状态
if (nameError.value) return;
if (sexError.value) return;

View File

@@ -373,8 +373,8 @@ console.log('完整userInfo对象:---223--', userType.value);
// 页面加载时计算高度和初始化数据
onMounted(async () => {
console.log('完整userInfo对象:-----', );
console.log('缓存中的userInfo:----', cachedUserInfo);
// console.log('完整userInfo对象:-----', );
// console.log('缓存中的userInfo:----', cachedUserInfo);
calculateScrollViewHeight();
await initFormData();

View File

@@ -17,7 +17,8 @@
<view class="input-titile">姓名</view>
<input class="input-con" v-model="fromValue.name" placeholder="请输入您的姓名" />
</view>
<view class="content-input" :class="{ 'input-error': passwordError }">
<!-- 设置密码模块已注释密码改为非必填 -->
<!-- <view class="content-input" :class="{ 'input-error': passwordError }">
<view class="input-titile">设置密码</view>
<input
class="input-con"
@@ -29,7 +30,7 @@
/>
<view v-if="passwordError" class="error-message">{{ passwordError }}</view>
<view v-if="fromValue.ytjPassword && !passwordError" class="success-message"> 密码格式正确</view>
</view>
</view> -->
<view class="content-sex">
<view class="sex-titile">性别</view>
<view class="sext-ri">
@@ -213,43 +214,21 @@ watch(() => userInfo.value, (newVal) => {
}
}, { deep: true, immediate: false });
// 监听字典数据加载完成,自动更新学历显示
watch(() => dictComplete.value, (newVal) => {
if (newVal) {
console.log('字典数据加载完成,更新学历显示');
// 确保有学历值(如果没有则使用默认值"4"本科)
watch([() => dictComplete.value, () => dictStore.state.education], ([completeVal, eduData]) => {
if (eduData && eduData.length > 0) {
console.log('学历字典数据已就绪,更新学历显示');
if (!fromValue.education) {
fromValue.education = '4';
}
// 直接遍历字典数据查找对应标签
const eduValue = String(fromValue.education);
const eduItem = dictStore.state.education.find(item => String(item.value) === eduValue);
const eduItem = eduData.find(item => String(item.value) === eduValue);
if (eduItem && eduItem.label) {
console.log('从字典数据中找到学历标签:', eduItem.label);
state.educationText = eduItem.label;
}
}
});
// 监听学历字典数据变化
watch(() => dictStore.state.education, (newVal) => {
if (newVal && newVal.length > 0) {
console.log('学历字典数据变化,更新显示');
// 确保有学历值(如果没有则使用默认值"4"本科)
if (!fromValue.education) {
fromValue.education = '4';
}
// 直接遍历字典数据查找对应标签
const eduValue = String(fromValue.education);
const eduItem = newVal.find(item => String(item.value) === eduValue);
if (eduItem && eduItem.label) {
console.log('从字典数据中找到学历标签:', eduItem.label);
state.educationText = eduItem.label;
}
}
}, { deep: true });
}, { immediate: true, deep: true });
function initLoad() {
// 优先从 store 获取,如果没有则从本地缓存获取
@@ -296,17 +275,14 @@ function initLoad() {
percent.value = result;
}
// 初始化学历显示文本
function initEducationText() {
// 确保有学历值(如果没有则使用默认值"4"本科)
if (!fromValue.education) {
fromValue.education = '4';
}
console.log('初始化学历显示,当前学历值:', fromValue.education);
// 直接遍历字典数据查找对应标签不依赖dictLabel函数确保准确性
const findLabelFromDict = () => {
const findLabel = () => {
if (dictStore.state.education && dictStore.state.education.length > 0) {
const eduValue = String(fromValue.education);
const eduItem = dictStore.state.education.find(item => String(item.value) === eduValue);
@@ -314,48 +290,34 @@ function initEducationText() {
console.log('从字典数据中找到学历标签:', eduItem.label);
state.educationText = eduItem.label;
return true;
} else {
console.log('字典数据中未找到匹配的学历标签');
}
}
return false;
};
// 立即尝试查找
if (!findLabelFromDict() && dictComplete.value) {
// 如果字典数据已加载完成但未找到标签,尝试重新获取字典数据
loadEducationDictAndUpdate();
if (findLabel()) {
return;
}
// 等待字典数据加载完成
const checkDictData = () => {
if (dictComplete.value && dictStore.state.education && dictStore.state.education.length > 0) {
findLabelFromDict();
} else {
// 如果字典数据未加载,等待一段时间后重试
setTimeout(() => {
if (dictComplete.value && dictStore.state.education && dictStore.state.education.length > 0) {
findLabelFromDict();
} else {
// 尝试主动加载字典数据
loadEducationDictAndUpdate();
}
}, 500);
let retryCount = 0;
const maxRetries = 10;
const retryInterval = 200;
const checkDict = () => {
retryCount++;
if (retryCount >= maxRetries) {
console.log('学历字典数据加载超时');
return;
}
if (findLabel()) {
return;
}
setTimeout(checkDict, retryInterval);
};
// 主动加载学历字典数据并更新显示
function loadEducationDictAndUpdate() {
getDictSelectOption('education').then((data) => {
console.log('主动加载学历字典数据:', data);
dictStore.state.education = data;
findLabelFromDict();
}).catch((error) => {
console.error('加载学历字典数据失败:', error);
});
}
checkDictData();
checkDict();
}
const confirm = () => {
if (!fromValue.name) {
@@ -374,12 +336,6 @@ const confirm = () => {
return $api.msg('请输入正确手机号');
}
// 密码校验
validatePassword();
if (fromValue.ytjPassword && passwordError.value) {
return $api.msg(passwordError.value);
}
// 构建appSkillsList数据结构 - 使用新的技能数据结构包含id字段
const appSkillsList = state.skills
.filter(skill => skill.name && skill.name.trim() !== '')