|
|
|
|
@ -8,22 +8,62 @@
|
|
|
|
|
</picker>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="field">
|
|
|
|
|
<text class="form-label">需求标题 *</text>
|
|
|
|
|
<text class="form-label">项目名称 *</text>
|
|
|
|
|
<input
|
|
|
|
|
v-model="form.title"
|
|
|
|
|
class="input"
|
|
|
|
|
maxlength="40"
|
|
|
|
|
placeholder="请输入标题"
|
|
|
|
|
placeholder="请输入项目名称"
|
|
|
|
|
placeholder-class="input-placeholder"
|
|
|
|
|
/>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="field">
|
|
|
|
|
<text class="form-label">需求描述 *</text>
|
|
|
|
|
<text class="form-label">行业类型 *</text>
|
|
|
|
|
<input
|
|
|
|
|
v-model="form.industry_type"
|
|
|
|
|
class="input"
|
|
|
|
|
maxlength="40"
|
|
|
|
|
placeholder="如:人工智能、生物医药"
|
|
|
|
|
placeholder-class="input-placeholder"
|
|
|
|
|
/>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="field">
|
|
|
|
|
<text class="form-label">主营业务 *</text>
|
|
|
|
|
<input
|
|
|
|
|
v-model="form.main_business"
|
|
|
|
|
class="input"
|
|
|
|
|
maxlength="80"
|
|
|
|
|
placeholder="请输入主营业务"
|
|
|
|
|
placeholder-class="input-placeholder"
|
|
|
|
|
/>
|
|
|
|
|
</view>
|
|
|
|
|
<view v-if="selectedTypeValue === 'finance'" class="field">
|
|
|
|
|
<text class="form-label">金额 *</text>
|
|
|
|
|
<input
|
|
|
|
|
v-model="form.finance_amount"
|
|
|
|
|
class="input"
|
|
|
|
|
maxlength="40"
|
|
|
|
|
placeholder="如:500万、A轮1000万"
|
|
|
|
|
placeholder-class="input-placeholder"
|
|
|
|
|
/>
|
|
|
|
|
</view>
|
|
|
|
|
<view v-if="selectedTypeValue === 'hire'" class="field">
|
|
|
|
|
<text class="form-label">岗位需求 *</text>
|
|
|
|
|
<input
|
|
|
|
|
v-model="form.job_positions"
|
|
|
|
|
class="input"
|
|
|
|
|
maxlength="80"
|
|
|
|
|
placeholder="如:算法工程师 2 名"
|
|
|
|
|
placeholder-class="input-placeholder"
|
|
|
|
|
/>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="field">
|
|
|
|
|
<text class="form-label">简要描述 *</text>
|
|
|
|
|
<textarea
|
|
|
|
|
v-model="form.content"
|
|
|
|
|
class="textarea"
|
|
|
|
|
maxlength="300"
|
|
|
|
|
placeholder="请详细描述需求"
|
|
|
|
|
maxlength="500"
|
|
|
|
|
:placeholder="contentPlaceholder"
|
|
|
|
|
placeholder-class="input-placeholder"
|
|
|
|
|
/>
|
|
|
|
|
</view>
|
|
|
|
|
@ -42,7 +82,7 @@ export default {
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { reactive, ref } from 'vue'
|
|
|
|
|
import { computed, reactive, ref } from 'vue'
|
|
|
|
|
import { onShow } from '@dcloudio/uni-app'
|
|
|
|
|
import { demandApi, dictApi } from '@/api/dict'
|
|
|
|
|
import { useUserStore } from '@/stores/user'
|
|
|
|
|
@ -52,13 +92,24 @@ const userStore = useUserStore()
|
|
|
|
|
const typeItems = ref<ApiDictItem[]>([])
|
|
|
|
|
const typeLabels = ref<string[]>([])
|
|
|
|
|
const selectedTypeLabel = ref('')
|
|
|
|
|
const selectedTypeValue = ref('')
|
|
|
|
|
const submitting = ref(false)
|
|
|
|
|
const form = reactive({
|
|
|
|
|
type_dict_item_id: 0,
|
|
|
|
|
title: '',
|
|
|
|
|
industry_type: '',
|
|
|
|
|
main_business: '',
|
|
|
|
|
finance_amount: '',
|
|
|
|
|
job_positions: '',
|
|
|
|
|
content: '',
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const contentPlaceholder = computed(() =>
|
|
|
|
|
selectedTypeValue.value === 'hire'
|
|
|
|
|
? '需填写所需职位的具体描述,如岗位要求、核心能力、薪酬范围等'
|
|
|
|
|
: '请简要描述您的需求',
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
onShow(async () => {
|
|
|
|
|
if (!userStore.isLoggedIn) {
|
|
|
|
|
uni.navigateTo({ url: '/subpkg/login/index' })
|
|
|
|
|
@ -84,19 +135,40 @@ function onTypeChange(event: UniHelper.PickerChangeEvent) {
|
|
|
|
|
const item = typeItems.value[index]
|
|
|
|
|
if (!item) return
|
|
|
|
|
selectedTypeLabel.value = item.label
|
|
|
|
|
selectedTypeValue.value = item.value
|
|
|
|
|
form.type_dict_item_id = item.id
|
|
|
|
|
if (item.value !== 'finance') form.finance_amount = ''
|
|
|
|
|
if (item.value !== 'hire') form.job_positions = ''
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function submit() {
|
|
|
|
|
if (!form.type_dict_item_id || !form.title.trim() || !form.content.trim()) {
|
|
|
|
|
if (
|
|
|
|
|
!form.type_dict_item_id ||
|
|
|
|
|
!form.title.trim() ||
|
|
|
|
|
!form.industry_type.trim() ||
|
|
|
|
|
!form.main_business.trim() ||
|
|
|
|
|
!form.content.trim()
|
|
|
|
|
) {
|
|
|
|
|
uni.showToast({ title: '请完整填写表单', icon: 'none' })
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (selectedTypeValue.value === 'finance' && !form.finance_amount.trim()) {
|
|
|
|
|
uni.showToast({ title: '请填写融资金额', icon: 'none' })
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (selectedTypeValue.value === 'hire' && !form.job_positions.trim()) {
|
|
|
|
|
uni.showToast({ title: '请填写岗位需求', icon: 'none' })
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
submitting.value = true
|
|
|
|
|
try {
|
|
|
|
|
await demandApi.create({
|
|
|
|
|
type_dict_item_id: form.type_dict_item_id,
|
|
|
|
|
title: form.title.trim(),
|
|
|
|
|
industry_type: form.industry_type.trim(),
|
|
|
|
|
main_business: form.main_business.trim(),
|
|
|
|
|
finance_amount: form.finance_amount.trim() || undefined,
|
|
|
|
|
job_positions: form.job_positions.trim() || undefined,
|
|
|
|
|
content: form.content.trim(),
|
|
|
|
|
company: userStore.profile.company || userStore.user?.company || undefined,
|
|
|
|
|
})
|
|
|
|
|
@ -124,6 +196,7 @@ async function submit() {
|
|
|
|
|
.field {
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
width: 100%;
|
|
|
|
|
margin-bottom: 24rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.picker-field {
|
|
|
|
|
|