发布岗位回显企业名称
This commit is contained in:
@@ -718,11 +718,21 @@ const confirm = () => {
|
|||||||
company: companyData
|
company: companyData
|
||||||
}
|
}
|
||||||
|
|
||||||
$api.createRequest('/app/user/registerUser', submitData, 'post')
|
$api.createRequest('/registerUser', submitData, 'post')
|
||||||
.then(async (resData) => {
|
.then(async (resData) => {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
$api.msg('企业信息保存成功')
|
$api.msg('企业信息保存成功')
|
||||||
|
|
||||||
|
// 如果接口返回了token,需要重新保存token
|
||||||
|
if (resData.token) {
|
||||||
|
try {
|
||||||
|
await userStore.loginSetToken(resData.token)
|
||||||
|
console.log('Token已更新:', resData.token)
|
||||||
|
} catch (error) {
|
||||||
|
console.error('更新Token失败:', error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 保存成功后,重新获取用户信息并更新缓存
|
// 保存成功后,重新获取用户信息并更新缓存
|
||||||
try {
|
try {
|
||||||
await userStore.getUserResume()
|
await userStore.getUserResume()
|
||||||
|
|||||||
@@ -425,7 +425,7 @@ const companyInfo = reactive({
|
|||||||
name: '',
|
name: '',
|
||||||
avatar: '',
|
avatar: '',
|
||||||
industry: '',
|
industry: '',
|
||||||
size: '',
|
scale: '',
|
||||||
isVerified: false
|
isVerified: false
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -583,7 +583,7 @@ const getCompanyInfo = () => {
|
|||||||
companyInfo.name = company.name || '';
|
companyInfo.name = company.name || '';
|
||||||
companyInfo.avatar = company.avatar || '';
|
companyInfo.avatar = company.avatar || '';
|
||||||
companyInfo.industry = company.industryType || '互联网';
|
companyInfo.industry = company.industryType || '互联网';
|
||||||
companyInfo.size = company.companySize || '100-999人';
|
companyInfo.scale = company.scale || '100-999人';
|
||||||
|
|
||||||
// 判断是否实名:legalIdCard字段有值则表示已实名
|
// 判断是否实名:legalIdCard字段有值则表示已实名
|
||||||
companyInfo.isVerified = !!(company.legalIdCard && company.legalIdCard.trim());
|
companyInfo.isVerified = !!(company.legalIdCard && company.legalIdCard.trim());
|
||||||
@@ -591,7 +591,7 @@ const getCompanyInfo = () => {
|
|||||||
console.log('企业信息:', {
|
console.log('企业信息:', {
|
||||||
name: companyInfo.name,
|
name: companyInfo.name,
|
||||||
industry: companyInfo.industry,
|
industry: companyInfo.industry,
|
||||||
size: companyInfo.size,
|
size: companyInfo.scale,
|
||||||
isVerified: companyInfo.isVerified
|
isVerified: companyInfo.isVerified
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -19,21 +19,18 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="form-group" v-if="userType === 0">
|
<view class="form-group" v-if="userType === 0">
|
||||||
<view class="label">招聘公司</view>
|
<view class="label">招聘公司</view>
|
||||||
<input
|
<view-text style="color: #333;font-size: 28rpx;padding: 16rpx 0;display: inline-block;">{{formData.companyName}}</view-text>
|
||||||
class="input"
|
|
||||||
placeholder="请输入招聘公司"
|
|
||||||
v-model="formData.companyName"
|
|
||||||
/>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="form-group" v-if="userType === 2">
|
<view class="form-group" v-if="userType === 2">
|
||||||
<view class="label">招聘公司</view>
|
<view class="label">招聘公司</view>
|
||||||
<!-- 企业用户:直接输入 -->
|
<!-- 企业用户:显示缓存中的企业名称,不可编辑 -->
|
||||||
<input
|
<view
|
||||||
v-if="userType === 1"
|
v-if="userType === 1"
|
||||||
class="input"
|
class="company-display"
|
||||||
placeholder="请输入公司名称"
|
>
|
||||||
v-model="formData.companyName"
|
<view class="company-name">{{ formData.companyName || '未设置企业名称' }}</view>
|
||||||
/>
|
<view class="readonly-tip">(企业用户,不可修改)</view>
|
||||||
|
</view>
|
||||||
<!-- 网格员:点击跳转搜索 -->
|
<!-- 网格员:点击跳转搜索 -->
|
||||||
<view
|
<view
|
||||||
v-else
|
v-else
|
||||||
@@ -223,6 +220,7 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, onMounted, onUnmounted } from 'vue';
|
import { ref, reactive, onMounted, onUnmounted } from 'vue';
|
||||||
|
import { onShow } from '@dcloudio/uni-app';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { createRequest } from '@/utils/request';
|
import { createRequest } from '@/utils/request';
|
||||||
import useDictStore from '@/stores/useDictStore';
|
import useDictStore from '@/stores/useDictStore';
|
||||||
@@ -295,6 +293,9 @@ onMounted(async () => {
|
|||||||
calculateScrollViewHeight();
|
calculateScrollViewHeight();
|
||||||
await initFormData();
|
await initFormData();
|
||||||
|
|
||||||
|
// 获取企业信息
|
||||||
|
getCompanyInfo();
|
||||||
|
|
||||||
// 监听企业选择事件
|
// 监听企业选择事件
|
||||||
uni.$on('companySelected', handleCompanySelected);
|
uni.$on('companySelected', handleCompanySelected);
|
||||||
});
|
});
|
||||||
@@ -304,6 +305,35 @@ onUnmounted(() => {
|
|||||||
uni.$off('companySelected', handleCompanySelected);
|
uni.$off('companySelected', handleCompanySelected);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 页面显示时获取最新的企业信息(参考首页方法)
|
||||||
|
onShow(() => {
|
||||||
|
getCompanyInfo();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 获取企业信息(参考首页方法)
|
||||||
|
const getCompanyInfo = () => {
|
||||||
|
try {
|
||||||
|
const cachedUserInfo = uni.getStorageSync('userInfo') || {};
|
||||||
|
console.log('缓存中的userInfo:', cachedUserInfo);
|
||||||
|
|
||||||
|
// 检查是否有company字段
|
||||||
|
if (cachedUserInfo.company) {
|
||||||
|
const company = cachedUserInfo.company;
|
||||||
|
formData.companyName = company.name || '';
|
||||||
|
console.log('从缓存获取企业名称:', company.name);
|
||||||
|
} else {
|
||||||
|
console.log('缓存中没有company字段');
|
||||||
|
// 如果company字段不存在,尝试从companyName字段获取(兼容旧数据)
|
||||||
|
if (cachedUserInfo.companyName) {
|
||||||
|
formData.companyName = cachedUserInfo.companyName;
|
||||||
|
console.log('从companyName字段获取企业名称:', cachedUserInfo.companyName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取企业信息失败:', error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 初始化表单数据
|
// 初始化表单数据
|
||||||
const initFormData = async () => {
|
const initFormData = async () => {
|
||||||
try {
|
try {
|
||||||
@@ -331,6 +361,11 @@ const initFormData = async () => {
|
|||||||
formData.companyId = userStore.userInfo.id;
|
formData.companyId = userStore.userInfo.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 如果是企业用户,获取企业信息
|
||||||
|
if (userType.value === 1) {
|
||||||
|
getCompanyInfo();
|
||||||
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('初始化表单数据失败:', error);
|
console.error('初始化表单数据失败:', error);
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@@ -747,6 +782,27 @@ const validateForm = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 企业名称显示样式
|
||||||
|
.company-display {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 0 0 20rpx 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
.company-name {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: 500;
|
||||||
|
margin-bottom: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.readonly-tip {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 联系人管理样式
|
// 联系人管理样式
|
||||||
.contacts-container {
|
.contacts-container {
|
||||||
.contact-item {
|
.contact-item {
|
||||||
|
|||||||
Reference in New Issue
Block a user