企业注册根据信用代码回显企业信息

This commit is contained in:
FengHui
2026-02-04 11:11:09 +08:00
parent 2a5d15b770
commit 70ef370b1d
3 changed files with 84 additions and 33 deletions

View File

@@ -120,7 +120,8 @@ const generateTabbarList = () => {
// #endif
}
if (userType === 0) {
baseItems.splice(2, 0, {
// 企业用户将招聘会添加到第1个位置AI图标保持在中间
baseItems.splice(1, 0, {
id: 5,
text: '招聘会',
path: '/pages/careerfair/careerfair',
@@ -129,6 +130,14 @@ const generateTabbarList = () => {
centerItem: false,
badge: 0,
});
// 调整AI图标的位置到中间索引2
const aiItem = baseItems.find(item => item.id === 2);
if (aiItem) {
// 移除AI图标
baseItems.splice(baseItems.indexOf(aiItem), 1);
// 将AI图标插入到中间位置
baseItems.splice(2, 0, aiItem);
}
}
return baseItems;
};
@@ -194,12 +203,12 @@ const switchTab = (item, index) => {
// 判断企业信息字段company是否为null或undefined
if (!currentUserInfo.company || currentUserInfo.company === null) {
// 企业信息为空,跳转到企业信息补全页面
uni.navigateTo({
uni.redirectTo({
url: '/packageA/pages/complete-info/company-info',
});
} else {
// 企业信息完整,跳转到发布岗位页面
uni.navigateTo({
uni.redirectTo({
url: '/packageA/pages/job/publishJob',
});
}
@@ -228,7 +237,7 @@ const switchTab = (item, index) => {
}
// 跳转到对应的页面
uni.navigateTo({
uni.redirectTo({
url: targetPath,
});
@@ -237,26 +246,10 @@ const switchTab = (item, index) => {
}
}
// 判断是否为 tabBar 页面
const tabBarPages = [
'/pages/index/index',
'/pages/careerfair/careerfair',
'/pages/chat/chat',
'/pages/msglog/msglog',
'/pages/mine/mine'
];
if (tabBarPages.includes(item.path)) {
// TabBar 页面使用 redirectTo 避免页面栈溢出
// 所有页面都使用 redirectTo 避免页面栈溢出
uni.redirectTo({
url: item.path,
});
} else {
// 非 TabBar 页面使用 navigateTo
uni.navigateTo({
url: item.path,
});
}
currentItem.value = item.id;
};

View File

@@ -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',//招聘、培训、帮扶

View File

@@ -23,6 +23,7 @@
<!-- 统一社会信用代码 -->
<view class="form-item">
<view class="label">统一社会信用代码</view>
<view class="input-with-button">
<input
class="input-field"
v-model="formData.socialCreditCode"
@@ -30,6 +31,8 @@
maxlength="18"
@input="updateCompletion"
/>
<button class="query-button" @click="queryCompanyByCreditCode">查询</button>
</view>
</view>
<!-- 企业注册地点 -->
@@ -600,6 +603,42 @@ const cancel = () => {
uni.navigateBack()
}
// 根据社会信用代码查询企业信息
const queryCompanyByCreditCode = async () => {
const creditCode = formData.socialCreditCode.trim()
if (!creditCode) {
$api.msg('请输入统一社会信用代码')
return
}
uni.showLoading({ title: '查询中...' })
try {
const response = await $api.createRequest('/app/company/queryCodeCompany', { code: creditCode }, 'get')
uni.hideLoading()
if (response.code === 200 && response.data) {
const companyData = response.data
// 回显企业信息到表单
if (companyData.name) formData.companyName = companyData.name
if (companyData.location) formData.registeredAddress = companyData.location
if (companyData.description) formData.companyIntro = companyData.description
if (companyData.nature) formData.nature = companyData.nature
if (companyData.registeredAddress) formData.registeredAddress = companyData.registeredAddress
if (companyData.legalPerson) formData.legalPersonName = companyData.legalPerson
// 其他字段根据接口返回的数据结构进行映射
updateCompletion()
$api.msg('企业信息查询成功')
} else {
$api.msg('未查询到企业信息')
}
} catch (error) {
uni.hideLoading()
$api.msg('查询失败,请重试')
console.error('查询企业信息失败:', error)
}
}
// 确认提交
const confirm = () => {
// 验证必填字段
@@ -837,6 +876,25 @@ defineExpose({
font-size: 28rpx
line-height: 1.4
.input-with-button
flex: 1
display: flex
align-items: center
gap: 16rpx
.query-button
padding: 8rpx 16rpx
background: #256BFA
color: #fff
font-size: 20rpx
border-radius: 6rpx
border: none
min-width: 100rpx
text-align: center
&:active
background: #1a5cd9
.input-con
flex: 1
font-size: 28rpx