12 Commits

Author SHA1 Message Date
FengHui
55c0b1fd22 11 2026-04-14 18:05:04 +08:00
FengHui
cec340da43 111 2026-04-14 13:37:14 +08:00
FengHui
183d43b664 样式优化 2026-04-14 13:26:23 +08:00
FengHui
3e408d5740 111 2026-04-14 11:39:36 +08:00
FengHui
855deb4643 11 2026-04-14 11:23:41 +08:00
FengHui
5a9d111d4c 删除测试代码 2026-04-13 17:52:29 +08:00
FengHui
9ec42f18f3 删除无用代码 2026-04-13 17:32:05 +08:00
FengHui
321e686d68 bug修复 2026-04-13 12:29:47 +08:00
FengHui
3d8e13c665 登录流程bug修改 2026-04-10 19:46:42 +08:00
FengHui
3fe4dbe47f 11111 2026-04-10 13:18:15 +08:00
FengHui
c742a65aa0 删除调试代码 2026-04-10 12:27:10 +08:00
FengHui
7c409e8528 登录验证提示 2026-04-10 12:17:53 +08:00
15 changed files with 610 additions and 165 deletions

View File

@@ -417,6 +417,136 @@ html {
background-color: #ffffff !important;
}
/* #ifdef H5 */
/* H5端字体和边距调整 - 放大1.5倍 */
html, body {
font-size: 150% !important;
}
/* 调整页面基础字体大小 */
page {
font-size: 42rpx !important;
}
/* 调整特定类的字体大小 */
.fs_10 {
font-size: 30rpx !important;
}
.fs_12 {
font-size: 36rpx !important;
}
.fs_14 {
font-size: 42rpx !important;
}
.fs_16 {
font-size: 48rpx !important;
}
.fs_18 {
font-size: 54rpx !important;
}
.fs_20 {
font-size: 60rpx !important;
}
.fs_22 {
font-size: 66rpx !important;
}
.fs_24 {
font-size: 72rpx !important;
}
.fs_26 {
font-size: 78rpx !important;
}
.fs_28 {
font-size: 84rpx !important;
}
.fs_30 {
font-size: 90rpx !important;
}
.fs_32 {
font-size: 96rpx !important;
}
/* 调整边距类 */
.mar_le30 {
margin-left: 90rpx !important;
}
.mar_le25 {
margin-left: 75rpx !important;
}
.mar_le20 {
margin-left: 60rpx !important;
}
.mar_le15 {
margin-left: 45rpx !important;
}
.mar_le10 {
margin-left: 30rpx !important;
}
.mar_le5 {
margin-left: 15rpx !important;
}
.mar_ri5 {
margin-right: 15rpx !important;
}
.mar_ri10 {
margin-right: 30rpx !important;
}
.mar_ri15 {
margin-right: 45rpx !important;
}
.mar_ri20 {
margin-right: 60rpx !important;
}
.mar_ri25 {
margin-right: 75rpx !important;
}
.mar_top0 {
margin-top: 0 !important;
}
.mar_top5 {
margin-top: 15rpx !important;
}
.mar_top10 {
margin-top: 30rpx !important;
}
.mar_top15 {
margin-top: 45rpx !important;
}
.mar_top20 {
margin-top: 60rpx !important;
}
.mar_top25 {
margin-top: 75rpx !important;
}
/* #endif */
/* 弹性布局 */

View File

@@ -584,6 +584,86 @@ function isInWechatMiniProgramWebview() {
function isEmptyObject(obj) {
return obj && typeof obj === 'object' && !Array.isArray(obj) && Object.keys(obj).length === 0;
}
/**
* 农历日期工具
* 提供公历转农历日期的中文表示
*/
export const LunarUtil = {
/**
* 获取农历日期的中文表示
* @param {number} year - 公历年
* @param {number} month - 公历月 (1-12)
* @param {number} day - 公历日
* @returns {string} 农历日期的中文表示(初一、初二...三十)
*/
getLunarDayInChinese(year, month, day) {
// 这里使用简化的农历转换算法
// 实际项目中可以根据需要扩展更完整的农历功能
const lunarDays = this.solarToLunar(year, month, day);
return this.getDayInChinese(lunarDays.day);
},
/**
* 简化的公历转农历日期算法
* 注意:这是一个简化版,实际农历计算更复杂
* 仅用于生成初一到三十的日期表示
*/
solarToLunar(year, month, day) {
// 这里使用简化算法,实际项目中可以使用更精确的算法
// 对于本项目,我们只需要生成初一到三十的序列
// 实际的农历计算需要考虑节气、闰月等因素
const daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
// 处理闰年
if ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0) {
daysInMonth[1] = 29;
}
// 计算当年已过天数
let dayOfYear = 0;
for (let i = 0; i < month - 1; i++) {
dayOfYear += daysInMonth[i];
}
dayOfYear += day;
// 简化的农历月份计算(实际农历月份计算更复杂)
const lunarMonth = Math.ceil(dayOfYear / 29.5);
const lunarDay = (dayOfYear % 29) || 29;
return {
month: lunarMonth,
day: lunarDay
};
},
/**
* 将农历日期转换为中文表示
* @param {number} day - 农历日
* @returns {string} 中文表示(初一、初二...三十)
*/
getDayInChinese(day) {
if (day === 1) {
return '初一';
} else if (day === 15) {
return '十五';
} else if (day === 30) {
return '三十';
} else {
const digits = ['', '一', '二', '三', '四', '五', '六', '七', '八', '九', '十'];
if (day <= 10) {
return '初' + digits[day];
} else if (day <= 19) {
return '十' + (day === 10 ? '' : digits[day - 10]);
} else if (day <= 29) {
return '廿' + (day === 20 ? '' : digits[day - 20]);
} else {
return '三十';
}
}
}
};
/**
* 身份证号码校验工具
* 支持15位和18位身份证号码校验
@@ -941,6 +1021,7 @@ export default {
cloneDeep,
formatDate,
IdCardValidator,
LunarUtil,
getdeviceInfo,
checkingPhoneRegExp,
checkingEmailRegExp,

View File

@@ -6,8 +6,8 @@
*/
export default {
// baseUrl: 'http://39.98.44.136:8080', // 测试
// baseUrl: 'https://www.xjksly.cn/api/ks', // 正式环境
baseUrl: 'http://ks.zhaopinzao8dian.com/api/ks', // 测试
baseUrl: 'https://www.xjksly.cn/api/ks', // 正式环境
// baseUrl: 'http://ks.zhaopinzao8dian.com/api/ks', // 测试
// LCBaseUrl:'http://10.110.145.145:9100',//内网端口
// LCBaseUrlInner:'http://10.110.145.145:10100',//招聘、培训、帮扶

View File

@@ -37,15 +37,8 @@ export function useColumnCount(onChange = () => {}) {
count = 2
// #endif
// #ifndef H5
if (width >= 1000) {
count = 5
} else if (width >= 750) {
count = 4
} else if (width >= 500) {
count = 3
} else {
count = 2
}
// 小程序端固定显示1列
count = 1
// #endif
if (count !== columnCount.value) {

File diff suppressed because one or more lines are too long

View File

@@ -46,12 +46,10 @@
<script setup>
import { reactive, inject, watch, ref, onMounted } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
const { $api, navTo, navBack } = inject('globalFunction');
const { $api, navTo, navBack, LunarUtil } = inject('globalFunction');
const weekMap = ['日', '一', '二', '三', '四', '五', '六'];
const calendarData = ref([]);
const current = ref({});
import lunarModule from '@/packageA/lib/lunar-javascript@1.7.2.js';
const { Solar, Lunar } = lunarModule;
const isRecord = ref(false);
const recordNum = ref(4);
@@ -162,12 +160,11 @@ function getMonthCalendarData({ year, month, selectableDates = [] }) {
const d = prevLastDate - i;
const prevMonth = month - 1 <= 0 ? 12 : month - 1;
const prevYear = month - 1 <= 0 ? year - 1 : year;
const solar = Solar.fromYmd(prevYear, prevMonth, d);
const lunar = Lunar.fromSolar(solar);
const nl = LunarUtil.getLunarDayInChinese(prevYear, prevMonth, d);
const dateStr = `${prevYear}-${String(prevMonth).padStart(2, '0')}-${String(d).padStart(2, '0')}`;
list.push({
day: d,
nl: lunar.getDayInChinese(),
nl: nl,
isThisMonth: false,
isToday: dateStr === todayStr,
isSelectable: isSelected(prevYear, prevMonth, d),
@@ -179,12 +176,11 @@ function getMonthCalendarData({ year, month, selectableDates = [] }) {
// 当前月天数
for (let d = 1; d <= lastDate; d++) {
const solar = Solar.fromYmd(year, month, d);
const lunar = Lunar.fromSolar(solar);
const nl = LunarUtil.getLunarDayInChinese(year, month, d);
const dateStr = `${year}-${String(month).padStart(2, '0')}-${String(d).padStart(2, '0')}`;
list.push({
day: d,
nl: lunar.getDayInChinese(),
nl: nl,
isThisMonth: true,
isToday: dateStr === todayStr,
isSelectable: isSelected(year, month, d),
@@ -199,12 +195,11 @@ function getMonthCalendarData({ year, month, selectableDates = [] }) {
for (let d = 1; d <= remaining; d++) {
const nextMonth = month + 1 > 12 ? 1 : month + 1;
const nextYear = month + 1 > 12 ? year + 1 : year;
const solar = Solar.fromYmd(nextYear, nextMonth, d);
const lunar = Lunar.fromSolar(solar);
const nl = LunarUtil.getLunarDayInChinese(nextYear, nextMonth, d);
const dateStr = `${nextYear}-${String(nextMonth).padStart(2, '0')}-${String(d).padStart(2, '0')}`;
list.push({
day: d,
nl: lunar.getDayInChinese(),
nl: nl,
isThisMonth: false,
isToday: dateStr === todayStr,
isSelectable: isSelected(nextYear, nextMonth, d),

View File

@@ -3,7 +3,10 @@
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "喀什智慧就业平台"
"navigationBarTitleText": "喀什智慧就业平台",
// #ifdef H5
"navigationStyle": "custom"
// #endif
}
},
{

View File

@@ -307,7 +307,8 @@
<view class="item btn-feel" v-if="!job.recommend">
<view class="falls-card" :class="{ 'disabled-card': Number(job.jobStatus) === 1 }" @click="nextDetail(job)">
<view class="falls-card-pay">
<view class="pay-text">
<view class="fl_1 falls-card-title">{{ job.jobTitle }}</view>
<view class="fr_1 pay-text">
<Salary-Expectation
:max-salary="job.maxSalary"
:min-salary="job.minSalary"
@@ -316,8 +317,10 @@
</view>
<image v-if="job.isHot" class="flame" src="/static/icon/flame.png"></image>
</view>
<view class="falls-card-title">{{ job.jobTitle }}</view>
<view class="fl_box fl_warp">
<view>
<!-- <view class="fl_1 falls-card-title">{{ job.jobTitle }}</view> -->
<view class="fr_1 fl_box fl_warp">
<view class="falls-card-education mar_ri10" v-if="job.education">
<dict-Label dictType="education" :value="job.education"></dict-Label>
</view>
@@ -325,22 +328,24 @@
<dict-Label dictType="experience" :value="job.experience"></dict-Label>
</view>
</view>
<view class="falls-card-company" v-show="isShowJw !== 3">
{{ config.appInfo.areaName }}
<!-- {{ job.jobLocation }} -->
<dict-Label dictType="jobLocationAreaCode" :value="job.jobLocationAreaCode"></dict-Label>
</view>
<!-- <view class="falls-card-company" v-show="isShowJw !== 3">
{{ config.appInfo.areaName }}
{{ job.jobLocation }}
<dict-Label dictType="jobLocationAreaCode" :value="job.jobLocationAreaCode"></dict-Label>
</view> -->
<view class="falls-card-pepleNumber">
<view>
<image class="point2" src="/static/icon/pintDate.png"></image>
<view class="fl_1">
{{ job.postingDate || '发布日期' }}
发布日期{{ job.postingDate || '暂无数据' }}
</view>
</view>
<view>
<image class="point3" src="/static/icon/pointpeople.png"></image>
<view class="fl_1">
{{ vacanciesTo(job.vacancies) }}
招聘人数{{ vacanciesTo(job.vacancies) }}
</view>
</view>
</view>
@@ -349,6 +354,10 @@
<view class="fl_1">
{{ job.companyName }}
</view>
<view class="fr-1">
地区{{ config.appInfo.areaName }}
</view>
</view>
<!-- 招聘者显示上下架开关 -->
<view class="falls-card-actions" v-if="isRecruiter">
@@ -395,7 +404,8 @@
<view class="item btn-feel" v-if="!job.recommend">
<view class="falls-card" :class="{ 'disabled-card': Number(job.jobStatus) === 1 }" @click="nextDetail(job)">
<view class="falls-card-pay">
<view class="pay-text">
<view class="fl_1 falls-card-title">{{ job.jobTitle }}</view>
<view class="fr_1 pay-text">
<Salary-Expectation
:max-salary="job.maxSalary"
:min-salary="job.minSalary"
@@ -404,7 +414,7 @@
</view>
<image v-if="job.isHot" class="flame" src="/static/icon/flame.png"></image>
</view>
<view class="falls-card-title">{{ job.jobTitle }}</view>
<view class="fl_box fl_warp">
<view class="falls-card-education mar_ri10" v-if="job.education">
<dict-Label dictType="education" :value="job.education"></dict-Label>
@@ -413,16 +423,16 @@
<dict-Label dictType="experience" :value="job.experience"></dict-Label>
</view>
</view>
<view class="falls-card-company" v-show="isShowJw !== 3">
{{ config.appInfo.areaName }}
<!-- {{ job.jobLocation }} -->
<!-- <view class="falls-card-company" v-show="isShowJw !== 3">
地区{{ config.appInfo.areaName }}
地址{{ job.jobLocation }}
<dict-Label dictType="jobLocationAreaCode" :value="job.jobLocationAreaCode"></dict-Label>
</view>
</view> -->
<view class="falls-card-pepleNumber">
<view>
<image class="point2" src="/static/icon/pintDate.png"></image>
<view class="fl_1">
{{ job.postingDate || '发布日期' }}
发布日期{{ job.postingDate || '暂无数据' }}
</view>
</view>
<view>
@@ -437,6 +447,10 @@
<view class="fl_1">
{{ job.companyName }}
</view>
<view class="fr-1">
地区{{ config.appInfo.areaName }}
</view>
</view>
<!-- 招聘者显示上下架开关 -->
<view class="falls-card-actions" v-if="isRecruiter">

View File

@@ -1,6 +1,16 @@
<template>
<view class="app-custom-root">
<view class="app-container">
<!-- #ifdef H5 -->
<!-- 自定义导航栏 -->
<view class="custom-nav" :style="{paddingTop: statusBarHeight + 'px'}">
<view class="nav-content">
<view class="nav-back" @click="back"><text class="nav-back-text"></text></view>
<view class="nav-title">喀什智慧就业平台</view>
<view class="nav-placeholder"></view>
</view>
</view>
<!-- #endif -->
<!-- 主体内容区域 -->
<view class="container-main">
<IndexOne @onShowTabbar="changeShowTabbar" />
@@ -26,7 +36,13 @@ const userStore = useUserStore();
onLoad((options) => {
// useReadMsg().fetchMessages();
});
// 返回按钮功能
function back() {
// uni.navigateBack({
// delta: 1
// });
window.location.href = 'https://www.xjksly.cn/mechine-single-vue/';
}
onShow(() => {
// 更新自定义tabbar选中状态
tabbarManager.updateSelected(0);
@@ -191,4 +207,39 @@ onShow(() => {
background: #FFFFFF
width: 4rpx
height: 20rpx
/* 自定义导航栏样式 */
.custom-nav
background: linear-gradient(135deg, #8a9bf0, #c3cafa, #e7ebfe)
width: 100%
box-shadow: 0 2rpx 10rpx rgba(138, 155, 240, 0.2)
border-radius: 0
.nav-content
height: 80rpx
display: flex
align-items: center
justify-content: space-between
padding: 0 40rpx
.nav-back
width: 120rpx
height: 80rpx
display: flex
align-items: center
justify-content: flex-start
color: #2f56e8
font-weight: 400
transition: all 0.3s ease
&:hover
transform: translateX(-5rpx)
.nav-back-text
font-size: 56rpx
line-height: 1
text-shadow: 1rpx 1rpx 2rpx rgba(0, 0, 0, 0.1)
.nav-title
color: #4a55b0
font-size: 36rpx
font-weight: 600
text-shadow: 1rpx 1rpx 2rpx rgba(255, 255, 255, 0.8)
letter-spacing: 2rpx
.nav-placeholder
width: 120rpx
</style>

View File

@@ -68,8 +68,11 @@
<script setup>
import { ref, inject, computed, onMounted, onUnmounted } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import useUserStore from '@/stores/useUserStore';
import { tabbarManager } from '@/utils/tabbarManager';
const { $api } = inject('globalFunction');
const userStore = useUserStore();
// 从页面参数获取数据
const phone = ref('');
@@ -194,13 +197,27 @@ const resendSms = async () => {
uni.showLoading({ title: '发送中...' });
try {
// 调用重新发送验证码接口
await $api.createRequest('/app/sendSmsAgain', { phone: phone.value }, 'post');
const requestParams = { phone: phone.value };
// 只有单位用户才传递机构类型
if (userType.value === '0') {
requestParams.orgType = orgType.value;
requestParams.userType = userType.value;
}
const res = await $api.createRequest('/app/sendSmsAgain', requestParams, 'post');
// 检查状态码
if (res.code === 200 ) {
uni.hideLoading();
uni.showToast({ title: '验证码已发送', icon: 'success' });
startCountdown();
} else {
uni.hideLoading();
uni.showToast({ title: res.msg || '发送失败', icon: 'none' });
}
} catch (error) {
uni.hideLoading();
uni.showToast({ title: error.msg || '发送失败', icon: 'none' });
uni.showToast({ title: error.msg || '发送失败,请重试', icon: 'none' });
}
};
@@ -305,38 +322,77 @@ const submitVerification = async () => {
try {
// 调用接口 /app/appLoginPhone
const res = await $api.createRequest('/app/appLoginPhone', {
const requestParams = {
smsCode: code,
phone: phone.value,
openid: openid.value,
unionid: unionid.value,
userType: userType.value,
orgType: orgType.value
}, 'post');
userType: userType.value
};
// 只有单位用户才传递机构类型
if (userType.value === '0') {
requestParams.orgType = orgType.value;
}
const res = await $api.createRequest('/app/appLoginPhone', requestParams, 'post');
if (res.token) {
if (res.token && res.code === 200) {
// 登录成功存储token
const userStore = useUserStore();
await userStore.loginSetToken(res.token);
await userStore.loginSetToken(res.token).then((resume) => {
// 更新用户类型到缓存
if (res.isCompanyUser !== undefined) {
const userInfo = uni.getStorageSync('userInfo') || {};
userInfo.isCompanyUser = res.isCompanyUser ? 0 : 1;
userInfo.isCompanyUser = Number(res.isCompanyUser); // 0-企业用户1-求职者
uni.setStorageSync('userInfo', userInfo);
}
uni.showToast({ title: '登录成功', icon: 'success' });
// 返回上一页或跳转到首页
setTimeout(() => {
uni.navigateBack({ delta: 2 }); // 返回两页(跳过登录页面)
}, 1500);
// 刷新tabbar以显示正确的用户类型
tabbarManager.refreshTabBar();
console.log(userType.value , res.isCompanyUser);
console.log('用户登录成功,简历信息-resume:', resume);
console.log('用户登录成功,简历信息-res:', res);
if (!resume?.data?.jobTitleId) {
if (!res.idCard) {
console.log('用户登录成功,没有身份证号');
if (userType.value == '1') {
// 求职者跳转到个人信息补全页面
uni.reLaunch({
url: '/packageA/pages/complete-info/complete-info?step=1'
});
} else if (userType.value == '0') {
// 招聘者跳转到企业信息补全页面
uni.reLaunch({
url: '/packageA/pages/complete-info/company-info'
});
}
} else {
// 跳转到首页
uni.reLaunch({
url: '/pages/index/index'
});
}
} else {
console.log('用户登录成功,有简历信息--');
// 跳转到首页
uni.reLaunch({
url: '/pages/index/index'
});
}
}).catch((error) => {
// 只有在非企业用户且确实需要简历信息时才显示错误
// 企业用户可能没有简历信息,这是正常的
if (userType.value !== '0') {
uni.showToast({ title: '获取用户信息失败', icon: 'none' });
} else {
console.log('企业用户登录成功,简历信息可能为空');
}
});
} else {
uni.showToast({ title: res.msg || '验证失败', icon: 'none' });
}
} catch (error) {
uni.showToast({ title: error.msg || '验证失败,请重试', icon: 'none' });
uni.showToast({ title: error || '验证失败,请重试', icon: 'none' });
} finally {
loading.value = false;
}
@@ -352,8 +408,7 @@ onUnmounted(() => {
clearInterval(timer.value);
});
// 需要导入useUserStore
import useUserStore from '@/stores/useUserStore';
</script>
<style lang="stylus" scoped>

View File

@@ -1,13 +1,13 @@
<template>
<view class="wx-login-page">
<!-- 顶部导航栏 -->
<view class="nav-bar">
<!-- <view class="nav-bar">
<view class="nav-back" @click="goBack">
<uni-icons type="arrowleft" size="24" color="#333"></uni-icons>
</view>
<view class="nav-title">登录</view>
<view class="nav-placeholder"></view>
</view>
</view> -->
<!-- 页面内容 -->
<view class="page-content">
@@ -83,8 +83,7 @@
<button
class="auth-btn primary"
open-type="getPhoneNumber"
@getphonenumber="getPhoneNumber"
:disabled="!canSubmit"
@getphonenumber="onWxGetPhoneNumber"
>
<uni-icons type="phone" size="20" color="#FFFFFF"></uni-icons>
<text>手机号快捷登录</text>
@@ -93,7 +92,7 @@
<!-- H5和App使用普通按钮 -->
<!-- #ifndef MP-WEIXIN -->
<button class="auth-btn primary" @click="wxLogin" :disabled="!canSubmit">
<button class="auth-btn primary" @click="wxLogin">
<uni-icons type="phone" size="20" color="#FFFFFF"></uni-icons>
<text>手机号快捷登录</text>
</button>
@@ -101,7 +100,7 @@
<!-- 测试登录按钮仅开发环境 -->
<!-- #ifdef APP-PLUS || H5 -->
<button class="auth-btn secondary" @click="testLogin" :disabled="!canSubmit">
<button class="auth-btn secondary" @click="testLogin">
<text>测试账号登录</text>
</button>
<!-- #endif -->
@@ -198,12 +197,57 @@ const goBack = () => {
uni.navigateBack();
};
// 微信获取手机号
const getPhoneNumber = async (e) => {
console.log('获取手机号:', e);
// 通用的验证函数
const validateForm = () => {
if (userType.value === null) {
uni.showToast({
title: '请先选择您的角色(个人或单位)',
icon: 'none',
duration: 2000
});
return false;
}
if (!canSubmit.value) {
$api.msg('请先完成上述选择并同意隐私协议');
if (userType.value === 0 && orgType.value === null) {
uni.showToast({
title: '请选择机构类型',
icon: 'none',
duration: 2000
});
return false;
}
if (!agreedToAgreement.value) {
uni.showToast({
title: '请先阅读并同意隐私协议',
icon: 'none',
duration: 2000
});
return false;
}
return true;
};
// 微信小程序授权前的检查
const checkBeforeWxAuth = (e) => {
// 验证表单
if (!validateForm()) {
// 阻止微信授权流程
if (e && e.preventDefault) {
e.preventDefault();
}
return false;
} else {
console.log('Validation passed, allowing wx auth');
}
};
// 微信获取手机号
const onWxGetPhoneNumber = async (e) => {
const { encryptedData, iv } = e.detail;
// 使用通用验证函数
if (!validateForm()) {
return;
}
@@ -211,24 +255,25 @@ const getPhoneNumber = async (e) => {
uni.login({
provider: 'weixin',
success: (loginRes) => {
console.log('微信登录code获取成功', loginRes.code);
const { encryptedData, iv } = e.detail;
const code = loginRes.code;
// 调用接口 /app/appWxphoneSmsCode
uni.showLoading({ title: '获取验证码中...' });
$api.createRequest('/app/appWxphoneSmsCode', {
// 根据用户类型构建参数
const requestParams = {
code,
encryptedData,
iv,
userType: userType.value,
orgType: orgType.value
}, 'post').then((resData) => {
uni.hideLoading();
console.log('获取验证码接口返回:', resData);
console.log('接口返回的所有字段:', Object.keys(resData));
userType: userType.value
};
// 只有单位用户才传递机构类型
if (userType.value === 0) {
requestParams.orgType = orgType.value;
}
$api.createRequest('/app/appWxphoneSmsCode', requestParams, 'post').then((resData) => {
uni.hideLoading();
// 检查可能的手机号字段
const possiblePhoneFields = ['phone', 'mobile', 'phoneNumber', 'tel', 'mobilePhone'];
let phoneValue = '';
@@ -246,9 +291,12 @@ const getPhoneNumber = async (e) => {
phone: phoneValue || '', // 接口返回的手机号
openid: resData.openid || '',
unionid: resData.unionid || '',
userType: userType.value,
orgType: orgType.value
userType: userType.value
};
// 只有单位用户才传递机构类型
if (userType.value === 0) {
params.orgType = orgType.value;
}
uni.navigateTo({
url: '/pages/login/sms-verify?' + Object.keys(params)
@@ -264,24 +312,35 @@ const getPhoneNumber = async (e) => {
});
},
fail: (err) => {
console.error('获取微信登录code失败', err);
$api.msg('获取登录信息失败,请重试');
uni.showToast({
title: '获取登录信息失败,请重试',
icon: 'none',
duration: 2000
});
}
});
} else if (e.detail.errMsg === 'getPhoneNumber:fail user deny') {
$api.msg('您取消了授权');
uni.showToast({
title: '您取消了授权',
icon: 'none',
duration: 2000
});
} else {
$api.msg('获取手机号失败');
uni.showToast({
title: '获取手机号失败',
icon: 'none',
duration: 2000
});
}
};
// H5/App 微信登录(暂保持原有逻辑,后续可调整)
const wxLogin = () => {
if (!canSubmit.value) {
$api.msg('请先完成上述选择并同意隐私协议');
// 使用通用验证函数
if (!validateForm()) {
console.log('Validation failed in wxLogin');
return;
}
// #ifdef H5
// H5端跳转到H5登录页面
uni.navigateTo({
@@ -301,12 +360,18 @@ const wxLogin = () => {
success: (loginRes) => {
console.log('微信登录成功:', loginRes);
// 调用后端接口进行登录
$api.createRequest('/app/appLogin', {
// 根据用户类型构建参数
const loginParams = {
code: loginRes.code,
userType: userType.value,
orgType: orgType.value
}, 'post').then((resData) => {
userType: userType.value
};
// 只有单位用户才传递机构类型
if (userType.value === 0) {
loginParams.orgType = orgType.value;
}
// 调用后端接口进行登录
$api.createRequest('/app/appLogin', loginParams, 'post').then((resData) => {
if (resData.token) {
userStore.loginSetToken(resData.token).then((resume) => {
// 更新用户类型到缓存
@@ -316,16 +381,42 @@ const wxLogin = () => {
uni.setStorageSync('userInfo', userInfo);
}
$api.msg('登录成功');
uni.showToast({
title: '登录成功',
icon: 'success',
duration: 2000
});
// 登录成功后返回上一页
uni.navigateBack();
}).catch((error) => {
// 只有在非企业用户且确实需要简历信息时才显示错误
// 企业用户可能没有简历信息,这是正常的
if (userType.value !== 0) {
uni.showToast({
title: '获取用户信息失败',
icon: 'none',
duration: 2000
});
} else {
console.log('企业用户登录成功,简历信息可能为空');
uni.showToast({
title: '登录成功',
icon: 'success',
duration: 2000
});
uni.navigateBack();
}
});
}
});
},
fail: (err) => {
console.error('微信登录失败:', err);
$api.msg('微信登录失败');
uni.showToast({
title: '微信登录失败',
icon: 'none',
duration: 2000
});
}
});
}
@@ -336,8 +427,8 @@ const wxLogin = () => {
// 测试账号登录(仅开发环境)
const testLogin = () => {
if (!canSubmit.value) {
$api.msg('请先完成上述选择并同意隐私协议');
// 使用通用验证函数
if (!validateForm()) {
return;
}
@@ -359,15 +450,39 @@ const testLogin = () => {
uni.setStorageSync('userInfo', userInfo);
}
$api.msg('测试登录成功');
uni.showToast({
title: '测试登录成功',
icon: 'success',
duration: 2000
});
// 登录成功后返回上一页
uni.navigateBack();
}).catch(() => {
$api.msg('获取用户信息失败');
}).catch((error) => {
// 只有在非企业用户且确实需要简历信息时才显示错误
// 企业用户可能没有简历信息,这是正常的
if (userType.value !== 0) {
uni.showToast({
title: '获取用户信息失败',
icon: 'none',
duration: 2000
});
} else {
console.log('企业用户测试登录成功,简历信息可能为空');
uni.showToast({
title: '测试登录成功',
icon: 'success',
duration: 2000
});
uni.navigateBack();
}
});
}).catch((err) => {
uni.hideLoading();
$api.msg(err.msg || '登录失败');
uni.showToast({
title: err.msg || '登录失败',
icon: 'none',
duration: 2000
});
});
};
@@ -547,6 +662,8 @@ onLoad(() => {
&:disabled
opacity: 0.5
cursor: not-allowed
background: #CCCCCC !important
box-shadow: none !important
text
margin-left: 12rpx

View File

@@ -144,10 +144,7 @@ function close() {
}
function confirm() {
// 调用退出登录
useUserStore().logOut();
// 关闭弹窗
popup.value.close();
useUserStore().logOut(false); // 不显示登录弹窗
// 跳转到首页
uni.reLaunch({
url: '/pages/index/index'

View File

@@ -191,7 +191,11 @@ function close() {
}
function confirm() {
useUserStore().logOut();
useUserStore().logOut(false); // 不显示登录弹窗
// 跳转到首页
uni.reLaunch({
url: '/pages/index/index'
});
}
const isAbove90 = (percent) => parseFloat(percent) < 90;

View File

@@ -74,10 +74,17 @@ const useUserStore = defineStore("user", () => {
uni.removeStorageSync('token')
uni.removeStorageSync('Padmin-Token')
// 如果需要显示登录弹窗,则通过事件通知页面显示微信登录弹窗
if (showLoginModal) {
// 通过 uni.$emit 发送全局事件,通知页面显示登录弹窗
uni.$emit('showLoginModal');
}
// if (showLoginModal) {
// // 通过 uni.$emit 发送全局事件,通知页面显示登录弹窗
// uni.$emit('showLoginModal');
// }
//#ifdef H5
// 跳转到首页
window.location.href = 'https://www.xjksly.cn/mechine-single-vue/';
//#endif
uni.reLaunch({
url: '/pages/index/index'
});
}
const getUserInfo = () => {
@@ -96,7 +103,13 @@ const useUserStore = defineStore("user", () => {
similarityJobs.setUserInfo(resume.data)
setUserInfo(resume);
reslove(resume)
}).catch(() => reject());
}).catch((error) => {
// 对于企业用户,简历接口可能失败,但这不应该阻止登录流程
// 记录错误但不reject让登录流程继续
console.warn('获取简历信息失败,可能是企业用户或无简历信息:', error);
// 返回一个空的简历对象,让登录流程继续
reslove({ data: {} });
});
})
}

View File

@@ -100,7 +100,7 @@ export default {
return {
data: {
list: this.value ? this.value : [],
column: this.column < 2 ? 2 : this.column,
column: this.column < 1 ? 1 : this.column,
columnSpace: this.columnSpace <= 5 ? this.columnSpace : 5,
imageKey: this.imageKey,
seat: this.seat,
@@ -179,7 +179,7 @@ export default {
this.isRefresh = true;
this.adds = [];
this.data.list = this.value ? this.value : [];
this.data.column = this.column < 2 ? 2 : this.column >= this.maxColumn ? this.maxColumn : this.column;
this.data.column = this.column < 1 ? 1 : this.column >= this.maxColumn ? this.maxColumn : this.column;
this.data.columnSpace = this.columnSpace <= 5 ? this.columnSpace : 5;
this.data.imageKey = this.imageKey;
this.data.seat = this.seat;