发布职位网格员模糊查询企业开发

This commit is contained in:
冯辉
2025-10-23 18:30:40 +08:00
parent 4450aa21bc
commit 0b339ee061
4 changed files with 280 additions and 129 deletions

View File

@@ -21,13 +21,36 @@
v-model="formData.jobTitle"
/>
</view>
<view class="form-group">
<view class="label">招聘公司</view>
<view class="form-group" v-if="userType === 0">
<view class="label">招聘公司</view>
<input
class="input"
placeholder="请输入招聘公司"
v-model="formData.companyName"
/>
</view>
<view class="form-group" v-if="userType === 2">
<view class="label">招聘公司</view>
<!-- 企业用户直接输入 -->
<input
v-if="userType === 1"
class="input"
placeholder="请输入公司名称"
v-model="formData.companyName"
/>
<!-- 网格员点击跳转搜索 -->
<view
v-else
class="company-selector"
@click="goToCompanySearch"
>
<view class="selector-text" :class="{ 'placeholder': !formData.companyName }">
{{ formData.companyName || '请选择企业' }}
</view>
<view class="selector-arrow">
<view class="arrow-icon"></view>
</view>
</view>
</view>
<view class="form-group">
<view class="label">最小薪资 (/)</view>
@@ -201,11 +224,13 @@
</template>
<script setup>
import { ref, reactive, onMounted } from 'vue';
import { ref, reactive, onMounted, onUnmounted } from 'vue';
import { storeToRefs } from 'pinia';
import { createRequest } from '@/utils/request';
import useDictStore from '@/stores/useDictStore';
import useUserStore from '@/stores/useUserStore';
const userStore = useUserStore();
const cachedUserInfo = uni.getStorageSync('userInfo') || {};
// 表单数据
const formData = reactive({
jobTitle: '',
@@ -233,7 +258,6 @@ const formData = reactive({
// 字典存储
const dictStore = useDictStore();
const userStore = useUserStore();
// 选择器数据
const educationLevels = ref([]);
@@ -261,11 +285,23 @@ const calculateScrollViewHeight = () => {
const scrollHeight = windowHeight - headerHeight - footerHeight;
scrollViewHeight.value = `${scrollHeight}px`;
};
const userType = ref(Number(userStore.userInfo.isCompanyUser));
console.log('完整userInfo对象:---223--', userType.value);
// 页面加载时计算高度和初始化数据
onMounted(async () => {
console.log('完整userInfo对象:-----', );
console.log('缓存中的userInfo:----', cachedUserInfo);
calculateScrollViewHeight();
await initFormData();
// 监听企业选择事件
uni.$on('companySelected', handleCompanySelected);
});
// 页面卸载时移除事件监听
onUnmounted(() => {
uni.$off('companySelected', handleCompanySelected);
});
// 初始化表单数据
@@ -368,6 +404,19 @@ const removeContact = (index) => {
}
};
// 跳转到企业搜索页面
const goToCompanySearch = () => {
uni.navigateTo({
url: '/pages/job/companySearch'
});
};
// 处理企业选择
const handleCompanySelected = (company) => {
formData.companyName = company.name;
formData.companyId = company.id;
};
// 返回上一页
const goBack = () => {
uni.navigateBack();
@@ -596,10 +645,14 @@ const validateForm = () => {
position: relative;
z-index: 1;
box-sizing: border-box;
line-height: 1.4;
display: flex;
align-items: center;
&::placeholder {
color: #999;
font-size: 24rpx;
font-size: 28rpx;
line-height: 1.4;
}
&:focus {
@@ -621,10 +674,12 @@ const validateForm = () => {
position: relative;
z-index: 1;
box-sizing: border-box;
line-height: 1.4;
&::placeholder {
color: #999;
font-size: 24rpx;
font-size: 28rpx;
line-height: 1.4;
}
&:focus {
@@ -668,6 +723,46 @@ const validateForm = () => {
}
}
// 企业选择器样式
.company-selector {
display: flex;
align-items: center;
justify-content: space-between;
height: 80rpx;
background: #fff;
border: none;
border-radius: 0;
padding: 0 0 20rpx 0;
box-sizing: border-box;
.selector-text {
font-size: 28rpx;
color: #333;
&.placeholder {
color: #999;
font-size: 24rpx;
}
}
.selector-arrow {
width: 40rpx;
height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
.arrow-icon {
font-size: 24rpx;
color: #999;
}
}
&:active {
background: #f8f8f8;
}
}
// 联系人管理样式
.contacts-container {
.contact-item {
@@ -728,6 +823,12 @@ const validateForm = () => {
.input {
font-size: 26rpx;
padding-bottom: 15rpx;
line-height: 1.4;
&::placeholder {
font-size: 26rpx;
line-height: 1.4;
}
}
}
}