添加页面

This commit is contained in:
2025-11-05 17:07:17 +08:00
parent 328721e6e9
commit 886b27218c
29 changed files with 1691 additions and 829 deletions

View File

@@ -1,12 +1,12 @@
<!--
* @Date: 2024-10-08 14:29:36
* @LastEditors: shirlwang
* @LastEditTime: 2025-11-04 14:00:51
* @LastEditTime: 2025-11-04 17:32:32
-->
<template>
<view class="input-outer-part">
<scroll-view scroll-y="true" :style="{height: edit?'calc(100vh - 200rpx)':'calc(100vh - 194rpx)'}">
<scroll-view scroll-y="true" :style="{height: edit?'calc(100vh - 380rpx)':'calc(100vh - 194rpx)'}">
<view class="inner">
<view class="part-title" style="display: flex;justify-content: space-between;">求职需求信息
<view v-if="!edit&&formData.id&&formData.currentStatus!=3" class="btn"
@@ -335,12 +335,12 @@
}
this.formData.fileUrl = this.$arrayToString(this.formData.fileUrl)
},
addOne() {
addOne(userId) {
this.formData = {}
this.getPersonInfo()
if(this.name){
this.formData.personName = this.name
this.formData.userId = this.needId
this.formData.userId = userId
}
this.edit = true
},
@@ -422,7 +422,7 @@
if (this.edit) {
if(type === 'workTypeTree') {
if (!this.workTypeTreeColumns[0] || !this.workTypeTreeColumns[0].length) {
uni.showToast({title: '工种数据未加载,请稍后重试'});
uni.showToast({title: '工种数据未加载,请稍后重试', icon: 'none'});
return;
}
// 弹窗打开时初始化临时columns和index
@@ -452,7 +452,7 @@
try {
// 先检查求职说明是否为空,如果为空直接提示
if (!this.formData.jobDescription || this.formData.jobDescription.trim() === '') {
uni.showToast({title: '请填写求职说明!'});
uni.showToast({title: '请填写求职说明!', icon: 'none'});
return;
}
@@ -466,34 +466,43 @@
this.formData.demandType = 1;
// this.formData.userId = this.formData.personId
// 根据 formData 是否有 id 来决定是更新还是新增
let response;
let successMessage;
if (this.formData.id) {
response = await updatePersonDemand(this.formData);
successMessage = '修改成功';
updatePersonDemand(this.formData).then(response => {
uni.showToast({title: '修改成功', icon: 'none'});
if (response.code == 200) {
// 如果是编辑模式,关闭编辑状态;否则返回上一页
if (this.formData.id) {
this.edit = false;
} else {
setTimeout(() => {
uni.navigateBack();
}, 2000);
}
}
})
} else {
response = await addPersonDemand(this.formData);
successMessage = '保存成功';
}
// 检查响应码是否为200
if (response.code === 200) {
uni.showToast({title: successMessage});
// 如果是编辑模式,关闭编辑状态;否则返回上一页
if (this.formData.id) {
this.edit = false;
} else {
setTimeout(() => {
uni.navigateBack();
}, 2000);
}
addPersonDemand(this.formData).then(response => {
uni.showToast({title: '保存成功', icon: 'none'});
if (response.code == 200) {
// 如果是编辑模式,关闭编辑状态;否则返回上一页
if (this.formData.id) {
this.edit = false;
} else {
setTimeout(() => {
uni.navigateBack();
}, 2000);
}
}
})
}
} catch (error) {
if(error.length){
uni.showToast({title: '请填写完整信息!'});
uni.showToast({title: '请填写完整信息!', icon: 'none'});
}else{
uni.showToast({title: '系统错误,请联系管理员!'});
uni.showToast({title: '系统错误,请联系管理员!', icon: 'none'});
}
// uni.showToast({title: '请检查必填项填写'});
// uni.showToast({title: '请检查必填项填写', icon: 'none'});
} finally {
// 确保加载页总是会被隐藏