登录注册逻辑开发

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

@@ -25,9 +25,9 @@ onLaunch((options) => {
}); });
}); });
} else { } else {
uni.redirectTo({ // uni.redirectTo({
url: '/pages/login/login', // url: '/pages/login/login',
}); // });
} }
}); });

View File

@@ -75,10 +75,10 @@ const { getTransformChildren } = useDictStore();
// 岗位类型数据 // 岗位类型数据
const getJobTypeData = () => { const getJobTypeData = () => {
return [ return [
{ label: '常规岗位', value: 'regular', text: '常规岗位' }, { label: '常规岗位', value: 0, text: '常规岗位' },
{ label: '就业见习岗位', value: 'internship', text: '就业见习岗位' }, { label: '就业见习岗位', value: 1, text: '就业见习岗位' },
{ label: '实习实训岗位', value: 'training', text: '实习实训岗位' }, { label: '实习实训岗位', value: 2, text: '实习实训岗位' },
{ label: '社区实践岗位', value: 'community', text: '社区实践岗位' } { label: '社区实践岗位', value: 3, text: '社区实践岗位' }
]; ];
}; };

View File

@@ -50,7 +50,7 @@
"quickapp" : {}, "quickapp" : {},
/* */ /* */
"mp-weixin" : { "mp-weixin" : {
"appid": "", "appid" : "wx9d1cbc11c8c40ba7",
"setting" : { "setting" : {
"urlCheck" : false, "urlCheck" : false,
"es6" : true, "es6" : true,

View File

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

View File

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

View File

@@ -56,9 +56,17 @@
<view class="input-titile">学历</view> <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>
<view class="content-input"> <view class="content-input" :class="{ 'input-error': idCardError }">
<view class="input-titile">身份证</view> <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> </view>
<view class="next-btn" @tap="nextStep">下一步</view> <view class="next-btn" @tap="nextStep">下一步</view>
@@ -130,7 +138,7 @@ const openSelectPopup = inject('openSelectPopup');
// console.log(config.appInfo.areaName); // console.log(config.appInfo.areaName);
// status // status
const selectJobsModel = ref(); const selectJobsModel = ref();
const tabCurrent = ref(0); const tabCurrent = ref(1);
const salay = [2, 5, 10, 15, 20, 25, 30, 50, 80, 100]; const salay = [2, 5, 10, 15, 20, 25, 30, 50, 80, 100];
const state = reactive({ const state = reactive({
station: [], station: [],
@@ -154,6 +162,9 @@ const fromValue = reactive({
idcard: '', idcard: '',
}); });
// 身份证校验相关
const idCardError = ref('');
onLoad((parmas) => { onLoad((parmas) => {
getTreeselect(); getTreeselect();
}); });
@@ -163,6 +174,26 @@ onMounted(() => {});
function changeSex(sex) { function changeSex(sex) {
fromValue.sex = 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() { function changeExperience() {
openSelectPopup({ openSelectPopup({
title: '工作经验', title: '工作经验',
@@ -239,6 +270,19 @@ function changeJobs() {
} }
function nextStep() { 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; tabCurrent.value += 1;
} }
@@ -451,6 +495,19 @@ function complete() {
border-radius: 2rpx border-radius: 2rpx
background: #697279; background: #697279;
transform: rotate(45deg) 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 .content-sex
height: 110rpx; height: 110rpx;
display: flex display: flex

View File

@@ -101,7 +101,7 @@ const useUserStore = defineStore("user", () => {
token.value = value token.value = value
uni.setStorageSync('token', value); uni.setStorageSync('token', value);
// 获取消息列表 // 获取消息列表
useReadMsg().fetchMessages() // useReadMsg().fetchMessages()
// 获取用户信息 // 获取用户信息
return getUserResume() return getUserResume()
} }

View File

@@ -13,7 +13,7 @@
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "", "libVersion": "",
"appid": "touristappid", "appid": "wx9d1cbc11c8c40ba7",
"projectname": "qingdao-employment-service", "projectname": "qingdao-employment-service",
"condition": { "condition": {
"search": { "search": {