Compare commits
14 Commits
1f8b24c0bf
...
jiagou
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
55c0b1fd22 | ||
|
|
cec340da43 | ||
|
|
183d43b664 | ||
|
|
3e408d5740 | ||
|
|
855deb4643 | ||
|
|
5a9d111d4c | ||
|
|
9ec42f18f3 | ||
|
|
321e686d68 | ||
|
|
3d8e13c665 | ||
|
|
3fe4dbe47f | ||
|
|
c742a65aa0 | ||
|
|
7c409e8528 | ||
|
|
4d8403609f | ||
|
|
769bc23edb |
@@ -83,3 +83,15 @@ export function getInfo() {
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 重新发送验证码
|
||||
export function sendSmsAgain(data) {
|
||||
return request({
|
||||
method: 'post',
|
||||
url: '/app/sendSmsAgain',
|
||||
data,
|
||||
headers: {
|
||||
isToken: false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
|
||||
/* 弹性布局 */
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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',//招聘、培训、帮扶
|
||||
|
||||
@@ -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
@@ -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),
|
||||
|
||||
11
pages.json
11
pages.json
@@ -3,7 +3,10 @@
|
||||
{
|
||||
"path": "pages/index/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "喀什智慧就业平台"
|
||||
"navigationBarTitleText": "喀什智慧就业平台",
|
||||
// #ifdef H5
|
||||
"navigationStyle": "custom"
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -79,15 +82,13 @@
|
||||
{
|
||||
"path": "pages/login/wx-login",
|
||||
"style": {
|
||||
"navigationBarTitleText": "登录",
|
||||
"navigationStyle": "custom"
|
||||
"navigationBarTitleText": "登录"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/login/sms-verify",
|
||||
"style": {
|
||||
"navigationBarTitleText": "短信验证",
|
||||
"navigationStyle": "custom"
|
||||
"navigationBarTitleText": "短信验证"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -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,31 +317,35 @@
|
||||
</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>
|
||||
</view>
|
||||
<view class="falls-card-experience" v-if="job.experience">
|
||||
<dict-Label dictType="experience" :value="job.experience"></dict-Label>
|
||||
<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>
|
||||
<view class="falls-card-experience" v-if="job.experience">
|
||||
<dict-Label dictType="experience" :value="job.experience"></dict-Label>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="falls-card-company" v-show="isShowJw !== 3">
|
||||
<!-- <view class="falls-card-company" v-show="isShowJw !== 3">
|
||||
{{ config.appInfo.areaName }}
|
||||
<!-- {{ job.jobLocation }} -->
|
||||
{{ 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>
|
||||
<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">
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<template>
|
||||
<view class="sms-verify-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">
|
||||
<!-- 安全提示 -->
|
||||
<view class="security-tip">
|
||||
<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 class="tip-text">为了您的账户安全需要您进行验证</view>
|
||||
</view>
|
||||
@@ -54,12 +54,6 @@
|
||||
<view v-else class="resend-text" @click="resendSms">
|
||||
重新获取验证码
|
||||
</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>
|
||||
|
||||
<!-- 提交按钮 -->
|
||||
@@ -74,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('');
|
||||
@@ -94,10 +91,7 @@ const autoFocus = ref(true); // 自动聚焦
|
||||
|
||||
// 格式化手机号:只显示前三位和后四位,中间用星号代替
|
||||
const formattedPhone = computed(() => {
|
||||
console.log('formattedPhone computed called, phone.value:', phone.value);
|
||||
|
||||
if (!phone.value || phone.value.trim() === '') {
|
||||
console.log('手机号为空,显示未知号码');
|
||||
return '未知号码';
|
||||
}
|
||||
|
||||
@@ -105,37 +99,21 @@ const formattedPhone = computed(() => {
|
||||
const cleanPhone = phone.value.replace(/\D/g, '');
|
||||
|
||||
if (cleanPhone.length < 11) {
|
||||
console.log('手机号长度不足11位,显示原始值:', phone.value);
|
||||
return phone.value;
|
||||
}
|
||||
|
||||
const prefix = cleanPhone.substring(0, 3);
|
||||
const suffix = cleanPhone.substring(cleanPhone.length - 4);
|
||||
const formatted = `${prefix}****${suffix}`;
|
||||
|
||||
console.log('格式化后的手机号:', formatted);
|
||||
return formatted;
|
||||
return `${prefix}****${suffix}`;
|
||||
});
|
||||
|
||||
// 是否可以提交
|
||||
const canSubmit = computed(() => {
|
||||
const can = smsCode.value.length === 6 && !loading.value;
|
||||
console.log('canSubmit计算属性调用:', {
|
||||
smsCodeLength: smsCode.value.length,
|
||||
loading: loading.value,
|
||||
canSubmit: can
|
||||
});
|
||||
return can;
|
||||
return smsCode.value.length === 6 && !loading.value;
|
||||
});
|
||||
|
||||
// 页面加载时获取参数
|
||||
onLoad(async (options) => {
|
||||
console.log('短信验证页面参数:', options);
|
||||
console.log('所有参数键值对:');
|
||||
Object.keys(options).forEach(key => {
|
||||
console.log(` ${key}: ${options[key]}`);
|
||||
});
|
||||
|
||||
// 尝试多种可能的手机号字段名(按优先级)
|
||||
const possiblePhoneFields = [
|
||||
'phone', 'mobile', 'phoneNumber', 'tel',
|
||||
@@ -147,18 +125,15 @@ onLoad(async (options) => {
|
||||
for (const field of possiblePhoneFields) {
|
||||
if (options[field]) {
|
||||
foundPhone = options[field];
|
||||
console.log(`找到手机号字段 "${field}": ${foundPhone}`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果没找到,尝试从URL参数中解析
|
||||
if (!foundPhone) {
|
||||
console.log('未在options中找到手机号字段,尝试从当前页面URL解析');
|
||||
const currentPages = getCurrentPages();
|
||||
if (currentPages.length > 0) {
|
||||
const currentPage = currentPages[currentPages.length - 1];
|
||||
console.log('当前页面对象:', currentPage);
|
||||
|
||||
// 尝试从页面路由参数中获取
|
||||
if (currentPage.$page && currentPage.$page.fullPath) {
|
||||
@@ -167,7 +142,6 @@ onLoad(async (options) => {
|
||||
const value = urlParams.get(field);
|
||||
if (value) {
|
||||
foundPhone = value;
|
||||
console.log(`从URL参数中找到手机号字段 "${field}": ${foundPhone}`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -181,21 +155,8 @@ onLoad(async (options) => {
|
||||
userType.value = options.userType || '';
|
||||
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) {
|
||||
console.error('无法获取手机号,请检查参数传递');
|
||||
uni.showToast({ title: '无法获取手机号,请返回重试', icon: 'none' });
|
||||
}
|
||||
|
||||
@@ -227,17 +188,36 @@ const startCountdown = () => {
|
||||
const resendSms = async () => {
|
||||
if (countdown.value > 0) return;
|
||||
|
||||
// 调用重新发送验证码接口(如果需要)
|
||||
// 检查手机号是否为空
|
||||
if (!phone.value) {
|
||||
uni.showToast({ title: '手机号获取失败,请返回重试', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
uni.showLoading({ title: '发送中...' });
|
||||
try {
|
||||
// 假设有一个重新发送验证码的接口
|
||||
// await $api.createRequest('/app/resendSms', { phone: phone.value }, 'post');
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: '验证码已发送', icon: 'success' });
|
||||
startCountdown();
|
||||
// 调用重新发送验证码接口
|
||||
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' });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -251,21 +231,12 @@ const onCodeInput = (e) => {
|
||||
}
|
||||
|
||||
smsCode.value = value;
|
||||
|
||||
// 如果输入了6位数字,可以自动提交(可选)
|
||||
if (value.length === 6) {
|
||||
// 这里可以添加自动提交逻辑,或者让用户手动点击按钮
|
||||
console.log('6位验证码已输入完整');
|
||||
}
|
||||
};
|
||||
|
||||
// 粘贴事件处理
|
||||
const onPaste = (e) => {
|
||||
console.log('onPaste event triggered', e);
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
// 微信小程序中,使用异步方式获取剪贴板
|
||||
console.log('MP-WEIXIN: onPaste called, using async clipboard API');
|
||||
setTimeout(() => {
|
||||
pasteFromClipboard();
|
||||
}, 50);
|
||||
@@ -281,14 +252,12 @@ const onPaste = (e) => {
|
||||
|
||||
// #ifndef MP-WEIXIN
|
||||
// 其他平台(H5/App)使用标准粘贴处理
|
||||
console.log('Non-MP-WEIXIN: Standard paste handling');
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
let pasteText = '';
|
||||
if (e.clipboardData && e.clipboardData.getData) {
|
||||
pasteText = e.clipboardData.getData('text');
|
||||
console.log('Got pasteText from clipboardData:', pasteText);
|
||||
}
|
||||
|
||||
if (pasteText) {
|
||||
@@ -309,7 +278,6 @@ const onPaste = (e) => {
|
||||
const handlePaste = (text) => {
|
||||
// 提取数字
|
||||
const digits = text.replace(/\D/g, '');
|
||||
console.log('Extracted digits from paste:', digits);
|
||||
|
||||
if (digits.length === 0) {
|
||||
uni.showToast({ title: '剪贴板中没有找到验证码', icon: 'none' });
|
||||
@@ -321,25 +289,16 @@ const handlePaste = (text) => {
|
||||
smsCode.value = code;
|
||||
|
||||
uni.showToast({ title: '已粘贴验证码', icon: 'success' });
|
||||
|
||||
// 如果粘贴了6位数字,可以自动提交(可选)
|
||||
if (code.length === 6) {
|
||||
console.log('6位验证码已通过粘贴输入完整');
|
||||
}
|
||||
};
|
||||
|
||||
// 从剪贴板粘贴验证码
|
||||
const pasteFromClipboard = () => {
|
||||
console.log('pasteFromClipboard called');
|
||||
|
||||
uni.getClipboardData({
|
||||
success: (res) => {
|
||||
console.log('getClipboardData success, data:', res.data);
|
||||
const text = res.data || '';
|
||||
handlePaste(text);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('读取剪贴板失败:', err);
|
||||
fail: () => {
|
||||
uni.showToast({ title: '读取剪贴板失败', icon: 'none' });
|
||||
}
|
||||
});
|
||||
@@ -347,21 +306,15 @@ const pasteFromClipboard = () => {
|
||||
|
||||
// 提交验证
|
||||
const submitVerification = async () => {
|
||||
console.log('submitVerification called, canSubmit:', canSubmit.value, 'loading:', loading.value);
|
||||
|
||||
if (!canSubmit.value) {
|
||||
console.log('不能提交,直接返回');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('开始提交验证,设置loading为true');
|
||||
loading.value = true;
|
||||
const code = smsCode.value;
|
||||
console.log('提交的验证码:', code, '手机号:', phone.value);
|
||||
|
||||
// 检查手机号是否为空
|
||||
if (!phone.value) {
|
||||
console.error('手机号为空,无法提交验证');
|
||||
uni.showToast({ title: '手机号获取失败,请返回重试', icon: 'none' });
|
||||
loading.value = false;
|
||||
return;
|
||||
@@ -369,45 +322,79 @@ 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');
|
||||
|
||||
console.log('短信验证接口返回:', res);
|
||||
|
||||
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 = Number(res.isCompanyUser); // 0-企业用户,1-求职者
|
||||
uni.setStorageSync('userInfo', userInfo);
|
||||
}
|
||||
|
||||
// 更新用户类型到缓存
|
||||
if (res.isCompanyUser !== undefined) {
|
||||
const userInfo = uni.getStorageSync('userInfo') || {};
|
||||
userInfo.isCompanyUser = res.isCompanyUser ? 0 : 1;
|
||||
uni.setStorageSync('userInfo', userInfo);
|
||||
}
|
||||
uni.showToast({ title: '登录成功', icon: 'success' });
|
||||
|
||||
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) {
|
||||
console.error('短信验证失败:', error);
|
||||
uni.showToast({ title: error.msg || '验证失败,请重试', icon: 'none' });
|
||||
uni.showToast({ title: error || '验证失败,请重试', icon: 'none' });
|
||||
} finally {
|
||||
console.log('submitVerification finally块执行,设置loading为false');
|
||||
loading.value = false;
|
||||
console.log('loading设置完成,当前loading值:', loading.value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -421,14 +408,13 @@ onUnmounted(() => {
|
||||
clearInterval(timer.value);
|
||||
});
|
||||
|
||||
// 需要导入useUserStore
|
||||
import useUserStore from '@/stores/useUserStore';
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.sms-verify-page
|
||||
min-height: 100vh
|
||||
background: #FFFFFF
|
||||
background: linear-gradient(135deg, #F7F9FF 0%, #FFFFFF 100%)
|
||||
|
||||
.nav-bar
|
||||
display: flex
|
||||
@@ -436,7 +422,8 @@ import useUserStore from '@/stores/useUserStore';
|
||||
justify-content: space-between
|
||||
height: 88rpx
|
||||
padding: 0 32rpx
|
||||
border-bottom: 1rpx solid #f5f5f5
|
||||
background: #FFFFFF
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04)
|
||||
|
||||
.nav-back
|
||||
width: 60rpx
|
||||
@@ -444,6 +431,11 @@ import useUserStore from '@/stores/useUserStore';
|
||||
display: flex
|
||||
align-items: center
|
||||
justify-content: center
|
||||
border-radius: 50%
|
||||
transition: background-color 0.2s ease
|
||||
|
||||
&:active
|
||||
background-color: #F5F5F5
|
||||
|
||||
.nav-title
|
||||
font-size: 32rpx
|
||||
@@ -454,127 +446,164 @@ import useUserStore from '@/stores/useUserStore';
|
||||
width: 60rpx
|
||||
|
||||
.page-content
|
||||
padding: 60rpx 40rpx 40rpx
|
||||
padding: 80rpx 48rpx 48rpx
|
||||
|
||||
.security-tip
|
||||
display: flex
|
||||
flex-direction: column
|
||||
align-items: 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
|
||||
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
|
||||
font-size: 28rpx
|
||||
font-weight: 500
|
||||
color: #333333
|
||||
color: #256BFA
|
||||
text-align: center
|
||||
line-height: 1.4
|
||||
|
||||
.phone-display
|
||||
text-align: center
|
||||
margin-bottom: 60rpx
|
||||
margin-bottom: 80rpx
|
||||
|
||||
.phone-label
|
||||
font-size: 26rpx
|
||||
font-size: 28rpx
|
||||
color: #666666
|
||||
margin-bottom: 12rpx
|
||||
margin-bottom: 16rpx
|
||||
opacity: 0.8
|
||||
|
||||
.phone-number
|
||||
font-size: 36rpx
|
||||
font-weight: 600
|
||||
font-size: 44rpx
|
||||
font-weight: 700
|
||||
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
|
||||
margin-bottom: 40rpx
|
||||
margin-bottom: 60rpx
|
||||
|
||||
.input-label
|
||||
font-size: 28rpx
|
||||
color: #666666
|
||||
text-align: center
|
||||
margin-bottom: 20rpx
|
||||
margin-bottom: 24rpx
|
||||
font-weight: 500
|
||||
|
||||
.single-input-container
|
||||
margin-bottom: 16rpx
|
||||
|
||||
.single-input
|
||||
width: 100%
|
||||
height: 100rpx
|
||||
border: 2rpx solid #E5E5E5
|
||||
border-radius: 16rpx
|
||||
font-size: 40rpx
|
||||
font-weight: 600
|
||||
height: 120rpx
|
||||
border: 3rpx solid #E8ECF4
|
||||
border-radius: 20rpx
|
||||
font-size: 48rpx
|
||||
font-weight: 700
|
||||
color: #333333
|
||||
background: #F7F8FA
|
||||
background: #FFFFFF
|
||||
text-align: center
|
||||
padding: 0 32rpx
|
||||
box-sizing: border-box
|
||||
outline: none
|
||||
caret-color: #256BFA
|
||||
transition: all 0.3s ease
|
||||
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05)
|
||||
|
||||
&:focus
|
||||
border-color: #256BFA
|
||||
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
|
||||
color: #999999
|
||||
color: #CCCCCC
|
||||
font-size: 32rpx
|
||||
font-weight: normal
|
||||
|
||||
.input-hint
|
||||
font-size: 24rpx
|
||||
color: #999999
|
||||
text-align: center
|
||||
|
||||
.countdown-section
|
||||
text-align: center
|
||||
margin-bottom: 60rpx
|
||||
margin-bottom: 80rpx
|
||||
|
||||
.countdown-text
|
||||
font-size: 26rpx
|
||||
font-size: 28rpx
|
||||
color: #999999
|
||||
font-weight: 500
|
||||
|
||||
.resend-text
|
||||
font-size: 26rpx
|
||||
font-size: 28rpx
|
||||
color: #256BFA
|
||||
text-decoration: underline
|
||||
font-weight: 600
|
||||
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
|
||||
margin-top: 20rpx
|
||||
|
||||
.paste-text
|
||||
display: inline-flex
|
||||
align-items: center
|
||||
justify-content: center
|
||||
font-size: 26rpx
|
||||
color: #256BFA
|
||||
cursor: pointer
|
||||
|
||||
text
|
||||
margin-left: 8rpx
|
||||
&:active
|
||||
background: rgba(37, 107, 250, 0.2)
|
||||
transform: scale(0.98)
|
||||
|
||||
.submit-btn
|
||||
width: 100%
|
||||
height: 88rpx
|
||||
height: 96rpx
|
||||
background: linear-gradient(135deg, #256BFA 0%, #1E5BFF 100%)
|
||||
border-radius: 44rpx
|
||||
border-radius: 48rpx
|
||||
color: #FFFFFF
|
||||
font-size: 32rpx
|
||||
font-weight: 500
|
||||
font-size: 34rpx
|
||||
font-weight: 600
|
||||
border: none
|
||||
display: flex
|
||||
align-items: 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
|
||||
opacity: 0.5
|
||||
cursor: not-allowed
|
||||
box-shadow: none
|
||||
|
||||
.loading-spinner
|
||||
width: 40rpx
|
||||
height: 40rpx
|
||||
width: 48rpx
|
||||
height: 48rpx
|
||||
border: 4rpx solid rgba(255, 255, 255, 0.3)
|
||||
border-radius: 50%
|
||||
border-top: 4rpx solid #FFFFFF
|
||||
@@ -590,4 +619,16 @@ button::after
|
||||
transform: rotate(0deg)
|
||||
100%
|
||||
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>
|
||||
@@ -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
|
||||
|
||||
@@ -144,10 +144,7 @@ function close() {
|
||||
}
|
||||
|
||||
function confirm() {
|
||||
// 调用退出登录
|
||||
useUserStore().logOut();
|
||||
// 关闭弹窗
|
||||
popup.value.close();
|
||||
useUserStore().logOut(false); // 不显示登录弹窗
|
||||
// 跳转到首页
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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: {} });
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user