登录注册逻辑开发

This commit is contained in:
冯辉
2025-10-17 13:15:14 +08:00
parent 14dafac147
commit 959e9ee9e4
8 changed files with 192 additions and 121 deletions

View File

@@ -373,12 +373,21 @@ function clearfindJob(job) {
}
function nextDetail(job) {
// 记录岗位类型,用作数据分析
if (job.jobCategory) {
const recordData = recommedIndexDb.JobParameter(job);
recommedIndexDb.addRecord(recordData);
// 登录
let token = uni.getStorageSync('token') || ''; // 同步获取 缓存信息
if (token) {
// 记录岗位类型,用作数据分析
if (job.jobCategory) {
const recordData = recommedIndexDb.JobParameter(job);
recommedIndexDb.addRecord(recordData);
}
navTo(`/packageA/pages/post/post?jobId=${btoa(job.jobId)}`);
} else {
uni.redirectTo({
url: '/pages/login/login',
});
}
navTo(`/packageA/pages/post/post?jobId=${btoa(job.jobId)}`);
}
function navToService(serviceType) {
@@ -422,7 +431,12 @@ function openFilter() {
...pageState.search,
};
for (const [key, value] of Object.entries(values)) {
pageState.search[key] = value.join(',');
// 特殊处理岗位类型,直接传递数字值
if (key === 'jobType') {
pageState.search.type = value.join(',');
} else {
pageState.search[key] = value.join(',');
}
}
showFilter.value = false;
getJobList('refresh');

View File

@@ -22,7 +22,7 @@ import { useReadMsg } from '@/stores/useReadMsg';
const { unreadCount } = storeToRefs(useReadMsg());
onLoad(() => {
useReadMsg().fetchMessages();
// useReadMsg().fetchMessages();
});
</script>

View File

@@ -56,9 +56,17 @@
<view class="input-titile">学历</view>
<input class="input-con" v-model="state.educationText" disabled placeholder="本科" />
</view>
<view class="content-input">
<view class="content-input" :class="{ 'input-error': idCardError }">
<view class="input-titile">身份证</view>
<input class="input-con2" v-model="fromValue.idcard" maxlength="18" placeholder="本科" />
<input
class="input-con2"
v-model="fromValue.idcard"
maxlength="18"
placeholder="请输入身份证号码"
@input="validateIdCard"
/>
<view v-if="idCardError" class="error-message">{{ idCardError }}</view>
<view v-if="fromValue.idcard && !idCardError" class="success-message"> 身份证格式正确</view>
</view>
</view>
<view class="next-btn" @tap="nextStep">下一步</view>
@@ -130,7 +138,7 @@ const openSelectPopup = inject('openSelectPopup');
// console.log(config.appInfo.areaName);
// status
const selectJobsModel = ref();
const tabCurrent = ref(0);
const tabCurrent = ref(1);
const salay = [2, 5, 10, 15, 20, 25, 30, 50, 80, 100];
const state = reactive({
station: [],
@@ -154,6 +162,9 @@ const fromValue = reactive({
idcard: '',
});
// 身份证校验相关
const idCardError = ref('');
onLoad((parmas) => {
getTreeselect();
});
@@ -163,6 +174,26 @@ onMounted(() => {});
function changeSex(sex) {
fromValue.sex = sex;
}
// 身份证实时校验
function validateIdCard() {
const idCard = fromValue.idcard.trim();
// 如果为空,清除错误信息
if (!idCard) {
idCardError.value = '';
return;
}
// 使用身份证校验器进行校验
const result = IdCardValidator.validate(idCard);
if (result.valid) {
idCardError.value = '';
} else {
idCardError.value = result.message;
}
}
function changeExperience() {
openSelectPopup({
title: '工作经验',
@@ -239,6 +270,19 @@ function changeJobs() {
}
function nextStep() {
// 校验身份证号码
const idCard = fromValue.idcard.trim();
if (!idCard) {
$api.msg('请输入身份证号码');
return;
}
const result = IdCardValidator.validate(idCard);
if (!result.valid) {
$api.msg(result.message);
return;
}
tabCurrent.value += 1;
}
@@ -451,6 +495,19 @@ function complete() {
border-radius: 2rpx
background: #697279;
transform: rotate(45deg)
.error-message
color: #ff4757;
font-size: 24rpx;
margin-top: 10rpx;
line-height: 1.4;
.success-message
color: #2ed573;
font-size: 24rpx;
margin-top: 10rpx;
line-height: 1.4;
.input-error
.input-con2
border-bottom-color: #ff4757;
.content-sex
height: 110rpx;
display: flex