投递简历添加确认弹窗

This commit is contained in:
francis_fh
2026-01-27 13:58:46 +08:00
parent e0f8faf757
commit dbdb330189
3 changed files with 209 additions and 26 deletions

View File

@@ -40,6 +40,22 @@
</view>
</view>
<!-- 机构类型选择仅单位角色显示 -->
<view v-if="userType === 0" class="org-type-select">
<view class="org-type-title">请选择机构类型</view>
<view class="org-type-options">
<view
v-for="option in orgTypeOptions"
:key="option.value"
class="org-type-item"
:class="{ active: orgType === option.value }"
@click="selectOrgType(option.value)"
>
<view class="org-type-text">{{ option.label }}</view>
</view>
</view>
</view>
<!-- 授权说明 -->
<view class="auth-tips">
<view class="tip-item">
@@ -99,21 +115,50 @@
</template>
<script setup>
import { ref, inject } from 'vue';
import { ref, inject, onMounted } from 'vue';
import useUserStore from '@/stores/useUserStore';
import useDictStore from '@/stores/useDictStore';
import { tabbarManager } from '@/utils/tabbarManager';
const { $api } = inject('globalFunction');
const { loginSetToken } = useUserStore();
const dictStore = useDictStore();
const popup = ref(null);
const userType = ref(null); // 用户角色1-求职者0-企业
const orgType = ref(null); // 机构类型
const orgTypeOptions = ref([]); // 机构类型选项
const emit = defineEmits(['success', 'cancel']);
// 获取机构类型字典
const getOrgTypeDict = async () => {
try {
const options = await dictStore.getDictSelectOption('org_type');
orgTypeOptions.value = options;
} catch (error) {
console.error('获取机构类型字典失败:', error);
// 使用备用数据
orgTypeOptions.value = [
{ label: '有限责任公司', value: '1' },
{ label: '股份有限公司', value: '2' },
{ label: '个人独资企业', value: '3' },
{ label: '合伙企业', value: '4' },
{ label: '外商投资企业', value: '5' },
{ label: '其他', value: '6' }
];
}
};
// 组件挂载时获取字典数据
onMounted(() => {
getOrgTypeDict();
});
// 打开弹窗
const open = () => {
popup.value?.open();
userType.value = null; // 重置角色选择
orgType.value = null; // 重置机构类型选择
};
// 关闭弹窗
@@ -125,6 +170,12 @@ const close = () => {
// 选择角色
const selectRole = (type) => {
userType.value = type;
orgType.value = null; // 切换角色时重置机构类型选择
};
// 选择机构类型
const selectOrgType = (type) => {
orgType.value = type;
};
// 验证角色是否已选择
@@ -133,6 +184,13 @@ const validateRole = () => {
$api.msg('请先选择您的角色');
return false;
}
// 验证机构类型是否已选择(仅单位角色)
if (userType.value === 0 && orgType.value === null) {
$api.msg('请选择机构类型');
return false;
}
return true;
};
@@ -147,6 +205,12 @@ const getPhoneNumber = (e) => {
$api.msg('请先选择您的角色');
return true;
}
// 验证机构类型是否已选择(仅单位角色)
if (userType.value === 0 && orgType.value === null) {
$api.msg('请选择机构类型');
return true;
}
uni.login({
provider: 'weixin',
success: (loginRes) => {
@@ -161,7 +225,8 @@ const getPhoneNumber = (e) => {
code,
encryptedData,
iv,
userType: userType.value
userType: userType.value,
orgType: orgType.value
}, 'post').then((resData) => {
uni.hideLoading();
console.log(resData, 'resume.idCard');
@@ -250,7 +315,8 @@ const wxLogin = () => {
// 调用后端接口进行登录
$api.createRequest('/app/appLogin', {
code: loginRes.code,
userType: userType.value
userType: userType.value,
orgType: orgType.value
}, 'post').then((resData) => {
if (resData.token) {
loginSetToken(resData.token).then((resume) => {
@@ -372,7 +438,7 @@ defineExpose({
overflow: hidden
.modal-content
padding: 60rpx 40rpx 40rpx
padding: 40rpx 40rpx 40rpx
position: relative
.close-btn
@@ -388,11 +454,11 @@ defineExpose({
.auth-header
text-align: center
margin-bottom: 40rpx
margin-bottom: 20rpx
.auth-logo
width: 120rpx
height: 120rpx
width: 90rpx
height: 90rpx
margin: 0 auto 24rpx
.auth-title
@@ -407,7 +473,6 @@ defineExpose({
.role-select
margin-bottom: 32rpx
.role-title
font-size: 28rpx
font-weight: 500
@@ -446,6 +511,41 @@ defineExpose({
color: #333333
font-weight: 500
.org-type-select
margin-bottom: 22rpx
.org-type-title
font-size: 28rpx
font-weight: 500
color: #333333
margin-bottom: 20rpx
text-align: center
.org-type-options
display: flex
flex-wrap: wrap
gap: 16rpx
.org-type-item
display:inline-block
background: #F7F8FA
border: 2rpx solid #E5E5E5
border-radius: 10rpx
padding: 10rpx 10rpx
transition: all 0.3s ease
cursor: pointer
text-align: center
&.active
background: #F0F5FF
border-color: #256BFA
box-shadow: 0 4rpx 12rpx rgba(37, 107, 250, 0.15)
.org-type-text
font-size: 22rpx
color: #333333
font-weight: 500
.auth-tips
background: #F7F8FA
border-radius: 16rpx