bug修复
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -350,23 +350,30 @@ const submitVerification = async () => {
|
||||
// 刷新tabbar以显示正确的用户类型
|
||||
tabbarManager.refreshTabBar();
|
||||
console.log(userType.value , res.isCompanyUser);
|
||||
console.log('用户登录成功,简历信息:', resume);
|
||||
console.log('用户登录成功,简历信息-resume:', resume);
|
||||
console.log('用户登录成功,简历信息-res:', res);
|
||||
if (!resume?.data?.jobTitleId) {
|
||||
if (!res.idCard) {
|
||||
if (userType.value === '1') {
|
||||
console.log('用户登录成功,没有身份证号');
|
||||
if (userType.value == '1') {
|
||||
// 求职者跳转到个人信息补全页面
|
||||
uni.reLaunch({
|
||||
url: '/packageA/pages/complete-info/complete-info?step=1'
|
||||
});
|
||||
} else if (userType.value === '0') {
|
||||
} else if (userType.value == '0') {
|
||||
// 招聘者跳转到企业信息补全页面
|
||||
uni.reLaunch({
|
||||
url: '/packageA/pages/complete-info/company-info'
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// 跳转到首页
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
});
|
||||
}
|
||||
} else {
|
||||
console.log('用户登录成功,有简历信息');
|
||||
console.log('用户登录成功,有简历信息--');
|
||||
// 跳转到首页
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
<uni-popup ref="popup" type="dialog">
|
||||
<uni-popup-dialog
|
||||
mode="base"
|
||||
title="确定退出登录吗?"
|
||||
title="确定退出登录吗?--"
|
||||
type="info"
|
||||
:duration="2000"
|
||||
:before-close="true"
|
||||
@@ -144,10 +144,7 @@ function close() {
|
||||
}
|
||||
|
||||
function confirm() {
|
||||
// 调用退出登录
|
||||
useUserStore().logOut();
|
||||
// 关闭弹窗
|
||||
popup.value.close();
|
||||
useUserStore().logOut(false); // 不显示登录弹窗
|
||||
// 跳转到首页
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
|
||||
@@ -74,10 +74,14 @@ 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');
|
||||
// }
|
||||
// 跳转到首页
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
});
|
||||
}
|
||||
|
||||
const getUserInfo = () => {
|
||||
|
||||
Reference in New Issue
Block a user