14 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
FengHui
4d8403609f Merge branch 'main' of http://124.243.245.42:3000/sdz/ks-app-employment-service 2026-04-10 11:25:36 +08:00
FengHui
769bc23edb 页面效果优化 2026-04-10 11:25:34 +08:00
16 changed files with 741 additions and 300 deletions

View File

@@ -83,3 +83,15 @@ export function getInfo() {
method: 'get' method: 'get'
}) })
} }
// 重新发送验证码
export function sendSmsAgain(data) {
return request({
method: 'post',
url: '/app/sendSmsAgain',
data,
headers: {
isToken: false
}
})
}

View File

@@ -417,6 +417,136 @@ html {
background-color: #ffffff !important; 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) { function isEmptyObject(obj) {
return obj && typeof obj === 'object' && !Array.isArray(obj) && Object.keys(obj).length === 0; 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位身份证号码校验 * 支持15位和18位身份证号码校验
@@ -941,6 +1021,7 @@ export default {
cloneDeep, cloneDeep,
formatDate, formatDate,
IdCardValidator, IdCardValidator,
LunarUtil,
getdeviceInfo, getdeviceInfo,
checkingPhoneRegExp, checkingPhoneRegExp,
checkingEmailRegExp, checkingEmailRegExp,

View File

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

View File

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

File diff suppressed because one or more lines are too long

View File

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

View File

@@ -3,7 +3,10 @@
{ {
"path": "pages/index/index", "path": "pages/index/index",
"style": { "style": {
"navigationBarTitleText": "喀什智慧就业平台" "navigationBarTitleText": "喀什智慧就业平台",
// #ifdef H5
"navigationStyle": "custom"
// #endif
} }
}, },
{ {
@@ -79,15 +82,13 @@
{ {
"path": "pages/login/wx-login", "path": "pages/login/wx-login",
"style": { "style": {
"navigationBarTitleText": "登录", "navigationBarTitleText": "登录"
"navigationStyle": "custom"
} }
}, },
{ {
"path": "pages/login/sms-verify", "path": "pages/login/sms-verify",
"style": { "style": {
"navigationBarTitleText": "短信验证", "navigationBarTitleText": "短信验证"
"navigationStyle": "custom"
} }
}, },
{ {

View File

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

View File

@@ -1,6 +1,16 @@
<template> <template>
<view class="app-custom-root"> <view class="app-custom-root">
<view class="app-container"> <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"> <view class="container-main">
<IndexOne @onShowTabbar="changeShowTabbar" /> <IndexOne @onShowTabbar="changeShowTabbar" />
@@ -26,7 +36,13 @@ const userStore = useUserStore();
onLoad((options) => { onLoad((options) => {
// useReadMsg().fetchMessages(); // useReadMsg().fetchMessages();
}); });
// 返回按钮功能
function back() {
// uni.navigateBack({
// delta: 1
// });
window.location.href = 'https://www.xjksly.cn/mechine-single-vue/';
}
onShow(() => { onShow(() => {
// 更新自定义tabbar选中状态 // 更新自定义tabbar选中状态
tabbarManager.updateSelected(0); tabbarManager.updateSelected(0);
@@ -191,4 +207,39 @@ onShow(() => {
background: #FFFFFF background: #FFFFFF
width: 4rpx width: 4rpx
height: 20rpx 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> </style>

View File

@@ -1,20 +1,20 @@
<template> <template>
<view class="sms-verify-page"> <view class="sms-verify-page">
<!-- 顶部导航栏 --> <!-- 顶部导航栏 -->
<view class="nav-bar"> <!-- <view class="nav-bar">
<view class="nav-back" @click="goBack"> <view class="nav-back" @click="goBack">
<uni-icons type="arrowleft" size="24" color="#333"></uni-icons> <uni-icons type="arrowleft" size="24" color="#333"></uni-icons>
</view> </view>
<view class="nav-title">短信验证</view> <view class="nav-title">短信验证</view>
<view class="nav-placeholder"></view> <view class="nav-placeholder"></view>
</view> </view> -->
<!-- 页面内容 --> <!-- 页面内容 -->
<view class="page-content"> <view class="page-content">
<!-- 安全提示 --> <!-- 安全提示 -->
<view class="security-tip"> <view class="security-tip">
<view class="tip-icon"> <view class="tip-icon">
<uni-icons type="auth-filled" size="32" color="#256BFA"></uni-icons> <uni-icons type="auth-filled" size="36" color="#256BFA"></uni-icons>
</view> </view>
<view class="tip-text">为了您的账户安全需要您进行验证</view> <view class="tip-text">为了您的账户安全需要您进行验证</view>
</view> </view>
@@ -54,12 +54,6 @@
<view v-else class="resend-text" @click="resendSms"> <view v-else class="resend-text" @click="resendSms">
重新获取验证码 重新获取验证码
</view> </view>
<view class="paste-section">
<view class="paste-text" @click="pasteFromClipboard">
<uni-icons type="clipboard" size="16" color="#256BFA"></uni-icons>
<text>粘贴验证码</text>
</view>
</view>
</view> </view>
<!-- 提交按钮 --> <!-- 提交按钮 -->
@@ -74,8 +68,11 @@
<script setup> <script setup>
import { ref, inject, computed, onMounted, onUnmounted } from 'vue'; import { ref, inject, computed, onMounted, onUnmounted } from 'vue';
import { onLoad } from '@dcloudio/uni-app'; import { onLoad } from '@dcloudio/uni-app';
import useUserStore from '@/stores/useUserStore';
import { tabbarManager } from '@/utils/tabbarManager';
const { $api } = inject('globalFunction'); const { $api } = inject('globalFunction');
const userStore = useUserStore();
// 从页面参数获取数据 // 从页面参数获取数据
const phone = ref(''); const phone = ref('');
@@ -94,10 +91,7 @@ const autoFocus = ref(true); // 自动聚焦
// 格式化手机号:只显示前三位和后四位,中间用星号代替 // 格式化手机号:只显示前三位和后四位,中间用星号代替
const formattedPhone = computed(() => { const formattedPhone = computed(() => {
console.log('formattedPhone computed called, phone.value:', phone.value);
if (!phone.value || phone.value.trim() === '') { if (!phone.value || phone.value.trim() === '') {
console.log('手机号为空,显示未知号码');
return '未知号码'; return '未知号码';
} }
@@ -105,37 +99,21 @@ const formattedPhone = computed(() => {
const cleanPhone = phone.value.replace(/\D/g, ''); const cleanPhone = phone.value.replace(/\D/g, '');
if (cleanPhone.length < 11) { if (cleanPhone.length < 11) {
console.log('手机号长度不足11位显示原始值', phone.value);
return phone.value; return phone.value;
} }
const prefix = cleanPhone.substring(0, 3); const prefix = cleanPhone.substring(0, 3);
const suffix = cleanPhone.substring(cleanPhone.length - 4); const suffix = cleanPhone.substring(cleanPhone.length - 4);
const formatted = `${prefix}****${suffix}`; return `${prefix}****${suffix}`;
console.log('格式化后的手机号:', formatted);
return formatted;
}); });
// 是否可以提交 // 是否可以提交
const canSubmit = computed(() => { const canSubmit = computed(() => {
const can = smsCode.value.length === 6 && !loading.value; return smsCode.value.length === 6 && !loading.value;
console.log('canSubmit计算属性调用', {
smsCodeLength: smsCode.value.length,
loading: loading.value,
canSubmit: can
});
return can;
}); });
// 页面加载时获取参数 // 页面加载时获取参数
onLoad(async (options) => { onLoad(async (options) => {
console.log('短信验证页面参数:', options);
console.log('所有参数键值对:');
Object.keys(options).forEach(key => {
console.log(` ${key}: ${options[key]}`);
});
// 尝试多种可能的手机号字段名(按优先级) // 尝试多种可能的手机号字段名(按优先级)
const possiblePhoneFields = [ const possiblePhoneFields = [
'phone', 'mobile', 'phoneNumber', 'tel', 'phone', 'mobile', 'phoneNumber', 'tel',
@@ -147,18 +125,15 @@ onLoad(async (options) => {
for (const field of possiblePhoneFields) { for (const field of possiblePhoneFields) {
if (options[field]) { if (options[field]) {
foundPhone = options[field]; foundPhone = options[field];
console.log(`找到手机号字段 "${field}": ${foundPhone}`);
break; break;
} }
} }
// 如果没找到尝试从URL参数中解析 // 如果没找到尝试从URL参数中解析
if (!foundPhone) { if (!foundPhone) {
console.log('未在options中找到手机号字段尝试从当前页面URL解析');
const currentPages = getCurrentPages(); const currentPages = getCurrentPages();
if (currentPages.length > 0) { if (currentPages.length > 0) {
const currentPage = currentPages[currentPages.length - 1]; const currentPage = currentPages[currentPages.length - 1];
console.log('当前页面对象:', currentPage);
// 尝试从页面路由参数中获取 // 尝试从页面路由参数中获取
if (currentPage.$page && currentPage.$page.fullPath) { if (currentPage.$page && currentPage.$page.fullPath) {
@@ -167,7 +142,6 @@ onLoad(async (options) => {
const value = urlParams.get(field); const value = urlParams.get(field);
if (value) { if (value) {
foundPhone = value; foundPhone = value;
console.log(`从URL参数中找到手机号字段 "${field}": ${foundPhone}`);
break; break;
} }
} }
@@ -181,21 +155,8 @@ onLoad(async (options) => {
userType.value = options.userType || ''; userType.value = options.userType || '';
orgType.value = options.orgType || ''; orgType.value = options.orgType || '';
console.log('最终获取到的手机号:', phone.value);
console.log('手机号长度:', phone.value.length);
console.log('formattedPhone值', formattedPhone.value);
// 检查所有可能包含手机号的字段
console.log('所有可能包含手机号的字段值:');
possiblePhoneFields.forEach(field => {
if (options[field]) {
console.log(` ${field}: ${options[field]}`);
}
});
// 如果手机号仍然为空,显示错误信息 // 如果手机号仍然为空,显示错误信息
if (!phone.value) { if (!phone.value) {
console.error('无法获取手机号,请检查参数传递');
uni.showToast({ title: '无法获取手机号,请返回重试', icon: 'none' }); uni.showToast({ title: '无法获取手机号,请返回重试', icon: 'none' });
} }
@@ -227,17 +188,36 @@ const startCountdown = () => {
const resendSms = async () => { const resendSms = async () => {
if (countdown.value > 0) return; if (countdown.value > 0) return;
// 调用重新发送验证码接口(如果需要) // 检查手机号是否为空
if (!phone.value) {
uni.showToast({ title: '手机号获取失败,请返回重试', icon: 'none' });
return;
}
uni.showLoading({ title: '发送中...' }); uni.showLoading({ title: '发送中...' });
try { try {
// 假设有一个重新发送验证码接口 // 调用重新发送验证码接口
// await $api.createRequest('/app/resendSms', { 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.hideLoading();
uni.showToast({ title: '验证码已发送', icon: 'success' }); uni.showToast({ title: '验证码已发送', icon: 'success' });
startCountdown(); startCountdown();
} else {
uni.hideLoading();
uni.showToast({ title: res.msg || '发送失败', icon: 'none' });
}
} catch (error) { } catch (error) {
uni.hideLoading(); uni.hideLoading();
uni.showToast({ title: error.msg || '发送失败', icon: 'none' }); uni.showToast({ title: error.msg || '发送失败,请重试', icon: 'none' });
} }
}; };
@@ -251,21 +231,12 @@ const onCodeInput = (e) => {
} }
smsCode.value = value; smsCode.value = value;
// 如果输入了6位数字可以自动提交可选
if (value.length === 6) {
// 这里可以添加自动提交逻辑,或者让用户手动点击按钮
console.log('6位验证码已输入完整');
}
}; };
// 粘贴事件处理 // 粘贴事件处理
const onPaste = (e) => { const onPaste = (e) => {
console.log('onPaste event triggered', e);
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
// 微信小程序中,使用异步方式获取剪贴板 // 微信小程序中,使用异步方式获取剪贴板
console.log('MP-WEIXIN: onPaste called, using async clipboard API');
setTimeout(() => { setTimeout(() => {
pasteFromClipboard(); pasteFromClipboard();
}, 50); }, 50);
@@ -281,14 +252,12 @@ const onPaste = (e) => {
// #ifndef MP-WEIXIN // #ifndef MP-WEIXIN
// 其他平台H5/App使用标准粘贴处理 // 其他平台H5/App使用标准粘贴处理
console.log('Non-MP-WEIXIN: Standard paste handling');
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
let pasteText = ''; let pasteText = '';
if (e.clipboardData && e.clipboardData.getData) { if (e.clipboardData && e.clipboardData.getData) {
pasteText = e.clipboardData.getData('text'); pasteText = e.clipboardData.getData('text');
console.log('Got pasteText from clipboardData:', pasteText);
} }
if (pasteText) { if (pasteText) {
@@ -309,7 +278,6 @@ const onPaste = (e) => {
const handlePaste = (text) => { const handlePaste = (text) => {
// 提取数字 // 提取数字
const digits = text.replace(/\D/g, ''); const digits = text.replace(/\D/g, '');
console.log('Extracted digits from paste:', digits);
if (digits.length === 0) { if (digits.length === 0) {
uni.showToast({ title: '剪贴板中没有找到验证码', icon: 'none' }); uni.showToast({ title: '剪贴板中没有找到验证码', icon: 'none' });
@@ -321,25 +289,16 @@ const handlePaste = (text) => {
smsCode.value = code; smsCode.value = code;
uni.showToast({ title: '已粘贴验证码', icon: 'success' }); uni.showToast({ title: '已粘贴验证码', icon: 'success' });
// 如果粘贴了6位数字可以自动提交可选
if (code.length === 6) {
console.log('6位验证码已通过粘贴输入完整');
}
}; };
// 从剪贴板粘贴验证码 // 从剪贴板粘贴验证码
const pasteFromClipboard = () => { const pasteFromClipboard = () => {
console.log('pasteFromClipboard called');
uni.getClipboardData({ uni.getClipboardData({
success: (res) => { success: (res) => {
console.log('getClipboardData success, data:', res.data);
const text = res.data || ''; const text = res.data || '';
handlePaste(text); handlePaste(text);
}, },
fail: (err) => { fail: () => {
console.error('读取剪贴板失败:', err);
uni.showToast({ title: '读取剪贴板失败', icon: 'none' }); uni.showToast({ title: '读取剪贴板失败', icon: 'none' });
} }
}); });
@@ -347,21 +306,15 @@ const pasteFromClipboard = () => {
// 提交验证 // 提交验证
const submitVerification = async () => { const submitVerification = async () => {
console.log('submitVerification called, canSubmit:', canSubmit.value, 'loading:', loading.value);
if (!canSubmit.value) { if (!canSubmit.value) {
console.log('不能提交,直接返回');
return; return;
} }
console.log('开始提交验证设置loading为true');
loading.value = true; loading.value = true;
const code = smsCode.value; const code = smsCode.value;
console.log('提交的验证码:', code, '手机号:', phone.value);
// 检查手机号是否为空 // 检查手机号是否为空
if (!phone.value) { if (!phone.value) {
console.error('手机号为空,无法提交验证');
uni.showToast({ title: '手机号获取失败,请返回重试', icon: 'none' }); uni.showToast({ title: '手机号获取失败,请返回重试', icon: 'none' });
loading.value = false; loading.value = false;
return; return;
@@ -369,45 +322,79 @@ const submitVerification = async () => {
try { try {
// 调用接口 /app/appLoginPhone // 调用接口 /app/appLoginPhone
const res = await $api.createRequest('/app/appLoginPhone', { const requestParams = {
smsCode: code, smsCode: code,
phone: phone.value, phone: phone.value,
openid: openid.value, openid: openid.value,
unionid: unionid.value, unionid: unionid.value,
userType: userType.value, userType: userType.value
orgType: orgType.value };
}, 'post'); // 只有单位用户才传递机构类型
if (userType.value === '0') {
requestParams.orgType = orgType.value;
}
const res = await $api.createRequest('/app/appLoginPhone', requestParams, 'post');
console.log('短信验证接口返回:', res); if (res.token && res.code === 200) {
if (res.token) {
// 登录成功存储token // 登录成功存储token
const userStore = useUserStore(); await userStore.loginSetToken(res.token).then((resume) => {
await userStore.loginSetToken(res.token);
// 更新用户类型到缓存 // 更新用户类型到缓存
if (res.isCompanyUser !== undefined) { if (res.isCompanyUser !== undefined) {
const userInfo = uni.getStorageSync('userInfo') || {}; const userInfo = uni.getStorageSync('userInfo') || {};
userInfo.isCompanyUser = res.isCompanyUser ? 0 : 1; userInfo.isCompanyUser = Number(res.isCompanyUser); // 0-企业用户1-求职者
uni.setStorageSync('userInfo', userInfo); uni.setStorageSync('userInfo', userInfo);
} }
uni.showToast({ title: '登录成功', icon: 'success' }); uni.showToast({ title: '登录成功', icon: 'success' });
// 返回上一页或跳转到首页 // 刷新tabbar以显示正确的用户类型
setTimeout(() => { tabbarManager.refreshTabBar();
uni.navigateBack({ delta: 2 }); // 返回两页(跳过登录页面) console.log(userType.value , res.isCompanyUser);
}, 1500); 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 { } else {
uni.showToast({ title: res.msg || '验证失败', icon: 'none' }); uni.showToast({ title: res.msg || '验证失败', icon: 'none' });
} }
} catch (error) { } catch (error) {
console.error('短信验证失败:', error); uni.showToast({ title: error || '验证失败,请重试', icon: 'none' });
uni.showToast({ title: error.msg || '验证失败,请重试', icon: 'none' });
} finally { } finally {
console.log('submitVerification finally块执行设置loading为false');
loading.value = false; loading.value = false;
console.log('loading设置完成当前loading值', loading.value);
} }
}; };
@@ -421,14 +408,13 @@ onUnmounted(() => {
clearInterval(timer.value); clearInterval(timer.value);
}); });
// 需要导入useUserStore
import useUserStore from '@/stores/useUserStore';
</script> </script>
<style lang="stylus" scoped> <style lang="stylus" scoped>
.sms-verify-page .sms-verify-page
min-height: 100vh min-height: 100vh
background: #FFFFFF background: linear-gradient(135deg, #F7F9FF 0%, #FFFFFF 100%)
.nav-bar .nav-bar
display: flex display: flex
@@ -436,7 +422,8 @@ import useUserStore from '@/stores/useUserStore';
justify-content: space-between justify-content: space-between
height: 88rpx height: 88rpx
padding: 0 32rpx padding: 0 32rpx
border-bottom: 1rpx solid #f5f5f5 background: #FFFFFF
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04)
.nav-back .nav-back
width: 60rpx width: 60rpx
@@ -444,6 +431,11 @@ import useUserStore from '@/stores/useUserStore';
display: flex display: flex
align-items: center align-items: center
justify-content: center justify-content: center
border-radius: 50%
transition: background-color 0.2s ease
&:active
background-color: #F5F5F5
.nav-title .nav-title
font-size: 32rpx font-size: 32rpx
@@ -454,127 +446,164 @@ import useUserStore from '@/stores/useUserStore';
width: 60rpx width: 60rpx
.page-content .page-content
padding: 60rpx 40rpx 40rpx padding: 80rpx 48rpx 48rpx
.security-tip .security-tip
display: flex display: flex
flex-direction: column
align-items: center align-items: center
justify-content: center justify-content: center
margin-bottom: 40rpx margin-bottom: 60rpx
padding: 32rpx
background: linear-gradient(135deg, rgba(37, 107, 250, 0.08) 0%, rgba(30, 91, 255, 0.04) 100%)
border-radius: 24rpx
border: 1rpx solid rgba(37, 107, 250, 0.1)
.tip-icon .tip-icon
margin-right: 16rpx margin-bottom: 20rpx
width: 64rpx
height: 64rpx
display: flex
align-items: center
justify-content: center
background: #FFFFFF
border-radius: 50%
box-shadow: 0 4rpx 16rpx rgba(37, 107, 250, 0.15)
.tip-text .tip-text
font-size: 28rpx font-size: 28rpx
font-weight: 500 font-weight: 500
color: #333333 color: #256BFA
text-align: center
line-height: 1.4
.phone-display .phone-display
text-align: center text-align: center
margin-bottom: 60rpx margin-bottom: 80rpx
.phone-label .phone-label
font-size: 26rpx font-size: 28rpx
color: #666666 color: #666666
margin-bottom: 12rpx margin-bottom: 16rpx
opacity: 0.8
.phone-number .phone-number
font-size: 36rpx font-size: 44rpx
font-weight: 600 font-weight: 700
color: #333333 color: #333333
letter-spacing: 2rpx
background: linear-gradient(135deg, #256BFA 0%, #1E5BFF 100%)
-webkit-background-clip: text
-webkit-text-fill-color: transparent
background-clip: text
.sms-input-area .sms-input-area
margin-bottom: 40rpx margin-bottom: 60rpx
.input-label .input-label
font-size: 28rpx font-size: 28rpx
color: #666666 color: #666666
text-align: center text-align: center
margin-bottom: 20rpx margin-bottom: 24rpx
font-weight: 500
.single-input-container .single-input-container
margin-bottom: 16rpx margin-bottom: 16rpx
.single-input .single-input
width: 100% width: 100%
height: 100rpx height: 120rpx
border: 2rpx solid #E5E5E5 border: 3rpx solid #E8ECF4
border-radius: 16rpx border-radius: 20rpx
font-size: 40rpx font-size: 48rpx
font-weight: 600 font-weight: 700
color: #333333 color: #333333
background: #F7F8FA background: #FFFFFF
text-align: center text-align: center
padding: 0 32rpx padding: 0 32rpx
box-sizing: border-box box-sizing: border-box
outline: none outline: none
caret-color: #256BFA caret-color: #256BFA
transition: all 0.3s ease transition: all 0.3s ease
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05)
&:focus &:focus
border-color: #256BFA border-color: #256BFA
background: #FFFFFF background: #FFFFFF
box-shadow: 0 4rpx 12rpx rgba(37, 107, 250, 0.15) box-shadow: 0 8rpx 32rpx rgba(37, 107, 250, 0.2)
transform: translateY(-2rpx)
&::placeholder &::placeholder
color: #999999 color: #CCCCCC
font-size: 32rpx font-size: 32rpx
font-weight: normal font-weight: normal
.input-hint
font-size: 24rpx
color: #999999
text-align: center
.countdown-section .countdown-section
text-align: center text-align: center
margin-bottom: 60rpx margin-bottom: 80rpx
.countdown-text .countdown-text
font-size: 26rpx font-size: 28rpx
color: #999999 color: #999999
font-weight: 500
.resend-text .resend-text
font-size: 26rpx font-size: 28rpx
color: #256BFA color: #256BFA
text-decoration: underline font-weight: 600
cursor: pointer cursor: pointer
padding: 12rpx 24rpx
border-radius: 24rpx
background: rgba(37, 107, 250, 0.1)
display: inline-block
transition: all 0.2s ease
.paste-section &:active
margin-top: 20rpx background: rgba(37, 107, 250, 0.2)
transform: scale(0.98)
.paste-text
display: inline-flex
align-items: center
justify-content: center
font-size: 26rpx
color: #256BFA
cursor: pointer
text
margin-left: 8rpx
.submit-btn .submit-btn
width: 100% width: 100%
height: 88rpx height: 96rpx
background: linear-gradient(135deg, #256BFA 0%, #1E5BFF 100%) background: linear-gradient(135deg, #256BFA 0%, #1E5BFF 100%)
border-radius: 44rpx border-radius: 48rpx
color: #FFFFFF color: #FFFFFF
font-size: 32rpx font-size: 34rpx
font-weight: 500 font-weight: 600
border: none border: none
display: flex display: flex
align-items: center align-items: center
justify-content: center justify-content: center
box-shadow: 0 8rpx 32rpx rgba(37, 107, 250, 0.3)
transition: all 0.3s ease
position: relative
overflow: hidden
&::before
content: ''
position: absolute
top: 0
left: -100%
width: 100%
height: 100%
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent)
transition: left 0.5s ease
&:not(:disabled):hover::before
left: 100%
&:not(:disabled):active
transform: translateY(2rpx)
box-shadow: 0 4rpx 16rpx rgba(37, 107, 250, 0.3)
&:disabled &:disabled
opacity: 0.5 opacity: 0.5
cursor: not-allowed cursor: not-allowed
box-shadow: none
.loading-spinner .loading-spinner
width: 40rpx width: 48rpx
height: 40rpx height: 48rpx
border: 4rpx solid rgba(255, 255, 255, 0.3) border: 4rpx solid rgba(255, 255, 255, 0.3)
border-radius: 50% border-radius: 50%
border-top: 4rpx solid #FFFFFF border-top: 4rpx solid #FFFFFF
@@ -590,4 +619,16 @@ button::after
transform: rotate(0deg) transform: rotate(0deg)
100% 100%
transform: rotate(360deg) transform: rotate(360deg)
// 页面进入动画
.sms-verify-page
animation: fadeIn 0.4s ease-out
@keyframes fadeIn
from
opacity: 0
transform: translateY(20rpx)
to
opacity: 1
transform: translateY(0)
</style> </style>

View File

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

View File

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

View File

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

View File

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

View File

@@ -100,7 +100,7 @@ export default {
return { return {
data: { data: {
list: this.value ? this.value : [], 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, columnSpace: this.columnSpace <= 5 ? this.columnSpace : 5,
imageKey: this.imageKey, imageKey: this.imageKey,
seat: this.seat, seat: this.seat,
@@ -179,7 +179,7 @@ export default {
this.isRefresh = true; this.isRefresh = true;
this.adds = []; this.adds = [];
this.data.list = this.value ? this.value : []; 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.columnSpace = this.columnSpace <= 5 ? this.columnSpace : 5;
this.data.imageKey = this.imageKey; this.data.imageKey = this.imageKey;
this.data.seat = this.seat; this.data.seat = this.seat;